summaryrefslogtreecommitdiffstats
path: root/kate/data/r.xml
diff options
context:
space:
mode:
Diffstat (limited to 'kate/data/r.xml')
-rw-r--r--kate/data/r.xml34
1 files changed, 17 insertions, 17 deletions
diff --git a/kate/data/r.xml b/kate/data/r.xml
index ada76ece5..bfb336f14 100644
--- a/kate/data/r.xml
+++ b/kate/data/r.xml
@@ -8,7 +8,7 @@
R : http://www.r-project.org/
RKWard : http://rkward.sourceforge.net/
-->
-<language version="2.02" kateversion="2.5" name="R Script" section="Scripts" extensions="*.R;*.r;*.S;*.s;*.q" mimetype="" license="GPL">
+<language version="2.07" kateversion="2.5" name="R Script" section="Scripts" extensions="*.R;*.r;*.S;*.s;*.q" mimetype="" license="GPL">
<highlighting>
<list name="controls">
@@ -77,6 +77,15 @@
<HlCStringChar attribute="String Char" context="#stay"/>
</context>
+ <context attribute="Normal Text" lineEndContext="#stay" name="operator_rhs" fallthrough="true" fallthroughContext="#pop">
+ <!-- While there is nothing of interest, stay in the context -->
+ <StringDetect attribute="Headline" context="Headline" String="##"/>
+ <DetectChar attribute="Comment" context="Comment" char="#"/>
+ <DetectChar attribute="String" context="#stay" char=" "/>
+ <!-- Operators other than +, -, and ! directly after another operator are an error. -->
+ <RegExpr attribute="Error" context="#stay" String="(\*|/|&lt;|&gt;|\!=|=|\||&amp;|:|\^|@|\$|~)"/>
+ </context>
+
<context attribute="Headline" lineEndContext="#pop" name="Headline"/>
<context attribute="Comment" lineEndContext="#pop" name="Comment"/>
@@ -95,21 +104,12 @@
<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="([\+\-\*/\^\:\$~!&amp;\|=&gt;@^])([&lt;]{1,2}\-|\-[&gt;]{1,2})"/>
- <RegExpr attribute="Error" context="#stay" String="([&lt;]{1,2}\-|\-[&gt;]{1,2})([\+\-\*/\^\:\$~!&amp;\|=&lt;@])"/>
- <RegExpr attribute="Error" context="#stay" String="([&lt;]{3}|[&gt;]{3})"/>
- <RegExpr attribute="Assign" context="#stay" String="[&lt;]{1,2}\-"/>
- <RegExpr attribute="Assign" context="#stay" String="\-[&gt;]{1,2}"/>
- <!-- Much like above: Most other operators are forbidden around = -->
- <RegExpr attribute="Error" context="#stay" String="([\+\-\*/\^\:\$~&amp;\|@^])="/>
- <RegExpr attribute="Error" context="#stay" String="=([\+\-\*/\^\:\$~!&lt;&gt;&amp;\|@^])"/>
- <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="(\+|\-|\*|/|&lt;=|&gt;=|={1,2}|\!=|\|{1,2}|&amp;{1,2}|:{1,3}|\^|@|\$|~)((?!(\+|\-|\*|/|&lt;=|&gt;=|=|\!=|\||&amp;|:|\^|@|\$|~))|$)"/>
- <RegExpr attribute="Error" context="#stay" String="(\+|\-|\*|/|&lt;=|&gt;=|={1,2}|\!=|\|{1,2}|&amp;{1,2}|:{1,3}|\^|@|\$|~){2,}"/>
- <RegExpr attribute="Operator" context="#stay" String="%[^%]*%"/>
+ <!-- For (assignment) operators, enter a new context operator_rhs to check what follows (generally, that should not be another op) -->
+ <RegExpr attribute="Assign" context="operator_rhs" String="[&lt;]{1,2}\-"/>
+ <RegExpr attribute="Assign" context="operator_rhs" String="\-[&gt;]{1,2}"/>
+ <RegExpr attribute="Assign" context="operator_rhs" String="=(?!=)"/>
+ <RegExpr attribute="Operator" context="operator_rhs" String="(\+|\-|\*{1,2}|/|&lt;=?|&gt;=?|={1,2}|\!=?|\|{1,2}|&amp;{1,2}|:{1,3}|\^|@|\$|~)"/>
+ <RegExpr attribute="Operator" context="operator_rhs" String="%[^%]*%"/>
<DetectChar attribute="Symbol" context="ctx0" char="{" beginRegion="Brace1" />
@@ -143,6 +143,6 @@
<comments>
<comment name="singleLine" start="#" end=""/>
</comments>
- <keywords casesensitive="1" />
+ <keywords casesensitive="true" weakDeliminator="." additionalDeliminator="$"/>
</general>
</language>