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