[rkward-cvs] SF.net SVN: rkward: [754] trunk/rkward/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu Sep 21 11:12:56 UTC 2006
Revision: 754
http://svn.sourceforge.net/rkward/?rev=754&view=rev
Author: tfry
Date: 2006-09-21 04:12:50 -0700 (Thu, 21 Sep 2006)
Log Message:
-----------
Add mismatching ')' and '}' detection to both syntax highlighting definitions
Modified Paths:
--------------
trunk/rkward/rkward/r.xml
trunk/rkward/rkward/rkward.xml
Modified: trunk/rkward/rkward/r.xml
===================================================================
--- trunk/rkward/rkward/r.xml 2006-09-21 10:56:29 UTC (rev 753)
+++ trunk/rkward/rkward/r.xml 2006-09-21 11:12:50 UTC (rev 754)
@@ -34,10 +34,19 @@
</list>
<contexts>
+ <!-- This context is really only good for detecting unexpected closing braces '}'. Since opening braces go to ctx0 (and nesting in there), this context is only active on the base level -->
+ <context attribute="Normal Text" lineEndContext="#stay" name="level0">
+ <IncludeRules context="CommonRules"/>
+
+ <DetectChar attribute="Error" context="#stay" char="}" />
+ <DetectChar attribute="Error" context="#stay" char=")"/>
+ </context>
+
<context attribute="Normal Text" lineEndContext="#stay" name="ctx0">
<IncludeRules context="CommonRules"/>
<DetectChar attribute="Symbol" context="#pop" char="}" endRegion="Brace1" name="FoldingEnd" />
+ <DetectChar attribute="Error" context="#stay" char=")"/>
</context>
<context attribute="In Parenthesis" lineEndContext="#stay" name="parenthesis">
@@ -47,6 +56,7 @@
<RegExpr attribute="Identifier" context="#stay" String="[a-zA-Z_\.][0-9a-zA-Z_\.]*[\s]*=(?=([^=]|$))"/>
<IncludeRules context="CommonRules"/>
+ <DetectChar attribute="Error" context="#stay" char="}" />
</context>
<context attribute="String" lineEndContext="#stay" name="string">
Modified: trunk/rkward/rkward/rkward.xml
===================================================================
--- trunk/rkward/rkward/rkward.xml 2006-09-21 10:56:29 UTC (rev 753)
+++ trunk/rkward/rkward/rkward.xml 2006-09-21 11:12:50 UTC (rev 754)
@@ -33,22 +33,31 @@
</list>
<contexts>
- <!-- This context dispatches to the two main contexts output or command. Anything that does not match one of the rules is an error (you may get this, if a closing brace '}' pops out of a command context) -->
- <context attribute="Error" lineEndContext="#stay" name="ctxbase">
- <RegExpr attribute="Prompt" context="command" String="^> " beginRegion="command"/>
+ <!-- This context dispatches to the two main contexts output or command. -->
+ <context attribute="Prompt" lineEndContext="#stay" name="ctxbase">
+ <RegExpr attribute="Prompt" context="command0" String="^> " beginRegion="commandRegion"/>
<RegExpr attribute="Normal Text" context="output" String="^([^>\+]|$)" lookAhead="true"/>
</context>
- <!-- The output context does no highlighting. If a "> " is encountered at line start, pop back to ctxbase (and to command from there) -->
+ <!-- The output context does no highlighting. If a "> " is encountered at line start, pop back to ctxbase (and to command0 from there) -->
<context attribute="Output" lineEndContext="#stay" name="output">
- <RegExpr attribute="Prompt" context="#pop" String="^> " lookAhead="true" endRegion="command"/>
+ <RegExpr attribute="Prompt" context="#pop" String="^> " lookAhead="true" endRegion="commandRegion"/>
</context>
- <!-- The base context in command mode -->
+ <!-- The base level context in command mode. Does not allow closing '}' -->
+ <context attribute="Normal Text" lineEndContext="#stay" name="command0">
+ <IncludeRules context="CommandContinuationCheck"/>
+ <IncludeRules context="CommonRules"/>
+ <DetectChar attribute="Error" context="#stay" char="}" />
+ <DetectChar attribute="Error" context="#stay" char=")"/>
+ </context>
+
+ <!-- A nested context in command mode. Closing '}' pops a level -->
<context attribute="Normal Text" lineEndContext="#stay" name="command">
<IncludeRules context="CommandContinuationCheck"/>
<IncludeRules context="CommonRules"/>
<DetectChar attribute="Symbol" context="#pop" char="}" />
+ <DetectChar attribute="Error" context="#stay" char=")"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="parenthesis">
@@ -73,7 +82,7 @@
<!-- This context is not really used, but meant to be included. It checks whether a new line is a continuation of a command. If so, it eats the "+ " at the line start. Else it tries to pop back to the top level -->
<context attribute="Normal Text" name="CommandContinuationCheck">
<!-- Since this rule is included in every (relevant) context, this will unwind the entire context stack back to ctxbase. -->
- <RegExpr attribute="Prompt" context="#pop" String="^> " lookAhead="true" endRegion="command"/>
+ <RegExpr attribute="Prompt" context="#pop" String="^> " lookAhead="true" endRegion="commandRegion"/>
<!-- See above -->
<RegExpr attribute="Normal Text" context="#pop" String="^([^\+]|$)" lookAhead="true"/>
<RegExpr attribute="Prompt" context="#stay" String="^\+ "/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list