| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language> |
| 3 |
<!-- Kate 2.5 (KDE 3.5) highlighting module for R |
| 4 |
based on an earlier version by E.L. Willighagen. Code folding code by Ben Goodrich |
| 5 |
version 2.0: (c) 2006 Thomas Friedrichsmeier, Arne Henningsen, and the RKWard Team |
| 6 |
license: GPL v2 |
| 7 |
Kate : http://kate.kde.org/ |
| 8 |
R : http://www.r-project.org/ |
| 9 |
RKWard : http://rkward.kde.org/ |
| 10 |
--> |
| 11 |
<language version="13" kateversion="5.0" name="R Script" section="Scientific" extensions="*.R;*.r;*.S;*.s;*.q" mimetype="" license="GPLv2"> |
| 12 |
<highlighting> |
| 13 |
|
| 14 |
<list name="controls"> |
| 15 |
<item>for</item> |
| 16 |
<item>in</item> |
| 17 |
<item>next</item> |
| 18 |
<item>break</item> |
| 19 |
<item>while</item> |
| 20 |
<item>repeat</item> |
| 21 |
<item>if</item> |
| 22 |
<item>else</item> |
| 23 |
<item>switch</item> |
| 24 |
<item>function</item> |
| 25 |
</list> |
| 26 |
<list name="words"> |
| 27 |
<item>TRUE</item> |
| 28 |
<item>FALSE</item> |
| 29 |
<item>NULL</item> |
| 30 |
<item>NA</item> |
| 31 |
<item>NA_integer_</item> |
| 32 |
<item>NA_real_</item> |
| 33 |
<item>NA_complex_</item> |
| 34 |
<item>NA_character_</item> |
| 35 |
<item>Inf</item> |
| 36 |
<item>NaN</item> |
| 37 |
</list> |
| 38 |
|
| 39 |
<contexts> |
| 40 |
<!-- 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 --> |
| 41 |
<context attribute="Normal Text" lineEndContext="#stay" name="level0"> |
| 42 |
<IncludeRules context="CommonRules"/> |
| 43 |
|
| 44 |
<AnyChar attribute="Error" context="#stay" String="})"/> |
| 45 |
</context> |
| 46 |
|
| 47 |
<context attribute="Normal Text" lineEndContext="#stay" name="ctx0"> |
| 48 |
<IncludeRules context="CommonRules"/> |
| 49 |
|
| 50 |
<DetectChar attribute="Symbol" context="#pop" char="}" endRegion="Brace1" /> |
| 51 |
<DetectChar attribute="Error" context="#stay" char=")"/> |
| 52 |
</context> |
| 53 |
|
| 54 |
<context attribute="Normal Text" lineEndContext="#stay" name="parenthesis"> |
| 55 |
<LineContinue attribute="Operator" context="#stay"/> |
| 56 |
<DetectChar attribute="Symbol" context="#pop" char=")"/> |
| 57 |
|
| 58 |
<RegExpr attribute="Identifier" context="#stay" String="[a-zA-Z_\.][0-9a-zA-Z_\.]*[\s]*[:]?=(?=[^=]|$)"/> |
| 59 |
|
| 60 |
<IncludeRules context="CommonRules"/> |
| 61 |
<DetectChar attribute="Error" context="#stay" char="}" /> |
| 62 |
</context> |
| 63 |
|
| 64 |
<context attribute="String" lineEndContext="#stay" name="string"> |
| 65 |
<DetectChar attribute="String" context="#pop" char="""/> |
| 66 |
<HlCStringChar attribute="String Char" context="#stay"/> |
| 67 |
</context> |
| 68 |
|
| 69 |
<context attribute="String" lineEndContext="#stay" name="string2"> |
| 70 |
<DetectChar attribute="String" context="#pop" char="'"/> |
| 71 |
<HlCStringChar attribute="String Char" context="#stay"/> |
| 72 |
</context> |
| 73 |
|
| 74 |
<context attribute="Identifier" lineEndContext="#stay" name="backquotedsymbol"> |
| 75 |
<DetectChar attribute="String" context="#pop" char="`"/> |
| 76 |
<HlCStringChar attribute="String Char" context="#stay"/> |
| 77 |
</context> |
| 78 |
|
| 79 |
<context attribute="Normal Text" lineEndContext="#stay" name="operator_rhs" fallthrough="true" fallthroughContext="#pop"> |
| 80 |
<!-- While there is nothing of interest, stay in the context --> |
| 81 |
<DetectSpaces /> |
| 82 |
<IncludeRules context="FindComments"/> |
| 83 |
<!-- Operators other than +, -, and ! directly after another operator are an error. --> |
| 84 |
<Detect2Chars attribute="Error" context="#stay" char="!" char1="="/> |
| 85 |
<AnyChar attribute="Error" context="#stay" String="*/<>=|&:^@$~"/> |
| 86 |
</context> |
| 87 |
|
| 88 |
<context attribute="Normal Text" lineEndContext="#stay" name="FindComments"> |
| 89 |
<Detect2Chars attribute="Headline" context="Headline" char="#" char1="#"/> |
| 90 |
<DetectChar attribute="Comment" context="Comment" char="#"/> |
| 91 |
</context> |
| 92 |
<context attribute="Headline" lineEndContext="#pop" name="Headline"> |
| 93 |
<DetectSpaces /> |
| 94 |
<IncludeRules context="##Comments" /> |
| 95 |
</context> |
| 96 |
<context attribute="Comment" lineEndContext="#pop" name="Comment"> |
| 97 |
<DetectSpaces /> |
| 98 |
<IncludeRules context="##Comments" /> |
| 99 |
</context> |
| 100 |
|
| 101 |
<!-- This context is not really used, but contains the common rules --> |
| 102 |
<context name="CommonRules" lineEndContext="#stay" attribute="Normal Text" > |
| 103 |
<DetectSpaces /> |
| 104 |
<IncludeRules context="FindComments"/> |
| 105 |
<DetectChar attribute="String" context="string" char="""/> |
| 106 |
<DetectChar attribute="String" context="string2" char="'"/> |
| 107 |
<DetectChar attribute="String" context="backquotedsymbol" char="`"/> |
| 108 |
<keyword attribute="Control Structure" context="#stay" String="controls"/> |
| 109 |
<keyword attribute="Reserved Words" context="#stay" String="words"/> |
| 110 |
<Float attribute="Float" context="#stay"/> |
| 111 |
<Int attribute="Int" context="#stay"/> |
| 112 |
<RegExpr attribute="Keyword" context="#stay" String="[a-zA-Z_]+[a-zA-Z_\.0-9]*(?=[\s]*[(])|\.[a-zA-Z_\.]+[a-zA-Z_\.0-9]*(?=[\s]*[(])"/> |
| 113 |
<DetectChar attribute="Symbol" context="parenthesis" char="("/> |
| 114 |
|
| 115 |
<!-- For (assignment) operators, enter a new context operator_rhs to check what follows (generally, that should not be another op) --> |
| 116 |
<StringDetect attribute="Assign" context="operator_rhs" String="<<-"/> |
| 117 |
<Detect2Chars attribute="Assign" context="operator_rhs" char="<" char1="-"/> |
| 118 |
<StringDetect attribute="Assign" context="operator_rhs" String="->>"/> |
| 119 |
<Detect2Chars attribute="Assign" context="operator_rhs" char="-" char1=">"/> |
| 120 |
<RegExpr attribute="Assign" context="operator_rhs" String="=(?!(=|>))"/> |
| 121 |
<Detect2Chars attribute="Operator" context="operator_rhs" char="*" char1="*"/> |
| 122 |
<Detect2Chars attribute="Operator" context="operator_rhs" char="<" char1="="/> |
| 123 |
<Detect2Chars attribute="Operator" context="operator_rhs" char=">" char1="="/> |
| 124 |
<Detect2Chars attribute="Operator" context="operator_rhs" char="=" char1="="/> |
| 125 |
<Detect2Chars attribute="Operator" context="operator_rhs" char="=" char1=">"/> |
| 126 |
<Detect2Chars attribute="Operator" context="operator_rhs" char="!" char1="="/> |
| 127 |
<Detect2Chars attribute="Operator" context="operator_rhs" char="|" char1=">"/> |
| 128 |
<Detect2Chars attribute="Operator" context="operator_rhs" char="|" char1="|"/> |
| 129 |
<Detect2Chars attribute="Operator" context="operator_rhs" char="&" char1="&"/> |
| 130 |
<StringDetect attribute="Operator" context="operator_rhs" String=":::"/> |
| 131 |
<Detect2Chars attribute="Operator" context="operator_rhs" char=":" char1=":"/> |
| 132 |
<Detect2Chars attribute="Operator" context="operator_rhs" char=":" char1="="/> |
| 133 |
<AnyChar attribute="Operator" context="operator_rhs" String="+-*/<>=!|&:^@$~"/> |
| 134 |
<RangeDetect attribute="Operator" context="operator_rhs" char="%" char1="%"/> |
| 135 |
|
| 136 |
<DetectChar attribute="Symbol" context="ctx0" char="{" beginRegion="Brace1" /> |
| 137 |
|
| 138 |
<!-- This is needed only to assist variable based indentation --> |
| 139 |
<AnyChar attribute="Symbol" context="#stay" String="[]" /> |
| 140 |
</context> |
| 141 |
</contexts> |
| 142 |
|
| 143 |
<itemDatas> |
| 144 |
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/> |
| 145 |
<itemData name="Symbol" defStyleNum="dsNormal" spellChecking="false"/> |
| 146 |
<itemData name="Keyword" defStyleNum="dsFunction" spellChecking="false"/> |
| 147 |
<itemData name="Identifier" defStyleNum="dsAttribute" spellChecking="false"/> |
| 148 |
<itemData name="String" defStyleNum="dsString"/> |
| 149 |
<itemData name="Headline" defStyleNum="dsDocumentation" bold="1"/> |
| 150 |
<itemData name="Comment" defStyleNum="dsComment"/> |
| 151 |
<itemData name="Assign" defStyleNum="dsOthers" bold="1" italic="0" spellChecking="false"/> |
| 152 |
<itemData name="Control Structure" defStyleNum="dsControlFlow" spellChecking="false"/> |
| 153 |
<itemData name="Reserved Words" defStyleNum="dsConstant" spellChecking="false"/> |
| 154 |
<itemData name="Error" defStyleNum="dsError" spellChecking="false"/> |
| 155 |
<itemData name="Operator" defStyleNum="dsSpecialChar" spellChecking="false"/> |
| 156 |
<itemData name="String Char" defStyleNum="dsSpecialChar" spellChecking="false"/> |
| 157 |
<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/> |
| 158 |
<itemData name="Int" defStyleNum="dsDecVal" spellChecking="false"/> |
| 159 |
</itemDatas> |
| 160 |
</highlighting> |
| 161 |
|
| 162 |
<general> |
| 163 |
<comments> |
| 164 |
<comment name="singleLine" start="#"/> |
| 165 |
</comments> |
| 166 |
<keywords casesensitive="true" weakDeliminator="." additionalDeliminator="$"/> |
| 167 |
</general> |
| 168 |
</language> |
| 169 |
<!-- kate: replace-tabs off; --> |