[rkward-cvs] rkward/rkward r.xml,1.12,1.13
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Tue Sep 12 14:33:02 UTC 2006
Update of /cvsroot/rkward/rkward/rkward
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv29467
Modified Files:
r.xml
Log Message:
Handle more syntax errors related to bad operator combinations
Index: r.xml
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/r.xml,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** r.xml 12 Sep 2006 12:34:07 -0000 1.12
--- r.xml 12 Sep 2006 14:33:00 -0000 1.13
***************
*** 2,6 ****
<!DOCTYPE language SYSTEM "language.dtd">
<!-- Kate 2.5 (KDE 3.5) highlighting module for R
! based on an earlier version by E.L. Willighagen.
version 0.4: (c) 2006 Thomas Friedrichsmeier, Arne Henningsen, and the RKWard Team
license: GPL v2
--- 2,6 ----
<!DOCTYPE language SYSTEM "language.dtd">
<!-- Kate 2.5 (KDE 3.5) highlighting module for R
! based on an earlier version by E.L. Willighagen. Code folding code by Ben Goodrich
version 0.4: (c) 2006 Thomas Friedrichsmeier, Arne Henningsen, and the RKWard Team
license: GPL v2
***************
*** 41,46 ****
<Float attribute="Float" context="#stay"/>
<Int attribute="Int" context="#stay"/>
- <RegExpr attribute="Error" context="#stay" String="[+\-*]="/>
- <RegExpr attribute="Error" context="#stay" String="=[+\-*]"/>
<RegExpr attribute="Keyword" context="#stay" String="[a-zA-Z_]+[a-zA-Z_\.0-9]*(?=[\s]*[(])"/>
<RegExpr attribute="Keyword" context="#stay" String="\.[a-zA-Z_\.]+[a-zA-Z_\.0-9]*(?=[\s]*[(])"/>
--- 41,44 ----
***************
*** 48,57 ****
<StringDetect attribute="Headline" context="Headline" String="##"/>
<DetectChar attribute="Comment" context="Comment" char="#"/>
<RegExpr attribute="Assign" context="#stay" String="[<]{1,2}\-"/>
<RegExpr attribute="Assign" context="#stay" String="\-[>]{1,2}"/>
<RegExpr attribute="Assign" context="#stay" String="[^=!><+\-*]=[^=!><+\-*]"/>
! <AnyChar attribute="Operator" context="#stay" String="+-*/^:$~!&|=><@"/>
<RegExpr attribute="Operator" context="#stay" String="%[^%]*%"/>
! <!-- for code folding (from Ben Goodrich) -->
<DetectChar attribute="Symbol" context="ctx0" char="{" beginRegion="Brace1" name="FoldingStart" />
<DetectChar attribute="Symbol" context="#pop" char="}" endRegion="Brace1" name="FoldingEnd" />
--- 46,65 ----
<StringDetect attribute="Headline" context="Headline" String="##"/>
<DetectChar attribute="Comment" context="Comment" char="#"/>
+
+ <!-- The following three lines look worse than they are: If there are any other operators directly before or after -> and <-, this is a syntax error (expections: ->> and <<-) -->
+ <RegExpr attribute="Error" context="#stay" String="([\+\-\*/\^\:\$~!&\|=>@^])([<]{1,2}\-|\-[>]{1,2})"/>
+ <RegExpr attribute="Error" context="#stay" String="([<]{1,2}\-|\-[>]{1,2})([\+\-\*/\^\:\$~!&\|=<@^])"/>
+ <RegExpr attribute="Error" context="#stay" String="([<]{3}|[>]{3})"/>
<RegExpr attribute="Assign" context="#stay" String="[<]{1,2}\-"/>
<RegExpr attribute="Assign" context="#stay" String="\-[>]{1,2}"/>
+ <!-- Much like above: Most other operators are forbidden around = -->
+ <RegExpr attribute="Error" context="#stay" String="([\+\-\*/\^\:\$~&\|@^])="/>
+ <RegExpr attribute="Error" context="#stay" String="=([\+\-\*/\^\:\$~!<>&\|@^])"/>
<RegExpr attribute="Assign" context="#stay" String="[^=!><+\-*]=[^=!><+\-*]"/>
! <!-- These operators are fine as long as they're followed by something else or end of line. Error otherwise -->
! <RegExpr attribute="Operator" context="#stay" String="(\+|\-|\*|/|<=|>=|={1,2}|\!=|\|{1,2}|&{1,2}|:{1,2}|\^|@|\$|~)((?!(\+|\-|\*|/|<=|>=|=|\!=|\||&|:|\^|@|\$|~))|$)"/>
! <RegExpr attribute="Error" context="#stay" String="(\+|\-|\*|/|<=|>=|={1,2}|\!=|\|{1,2}|&{1,2}|:{1,2}|\^|@|\$|~){2,}"/>
<RegExpr attribute="Operator" context="#stay" String="%[^%]*%"/>
!
<DetectChar attribute="Symbol" context="ctx0" char="{" beginRegion="Brace1" name="FoldingStart" />
<DetectChar attribute="Symbol" context="#pop" char="}" endRegion="Brace1" name="FoldingEnd" />
***************
*** 68,73 ****
<Float attribute="Float" context="#stay"/>
<Int attribute="Int" context="#stay"/>
- <RegExpr attribute="Error" context="#stay" String="[+\-*]="/>
- <RegExpr attribute="Error" context="#stay" String="=[+\-*]"/>
<RegExpr attribute="Keyword" context="#stay" String="[a-zA-Z_]+[a-zA-Z_\.0-9]*(?=[\s]*[(])"/>
<RegExpr attribute="Keyword" context="#stay" String="\.[a-zA-Z_\.]+[a-zA-Z_\.0-9]*(?=[\s]*[(])"/>
--- 76,79 ----
***************
*** 75,84 ****
<StringDetect attribute="Headline" context="Headline" String="##"/>
<DetectChar attribute="Comment" context="Comment" char="#"/>
<RegExpr attribute="Assign" context="#stay" String="[<]{1,2}\-"/>
<RegExpr attribute="Assign" context="#stay" String="\-[>]{1,2}"/>
<!-- no traditional assignment with "=" inside parentheses! See "Identifier below" -->
! <AnyChar attribute="Operator" context="#stay" String="+-*/^:$~!&|=><@"/>
<RegExpr attribute="Operator" context="#stay" String="%[^%]*%"/>
! <!-- for code folding (from Ben Goodrich) -->
<DetectChar attribute="Symbol" context="ctx0" char="{" beginRegion="Brace1" name="FoldingStart" />
<!-- no need to define brace end here, as we've already jumped to ctx0 at the brace start -->
--- 81,100 ----
<StringDetect attribute="Headline" context="Headline" String="##"/>
<DetectChar attribute="Comment" context="Comment" char="#"/>
+
+ <!-- The following three lines look worse than they are: If there are any other operators directly before or after -> and <-, this is a syntax error (expections: ->> and <<-) -->
+ <RegExpr attribute="Error" context="#stay" String="([\+\-\*/\^\:\$~!&\|=>@^])([<]{1,2}\-|\-[>]{1,2})"/>
+ <RegExpr attribute="Error" context="#stay" String="([<]{1,2}\-|\-[>]{1,2})([\+\-\*/\^\:\$~!&\|=<@^])"/>
+ <RegExpr attribute="Error" context="#stay" String="([<]{3}|[>]{3})"/>
<RegExpr attribute="Assign" context="#stay" String="[<]{1,2}\-"/>
<RegExpr attribute="Assign" context="#stay" String="\-[>]{1,2}"/>
+ <!-- Much like above: Most other operators are forbidden around = -->
+ <RegExpr attribute="Error" context="#stay" String="([\+\-\*/\^\:\$~&\|@^])="/>
+ <RegExpr attribute="Error" context="#stay" String="=([\+\-\*/\^\:\$~!<>&\|@^])"/>
<!-- no traditional assignment with "=" inside parentheses! See "Identifier below" -->
! <!-- These operators are fine as long as they're followed by something else or end of line. Error otherwise -->
! <RegExpr attribute="Operator" context="#stay" String="(\+|\-|\*|/|<=|>=|={1,2}|\!=|\|{1,2}|&{1,2}|:{1,2}|\^|@|\$|~)((?!(\+|\-|\*|/|<=|>=|=|\!=|\||&|:|\^|@|\$|~))|$)"/>
! <RegExpr attribute="Error" context="#stay" String="(\+|\-|\*|/|<=|>=|={1,2}|\!=|\|{1,2}|&{1,2}|:{1,2}|\^|@|\$|~){2,}"/>
<RegExpr attribute="Operator" context="#stay" String="%[^%]*%"/>
!
<DetectChar attribute="Symbol" context="ctx0" char="{" beginRegion="Brace1" name="FoldingStart" />
<!-- no need to define brace end here, as we've already jumped to ctx0 at the brace start -->
***************
*** 105,109 ****
<itemData name="Headline" defStyleNum="dsNormal" color="#b00000" selColor="#b00000" bold="1" italic="0"/> <!-- KDE default color: text 5 -->
<itemData name="Comment" defStyleNum="dsComment"/>
! <itemData name="Assign" defStyleNum="dsNormal" color="#336366" selColor="#cc9c099" bold="1" italic="0"/> <!-- KDE default color: text 7 -->
<itemData name="Control Structure" defStyleNum="dsNormal" color="#0000bf" selColor="#bfbf00"/> <!-- KDE default color: text 2 -->
<itemData name="Reserved Words" defStyleNum="dsOthers"/>
--- 121,125 ----
<itemData name="Headline" defStyleNum="dsNormal" color="#b00000" selColor="#b00000" bold="1" italic="0"/> <!-- KDE default color: text 5 -->
<itemData name="Comment" defStyleNum="dsComment"/>
! <itemData name="Assign" defStyleNum="dsNormal" color="#336366" selColor="#ccc099" bold="1" italic="0"/> <!-- KDE default color: text 7 -->
<itemData name="Control Structure" defStyleNum="dsNormal" color="#0000bf" selColor="#bfbf00"/> <!-- KDE default color: text 2 -->
<itemData name="Reserved Words" defStyleNum="dsOthers"/>
More information about the rkward-tracker
mailing list