| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language> |
| 3 |
|
| 4 |
<!-- |
| 5 |
Crystal syntax highlighting definition for Kate. |
| 6 |
Copyright (C) 2022 by Gaurav Shah ([email protected]) |
| 7 |
|
| 8 |
Forked from the Ruby syntax highlighting definition. |
| 9 |
Copyright (C) 2004 by Sebastian Vuorinen (sebastian dot vuorinen at helsinki dot fi) |
| 10 |
Copyright (C) 2004 by Stefan Lang ([email protected]) |
| 11 |
Copyright (C) 2008 by Robin Pedersen ([email protected]) |
| 12 |
Copyright (C) 2011 by Miquel Sabaté ([email protected]) |
| 13 |
|
| 14 |
This library is free software; you can redistribute it and/or |
| 15 |
modify it under the terms of the GNU Library General Public |
| 16 |
License as published by the Free Software Foundation; either |
| 17 |
version 2 of the License, or (at your option) any later version. |
| 18 |
|
| 19 |
This library is distributed in the hope that it will be useful, |
| 20 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 |
Library General Public License for more details. |
| 23 |
|
| 24 |
You should have received a copy of the GNU Library General Public |
| 25 |
License along with this library; if not, write to the |
| 26 |
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 27 |
Boston, MA 02110-1301, USA. |
| 28 |
--> |
| 29 |
|
| 30 |
<!-- |
| 31 |
TODO: Division after gdl contexts is interpreted as regexp |
| 32 |
--> |
| 33 |
|
| 34 |
<!-- Hold the "language" opening tag on a single line, as mentioned in "language.dtd". --> |
| 35 |
<language name="Crystal" section="Sources" |
| 36 |
version="0" kateversion="5.0" |
| 37 |
extensions="*.cr" |
| 38 |
mimetype="application/x-crystal" |
| 39 |
style="crystal" indenter="ruby" |
| 40 |
author="Gaurav Shah ([email protected])" license="LGPLv2+"> |
| 41 |
|
| 42 |
<highlighting> |
| 43 |
|
| 44 |
<list name="keywords"> |
| 45 |
<item>begin</item> |
| 46 |
<item>break</item> |
| 47 |
<item>case</item> |
| 48 |
<item>do</item> |
| 49 |
<item>else</item> |
| 50 |
<item>elsif</item> |
| 51 |
<item>end</item> |
| 52 |
<item>ensure</item> |
| 53 |
<item>for</item> |
| 54 |
<item>if</item> |
| 55 |
<item>in</item> |
| 56 |
<item>next</item> |
| 57 |
<item>rescue</item> |
| 58 |
<item>return</item> |
| 59 |
<item>then</item> |
| 60 |
<item>unless</item> |
| 61 |
<item>until</item> |
| 62 |
<item>when</item> |
| 63 |
<item>yield</item> |
| 64 |
</list> |
| 65 |
|
| 66 |
<list name="access-control"> |
| 67 |
<item>private</item> |
| 68 |
<item>protected</item> |
| 69 |
</list> |
| 70 |
|
| 71 |
<list name="attribute-definitions"> |
| 72 |
<item>getter</item> |
| 73 |
<item>setter</item> |
| 74 |
<item>property</item> |
| 75 |
</list> |
| 76 |
|
| 77 |
<list name="definitions"> |
| 78 |
<item>alias</item> |
| 79 |
<item>module</item> |
| 80 |
<item>class</item> |
| 81 |
<item>struct</item> |
| 82 |
<item>def</item> |
| 83 |
<item>macro</item> |
| 84 |
</list> |
| 85 |
|
| 86 |
<list name="pseudo-variables"> |
| 87 |
<item>self</item> |
| 88 |
<item>super</item> |
| 89 |
<item>nil</item> |
| 90 |
<item>false</item> |
| 91 |
<item>true</item> |
| 92 |
<item>caller</item> |
| 93 |
<!-- TODO: move these to psudo constants list --> |
| 94 |
<item>__FILE__</item> |
| 95 |
<item>__LINE__</item> |
| 96 |
<item>__END_LINE__</item> |
| 97 |
<item>__DIR__</item> |
| 98 |
</list> |
| 99 |
|
| 100 |
<!-- Kernel module methods. |
| 101 |
NOTE: Methods ending in ? or ! |
| 102 |
are included below as regexes. |
| 103 |
--> |
| 104 |
<!-- TODO: replace this with Crystal Object methods? --> |
| 105 |
<list name="kernel-methods"> |
| 106 |
<!-- backquote ` --> |
| 107 |
<item>abort</item> |
| 108 |
<item>at_exit</item> |
| 109 |
<item>autoload</item> |
| 110 |
<item>autoload?</item> |
| 111 |
<item>binding</item> |
| 112 |
<item>block_given?</item> |
| 113 |
<item>callcc</item> |
| 114 |
<item>caller</item> |
| 115 |
<item>catch</item> |
| 116 |
<item>chomp</item> |
| 117 |
<item>chomp!</item> |
| 118 |
<item>chop</item> |
| 119 |
<item>chop!</item> |
| 120 |
<item>eval</item> |
| 121 |
<item>exec</item> |
| 122 |
<item>exit</item> |
| 123 |
<item>exit!</item> |
| 124 |
<item>fail</item> |
| 125 |
<item>fork</item> |
| 126 |
<item>format</item> |
| 127 |
<item>getc</item> |
| 128 |
<item>gets</item> |
| 129 |
<item>global_variables</item> |
| 130 |
<item>gsub</item> |
| 131 |
<item>gsub!</item> |
| 132 |
<item>iterator?</item> |
| 133 |
<item>lambda</item> |
| 134 |
<item>load</item> |
| 135 |
<item>local_variables</item> |
| 136 |
<item>loop</item> |
| 137 |
<item>method_missing</item> |
| 138 |
<item>open</item> |
| 139 |
<item>p</item> |
| 140 |
<item>print</item> |
| 141 |
<item>printf</item> |
| 142 |
<item>proc</item> |
| 143 |
<item>putc</item> |
| 144 |
<item>puts</item> |
| 145 |
<item>raise</item> |
| 146 |
<item>rand</item> |
| 147 |
<item>readline</item> |
| 148 |
<item>readlines</item> |
| 149 |
<item>require</item> |
| 150 |
<item>require_relative</item> |
| 151 |
<item>scan</item> |
| 152 |
<item>select</item> |
| 153 |
<item>set_trace_func</item> |
| 154 |
<item>sleep</item> |
| 155 |
<item>split</item> |
| 156 |
<item>sprintf</item> |
| 157 |
<item>srand</item> |
| 158 |
<item>sub</item> |
| 159 |
<item>sub!</item> |
| 160 |
<item>syscall</item> |
| 161 |
<item>system</item> |
| 162 |
<item>test</item> |
| 163 |
<item>throw</item> |
| 164 |
<item>trace_var</item> |
| 165 |
<item>trap</item> |
| 166 |
<item>untrace_var</item> |
| 167 |
<item>warn</item> |
| 168 |
</list> |
| 169 |
|
| 170 |
<list name="mixin-methods"> |
| 171 |
<item>extend</item> |
| 172 |
<item>include</item> |
| 173 |
</list> |
| 174 |
|
| 175 |
<contexts> |
| 176 |
<context name="Normal" attribute="Normal Text" lineEndContext="#stay"> |
| 177 |
<!-- crystal ignores newline after \ --> |
| 178 |
<LineContinue attribute="Normal Text" context="Line Continue"/> |
| 179 |
|
| 180 |
<!-- "shebang" line --> |
| 181 |
<!-- TODO: this may be required once crystal interpreter is ready --> |
| 182 |
<!--<RegExpr attribute="Keyword" String="^#!\/.*" context="#stay" column="0"/>--> |
| 183 |
|
| 184 |
<!-- "def" - "end" blocks --> |
| 185 |
<!-- check for statement modifiers with regexes --> |
| 186 |
<Detect2Chars attribute="Operator" char="{" char1="%" context="Find closing macro brace" beginRegion="def block"/> |
| 187 |
<DetectChar attribute="Operator" char="{" context="Find closing block brace" beginRegion="def block"/> |
| 188 |
<!-- TODO: why is this needed as a Delimiter? --> |
| 189 |
<DetectChar attribute="Delimiter" char="}" context="check_div_1" endRegion="def block"/> |
| 190 |
<RegExpr attribute="Keyword" String="[=([]\s*(if|unless|while|until)\b|(while|until)\b(?!.*\bdo\b)|\;\s*(while|until)\b(?!.*\bdo\b)|\;\s*(if|unless)\b" context="#stay" beginRegion="def block"/> |
| 191 |
<RegExpr attribute="Keyword" String="(if|unless)\b" context="#stay" beginRegion="def block" firstNonSpace="true"/> |
| 192 |
<WordDetect attribute="Keyword" String="class" context="no_heredoc" beginRegion="def block"/> |
| 193 |
<WordDetect attribute="Keyword" String="struct" context="no_heredoc" beginRegion="def block"/> |
| 194 |
<WordDetect attribute="Keyword" String="module" context="#stay" beginRegion="def block"/> |
| 195 |
<WordDetect attribute="Keyword" String="begin" context="#stay" beginRegion="def block"/> |
| 196 |
<WordDetect attribute="Keyword" String="case" context="#stay" beginRegion="def block"/> |
| 197 |
<WordDetect attribute="Keyword" String="do" context="#stay" beginRegion="def block"/> |
| 198 |
<WordDetect attribute="Keyword" String="macro" context="#stay" beginRegion="def block"/> |
| 199 |
<WordDetect attribute="Keyword" String="def" context="Overloaded Operators" beginRegion="def block"/> |
| 200 |
<WordDetect attribute="Keyword" String="end" context="#stay" endRegion="def block"/> |
| 201 |
<!-- elsif/else close the current block and start a new one --> |
| 202 |
<RegExpr attribute="Keyword" String="\b(else|elsif|rescue|ensure)\b" context="#stay" endRegion="def block" beginRegion="def block"/> |
| 203 |
|
| 204 |
<StringDetect attribute="Operator" String="..." context="#stay"/> |
| 205 |
<Detect2Chars attribute="Operator" char="." char1="." context="#stay"/> |
| 206 |
|
| 207 |
<!-- marks a message being sent, not defined --> |
| 208 |
<RegExpr attribute="Message" String="\.[_a-z][_a-zA-Z0-9]*(\?|\!|\b)" context="check_div_2"/> |
| 209 |
|
| 210 |
<keyword attribute="Keyword" String="keywords" context="#stay"/> |
| 211 |
<keyword attribute="Attribute Definition" String="attribute-definitions" context="check_div_2"/> |
| 212 |
<keyword attribute="Access Control" String="access-control" context="check_div_2"/> |
| 213 |
<keyword attribute="Definition" String="definitions" context="#stay" /> |
| 214 |
<keyword attribute="Pseudo variable" String="pseudo-variables" context="check_div_1"/> |
| 215 |
<keyword attribute="Kernel methods" String="kernel-methods" context="check_div_2"/> |
| 216 |
<keyword attribute="Module mixin methods" String="mixin-methods" context="check_div_2"/> |
| 217 |
|
| 218 |
<!-- TODO: write a rule for $~ and $? --> |
| 219 |
<RegExpr attribute="Global Constant" String="\b[_A-Z]+[A-Z_0-9]+\b" context="check_div_2"/> |
| 220 |
<!-- Generally a module or class name like "File", "MyModule_1", .. --> |
| 221 |
<RegExpr attribute="Constant" String="\b[A-Z]+_*([0-9]|[a-z])[_a-zA-Z0-9]*\b" context="check_div_2"/> |
| 222 |
|
| 223 |
<!-- Numeric values. Note that we have to allow underscores between two digits (thus the creepy regular expressions). --> |
| 224 |
<!-- TODO: add support for Crystal number literals --> |
| 225 |
<RegExpr attribute="Hex" String="\b\-?0[xX]([0-9a-fA-F]|_[0-9a-fA-F])+" context="check_div_1"/> |
| 226 |
<RegExpr attribute="Bin" String="\b\-?0[bB]([01]|_[01])+" context="check_div_1"/> |
| 227 |
<RegExpr attribute="Octal" String="\b\-?0[1-7]([0-7]|_[0-7])*" context="check_div_1"/> |
| 228 |
<RegExpr attribute="Float" String="\b\-?[0-9]([0-9]|_[0-9])*\.[0-9]([0-9]|_[0-9])*([eE]\-?[1-9]([0-9]|_[0-9])*(\.[0-9]*)?)?" context="check_div_1"/> |
| 229 |
<RegExpr attribute="Dec" String="\b\-?[1-9]([0-9]|_[0-9])*\b" context="check_div_1"/> |
| 230 |
<Int attribute="Dec" context="check_div_1"/> |
| 231 |
<!-- TODO: what is this? remove if this is not required. --> |
| 232 |
<HlCChar attribute="Char" context="check_div_1"/> |
| 233 |
|
| 234 |
<!-- recognize the beginning of a HEREDOC |
| 235 |
This uses new features in Kate 2.3 and later |
| 236 |
|
| 237 |
There is no other chance of keeping heredoc apart from the |
| 238 |
push operator '<<' than requiring to put space between the operator |
| 239 |
and the string. |
| 240 |
--> |
| 241 |
<RegExpr attribute="Operator" context="find_indented_heredoc" String="\s*<<[-~](?=\w+|["'`])" beginRegion="HereDocument" /> |
| 242 |
<RegExpr attribute="Operator" context="find_heredoc" String="\s*<<(?=\w+|["'`])" beginRegion="HereDocument" /> |
| 243 |
|
| 244 |
<DetectChar attribute="Operator" char="." context="#stay"/> |
| 245 |
<Detect2Chars attribute="Operator" char="&" char1="&" context="#stay"/> |
| 246 |
<Detect2Chars attribute="Operator" char="|" char1="|" context="#stay"/> |
| 247 |
<!-- \s! is regexp hack --> |
| 248 |
<RegExpr attribute="Operator" String="\s[\?\:\%]\s|[|&<>\^\+*~\-=]+|\s!|/=\s" context="#stay"/> |
| 249 |
<Detect2Chars attribute="Operator" char="%" char1="=" context="#stay"/> |
| 250 |
<Detect2Chars attribute="Operator" char=":" char1=":" context="Member Access"/> |
| 251 |
|
| 252 |
<RegExpr attribute="Symbol" String=":(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?|:\[\]=?" context="check_div_1"/> |
| 253 |
|
| 254 |
<!-- Do not send to "check_div_1" context!: |
| 255 |
after detecting these rules (": ") there can be a regular expression (see bug: #361875) --> |
| 256 |
<RegExpr attribute="Symbol" String="(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?: |\[\]=?: " context="#stay"/> |
| 257 |
|
| 258 |
<DetectChar attribute="String" char=""" context="Quoted String"/> |
| 259 |
<!-- TODO: There are no single-quoted strings in Crystal. Only single-quoted characters. Modify accordingly. --> |
| 260 |
<DetectChar attribute="Raw String" char="'" context="Apostrophed String"/> |
| 261 |
<DetectChar attribute="Command" char="`" context="Command String"/> |
| 262 |
|
| 263 |
<!-- TODO: Remove this if not needed --> |
| 264 |
<Detect2Chars attribute="Normal Text" char="?" char1="#" context="#stay"/> |
| 265 |
|
| 266 |
<DetectChar attribute="Comment" char="#" context="General Comment"/> |
| 267 |
|
| 268 |
<DetectChar attribute="Delimiter" char="[" context="#stay"/> |
| 269 |
<DetectChar attribute="Delimiter" char="]" context="check_div_1"/> |
| 270 |
|
| 271 |
<RegExpr attribute="Instance Variable" String="@[a-zA-Z_0-9]+" context="check_div_1"/> |
| 272 |
<RegExpr attribute="Class Variable" String="@@[a-zA-Z_0-9]+" context="check_div_1"/> |
| 273 |
|
| 274 |
<!-- handle the different regular expression formats --> |
| 275 |
<DetectChar attribute="Regular Expression" char="/" context="RegEx 1"/> |
| 276 |
|
| 277 |
<!-- recognize the beginning of a general delimited input format --> |
| 278 |
<!-- this moves to the next context to separate out the exact nature of the GDL input --> |
| 279 |
<RegExpr attribute="GDL input" context="find_gdl_input" String="\s*[%](?=[QqxwW]?[^\s}])" beginRegion="GdlInput" /> |
| 280 |
|
| 281 |
<DetectChar attribute="Normal Text" char=")" context="check_div_1"/> |
| 282 |
<DetectIdentifier attribute="Normal Text" context="check_div_2"/> |
| 283 |
|
| 284 |
</context> |
| 285 |
|
| 286 |
<context name="Macro" attribute="Normal Text" lineEndContext="#stay"> |
| 287 |
<!-- TODO: copied Macro context from Normal context. repititions can be removed. pls refactor by including rules. --> |
| 288 |
<!-- crystal ignores newline after \ --> |
| 289 |
<LineContinue attribute="Normal Text" context="Line Continue"/> |
| 290 |
|
| 291 |
<!-- "def" - "end" blocks --> |
| 292 |
<!-- check for statement modifiers with regexes --> |
| 293 |
<DetectChar attribute="Operator" char="{" context="Find closing block brace" beginRegion="def block"/> |
| 294 |
<DetectChar attribute="Delimiter" char="}" context="check_div_1" endRegion="def block"/> |
| 295 |
<RegExpr attribute="Keyword" String="[=([]\s*(if|unless|while|until)\b|(while|until)\b(?!.*\bdo\b)|\;\s*(while|until)\b(?!.*\bdo\b)|\;\s*(if|unless)\b" context="#stay" beginRegion="def block"/> |
| 296 |
<RegExpr attribute="Keyword" String="(if|unless)\b" context="#stay" beginRegion="def block" firstNonSpace="true"/> |
| 297 |
<WordDetect attribute="Keyword" String="begin" context="#stay" beginRegion="def block"/> |
| 298 |
<RegExpr attribute="Keyword" String="\bfor\b(?!.*\bdo\b)" context="#stay" beginRegion="def block"/> |
| 299 |
<WordDetect attribute="Keyword" String="do" context="#stay" beginRegion="def block"/> |
| 300 |
<WordDetect attribute="Keyword" String="def" context="Overloaded Operators" beginRegion="def block"/> |
| 301 |
<WordDetect attribute="Keyword" String="end" context="#stay" endRegion="def block"/> |
| 302 |
<!-- elsif/else close the current block and start a new one --> |
| 303 |
<RegExpr attribute="Keyword" String="\b(else|elsif|rescue|ensure)\b" context="#stay" endRegion="def block" beginRegion="def block"/> |
| 304 |
|
| 305 |
<StringDetect attribute="Operator" String="..." context="#stay"/> |
| 306 |
<Detect2Chars attribute="Operator" char="." char1="." context="#stay"/> |
| 307 |
|
| 308 |
<!-- marks a message (being sent, not defined) --> |
| 309 |
<RegExpr attribute="Message" String="\.[_a-z][_a-zA-Z0-9]*(\?|\!|\b)" context="check_div_2"/> |
| 310 |
|
| 311 |
<keyword attribute="Keyword" String="keywords" context="#stay"/> |
| 312 |
<keyword attribute="Attribute Definition" String="attribute-definitions" context="check_div_2"/> |
| 313 |
<keyword attribute="Definition" String="definitions" context="#stay" /> |
| 314 |
<keyword attribute="Pseudo variable" String="pseudo-variables" context="check_div_1"/> |
| 315 |
|
| 316 |
<RegExpr attribute="Global Constant" String="\b[_A-Z]+[A-Z_0-9]+\b" context="check_div_2"/> |
| 317 |
<!-- Generally a module or class name like "File", "MyModule_1", .. --> |
| 318 |
<RegExpr attribute="Constant" String="\b[A-Z]+_*([0-9]|[a-z])[_a-zA-Z0-9]*\b" context="check_div_2"/> |
| 319 |
|
| 320 |
<!-- Numeric values. Note that we have to allow underscores between two digits (thus the creepy regular expressions). --> |
| 321 |
<RegExpr attribute="Hex" String="\b\-?0[xX]([0-9a-fA-F]|_[0-9a-fA-F])+" context="check_div_1"/> |
| 322 |
<RegExpr attribute="Bin" String="\b\-?0[bB]([01]|_[01])+" context="check_div_1"/> |
| 323 |
<RegExpr attribute="Octal" String="\b\-?0[1-7]([0-7]|_[0-7])*" context="check_div_1"/> |
| 324 |
<RegExpr attribute="Float" String="\b\-?[0-9]([0-9]|_[0-9])*\.[0-9]([0-9]|_[0-9])*([eE]\-?[1-9]([0-9]|_[0-9])*(\.[0-9]*)?)?" context="check_div_1"/> |
| 325 |
<RegExpr attribute="Dec" String="\b\-?[1-9]([0-9]|_[0-9])*\b" context="check_div_1"/> |
| 326 |
<Int attribute="Dec" context="check_div_1"/> |
| 327 |
<HlCChar attribute="Char" context="check_div_1"/> |
| 328 |
|
| 329 |
<!-- recognize the beginning of a HEREDOC |
| 330 |
This uses new features in Kate 2.3 and later |
| 331 |
|
| 332 |
There is no other chance of keeping heredoc apart from the |
| 333 |
push operator '<<' than requiring to put space between the operator |
| 334 |
and the string. |
| 335 |
--> |
| 336 |
<RegExpr attribute="Operator" context="find_indented_heredoc" String="\s*<<[-~](?=\w+|["'`])" beginRegion="HereDocument" /> |
| 337 |
<RegExpr attribute="Operator" context="find_heredoc" String="\s*<<(?=\w+|["'`])" beginRegion="HereDocument" /> |
| 338 |
|
| 339 |
<DetectChar attribute="Operator" char="." context="#stay"/> |
| 340 |
<Detect2Chars attribute="Operator" char="&" char1="&" context="#stay"/> |
| 341 |
<Detect2Chars attribute="Operator" char="|" char1="|" context="#stay"/> |
| 342 |
<!-- \s! is regexp hack --> |
| 343 |
<RegExpr attribute="Operator" String="\s[\?\:\%]\s|[|&<>\^\+*~\-=]+|\s!|/=\s" context="#stay"/> |
| 344 |
<Detect2Chars attribute="Operator" char="%" char1="=" context="#stay"/> |
| 345 |
<Detect2Chars attribute="Operator" char=":" char1=":" context="Member Access"/> |
| 346 |
|
| 347 |
<RegExpr attribute="Symbol" String=":(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?|:\[\]=?" context="check_div_1"/> |
| 348 |
|
| 349 |
<!-- Do not send to "check_div_1" context!: |
| 350 |
after detecting these rules (": ") there can be a regular expression (see bug: #361875) --> |
| 351 |
<RegExpr attribute="Symbol" String="(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?: |\[\]=?: " context="#stay"/> |
| 352 |
|
| 353 |
<DetectChar attribute="String" char=""" context="Quoted String"/> |
| 354 |
<!-- TODO: There are no single-quoted strings in Crystal. Only single-quoted characters. Modify accordingly. --> |
| 355 |
<DetectChar attribute="Raw String" char="'" context="Apostrophed String"/> |
| 356 |
<DetectChar attribute="Command" char="`" context="Command String"/> |
| 357 |
|
| 358 |
<!-- TODO: Remove this if not needed --> |
| 359 |
<Detect2Chars attribute="Normal Text" char="?" char1="#" context="#stay"/> |
| 360 |
|
| 361 |
<DetectChar attribute="Comment" char="#" context="General Comment"/> |
| 362 |
|
| 363 |
<DetectChar attribute="Delimiter" char="[" context="#stay"/> |
| 364 |
<DetectChar attribute="Delimiter" char="]" context="check_div_1"/> |
| 365 |
|
| 366 |
<!-- handle the different regular expression formats --> |
| 367 |
<DetectChar attribute="Regular Expression" char="/" context="RegEx 1"/> |
| 368 |
|
| 369 |
<!-- recognize the beginning of a general delimited input format --> |
| 370 |
<!-- this moves to the next context to separate out the exact nature of the GDL input --> |
| 371 |
<RegExpr attribute="GDL input" context="find_gdl_input" String="\s*[%](?=[QqxwW]?[^\s}])" beginRegion="GdlInput" /> |
| 372 |
|
| 373 |
<DetectChar attribute="Normal Text" char=")" context="check_div_1"/> |
| 374 |
<DetectIdentifier attribute="Normal Text" context="check_div_2"/> |
| 375 |
</context> |
| 376 |
|
| 377 |
<context name="Overloaded Operators" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop" lineEndContext="#pop"> |
| 378 |
<DetectSpaces attribute="Normal Text" context="#stay"/> |
| 379 |
<DetectChar attribute="Normal Text" char="/" context="#pop"/> |
| 380 |
</context> |
| 381 |
|
| 382 |
<!-- In the following contexts, a slash character ('/') is a division operator --> |
| 383 |
<!-- Everywhere else, it's a regular expression delimiter --> |
| 384 |
|
| 385 |
<!-- A slash is always a division operator, even if preceeded by whitespace --> |
| 386 |
<context name="check_div_1" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop" lineEndContext="#pop"> |
| 387 |
<Detect2Chars attribute="Operator" char="/" char1="/" context="#pop"/> |
| 388 |
<DetectSpaces attribute="Normal Text" context="#stay"/> |
| 389 |
<Detect2Chars attribute="Operator" char="%" char1="}" context="#pop#pop"/> |
| 390 |
<AnyChar attribute="Operator" String="/%" context="#pop"/> |
| 391 |
</context> |
| 392 |
|
| 393 |
<!-- Same as check_div_1, but with double pop to exit the surrounding context --> |
| 394 |
<context name="check_div_1_pop" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop#pop" lineEndContext="#pop#pop"> |
| 395 |
<Detect2Chars attribute="Operator" char="/" char1="/" context="#pop#pop"/> |
| 396 |
<DetectSpaces attribute="Normal Text" context="#stay"/> |
| 397 |
<Detect2Chars attribute="Operator" char="%" char1="}" context="#pop#pop#pop#pop"/> |
| 398 |
<AnyChar attribute="Operator" String="/%" context="#pop#pop"/> |
| 399 |
</context> |
| 400 |
|
| 401 |
<!-- A slash is division operator if it's the first character, or if preceeded and followed by whitespace --> |
| 402 |
<context name="check_div_2" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop" lineEndContext="#pop"> |
| 403 |
<Detect2Chars attribute="Operator" char="/" char1="/" context="#pop"/> |
| 404 |
<AnyChar attribute="Operator" String="/%" context="#pop"/> |
| 405 |
<DetectSpaces attribute="Normal Text" context="check_div_2_internal"/> |
| 406 |
</context> |
| 407 |
|
| 408 |
<!-- Internal context used by check_div_2 --> |
| 409 |
<context name="check_div_2_internal" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop#pop" lineEndContext="#pop#pop"> |
| 410 |
<RegExpr attribute="Operator" String="(//|[/%])(?=\s)" context="#pop#pop"/> |
| 411 |
</context> |
| 412 |
|
| 413 |
<!-- Same as check_div_2, but with double pop to exit the surrounding context --> |
| 414 |
<context name="check_div_2_pop" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop#pop" lineEndContext="#pop#pop"> |
| 415 |
<Detect2Chars attribute="Operator" char="/" char1="/" context="#pop#pop"/> |
| 416 |
<AnyChar attribute="Operator" String="/%" context="#pop#pop"/> |
| 417 |
<DetectSpaces attribute="Normal Text" context="check_div_2_pop_internal"/> |
| 418 |
</context> |
| 419 |
|
| 420 |
<!-- Internal context used by check_div_2_pop --> |
| 421 |
<context name="check_div_2_pop_internal" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop#pop#pop" lineEndContext="#pop#pop#pop"> |
| 422 |
<RegExpr attribute="Operator" String="//(?=\s)" context="#pop#pop#pop"/> |
| 423 |
<DetectChar attribute="Operator" char="%" context="#pop#pop#pop"/> |
| 424 |
<RegExpr attribute="Operator" String="/(?=\s)" context="#pop#pop#pop"/> |
| 425 |
</context> |
| 426 |
|
| 427 |
<context name="Line Continue" attribute="Normal Text" lineEndContext="#pop"> |
| 428 |
<RegExpr attribute="Keyword" String="(while|until)\b(?!.*\bdo\b)|(if|unless)\b" context="#stay" firstNonSpace="true"/> |
| 429 |
<IncludeRules context="Normal"/> |
| 430 |
</context> |
| 431 |
|
| 432 |
<context name="Find closing macro brace" attribute="Normal Text" lineEndContext="#stay"> |
| 433 |
<Detect2Chars attribute="Operator" char="%" char1="}" context="check_div_1_pop" endRegion="def block"/> |
| 434 |
<IncludeRules context="Macro"/> |
| 435 |
</context> |
| 436 |
|
| 437 |
<context name="Find closing block brace" attribute="Normal Text" lineEndContext="#stay"> |
| 438 |
<DetectChar attribute="Operator" char="}" context="check_div_1_pop" endRegion="def block"/> |
| 439 |
<IncludeRules context="Normal"/> |
| 440 |
</context> |
| 441 |
|
| 442 |
<context name="Quoted String" attribute="String" lineEndContext="#stay"> |
| 443 |
<Detect2Chars attribute="String" char="\" char1="\" context="#stay"/> |
| 444 |
<Detect2Chars attribute="String" char="\" char1=""" context="#stay"/> |
| 445 |
<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> |
| 446 |
<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> |
| 447 |
<DetectChar char=""" attribute="String" context="check_div_1_pop"/> |
| 448 |
</context> |
| 449 |
|
| 450 |
<context name="Apostrophed String" attribute="Raw String" lineEndContext="#stay"> |
| 451 |
<Detect2Chars attribute="String" char="\" char1="\" context="#stay"/> |
| 452 |
<Detect2Chars attribute="String" char="\" char1="'" context="#stay"/> |
| 453 |
<DetectChar char="'" attribute="Raw String" context="check_div_1_pop"/> |
| 454 |
</context> |
| 455 |
|
| 456 |
<context name="Command String" attribute="Command" lineEndContext="#stay"> |
| 457 |
<Detect2Chars attribute="String" char="\" char1="\" context="#stay"/> |
| 458 |
<Detect2Chars attribute="String" char="\" char1="`" context="#stay"/> |
| 459 |
<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> |
| 460 |
<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> |
| 461 |
<DetectChar char="`" attribute="Command" context="check_div_1_pop"/> |
| 462 |
</context> |
| 463 |
|
| 464 |
<context name="RegEx 1" attribute="Regular Expression" lineEndContext="#stay"> |
| 465 |
<Detect2Chars attribute="Regular Expression" char="\" char1="/" context="#stay"/> |
| 466 |
<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> |
| 467 |
<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> |
| 468 |
<RegExpr attribute="Regular Expression" String="/[uiomxn]*" context="check_div_1_pop"/> |
| 469 |
</context> |
| 470 |
|
| 471 |
<!-- Substitutions can be nested --> |
| 472 |
<context name="Subst" attribute="Normal Text" lineEndContext="#stay"> |
| 473 |
<DetectChar attribute="Substitution" char="}" context="#pop"/> |
| 474 |
<!-- Highlight substitution as code. --> |
| 475 |
<IncludeRules context="Normal"/> |
| 476 |
</context> |
| 477 |
|
| 478 |
<context name="Short Subst" attribute="Substitution" lineEndContext="#pop"> |
| 479 |
<!-- Check for e.g.: "#@var#@@xy" --> |
| 480 |
<RegExpr attribute="Substitution" String="#@{1,2}" context="#stay"/> |
| 481 |
<RegExpr attribute="Substitution" String="\w(?!\w)" context="#pop"/> |
| 482 |
</context> |
| 483 |
|
| 484 |
<!-- This handles access of nested module classes and class methods --> |
| 485 |
<context name="Member Access" attribute="Member" lineEndContext="#pop"> |
| 486 |
<!-- marks a message (being sent, not defined) --> |
| 487 |
<RegExpr attribute="Message" String="\.?[_a-z]\w*(\?|\!)?(?=[^\w\d\.\:])" context="check_div_2_pop"/> |
| 488 |
<RegExpr attribute="Message" String="\.?[_a-z]\w*(\?|\!)?" context="#stay"/> |
| 489 |
<RegExpr attribute="Constant" String="[A-Z]+_*(\d|[a-z])\w*(?=[^\w\d\.\:])" context="check_div_2_pop"/> |
| 490 |
<RegExpr attribute="Constant" String="[A-Z]+_*([0-9]|[a-z])\w*" context="#stay"/> |
| 491 |
<RegExpr attribute="Constant Value" String="[_A-Z][_A-Z0-9]*(?=[^\w\d\.\:])" context="check_div_2_pop"/> |
| 492 |
<RegExpr attribute="Constant Value" String="[_A-Z][_A-Z0-9]*" context="#stay"/> |
| 493 |
<Detect2Chars attribute="Operator" char=":" char1=":" context="#stay"/> |
| 494 |
<DetectChar attribute="Member" char="." context="#stay"/> |
| 495 |
|
| 496 |
<AnyChar attribute="Operator" String="=+-*/%|&[]{}~" context="#pop"/> |
| 497 |
<DetectChar attribute="Comment" char="#" context="#pop"/> |
| 498 |
<AnyChar attribute="Normal Text" String="()\" context="#pop"/> |
| 499 |
<RegExpr attribute="Member" String="\W" context="#pop"/> |
| 500 |
</context> |
| 501 |
|
| 502 |
<context name="General Comment" attribute="Comment" lineEndContext="#pop"> |
| 503 |
<DetectSpaces /> |
| 504 |
<IncludeRules context="##Comments" /> |
| 505 |
</context> |
| 506 |
|
| 507 |
<!-- HEREDOC support |
| 508 |
The contexts below support both normal and indented heredocs |
| 509 |
--> |
| 510 |
<!-- here we markup the heredoc markers --> |
| 511 |
<context name="find_heredoc" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> |
| 512 |
<RegExpr attribute="Keyword" context="apostrophed_normal_heredoc" String="'(\w+)'" /> |
| 513 |
<RegExpr attribute="Keyword" context="normal_heredoc" String="(?|(\w+)|"(\w+)"|`(\w+)`)" /> |
| 514 |
</context> |
| 515 |
<context name="find_indented_heredoc" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> |
| 516 |
<RegExpr attribute="Keyword" context="apostrophed_indented_heredoc" String="'(\w+)'" /> |
| 517 |
<RegExpr attribute="Keyword" context="indented_heredoc" String="(?|(\w+)|"(\w+)"|`(\w+)`)" /> |
| 518 |
</context> |
| 519 |
<!-- these are the real heredoc contexts --> |
| 520 |
<context name="indented_heredoc" attribute="Here Document" lineEndContext="#stay" dynamic="true"> |
| 521 |
<RegExpr attribute="Keyword" context="#pop#pop" String="%1$" dynamic="true" endRegion="HereDocument" firstNonSpace="true"/> |
| 522 |
<IncludeRules context="heredoc_rules" /> |
| 523 |
</context> |
| 524 |
<context name="apostrophed_indented_heredoc" attribute="Here Document" lineEndContext="#stay" dynamic="true"> |
| 525 |
<RegExpr attribute="Keyword" context="#pop#pop" String="%1$" dynamic="true" endRegion="HereDocument" firstNonSpace="true"/> |
| 526 |
</context> |
| 527 |
|
| 528 |
<context name="normal_heredoc" attribute="Here Document" lineEndContext="#stay" dynamic="true"> |
| 529 |
<RegExpr attribute="Keyword" context="#pop#pop" String="^%1$" dynamic="true" endRegion="HereDocument" column="0"/> |
| 530 |
<IncludeRules context="heredoc_rules" /> |
| 531 |
</context> |
| 532 |
<context name="apostrophed_normal_heredoc" attribute="Here Document" lineEndContext="#stay" dynamic="true"> |
| 533 |
<RegExpr attribute="Keyword" context="#pop#pop" String="^%1$" dynamic="true" endRegion="HereDocument" column="0"/> |
| 534 |
</context> |
| 535 |
|
| 536 |
<!-- rules for heredoc types --> |
| 537 |
<context name="heredoc_rules" attribute="Normal Text" lineEndContext="#stay"> |
| 538 |
<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> |
| 539 |
<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> |
| 540 |
</context> |
| 541 |
|
| 542 |
<!-- avoid highlighting heredoc markers, for example, in singleton class definition (see bug: #358273) --> |
| 543 |
<context name="no_heredoc" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop"> |
| 544 |
<DetectSpaces /> |
| 545 |
<Detect2Chars attribute="Operator" char="<" char1="<" context="#pop"/> |
| 546 |
<!-- comments --> |
| 547 |
<RegExpr attribute="Comment" String="^#\s*BEGIN.*$" context="#stay" beginRegion="marker" column="0"/> |
| 548 |
<RegExpr attribute="Comment" String="^#\s*END.*$" context="#stay" endRegion="marker" column="0"/> |
| 549 |
<DetectChar attribute="Comment" char="#" context="General Comment"/> |
| 550 |
</context> |
| 551 |
|
| 552 |
<!-- General delimited input support |
| 553 |
The contexts below handle the various gdl formats |
| 554 |
--> |
| 555 |
<context name="find_gdl_input" attribute="Normal Text" lineEndContext="#pop"> |
| 556 |
|
| 557 |
<!-- handle token arrays --> |
| 558 |
<Detect2Chars attribute="GDL input" context="gdl_token_array_1" char="w" char1="(" /> |
| 559 |
<Detect2Chars attribute="GDL input" context="gdl_token_array_2" char="w" char1="{" /> |
| 560 |
<Detect2Chars attribute="GDL input" context="gdl_token_array_3" char="w" char1="[" /> |
| 561 |
<Detect2Chars attribute="GDL input" context="gdl_token_array_4" char="w" char1="<" /> |
| 562 |
<!-- then we handle the 'any char' format --> |
| 563 |
<RegExpr attribute="GDL input" context="gdl_token_array_5" String="w([^\s\w])" /> |
| 564 |
|
| 565 |
<!-- handle token arrays --> |
| 566 |
<Detect2Chars attribute="GDL input" context="gdl_token_array_1" char="W" char1="(" /> |
| 567 |
<Detect2Chars attribute="GDL input" context="gdl_token_array_2" char="W" char1="{" /> |
| 568 |
<Detect2Chars attribute="GDL input" context="gdl_token_array_3" char="W" char1="[" /> |
| 569 |
<Detect2Chars attribute="GDL input" context="gdl_token_array_4" char="W" char1="<" /> |
| 570 |
<!-- then we handle the 'any char' format --> |
| 571 |
<RegExpr attribute="GDL input" context="gdl_token_array_5" String="W([^\s\w])" /> |
| 572 |
|
| 573 |
<!-- handle apostrophed strings --> |
| 574 |
<Detect2Chars attribute="GDL input" context="gdl_apostrophed_1" char="q" char1="(" /> |
| 575 |
<Detect2Chars attribute="GDL input" context="gdl_apostrophed_2" char="q" char1="{" /> |
| 576 |
<Detect2Chars attribute="GDL input" context="gdl_apostrophed_3" char="q" char1="[" /> |
| 577 |
<Detect2Chars attribute="GDL input" context="gdl_apostrophed_4" char="q" char1="<" /> |
| 578 |
<!-- then we handle the 'any char' format --> |
| 579 |
<RegExpr attribute="GDL input" context="gdl_apostrophed_5" String="q([^\s\w])" /> |
| 580 |
|
| 581 |
<!-- handle shell commands --> |
| 582 |
<Detect2Chars attribute="GDL input" context="gdl_shell_command_1" char="x" char1="(" /> |
| 583 |
<Detect2Chars attribute="GDL input" context="gdl_shell_command_2" char="x" char1="{" /> |
| 584 |
<Detect2Chars attribute="GDL input" context="gdl_shell_command_3" char="x" char1="[" /> |
| 585 |
<Detect2Chars attribute="GDL input" context="gdl_shell_command_4" char="x" char1="<" /> |
| 586 |
<!-- then we handle the 'any char' format --> |
| 587 |
<RegExpr attribute="GDL input" context="gdl_shell_command_5" String="x([^\s\w])" /> |
| 588 |
|
| 589 |
<!-- handle regular expressions --> |
| 590 |
<Detect2Chars attribute="GDL input" context="gdl_regexpr_1" char="r" char1="(" /> |
| 591 |
<Detect2Chars attribute="GDL input" context="gdl_regexpr_2" char="r" char1="{" /> |
| 592 |
<Detect2Chars attribute="GDL input" context="gdl_regexpr_3" char="r" char1="[" /> |
| 593 |
<Detect2Chars attribute="GDL input" context="gdl_regexpr_4" char="r" char1="<" /> |
| 594 |
<!-- then we handle the 'any char' format --> |
| 595 |
<RegExpr attribute="GDL input" context="gdl_regexpr_5" String="r([^\s\w])" /> |
| 596 |
|
| 597 |
<!-- handle double-quoted strings --> |
| 598 |
<!-- |
| 599 |
be careful to make this the last GDL ruleset, because the rule for |
| 600 |
the short form %?foo? will otherwise catch any of the other formats |
| 601 |
--> |
| 602 |
<Detect2Chars attribute="GDL input" context="gdl_dq_string_1" char="Q" char1="(" /> |
| 603 |
<Detect2Chars attribute="GDL input" context="gdl_dq_string_2" char="Q" char1="{" /> |
| 604 |
<Detect2Chars attribute="GDL input" context="gdl_dq_string_3" char="Q" char1="[" /> |
| 605 |
<Detect2Chars attribute="GDL input" context="gdl_dq_string_4" char="Q" char1="<" /> |
| 606 |
<DetectChar attribute="GDL input" context="gdl_dq_string_1" char="(" /> |
| 607 |
<DetectChar attribute="GDL input" context="gdl_dq_string_2" char="{" /> |
| 608 |
<DetectChar attribute="GDL input" context="gdl_dq_string_3" char="[" /> |
| 609 |
<DetectChar attribute="GDL input" context="gdl_dq_string_4" char="<" /> |
| 610 |
<!-- then we handle the 'any char' format --> |
| 611 |
<RegExpr attribute="GDL input" context="gdl_dq_string_5" String="Q?([^\s\w])" /> |
| 612 |
|
| 613 |
</context> |
| 614 |
<!-- double-quoted string specific contexts follow --> |
| 615 |
<context name="gdl_dq_string_1" attribute="String" lineEndContext="#stay" > |
| 616 |
<IncludeRules context="dq_string_rules" /> |
| 617 |
<Detect2Chars attribute="String" char="\" char1=")" context="#stay"/> |
| 618 |
<DetectChar attribute="String" context="gdl_dq_string_1_nested" char="(" /> |
| 619 |
<DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" /> |
| 620 |
</context> |
| 621 |
<context name="gdl_dq_string_1_nested" attribute="String" lineEndContext="#stay" > |
| 622 |
<IncludeRules context="dq_string_rules" /> |
| 623 |
<DetectChar attribute="String" context="gdl_dq_string_1_nested" char="(" /> |
| 624 |
<DetectChar attribute="String" context="#pop" char=")" /> |
| 625 |
</context> |
| 626 |
<!-- note that here substitution should win over nesting --> |
| 627 |
<context name="gdl_dq_string_2" attribute="String" lineEndContext="#stay" > |
| 628 |
<IncludeRules context="dq_string_rules" /> |
| 629 |
<Detect2Chars attribute="String" char="\" char1="}" context="#stay"/> |
| 630 |
<DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" /> |
| 631 |
<DetectChar attribute="String" context="gdl_dq_string_2_nested" char="{" /> |
| 632 |
</context> |
| 633 |
<context name="gdl_dq_string_2_nested" attribute="String" lineEndContext="#stay" > |
| 634 |
<DetectChar attribute="String" context="gdl_dq_string_2_nested" char="{" /> |
| 635 |
<DetectChar attribute="String" context="#pop" char="}" /> |
| 636 |
<IncludeRules context="dq_string_rules" /> |
| 637 |
</context> |
| 638 |
|
| 639 |
<context name="gdl_dq_string_3" attribute="String" lineEndContext="#stay" > |
| 640 |
<IncludeRules context="dq_string_rules" /> |
| 641 |
<Detect2Chars attribute="String" char="\" char1="]" context="#stay"/> |
| 642 |
<DetectChar attribute="String" context="gdl_dq_string_3_nested" char="[" /> |
| 643 |
<DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" /> |
| 644 |
</context> |
| 645 |
<context name="gdl_dq_string_3_nested" attribute="String" lineEndContext="#stay" > |
| 646 |
<DetectChar attribute="String" context="gdl_dq_string_3_nested" char="[" /> |
| 647 |
<DetectChar attribute="String" context="#pop" char="]" /> |
| 648 |
<IncludeRules context="dq_string_rules" /> |
| 649 |
</context> |
| 650 |
|
| 651 |
<context name="gdl_dq_string_4" attribute="String" lineEndContext="#stay" > |
| 652 |
<IncludeRules context="dq_string_rules" /> |
| 653 |
<Detect2Chars attribute="String" char="\" char1=">" context="#stay"/> |
| 654 |
<DetectChar attribute="String" context="gdl_dq_string_4_nested" char="<" /> |
| 655 |
<DetectChar attribute="GDL input" context="#pop#pop" char=">" endRegion="GdlInput" /> |
| 656 |
</context> |
| 657 |
<context name="gdl_dq_string_4_nested" attribute="String" lineEndContext="#stay" > |
| 658 |
<DetectChar attribute="String" context="gdl_dq_string_4_nested" char="<" /> |
| 659 |
<DetectChar attribute="String" context="#pop" char=">" /> |
| 660 |
<IncludeRules context="dq_string_rules" /> |
| 661 |
</context> |
| 662 |
|
| 663 |
<!-- this format doesn't allow nesting. it is terminated by the next occurrence of the |
| 664 |
delimiter character |
| 665 |
--> |
| 666 |
<context name="gdl_dq_string_5" attribute="String" lineEndContext="#stay" dynamic="true"> |
| 667 |
<IncludeRules context="dq_string_rules" /> |
| 668 |
<StringDetect attribute="String" String="\%1" context="#stay" dynamic="true" /> |
| 669 |
<RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" /> |
| 670 |
</context> |
| 671 |
<!-- rules to be included in all dq_string contexts --> |
| 672 |
<context name="dq_string_rules" attribute="String" lineEndContext="#stay" > |
| 673 |
<Detect2Chars attribute="String" char="\" char1="\" context="#stay"/> |
| 674 |
<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> |
| 675 |
<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> |
| 676 |
</context> |
| 677 |
|
| 678 |
<!-- token array specific contexts --> |
| 679 |
|
| 680 |
<context name="gdl_token_array_1" attribute="String" lineEndContext="#stay" > |
| 681 |
<IncludeRules context="token_array_rules" /> |
| 682 |
<Detect2Chars attribute="String" char="\" char1=")" context="#stay"/> |
| 683 |
<DetectChar attribute="String" context="gdl_token_array_1_nested" char="(" /> |
| 684 |
<DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" /> |
| 685 |
</context> |
| 686 |
<context name="gdl_token_array_1_nested" attribute="String" lineEndContext="#stay" > |
| 687 |
<IncludeRules context="token_array_rules" /> |
| 688 |
<DetectChar attribute="String" context="gdl_token_array_1_nested" char="(" /> |
| 689 |
<DetectChar attribute="String" context="#pop" char=")" /> |
| 690 |
</context> |
| 691 |
|
| 692 |
<context name="gdl_token_array_2" attribute="String" lineEndContext="#stay" > |
| 693 |
<IncludeRules context="token_array_rules" /> |
| 694 |
<Detect2Chars attribute="String" char="\" char1="}" context="#stay"/> |
| 695 |
<DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" /> |
| 696 |
<DetectChar attribute="String" context="gdl_token_array_2_nested" char="{" /> |
| 697 |
</context> |
| 698 |
<context name="gdl_token_array_2_nested" attribute="String" lineEndContext="#stay" > |
| 699 |
<IncludeRules context="token_array_rules" /> |
| 700 |
<DetectChar attribute="String" context="gdl_token_array_2_nested" char="{" /> |
| 701 |
<DetectChar attribute="String" context="#pop" char="}" /> |
| 702 |
</context> |
| 703 |
|
| 704 |
<context name="gdl_token_array_3" attribute="String" lineEndContext="#stay" > |
| 705 |
<IncludeRules context="token_array_rules" /> |
| 706 |
<Detect2Chars attribute="String" char="\" char1="]" context="#stay"/> |
| 707 |
<DetectChar attribute="String" context="gdl_token_array_3_nested" char="[" /> |
| 708 |
<DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" /> |
| 709 |
</context> |
| 710 |
<context name="gdl_token_array_3_nested" attribute="String" lineEndContext="#stay" > |
| 711 |
<IncludeRules context="token_array_rules" /> |
| 712 |
<DetectChar attribute="String" context="gdl_token_array_3_nested" char="[" /> |
| 713 |
<DetectChar attribute="String" context="#pop" char="]" /> |
| 714 |
</context> |
| 715 |
|
| 716 |
<context name="gdl_token_array_4" attribute="String" lineEndContext="#stay" > |
| 717 |
<IncludeRules context="token_array_rules" /> |
| 718 |
<Detect2Chars attribute="String" char="\" char1=">" context="#stay"/> |
| 719 |
<DetectChar attribute="String" context="gdl_token_array_4_nested" char="<" /> |
| 720 |
<DetectChar attribute="GDL input" context="#pop#pop" char=">" endRegion="GdlInput" /> |
| 721 |
</context> |
| 722 |
<context name="gdl_token_array_4_nested" attribute="String" lineEndContext="#stay" > |
| 723 |
<IncludeRules context="token_array_rules" /> |
| 724 |
<DetectChar attribute="String" context="gdl_token_array_4_nested" char="<" /> |
| 725 |
<DetectChar attribute="String" context="#pop" char=">" /> |
| 726 |
</context> |
| 727 |
|
| 728 |
<!-- this format doesn't allow nesting. it is terminated by the next occurrence of the |
| 729 |
delimiter character |
| 730 |
--> |
| 731 |
<context name="gdl_token_array_5" attribute="String" lineEndContext="#stay" dynamic="true"> |
| 732 |
<IncludeRules context="token_array_rules" /> |
| 733 |
<StringDetect attribute="String" String="\%1" context="#stay" dynamic="true"/> |
| 734 |
<RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" /> |
| 735 |
</context> |
| 736 |
|
| 737 |
<!-- rules to be included in all token_array contexts --> |
| 738 |
<context name="token_array_rules" attribute="String" lineEndContext="#stay" > |
| 739 |
<Detect2Chars attribute="String" char="\" char1="\" context="#stay"/> |
| 740 |
</context> |
| 741 |
|
| 742 |
<!-- apostrophed string specific contexts --> |
| 743 |
|
| 744 |
<context name="gdl_apostrophed_1" attribute="Raw String" lineEndContext="#stay" > |
| 745 |
<IncludeRules context="apostrophed_rules" /> |
| 746 |
<Detect2Chars attribute="Raw String" char="\" char1=")" context="#stay"/> |
| 747 |
<DetectChar attribute="Raw String" context="gdl_apostrophed_1_nested" char="(" /> |
| 748 |
<DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" /> |
| 749 |
</context> |
| 750 |
<context name="gdl_apostrophed_1_nested" attribute="Raw String" lineEndContext="#stay" > |
| 751 |
<IncludeRules context="apostrophed_rules" /> |
| 752 |
<DetectChar attribute="Raw String" context="gdl_apostrophed_1_nested" char="(" /> |
| 753 |
<DetectChar attribute="Raw String" context="#pop" char=")" /> |
| 754 |
</context> |
| 755 |
|
| 756 |
<context name="gdl_apostrophed_2" attribute="Raw String" lineEndContext="#stay" > |
| 757 |
<IncludeRules context="apostrophed_rules" /> |
| 758 |
<Detect2Chars attribute="Raw String" char="\" char1="}" context="#stay"/> |
| 759 |
<DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" /> |
| 760 |
<DetectChar attribute="Raw String" context="gdl_apostrophed_2_nested" char="{" /> |
| 761 |
</context> |
| 762 |
<context name="gdl_apostrophed_2_nested" attribute="Raw String" lineEndContext="#stay" > |
| 763 |
<IncludeRules context="apostrophed_rules" /> |
| 764 |
<DetectChar attribute="Raw String" context="gdl_apostrophed_2_nested" char="{" /> |
| 765 |
<DetectChar attribute="Raw String" context="#pop" char="}" /> |
| 766 |
</context> |
| 767 |
|
| 768 |
<context name="gdl_apostrophed_3" attribute="Raw String" lineEndContext="#stay" > |
| 769 |
<IncludeRules context="apostrophed_rules" /> |
| 770 |
<Detect2Chars attribute="Raw String" char="\" char1="]" context="#stay"/> |
| 771 |
<DetectChar attribute="Raw String" context="gdl_apostrophed_3_nested" char="[" /> |
| 772 |
<DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" /> |
| 773 |
</context> |
| 774 |
<context name="gdl_apostrophed_3_nested" attribute="Raw String" lineEndContext="#stay" > |
| 775 |
<IncludeRules context="apostrophed_rules" /> |
| 776 |
<DetectChar attribute="Raw String" context="gdl_apostrophed_3_nested" char="[" /> |
| 777 |
<DetectChar attribute="Raw String" context="#pop" char="]" /> |
| 778 |
</context> |
| 779 |
|
| 780 |
<context name="gdl_apostrophed_4" attribute="Raw String" lineEndContext="#stay" > |
| 781 |
<IncludeRules context="apostrophed_rules" /> |
| 782 |
<Detect2Chars attribute="Raw String" char="\" char1=">" context="#stay"/> |
| 783 |
<DetectChar attribute="Raw String" context="gdl_apostrophed_4_nested" char="<" /> |
| 784 |
<DetectChar attribute="GDL input" context="#pop#pop" char=">" endRegion="GdlInput" /> |
| 785 |
</context> |
| 786 |
<context name="gdl_apostrophed_4_nested" attribute="Raw String" lineEndContext="#stay" > |
| 787 |
<IncludeRules context="apostrophed_rules" /> |
| 788 |
<DetectChar attribute="Raw String" context="gdl_apostrophed_4_nested" char="<" /> |
| 789 |
<DetectChar attribute="Raw String" context="#pop" char=">" /> |
| 790 |
</context> |
| 791 |
|
| 792 |
<!-- this format doesn't allow nesting. it is terminated by the next occurrence of the |
| 793 |
delimiter character |
| 794 |
--> |
| 795 |
<context name="gdl_apostrophed_5" attribute="Raw String" lineEndContext="#stay" dynamic="true"> |
| 796 |
<IncludeRules context="apostrophed_rules" /> |
| 797 |
<StringDetect attribute="Raw String" String="\%1" context="#stay" dynamic="true"/> |
| 798 |
<RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" /> |
| 799 |
</context> |
| 800 |
|
| 801 |
<!-- rules to be included in all apostrophed contexts --> |
| 802 |
<context name="apostrophed_rules" attribute="Raw String" lineEndContext="#stay" > |
| 803 |
<Detect2Chars attribute="Raw String" char="\" char1="\" context="#stay"/> |
| 804 |
</context> |
| 805 |
|
| 806 |
<!-- shell command specific contexts --> |
| 807 |
|
| 808 |
<context name="gdl_shell_command_1" attribute="Command" lineEndContext="#stay" > |
| 809 |
<IncludeRules context="shell_command_rules" /> |
| 810 |
<Detect2Chars attribute="Command" char="\" char1=")" context="#stay"/> |
| 811 |
<DetectChar attribute="Command" context="gdl_shell_command_1_nested" char="(" /> |
| 812 |
<DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" /> |
| 813 |
</context> |
| 814 |
<context name="gdl_shell_command_1_nested" attribute="Command" lineEndContext="#stay" > |
| 815 |
<IncludeRules context="shell_command_rules" /> |
| 816 |
<DetectChar attribute="Command" context="gdl_shell_command_1_nested" char="(" /> |
| 817 |
<DetectChar attribute="Command" context="#pop" char=")" /> |
| 818 |
</context> |
| 819 |
|
| 820 |
<context name="gdl_shell_command_2" attribute="Command" lineEndContext="#stay" > |
| 821 |
<IncludeRules context="shell_command_rules" /> |
| 822 |
<Detect2Chars attribute="Command" char="\" char1="}" context="#stay"/> |
| 823 |
<DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" /> |
| 824 |
<DetectChar attribute="Command" context="gdl_shell_command_2_nested" char="{" /> |
| 825 |
</context> |
| 826 |
<context name="gdl_shell_command_2_nested" attribute="Command" lineEndContext="#stay" > |
| 827 |
<IncludeRules context="shell_command_rules" /> |
| 828 |
<DetectChar attribute="Command" context="gdl_shell_command_2_nested" char="{" /> |
| 829 |
<DetectChar attribute="Command" context="#pop" char="}" /> |
| 830 |
</context> |
| 831 |
|
| 832 |
<context name="gdl_shell_command_3" attribute="Command" lineEndContext="#stay" > |
| 833 |
<IncludeRules context="shell_command_rules" /> |
| 834 |
<Detect2Chars attribute="Command" char="\" char1="]" context="#stay"/> |
| 835 |
<DetectChar attribute="Command" context="gdl_shell_command_3_nested" char="[" /> |
| 836 |
<DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" /> |
| 837 |
</context> |
| 838 |
<context name="gdl_shell_command_3_nested" attribute="Command" lineEndContext="#stay" > |
| 839 |
<IncludeRules context="shell_command_rules" /> |
| 840 |
<DetectChar attribute="Command" context="gdl_shell_command_3_nested" char="[" /> |
| 841 |
<DetectChar attribute="Command" context="#pop" char="]" /> |
| 842 |
</context> |
| 843 |
|
| 844 |
<context name="gdl_shell_command_4" attribute="Command" lineEndContext="#stay" > |
| 845 |
<IncludeRules context="shell_command_rules" /> |
| 846 |
<Detect2Chars attribute="Command" char="\" char1=">" context="#stay"/> |
| 847 |
<DetectChar attribute="Command" context="gdl_shell_command_4_nested" char="<" /> |
| 848 |
<DetectChar attribute="GDL input" context="#pop#pop" char=">" endRegion="GdlInput" /> |
| 849 |
</context> |
| 850 |
<context name="gdl_shell_command_4_nested" attribute="Command" lineEndContext="#stay" > |
| 851 |
<IncludeRules context="shell_command_rules" /> |
| 852 |
<DetectChar attribute="Command" context="gdl_shell_command_4_nested" char="<" /> |
| 853 |
<DetectChar attribute="Command" context="#pop" char=">" /> |
| 854 |
</context> |
| 855 |
|
| 856 |
<!-- this format doesn't allow nesting. it is terminated by the next occurrence of the |
| 857 |
delimiter character |
| 858 |
--> |
| 859 |
<context name="gdl_shell_command_5" attribute="Command" lineEndContext="#stay" dynamic="true"> |
| 860 |
<IncludeRules context="shell_command_rules" /> |
| 861 |
<StringDetect attribute="Command" String="\%1" context="#stay" dynamic="true" /> |
| 862 |
<RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" /> |
| 863 |
</context> |
| 864 |
|
| 865 |
<!-- rules to be included in all shell_command contexts --> |
| 866 |
<context name="shell_command_rules" attribute="Command" lineEndContext="#stay" > |
| 867 |
<Detect2Chars attribute="Command" char="\" char1="\" context="#stay"/> |
| 868 |
<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> |
| 869 |
<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> |
| 870 |
</context> |
| 871 |
|
| 872 |
<!-- regular expression specific contexts --> |
| 873 |
|
| 874 |
<context name="gdl_regexpr_1" attribute="Regular Expression" lineEndContext="#stay" > |
| 875 |
<IncludeRules context="regexpr_rules" /> |
| 876 |
<Detect2Chars attribute="Regular Expression" char="\" char1=")" context="#stay"/> |
| 877 |
<DetectChar attribute="Regular Expression" context="gdl_regexpr_1_nested" char="(" /> |
| 878 |
<RegExpr attribute="GDL input" context="#pop#pop" String="\)[uiomxn]*" endRegion="GdlInput" /> |
| 879 |
</context> |
| 880 |
<context name="gdl_regexpr_1_nested" attribute="Regular Expression" lineEndContext="#stay" > |
| 881 |
<IncludeRules context="regexpr_rules" /> |
| 882 |
<DetectChar attribute="Regular Expression" context="gdl_regexpr_1_nested" char="(" /> |
| 883 |
<DetectChar attribute="Regular Expression" context="#pop" char=")" /> |
| 884 |
</context> |
| 885 |
|
| 886 |
<context name="gdl_regexpr_2" attribute="Regular Expression" lineEndContext="#stay" > |
| 887 |
<IncludeRules context="regexpr_rules" /> |
| 888 |
<Detect2Chars attribute="Regular Expression" char="\" char1="}" context="#stay"/> |
| 889 |
<RegExpr attribute="GDL input" context="#pop#pop" String="\}[uiomxn]*" endRegion="GdlInput" /> |
| 890 |
<DetectChar attribute="Regular Expression" context="gdl_regexpr_2_nested" char="{" /> |
| 891 |
</context> |
| 892 |
<context name="gdl_regexpr_2_nested" attribute="Regular Expression" lineEndContext="#stay" > |
| 893 |
<IncludeRules context="regexpr_rules" /> |
| 894 |
<DetectChar attribute="Regular Expression" context="gdl_regexpr_2_nested" char="{" /> |
| 895 |
<DetectChar attribute="Regular Expression" context="#pop" char="}" /> |
| 896 |
</context> |
| 897 |
|
| 898 |
<context name="gdl_regexpr_3" attribute="Regular Expression" lineEndContext="#stay" > |
| 899 |
<IncludeRules context="regexpr_rules" /> |
| 900 |
<Detect2Chars attribute="Regular Expression" char="\" char1="]" context="#stay"/> |
| 901 |
<DetectChar attribute="Regular Expression" context="gdl_regexpr_3_nested" char="[" /> |
| 902 |
<RegExpr attribute="GDL input" context="#pop#pop" String="\][uiomxn]*" endRegion="GdlInput" /> |
| 903 |
</context> |
| 904 |
<context name="gdl_regexpr_3_nested" attribute="Regular Expression" lineEndContext="#stay" > |
| 905 |
<IncludeRules context="regexpr_rules" /> |
| 906 |
<DetectChar attribute="Regular Expression" context="gdl_regexpr_3_nested" char="[" /> |
| 907 |
<DetectChar attribute="Regular Expression" context="#pop" char="]" /> |
| 908 |
</context> |
| 909 |
|
| 910 |
<context name="gdl_regexpr_4" attribute="Regular Expression" lineEndContext="#stay" > |
| 911 |
<IncludeRules context="regexpr_rules" /> |
| 912 |
<Detect2Chars attribute="Regular Expression" char="\" char1=">" context="#stay"/> |
| 913 |
<DetectChar attribute="Regular Expression" context="gdl_regexpr_4_nested" char="<" /> |
| 914 |
<RegExpr attribute="GDL input" context="#pop#pop" String=">[uiomxn]*" endRegion="GdlInput" /> |
| 915 |
</context> |
| 916 |
<context name="gdl_regexpr_4_nested" attribute="Regular Expression" lineEndContext="#stay" > |
| 917 |
<IncludeRules context="regexpr_rules" /> |
| 918 |
<DetectChar attribute="Regular Expression" context="gdl_regexpr_4_nested" char="<" /> |
| 919 |
<DetectChar attribute="Regular Expression" context="#pop" char=">" /> |
| 920 |
</context> |
| 921 |
|
| 922 |
<!-- this format doesn't allow nesting. it is terminated by the next occurrence of the |
| 923 |
delimiter character |
| 924 |
--> |
| 925 |
<context name="gdl_regexpr_5" attribute="Regular Expression" lineEndContext="#stay" dynamic="true"> |
| 926 |
<IncludeRules context="regexpr_rules" /> |
| 927 |
<StringDetect attribute="Regular Expression" String="\%1" context="#stay" dynamic="true" /> |
| 928 |
<RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1[uiomxn]*" dynamic="true" endRegion="GdlInput" /> |
| 929 |
</context> |
| 930 |
|
| 931 |
<!-- rules to be included in all regexpr contexts --> |
| 932 |
<context name="regexpr_rules" attribute="Regular Expression" lineEndContext="#stay" > |
| 933 |
<Detect2Chars attribute="Regular Expression" char="\" char1="\" context="#stay"/> |
| 934 |
<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/> |
| 935 |
<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/> |
| 936 |
</context> |
| 937 |
|
| 938 |
<!-- END of General delimited input support --> |
| 939 |
|
| 940 |
</contexts> |
| 941 |
|
| 942 |
<itemDatas> |
| 943 |
<itemData name="Normal Text" defStyleNum="dsNormal"/> |
| 944 |
|
| 945 |
<itemData name="Keyword" defStyleNum="dsControlFlow"/> |
| 946 |
<itemData name="Attribute Definition" defStyleNum="dsOthers"/> |
| 947 |
<itemData name="Access Control" defStyleNum="dsAttribute" bold="1"/> <!-- #0000FF --> |
| 948 |
<itemData name="Definition" defStyleNum="dsKeyword"/> |
| 949 |
<itemData name="Pseudo variable" defStyleNum="dsDecVal"/> |
| 950 |
|
| 951 |
<itemData name="Dec" defStyleNum="dsDecVal"/> |
| 952 |
<itemData name="Float" defStyleNum="dsFloat"/> |
| 953 |
<itemData name="Char" defStyleNum="dsChar"/> |
| 954 |
<itemData name="Octal" defStyleNum="dsBaseN"/> |
| 955 |
<itemData name="Hex" defStyleNum="dsBaseN"/> |
| 956 |
<itemData name="Bin" defStyleNum="dsBaseN"/> |
| 957 |
|
| 958 |
<itemData name="Symbol" defStyleNum="dsWarning" bold="0" underline="0"/> <!-- #D40000 --> |
| 959 |
<itemData name="String" defStyleNum="dsString"/> |
| 960 |
<itemData name="Raw String" defStyleNum="dsVerbatimString" /> <!-- #DD4A4A --> |
| 961 |
<itemData name="Command" defStyleNum="dsInformation"/> <!-- #AA3000 --> |
| 962 |
<itemData name="Message" defStyleNum="dsAttribute" bold="0"/> <!-- #4000A7 --> |
| 963 |
<itemData name="Regular Expression" defStyleNum="dsSpecialString"/> <!-- #4A5704 --> |
| 964 |
<itemData name="Substitution" defStyleNum="dsSpecialChar"/> |
| 965 |
<!-- short for 'general delimited input' --> |
| 966 |
<itemData name="GDL input" defStyleNum="dsOthers" /> |
| 967 |
|
| 968 |
<itemData name="Global Constant" defStyleNum="dsConstant" bold="1"/> <!-- #bb1188 --> |
| 969 |
<itemData name="Constant" defStyleNum="dsDataType"/> |
| 970 |
<itemData name="Constant Value" defStyleNum="dsConstant" bold="0"/> <!-- #bb1188 --> |
| 971 |
<itemData name="Kernel methods" defStyleNum="dsFunction" bold="1"/> <!-- #CC0E86 --> |
| 972 |
<itemData name="Module mixin methods" defStyleNum="dsFunction" bold="1"/> <!-- #CC0E86 --> |
| 973 |
<itemData name="Member" defStyleNum="dsNormal"/> |
| 974 |
<itemData name="Instance Variable" defStyleNum="dsOthers"/> |
| 975 |
<itemData name="Class Variable" defStyleNum="dsOthers"/> |
| 976 |
|
| 977 |
<itemData name="Comment" defStyleNum="dsComment"/> |
| 978 |
|
| 979 |
<itemData name="Here Document" defStyleNum="dsDocumentation"/> |
| 980 |
|
| 981 |
<itemData name="Delimiter" defStyleNum="dsKeyword"/> <!-- #FF9FEC --> |
| 982 |
<itemData name="Operator" defStyleNum="dsKeyword"/> <!-- #FF9FEC --> |
| 983 |
</itemDatas> |
| 984 |
</highlighting> |
| 985 |
<general> |
| 986 |
<comments> |
| 987 |
<comment name="singleLine" start="#" position="afterwhitespace"/> |
| 988 |
</comments> |
| 989 |
<keywords casesensitive="1" weakDeliminator="!?"/> |
| 990 |
</general> |
| 991 |
</language> |
| 992 |
|
| 993 |
<!-- kate: replace-tabs off; --> |