Warning, /frameworks/syntax-highlighting/data/syntax/crystal.xml is written in an unsupported language. File is not indexed.

0001 <?xml version="1.0" encoding="UTF-8"?>
0002 <!DOCTYPE language>
0003 
0004 <!--
0005   Crystal syntax highlighting definition for Kate.
0006   Copyright (C) 2022  by Gaurav Shah (gauravshah.89@gmail.com)
0007 
0008   Forked from the Ruby syntax highlighting definition.
0009   Copyright (C) 2004  by Sebastian Vuorinen (sebastian dot vuorinen at helsinki dot fi)
0010   Copyright (C) 2004  by Stefan Lang (langstefan@gmx.at)
0011   Copyright (C) 2008  by Robin Pedersen (robinpeder@gmail.com)
0012   Copyright (C) 2011  by Miquel Sabaté (mikisabate@gmail.com)
0013 
0014   This library is free software; you can redistribute it and/or
0015   modify it under the terms of the GNU Library General Public
0016   License as published by the Free Software Foundation; either
0017   version 2 of the License, or (at your option) any later version.
0018 
0019   This library is distributed in the hope that it will be useful,
0020   but WITHOUT ANY WARRANTY; without even the implied warranty of
0021   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0022   Library General Public License for more details.
0023 
0024   You should have received a copy of the GNU Library General Public
0025   License along with this library; if not, write to the
0026   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0027   Boston, MA  02110-1301, USA.
0028 -->
0029 
0030 <!--
0031     TODO: Division after gdl contexts is interpreted as regexp
0032 -->
0033 
0034 <!-- Hold the "language" opening tag on a single line, as mentioned in "language.dtd". -->
0035 <language name="Crystal" section="Sources"
0036           version="0" kateversion="5.0"
0037           extensions="*.cr"
0038           mimetype="application/x-crystal"
0039           style="crystal" indenter="ruby"
0040           author="Gaurav Shah (gauravshah.89@gmail.com)" license="LGPLv2+">
0041 
0042         <highlighting>
0043 
0044                 <list name="keywords">
0045                         <item>begin</item>
0046                         <item>break</item>
0047                         <item>case</item>
0048                         <item>do</item>
0049                         <item>else</item>
0050                         <item>elsif</item>
0051                         <item>end</item>
0052                         <item>ensure</item>
0053                         <item>for</item>
0054                         <item>if</item>
0055                         <item>in</item>
0056                         <item>next</item>
0057                         <item>rescue</item>
0058                         <item>return</item>
0059                         <item>then</item>
0060                         <item>unless</item>
0061                         <item>until</item>
0062                         <item>when</item>
0063                         <item>yield</item>
0064                 </list>
0065 
0066                 <list name="access-control">
0067                         <item>private</item>
0068                         <item>protected</item>
0069                 </list>
0070 
0071                 <list name="attribute-definitions">
0072                         <item>getter</item>
0073                         <item>setter</item>
0074                         <item>property</item>
0075                 </list>
0076 
0077                 <list name="definitions">
0078                         <item>alias</item>
0079                         <item>module</item>
0080                         <item>class</item>
0081                         <item>struct</item>
0082                         <item>def</item>
0083                         <item>macro</item>
0084                 </list>
0085 
0086                 <list name="pseudo-variables">
0087                         <item>self</item>
0088                         <item>super</item>
0089                         <item>nil</item>
0090                         <item>false</item>
0091                         <item>true</item>
0092                         <item>caller</item>
0093                         <!-- TODO: move these to psudo constants list -->
0094                         <item>__FILE__</item>
0095                         <item>__LINE__</item>
0096                         <item>__END_LINE__</item>
0097                         <item>__DIR__</item>
0098                 </list>
0099 
0100                 <!-- Kernel module methods.
0101                         NOTE: Methods ending in ? or !
0102                                 are included below as regexes.
0103                 -->
0104                 <!-- TODO: replace this with Crystal Object methods? -->
0105                 <list name="kernel-methods">
0106                         <!-- backquote ` -->
0107                         <item>abort</item>
0108                         <item>at_exit</item>
0109                         <item>autoload</item>
0110                         <item>autoload?</item>
0111                         <item>binding</item>
0112                         <item>block_given?</item>
0113                         <item>callcc</item>
0114                         <item>caller</item>
0115                         <item>catch</item>
0116                         <item>chomp</item>
0117                         <item>chomp!</item>
0118                         <item>chop</item>
0119                         <item>chop!</item>
0120                         <item>eval</item>
0121                         <item>exec</item>
0122                         <item>exit</item>
0123                         <item>exit!</item>
0124                         <item>fail</item>
0125                         <item>fork</item>
0126                         <item>format</item>
0127                         <item>getc</item>
0128                         <item>gets</item>
0129                         <item>global_variables</item>
0130                         <item>gsub</item>
0131                         <item>gsub!</item>
0132                         <item>iterator?</item>
0133                         <item>lambda</item>
0134                         <item>load</item>
0135                         <item>local_variables</item>
0136                         <item>loop</item>
0137                         <item>method_missing</item>
0138                         <item>open</item>
0139                         <item>p</item>
0140                         <item>print</item>
0141                         <item>printf</item>
0142                         <item>proc</item>
0143                         <item>putc</item>
0144                         <item>puts</item>
0145                         <item>raise</item>
0146                         <item>rand</item>
0147                         <item>readline</item>
0148                         <item>readlines</item>
0149                         <item>require</item>
0150                         <item>require_relative</item>
0151                         <item>scan</item>
0152                         <item>select</item>
0153                         <item>set_trace_func</item>
0154                         <item>sleep</item>
0155                         <item>split</item>
0156                         <item>sprintf</item>
0157                         <item>srand</item>
0158                         <item>sub</item>
0159                         <item>sub!</item>
0160                         <item>syscall</item>
0161                         <item>system</item>
0162                         <item>test</item>
0163                         <item>throw</item>
0164                         <item>trace_var</item>
0165                         <item>trap</item>
0166                         <item>untrace_var</item>
0167                         <item>warn</item>
0168                 </list>
0169 
0170                 <list name="mixin-methods">
0171                         <item>extend</item>
0172                         <item>include</item>
0173                 </list>
0174 
0175                 <contexts>
0176                         <context name="Normal" attribute="Normal Text" lineEndContext="#stay">
0177                                 <!-- crystal ignores newline after \ -->
0178                                 <LineContinue attribute="Normal Text" context="Line Continue"/>
0179 
0180                                 <!-- "shebang" line -->
0181                                 <!-- TODO: this may be required once crystal interpreter is ready -->
0182                                 <!--<RegExpr attribute="Keyword" String="^#!\/.*" context="#stay" column="0"/>-->
0183 
0184                                 <!-- "def" - "end" blocks -->
0185                                 <!-- check for statement modifiers with regexes -->
0186                                 <Detect2Chars attribute="Operator" char="{" char1="%" context="Find closing macro brace" beginRegion="def block"/>
0187                                 <DetectChar attribute="Operator" char="{" context="Find closing block brace" beginRegion="def block"/>
0188                                 <!-- TODO: why is this needed as a Delimiter? -->
0189                                 <DetectChar attribute="Delimiter" char="}" context="check_div_1" endRegion="def block"/>
0190                                 <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"/>
0191                                 <RegExpr attribute="Keyword" String="(if|unless)\b" context="#stay" beginRegion="def block" firstNonSpace="true"/>
0192                                 <WordDetect attribute="Keyword" String="class" context="no_heredoc" beginRegion="def block"/>
0193                                 <WordDetect attribute="Keyword" String="struct" context="no_heredoc" beginRegion="def block"/>
0194                                 <WordDetect attribute="Keyword" String="module" context="#stay" beginRegion="def block"/>
0195                                 <WordDetect attribute="Keyword" String="begin" context="#stay" beginRegion="def block"/>
0196                                 <WordDetect attribute="Keyword" String="case" context="#stay" beginRegion="def block"/>
0197                                 <WordDetect attribute="Keyword" String="do" context="#stay" beginRegion="def block"/>
0198                                 <WordDetect attribute="Keyword" String="macro" context="#stay" beginRegion="def block"/>
0199                                 <WordDetect attribute="Keyword" String="def" context="Overloaded Operators" beginRegion="def block"/>
0200                                 <WordDetect attribute="Keyword" String="end" context="#stay" endRegion="def block"/>
0201                                 <!-- elsif/else close the current block and start a new one -->
0202                                 <RegExpr attribute="Keyword" String="\b(else|elsif|rescue|ensure)\b" context="#stay" endRegion="def block" beginRegion="def block"/>
0203 
0204                                 <StringDetect attribute="Operator" String="..." context="#stay"/>
0205                                 <Detect2Chars attribute="Operator" char="." char1="." context="#stay"/>
0206 
0207                                 <!-- marks a message being sent, not defined -->
0208                                 <RegExpr attribute="Message" String="\.[_a-z][_a-zA-Z0-9]*(\?|\!|\b)" context="check_div_2"/>
0209 
0210                                 <keyword attribute="Keyword" String="keywords" context="#stay"/>
0211                                 <keyword attribute="Attribute Definition" String="attribute-definitions"  context="check_div_2"/>
0212                                 <keyword attribute="Access Control" String="access-control" context="check_div_2"/>
0213                                 <keyword attribute="Definition" String="definitions"  context="#stay" />
0214                                 <keyword attribute="Pseudo variable" String="pseudo-variables"  context="check_div_1"/>
0215                                 <keyword attribute="Kernel methods" String="kernel-methods" context="check_div_2"/>
0216                                 <keyword attribute="Module mixin methods" String="mixin-methods" context="check_div_2"/>
0217 
0218                                 <!-- TODO: write a rule for $~ and $? -->
0219                                 <RegExpr attribute="Global Constant" String="\b[_A-Z]+[A-Z_0-9]+\b" context="check_div_2"/>
0220                                 <!-- Generally a module or class name like "File", "MyModule_1", .. -->
0221                                 <RegExpr attribute="Constant" String="\b[A-Z]+_*([0-9]|[a-z])[_a-zA-Z0-9]*\b" context="check_div_2"/>
0222 
0223                                 <!-- Numeric values. Note that we have to allow underscores between two digits (thus the creepy regular expressions). -->
0224                                 <!-- TODO: add support for Crystal number literals -->
0225                                 <RegExpr attribute="Hex" String="\b\-?0[xX]([0-9a-fA-F]|_[0-9a-fA-F])+" context="check_div_1"/>
0226                                 <RegExpr attribute="Bin" String="\b\-?0[bB]([01]|_[01])+" context="check_div_1"/>
0227                                 <RegExpr attribute="Octal" String="\b\-?0[1-7]([0-7]|_[0-7])*" context="check_div_1"/>
0228                                 <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"/>
0229                                 <RegExpr attribute="Dec" String="\b\-?[1-9]([0-9]|_[0-9])*\b" context="check_div_1"/>
0230                                 <Int attribute="Dec" context="check_div_1"/>
0231                                 <!-- TODO: what is this? remove if this is not required. -->
0232                                 <HlCChar attribute="Char" context="check_div_1"/>
0233 
0234                                 <!-- recognize the beginning of a HEREDOC
0235                                         This uses new features in Kate 2.3 and later
0236 
0237                                         There is no other chance of keeping heredoc apart from the
0238                                         push operator '<<' than requiring to put space between the operator
0239                                         and the string.
0240                                 -->
0241                                 <RegExpr attribute="Operator" context="find_indented_heredoc" String="\s*&lt;&lt;[-~](?=\w+|[&quot;'`])" beginRegion="HereDocument" />
0242                                 <RegExpr attribute="Operator" context="find_heredoc" String="\s*&lt;&lt;(?=\w+|[&quot;'`])" beginRegion="HereDocument" />
0243 
0244                                 <DetectChar attribute="Operator" char="." context="#stay"/>
0245                                 <Detect2Chars attribute="Operator" char="&amp;" char1="&amp;" context="#stay"/>
0246                                 <Detect2Chars attribute="Operator" char="|" char1="|" context="#stay"/>
0247                                 <!-- \s! is regexp hack -->
0248                                 <RegExpr attribute="Operator" String="\s[\?\:\%]\s|[|&amp;&lt;&gt;\^\+*~\-=]+|\s!|/=\s" context="#stay"/>
0249                                 <Detect2Chars attribute="Operator" char="%" char1="=" context="#stay"/>
0250                                 <Detect2Chars attribute="Operator" char=":" char1=":" context="Member Access"/>
0251 
0252                                 <RegExpr attribute="Symbol" String=":(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?|:\[\]=?" context="check_div_1"/>
0253 
0254                                 <!-- Do not send to "check_div_1" context!:
0255                                      after detecting these rules (": ") there can be a regular expression (see bug: #361875) -->
0256                                 <RegExpr attribute="Symbol" String="(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?: |\[\]=?: " context="#stay"/>
0257 
0258                                 <DetectChar attribute="String" char="&quot;" context="Quoted String"/>
0259                                 <!-- TODO: There are no single-quoted strings in Crystal. Only single-quoted characters. Modify accordingly. -->
0260                                 <DetectChar attribute="Raw String" char="'" context="Apostrophed String"/>
0261                                 <DetectChar attribute="Command" char="`" context="Command String"/>
0262 
0263                                 <!-- TODO: Remove this if not needed -->
0264                                 <Detect2Chars attribute="Normal Text" char="?" char1="#" context="#stay"/>
0265 
0266                                 <DetectChar attribute="Comment" char="#" context="General Comment"/>
0267 
0268                                 <DetectChar attribute="Delimiter" char="["  context="#stay"/>
0269                                 <DetectChar attribute="Delimiter" char="]"  context="check_div_1"/>
0270 
0271                                 <RegExpr attribute="Instance Variable" String="@[a-zA-Z_0-9]+" context="check_div_1"/>
0272                                 <RegExpr attribute="Class Variable" String="@@[a-zA-Z_0-9]+" context="check_div_1"/>
0273 
0274                                 <!-- handle the different regular expression formats -->
0275                                 <DetectChar attribute="Regular Expression" char="/" context="RegEx 1"/>
0276 
0277                                 <!-- recognize the beginning of a general delimited input format -->
0278                                 <!-- this moves to the next context to separate out the exact nature of the GDL input -->
0279                                 <RegExpr attribute="GDL input" context="find_gdl_input" String="\s*[%](?=[QqxwW]?[^\s}])" beginRegion="GdlInput" />
0280 
0281                                 <DetectChar attribute="Normal Text" char=")" context="check_div_1"/>
0282                                 <DetectIdentifier attribute="Normal Text" context="check_div_2"/>
0283 
0284                         </context>
0285 
0286                         <context name="Macro" attribute="Normal Text" lineEndContext="#stay">
0287                                 <!-- TODO: copied Macro context from Normal context. repititions can be removed. pls refactor by including rules. -->
0288                                 <!-- crystal ignores newline after \ -->
0289                                 <LineContinue attribute="Normal Text" context="Line Continue"/>
0290 
0291                                 <!-- "def" - "end" blocks -->
0292                                 <!-- check for statement modifiers with regexes -->
0293                                 <DetectChar attribute="Operator" char="{" context="Find closing block brace" beginRegion="def block"/>
0294                                 <DetectChar attribute="Delimiter" char="}" context="check_div_1" endRegion="def block"/>
0295                                 <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"/>
0296                                 <RegExpr attribute="Keyword" String="(if|unless)\b" context="#stay" beginRegion="def block" firstNonSpace="true"/>
0297                                 <WordDetect attribute="Keyword" String="begin" context="#stay" beginRegion="def block"/>
0298                                 <RegExpr attribute="Keyword" String="\bfor\b(?!.*\bdo\b)" context="#stay" beginRegion="def block"/>
0299                                 <WordDetect attribute="Keyword" String="do" context="#stay" beginRegion="def block"/>
0300                                 <WordDetect attribute="Keyword" String="def" context="Overloaded Operators" beginRegion="def block"/>
0301                                 <WordDetect attribute="Keyword" String="end" context="#stay" endRegion="def block"/>
0302                                 <!-- elsif/else close the current block and start a new one -->
0303                                 <RegExpr attribute="Keyword" String="\b(else|elsif|rescue|ensure)\b" context="#stay" endRegion="def block" beginRegion="def block"/>
0304 
0305                                 <StringDetect attribute="Operator" String="..." context="#stay"/>
0306                                 <Detect2Chars attribute="Operator" char="." char1="." context="#stay"/>
0307 
0308                                 <!-- marks a message (being sent, not defined) -->
0309                                 <RegExpr attribute="Message" String="\.[_a-z][_a-zA-Z0-9]*(\?|\!|\b)" context="check_div_2"/>
0310 
0311                                 <keyword attribute="Keyword" String="keywords" context="#stay"/>
0312                                 <keyword attribute="Attribute Definition" String="attribute-definitions"  context="check_div_2"/>
0313                                 <keyword attribute="Definition" String="definitions"  context="#stay" />
0314                                 <keyword attribute="Pseudo variable" String="pseudo-variables"  context="check_div_1"/>
0315 
0316                                 <RegExpr attribute="Global Constant" String="\b[_A-Z]+[A-Z_0-9]+\b" context="check_div_2"/>
0317                                 <!-- Generally a module or class name like "File", "MyModule_1", .. -->
0318                                 <RegExpr attribute="Constant" String="\b[A-Z]+_*([0-9]|[a-z])[_a-zA-Z0-9]*\b" context="check_div_2"/>
0319 
0320                                 <!-- Numeric values. Note that we have to allow underscores between two digits (thus the creepy regular expressions). -->
0321                                 <RegExpr attribute="Hex" String="\b\-?0[xX]([0-9a-fA-F]|_[0-9a-fA-F])+" context="check_div_1"/>
0322                                 <RegExpr attribute="Bin" String="\b\-?0[bB]([01]|_[01])+" context="check_div_1"/>
0323                                 <RegExpr attribute="Octal" String="\b\-?0[1-7]([0-7]|_[0-7])*" context="check_div_1"/>
0324                                 <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"/>
0325                                 <RegExpr attribute="Dec" String="\b\-?[1-9]([0-9]|_[0-9])*\b" context="check_div_1"/>
0326                                 <Int attribute="Dec" context="check_div_1"/>
0327                                 <HlCChar attribute="Char" context="check_div_1"/>
0328 
0329                                 <!-- recognize the beginning of a HEREDOC
0330                                         This uses new features in Kate 2.3 and later
0331 
0332                                         There is no other chance of keeping heredoc apart from the
0333                                         push operator '<<' than requiring to put space between the operator
0334                                         and the string.
0335                                 -->
0336                                 <RegExpr attribute="Operator" context="find_indented_heredoc" String="\s*&lt;&lt;[-~](?=\w+|[&quot;'`])" beginRegion="HereDocument" />
0337                                 <RegExpr attribute="Operator" context="find_heredoc" String="\s*&lt;&lt;(?=\w+|[&quot;'`])" beginRegion="HereDocument" />
0338 
0339                                 <DetectChar attribute="Operator" char="." context="#stay"/>
0340                                 <Detect2Chars attribute="Operator" char="&amp;" char1="&amp;" context="#stay"/>
0341                                 <Detect2Chars attribute="Operator" char="|" char1="|" context="#stay"/>
0342                                 <!-- \s! is regexp hack -->
0343                                 <RegExpr attribute="Operator" String="\s[\?\:\%]\s|[|&amp;&lt;&gt;\^\+*~\-=]+|\s!|/=\s" context="#stay"/>
0344                                 <Detect2Chars attribute="Operator" char="%" char1="=" context="#stay"/>
0345                                 <Detect2Chars attribute="Operator" char=":" char1=":" context="Member Access"/>
0346 
0347                                 <RegExpr attribute="Symbol" String=":(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?|:\[\]=?" context="check_div_1"/>
0348 
0349                                 <!-- Do not send to "check_div_1" context!:
0350                                      after detecting these rules (": ") there can be a regular expression (see bug: #361875) -->
0351                                 <RegExpr attribute="Symbol" String="(@{1,2}|\$)?[a-zA-Z_][a-zA-Z0-9_]*[=?!]?: |\[\]=?: " context="#stay"/>
0352 
0353                                 <DetectChar attribute="String" char="&quot;" context="Quoted String"/>
0354                                 <!-- TODO: There are no single-quoted strings in Crystal. Only single-quoted characters. Modify accordingly. -->
0355                                 <DetectChar attribute="Raw String" char="'" context="Apostrophed String"/>
0356                                 <DetectChar attribute="Command" char="`" context="Command String"/>
0357 
0358                                 <!-- TODO: Remove this if not needed -->
0359                                 <Detect2Chars attribute="Normal Text" char="?" char1="#" context="#stay"/>
0360 
0361                                 <DetectChar attribute="Comment" char="#" context="General Comment"/>
0362 
0363                                 <DetectChar attribute="Delimiter" char="["  context="#stay"/>
0364                                 <DetectChar attribute="Delimiter" char="]"  context="check_div_1"/>
0365 
0366                                 <!-- handle the different regular expression formats -->
0367                                 <DetectChar attribute="Regular Expression" char="/" context="RegEx 1"/>
0368 
0369                                 <!-- recognize the beginning of a general delimited input format -->
0370                                 <!-- this moves to the next context to separate out the exact nature of the GDL input -->
0371                                 <RegExpr attribute="GDL input" context="find_gdl_input" String="\s*[%](?=[QqxwW]?[^\s}])" beginRegion="GdlInput" />
0372 
0373                                 <DetectChar attribute="Normal Text" char=")" context="check_div_1"/>
0374                                 <DetectIdentifier attribute="Normal Text" context="check_div_2"/>
0375                         </context>
0376 
0377                         <context name="Overloaded Operators" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop" lineEndContext="#pop">
0378                                 <DetectSpaces attribute="Normal Text" context="#stay"/>
0379                                 <DetectChar attribute="Normal Text" char="/" context="#pop"/>
0380                         </context>
0381 
0382                         <!-- In the following contexts, a slash character ('/') is a division operator -->
0383                         <!-- Everywhere else, it's a regular expression delimiter -->
0384 
0385                         <!-- A slash is always a division operator, even if preceeded by whitespace -->
0386                         <context name="check_div_1" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop" lineEndContext="#pop">
0387                                 <Detect2Chars attribute="Operator" char="/" char1="/" context="#pop"/>
0388                                 <DetectSpaces attribute="Normal Text" context="#stay"/>
0389                                 <Detect2Chars attribute="Operator" char="%" char1="}" context="#pop#pop"/>
0390                                 <AnyChar attribute="Operator" String="/%" context="#pop"/>
0391                         </context>
0392 
0393                         <!-- Same as check_div_1, but with double pop to exit the surrounding context -->
0394                         <context name="check_div_1_pop" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop#pop" lineEndContext="#pop#pop">
0395                                 <Detect2Chars attribute="Operator" char="/" char1="/" context="#pop#pop"/>
0396                                 <DetectSpaces attribute="Normal Text" context="#stay"/>
0397                                 <Detect2Chars attribute="Operator" char="%" char1="}" context="#pop#pop#pop#pop"/>
0398                                 <AnyChar attribute="Operator" String="/%" context="#pop#pop"/>
0399                         </context>
0400 
0401                         <!-- A slash is division operator if it's the first character, or if preceeded and followed by whitespace -->
0402                         <context name="check_div_2" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop" lineEndContext="#pop">
0403                                 <Detect2Chars attribute="Operator" char="/" char1="/" context="#pop"/>
0404                                 <AnyChar attribute="Operator" String="/%" context="#pop"/>
0405                                 <DetectSpaces attribute="Normal Text" context="check_div_2_internal"/>
0406                         </context>
0407 
0408                         <!-- Internal context used by check_div_2 -->
0409                         <context name="check_div_2_internal" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop#pop" lineEndContext="#pop#pop">
0410                                 <RegExpr attribute="Operator" String="(//|[/%])(?=\s)" context="#pop#pop"/>
0411                         </context>
0412 
0413                         <!-- Same as check_div_2, but with double pop to exit the surrounding context -->
0414                         <context name="check_div_2_pop" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop#pop" lineEndContext="#pop#pop">
0415                                 <Detect2Chars attribute="Operator" char="/" char1="/" context="#pop#pop"/>
0416                                 <AnyChar attribute="Operator" String="/%" context="#pop#pop"/>
0417                                 <DetectSpaces attribute="Normal Text" context="check_div_2_pop_internal"/>
0418                         </context>
0419 
0420                         <!-- Internal context used by check_div_2_pop -->
0421                         <context name="check_div_2_pop_internal" attribute="Normal Text" fallthrough="true" fallthroughContext="#pop#pop#pop" lineEndContext="#pop#pop#pop">
0422                                 <RegExpr attribute="Operator" String="//(?=\s)" context="#pop#pop#pop"/>
0423                                 <DetectChar attribute="Operator" char="%" context="#pop#pop#pop"/>
0424                                 <RegExpr attribute="Operator" String="/(?=\s)" context="#pop#pop#pop"/>
0425                         </context>
0426 
0427                         <context name="Line Continue" attribute="Normal Text" lineEndContext="#pop">
0428                                 <RegExpr attribute="Keyword" String="(while|until)\b(?!.*\bdo\b)|(if|unless)\b" context="#stay" firstNonSpace="true"/>
0429                                 <IncludeRules context="Normal"/>
0430                         </context>
0431 
0432                         <context name="Find closing macro brace" attribute="Normal Text" lineEndContext="#stay">
0433                                 <Detect2Chars attribute="Operator" char="%" char1="}" context="check_div_1_pop" endRegion="def block"/>
0434                                 <IncludeRules context="Macro"/>
0435                         </context>
0436 
0437                         <context name="Find closing block brace" attribute="Normal Text" lineEndContext="#stay">
0438                                 <DetectChar attribute="Operator" char="}" context="check_div_1_pop" endRegion="def block"/>
0439                                 <IncludeRules context="Normal"/>
0440                         </context>
0441 
0442                         <context name="Quoted String" attribute="String" lineEndContext="#stay">
0443                                 <Detect2Chars attribute="String" char="\" char1="\" context="#stay"/>
0444                                 <Detect2Chars attribute="String" char="\" char1="&quot;" context="#stay"/>
0445                                 <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
0446                                 <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
0447                                 <DetectChar char="&quot;" attribute="String" context="check_div_1_pop"/>
0448                         </context>
0449 
0450                         <context name="Apostrophed String" attribute="Raw String" lineEndContext="#stay">
0451                                 <Detect2Chars attribute="String" char="\" char1="\" context="#stay"/>
0452                                 <Detect2Chars attribute="String" char="\" char1="'" context="#stay"/>
0453                                 <DetectChar char="'" attribute="Raw String" context="check_div_1_pop"/>
0454                         </context>
0455 
0456                         <context name="Command String" attribute="Command" lineEndContext="#stay">
0457                                 <Detect2Chars attribute="String" char="\" char1="\" context="#stay"/>
0458                                 <Detect2Chars attribute="String" char="\" char1="`" context="#stay"/>
0459                                 <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
0460                                 <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
0461                                 <DetectChar char="`" attribute="Command" context="check_div_1_pop"/>
0462                         </context>
0463 
0464                         <context name="RegEx 1" attribute="Regular Expression" lineEndContext="#stay">
0465                                 <Detect2Chars attribute="Regular Expression" char="\" char1="/" context="#stay"/>
0466                                 <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
0467                                 <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
0468                                 <RegExpr attribute="Regular Expression" String="/[uiomxn]*" context="check_div_1_pop"/>
0469                         </context>
0470 
0471                         <!-- Substitutions can be nested -->
0472                         <context name="Subst" attribute="Normal Text" lineEndContext="#stay">
0473                                 <DetectChar attribute="Substitution" char="}" context="#pop"/>
0474                                 <!-- Highlight substitution as code. -->
0475                                 <IncludeRules context="Normal"/>
0476                         </context>
0477 
0478                         <context name="Short Subst" attribute="Substitution" lineEndContext="#pop">
0479                                 <!-- Check for e.g.: "#@var#@@xy" -->
0480                                 <RegExpr attribute="Substitution" String="#@{1,2}" context="#stay"/>
0481                                 <RegExpr attribute="Substitution" String="\w(?!\w)" context="#pop"/>
0482                         </context>
0483 
0484                         <!-- This handles access of nested module classes and class methods -->
0485                         <context name="Member Access" attribute="Member" lineEndContext="#pop">
0486                                 <!-- marks a message (being sent, not defined) -->
0487                                 <RegExpr attribute="Message" String="\.?[_a-z]\w*(\?|\!)?(?=[^\w\d\.\:])" context="check_div_2_pop"/>
0488                                 <RegExpr attribute="Message" String="\.?[_a-z]\w*(\?|\!)?" context="#stay"/>
0489                                 <RegExpr attribute="Constant" String="[A-Z]+_*(\d|[a-z])\w*(?=[^\w\d\.\:])" context="check_div_2_pop"/>
0490                                 <RegExpr attribute="Constant" String="[A-Z]+_*([0-9]|[a-z])\w*" context="#stay"/>
0491                                 <RegExpr attribute="Constant Value" String="[_A-Z][_A-Z0-9]*(?=[^\w\d\.\:])" context="check_div_2_pop"/>
0492                                 <RegExpr attribute="Constant Value" String="[_A-Z][_A-Z0-9]*" context="#stay"/>
0493                                 <Detect2Chars attribute="Operator" char=":" char1=":" context="#stay"/>
0494                                 <DetectChar attribute="Member" char="." context="#stay"/>
0495 
0496                                 <AnyChar attribute="Operator" String="=+-*/%|&amp;[]{}~" context="#pop"/>
0497                                 <DetectChar attribute="Comment" char="#" context="#pop"/>
0498                                 <AnyChar attribute="Normal Text" String="()\" context="#pop"/>
0499                                 <RegExpr attribute="Member" String="\W" context="#pop"/>
0500                         </context>
0501 
0502                         <context name="General Comment" attribute="Comment" lineEndContext="#pop">
0503                                 <DetectSpaces />
0504                                 <IncludeRules context="##Comments" />
0505                         </context>
0506 
0507                         <!-- HEREDOC support
0508                                 The contexts below support both normal and indented heredocs
0509                          -->
0510                         <!-- here we markup the heredoc markers -->
0511                         <context name="find_heredoc" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
0512                                 <RegExpr attribute="Keyword" context="apostrophed_normal_heredoc" String="'(\w+)'" />
0513                                 <RegExpr attribute="Keyword" context="normal_heredoc" String="(?|(\w+)|&quot;(\w+)&quot;|`(\w+)`)" />
0514                         </context>
0515                         <context name="find_indented_heredoc" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
0516                                 <RegExpr attribute="Keyword" context="apostrophed_indented_heredoc" String="'(\w+)'" />
0517                                 <RegExpr attribute="Keyword" context="indented_heredoc" String="(?|(\w+)|&quot;(\w+)&quot;|`(\w+)`)" />
0518                         </context>
0519                         <!-- these are the real heredoc contexts -->
0520                         <context name="indented_heredoc" attribute="Here Document" lineEndContext="#stay" dynamic="true">
0521                                 <RegExpr attribute="Keyword" context="#pop#pop" String="%1$" dynamic="true" endRegion="HereDocument" firstNonSpace="true"/>
0522                                 <IncludeRules context="heredoc_rules" />
0523                         </context>
0524                         <context name="apostrophed_indented_heredoc" attribute="Here Document" lineEndContext="#stay" dynamic="true">
0525                                 <RegExpr attribute="Keyword" context="#pop#pop" String="%1$" dynamic="true" endRegion="HereDocument" firstNonSpace="true"/>
0526                         </context>
0527 
0528                         <context name="normal_heredoc" attribute="Here Document" lineEndContext="#stay" dynamic="true">
0529                                 <RegExpr attribute="Keyword" context="#pop#pop" String="^%1$" dynamic="true" endRegion="HereDocument" column="0"/>
0530                                 <IncludeRules context="heredoc_rules" />
0531                         </context>
0532                         <context name="apostrophed_normal_heredoc" attribute="Here Document" lineEndContext="#stay" dynamic="true">
0533                                 <RegExpr attribute="Keyword" context="#pop#pop" String="^%1$" dynamic="true" endRegion="HereDocument" column="0"/>
0534                         </context>
0535 
0536                         <!-- rules for heredoc types -->
0537                         <context name="heredoc_rules" attribute="Normal Text" lineEndContext="#stay">
0538                                 <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
0539                                 <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
0540                         </context>
0541 
0542                         <!-- avoid highlighting heredoc markers, for example, in singleton class definition (see bug: #358273) -->
0543                         <context name="no_heredoc" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
0544                                 <DetectSpaces />
0545                                 <Detect2Chars attribute="Operator" char="&lt;" char1="&lt;" context="#pop"/>
0546                                 <!-- comments -->
0547                                 <RegExpr attribute="Comment" String="^#\s*BEGIN.*$"  context="#stay" beginRegion="marker" column="0"/>
0548                                 <RegExpr attribute="Comment" String="^#\s*END.*$"  context="#stay" endRegion="marker" column="0"/>
0549                                 <DetectChar attribute="Comment" char="#" context="General Comment"/>
0550                         </context>
0551 
0552                         <!-- General delimited input support
0553                                 The contexts below handle the various gdl formats
0554                          -->
0555                         <context name="find_gdl_input" attribute="Normal Text" lineEndContext="#pop">
0556 
0557                                 <!-- handle token arrays -->
0558                                 <Detect2Chars attribute="GDL input" context="gdl_token_array_1" char="w" char1="(" />
0559                                 <Detect2Chars attribute="GDL input" context="gdl_token_array_2" char="w" char1="{" />
0560                                 <Detect2Chars attribute="GDL input" context="gdl_token_array_3" char="w" char1="[" />
0561                                 <Detect2Chars attribute="GDL input" context="gdl_token_array_4" char="w" char1="&lt;" />
0562                                 <!-- then we handle the 'any char' format -->
0563                                 <RegExpr attribute="GDL input" context="gdl_token_array_5" String="w([^\s\w])" />
0564 
0565                                 <!-- handle token arrays -->
0566                                 <Detect2Chars attribute="GDL input" context="gdl_token_array_1" char="W" char1="(" />
0567                                 <Detect2Chars attribute="GDL input" context="gdl_token_array_2" char="W" char1="{" />
0568                                 <Detect2Chars attribute="GDL input" context="gdl_token_array_3" char="W" char1="[" />
0569                                 <Detect2Chars attribute="GDL input" context="gdl_token_array_4" char="W" char1="&lt;" />
0570                                 <!-- then we handle the 'any char' format -->
0571                                 <RegExpr attribute="GDL input" context="gdl_token_array_5" String="W([^\s\w])" />
0572 
0573                                 <!-- handle apostrophed strings -->
0574                                 <Detect2Chars attribute="GDL input" context="gdl_apostrophed_1" char="q" char1="(" />
0575                                 <Detect2Chars attribute="GDL input" context="gdl_apostrophed_2" char="q" char1="{" />
0576                                 <Detect2Chars attribute="GDL input" context="gdl_apostrophed_3" char="q" char1="[" />
0577                                 <Detect2Chars attribute="GDL input" context="gdl_apostrophed_4" char="q" char1="&lt;" />
0578                                 <!-- then we handle the 'any char' format -->
0579                                 <RegExpr attribute="GDL input" context="gdl_apostrophed_5" String="q([^\s\w])" />
0580 
0581                                 <!-- handle shell commands -->
0582                                 <Detect2Chars attribute="GDL input" context="gdl_shell_command_1" char="x" char1="(" />
0583                                 <Detect2Chars attribute="GDL input" context="gdl_shell_command_2" char="x" char1="{" />
0584                                 <Detect2Chars attribute="GDL input" context="gdl_shell_command_3" char="x" char1="[" />
0585                                 <Detect2Chars attribute="GDL input" context="gdl_shell_command_4" char="x" char1="&lt;" />
0586                                 <!-- then we handle the 'any char' format -->
0587                                 <RegExpr attribute="GDL input" context="gdl_shell_command_5" String="x([^\s\w])" />
0588 
0589                                 <!-- handle regular expressions -->
0590                                 <Detect2Chars attribute="GDL input" context="gdl_regexpr_1" char="r" char1="(" />
0591                                 <Detect2Chars attribute="GDL input" context="gdl_regexpr_2" char="r" char1="{" />
0592                                 <Detect2Chars attribute="GDL input" context="gdl_regexpr_3" char="r" char1="[" />
0593                                 <Detect2Chars attribute="GDL input" context="gdl_regexpr_4" char="r" char1="&lt;" />
0594                                 <!-- then we handle the 'any char' format -->
0595                                 <RegExpr attribute="GDL input" context="gdl_regexpr_5" String="r([^\s\w])" />
0596 
0597                                 <!-- handle double-quoted strings -->
0598                                 <!--
0599                                           be careful to make this the last GDL ruleset, because the rule for
0600                                           the short form %?foo? will otherwise catch any of the other formats
0601                                 -->
0602                                 <Detect2Chars attribute="GDL input" context="gdl_dq_string_1" char="Q" char1="(" />
0603                                 <Detect2Chars attribute="GDL input" context="gdl_dq_string_2" char="Q" char1="{" />
0604                                 <Detect2Chars attribute="GDL input" context="gdl_dq_string_3" char="Q" char1="[" />
0605                                 <Detect2Chars attribute="GDL input" context="gdl_dq_string_4" char="Q" char1="&lt;" />
0606                                 <DetectChar attribute="GDL input" context="gdl_dq_string_1" char="(" />
0607                                 <DetectChar attribute="GDL input" context="gdl_dq_string_2" char="{" />
0608                                 <DetectChar attribute="GDL input" context="gdl_dq_string_3" char="[" />
0609                                 <DetectChar attribute="GDL input" context="gdl_dq_string_4" char="&lt;" />
0610                                 <!-- then we handle the 'any char' format -->
0611                                 <RegExpr attribute="GDL input" context="gdl_dq_string_5" String="Q?([^\s\w])" />
0612 
0613                         </context>
0614                         <!-- double-quoted string specific contexts follow -->
0615                         <context name="gdl_dq_string_1" attribute="String" lineEndContext="#stay" >
0616                                 <IncludeRules context="dq_string_rules" />
0617                                 <Detect2Chars attribute="String" char="\" char1=")" context="#stay"/>
0618                                 <DetectChar attribute="String" context="gdl_dq_string_1_nested" char="(" />
0619                                 <DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" />
0620                         </context>
0621                         <context name="gdl_dq_string_1_nested" attribute="String" lineEndContext="#stay" >
0622                                 <IncludeRules context="dq_string_rules" />
0623                                 <DetectChar attribute="String" context="gdl_dq_string_1_nested" char="(" />
0624                                 <DetectChar attribute="String" context="#pop" char=")" />
0625                         </context>
0626                         <!-- note that here substitution should win over nesting -->
0627                         <context name="gdl_dq_string_2" attribute="String" lineEndContext="#stay" >
0628                                 <IncludeRules context="dq_string_rules" />
0629                                 <Detect2Chars attribute="String" char="\" char1="}" context="#stay"/>
0630                                 <DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" />
0631                                 <DetectChar attribute="String" context="gdl_dq_string_2_nested" char="{" />
0632                         </context>
0633                         <context name="gdl_dq_string_2_nested" attribute="String" lineEndContext="#stay" >
0634                                 <DetectChar attribute="String" context="gdl_dq_string_2_nested" char="{" />
0635                                 <DetectChar attribute="String" context="#pop" char="}" />
0636                                 <IncludeRules context="dq_string_rules" />
0637                         </context>
0638 
0639                         <context name="gdl_dq_string_3" attribute="String" lineEndContext="#stay" >
0640                                 <IncludeRules context="dq_string_rules" />
0641                                 <Detect2Chars attribute="String" char="\" char1="]" context="#stay"/>
0642                                 <DetectChar attribute="String" context="gdl_dq_string_3_nested" char="[" />
0643                                 <DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" />
0644                         </context>
0645                         <context name="gdl_dq_string_3_nested" attribute="String" lineEndContext="#stay" >
0646                                 <DetectChar attribute="String" context="gdl_dq_string_3_nested" char="[" />
0647                                 <DetectChar attribute="String" context="#pop" char="]" />
0648                                 <IncludeRules context="dq_string_rules" />
0649                         </context>
0650 
0651                         <context name="gdl_dq_string_4" attribute="String" lineEndContext="#stay" >
0652                                 <IncludeRules context="dq_string_rules" />
0653                                 <Detect2Chars attribute="String" char="\" char1="&gt;" context="#stay"/>
0654                                 <DetectChar attribute="String" context="gdl_dq_string_4_nested" char="&lt;" />
0655                                 <DetectChar attribute="GDL input" context="#pop#pop" char="&gt;" endRegion="GdlInput" />
0656                         </context>
0657                         <context name="gdl_dq_string_4_nested" attribute="String" lineEndContext="#stay" >
0658                                 <DetectChar attribute="String" context="gdl_dq_string_4_nested" char="&lt;" />
0659                                 <DetectChar attribute="String" context="#pop" char="&gt;" />
0660                                 <IncludeRules context="dq_string_rules" />
0661                         </context>
0662 
0663                         <!-- this format doesn't allow nesting. it is terminated by the next occurrence of the
0664                                 delimiter character
0665                          -->
0666                         <context name="gdl_dq_string_5" attribute="String" lineEndContext="#stay" dynamic="true">
0667                                 <IncludeRules context="dq_string_rules" />
0668                                 <StringDetect attribute="String" String="\%1" context="#stay" dynamic="true" />
0669                                 <RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" />
0670                         </context>
0671                         <!-- rules to be included in all dq_string contexts -->
0672                         <context name="dq_string_rules" attribute="String" lineEndContext="#stay" >
0673                                 <Detect2Chars attribute="String" char="\" char1="\" context="#stay"/>
0674                                 <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
0675                                 <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
0676                         </context>
0677 
0678                         <!-- token array specific contexts -->
0679 
0680                         <context name="gdl_token_array_1" attribute="String" lineEndContext="#stay" >
0681                                 <IncludeRules context="token_array_rules" />
0682                                 <Detect2Chars attribute="String" char="\" char1=")" context="#stay"/>
0683                                 <DetectChar attribute="String" context="gdl_token_array_1_nested" char="(" />
0684                                 <DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" />
0685                         </context>
0686                         <context name="gdl_token_array_1_nested" attribute="String" lineEndContext="#stay" >
0687                                 <IncludeRules context="token_array_rules" />
0688                                 <DetectChar attribute="String" context="gdl_token_array_1_nested" char="(" />
0689                                 <DetectChar attribute="String" context="#pop" char=")" />
0690                         </context>
0691 
0692                         <context name="gdl_token_array_2" attribute="String" lineEndContext="#stay" >
0693                                 <IncludeRules context="token_array_rules" />
0694                                 <Detect2Chars attribute="String" char="\" char1="}" context="#stay"/>
0695                                 <DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" />
0696                                 <DetectChar attribute="String" context="gdl_token_array_2_nested" char="{" />
0697                         </context>
0698                         <context name="gdl_token_array_2_nested" attribute="String" lineEndContext="#stay" >
0699                                 <IncludeRules context="token_array_rules" />
0700                                 <DetectChar attribute="String" context="gdl_token_array_2_nested" char="{" />
0701                                 <DetectChar attribute="String" context="#pop" char="}" />
0702                         </context>
0703 
0704                         <context name="gdl_token_array_3" attribute="String" lineEndContext="#stay" >
0705                                 <IncludeRules context="token_array_rules" />
0706                                 <Detect2Chars attribute="String" char="\" char1="]" context="#stay"/>
0707                                 <DetectChar attribute="String" context="gdl_token_array_3_nested" char="[" />
0708                                 <DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" />
0709                         </context>
0710                         <context name="gdl_token_array_3_nested" attribute="String" lineEndContext="#stay" >
0711                                 <IncludeRules context="token_array_rules" />
0712                                 <DetectChar attribute="String" context="gdl_token_array_3_nested" char="[" />
0713                                 <DetectChar attribute="String" context="#pop" char="]" />
0714                         </context>
0715 
0716                         <context name="gdl_token_array_4" attribute="String" lineEndContext="#stay" >
0717                                 <IncludeRules context="token_array_rules" />
0718                                 <Detect2Chars attribute="String" char="\" char1="&gt;" context="#stay"/>
0719                                 <DetectChar attribute="String" context="gdl_token_array_4_nested" char="&lt;" />
0720                                 <DetectChar attribute="GDL input" context="#pop#pop" char="&gt;" endRegion="GdlInput" />
0721                         </context>
0722                         <context name="gdl_token_array_4_nested" attribute="String" lineEndContext="#stay" >
0723                                 <IncludeRules context="token_array_rules" />
0724                                 <DetectChar attribute="String" context="gdl_token_array_4_nested" char="&lt;" />
0725                                 <DetectChar attribute="String" context="#pop" char="&gt;" />
0726                         </context>
0727 
0728                         <!-- this format doesn't allow nesting. it is terminated by the next occurrence of the
0729                                 delimiter character
0730                          -->
0731                         <context name="gdl_token_array_5" attribute="String" lineEndContext="#stay" dynamic="true">
0732                                 <IncludeRules context="token_array_rules" />
0733                                 <StringDetect attribute="String" String="\%1" context="#stay" dynamic="true"/>
0734                                 <RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" />
0735                         </context>
0736 
0737                         <!-- rules to be included in all token_array contexts -->
0738                         <context name="token_array_rules" attribute="String" lineEndContext="#stay" >
0739                                 <Detect2Chars attribute="String" char="\" char1="\" context="#stay"/>
0740                         </context>
0741 
0742                         <!-- apostrophed string specific contexts -->
0743 
0744                         <context name="gdl_apostrophed_1" attribute="Raw String" lineEndContext="#stay" >
0745                                 <IncludeRules context="apostrophed_rules" />
0746                                 <Detect2Chars attribute="Raw String" char="\" char1=")" context="#stay"/>
0747                                 <DetectChar attribute="Raw String" context="gdl_apostrophed_1_nested" char="(" />
0748                                 <DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" />
0749                         </context>
0750                         <context name="gdl_apostrophed_1_nested" attribute="Raw String" lineEndContext="#stay" >
0751                                 <IncludeRules context="apostrophed_rules" />
0752                                 <DetectChar attribute="Raw String" context="gdl_apostrophed_1_nested" char="(" />
0753                                 <DetectChar attribute="Raw String" context="#pop" char=")" />
0754                         </context>
0755 
0756                         <context name="gdl_apostrophed_2" attribute="Raw String" lineEndContext="#stay" >
0757                                 <IncludeRules context="apostrophed_rules" />
0758                                 <Detect2Chars attribute="Raw String" char="\" char1="}" context="#stay"/>
0759                                 <DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" />
0760                                 <DetectChar attribute="Raw String" context="gdl_apostrophed_2_nested" char="{" />
0761                         </context>
0762                         <context name="gdl_apostrophed_2_nested" attribute="Raw String" lineEndContext="#stay" >
0763                                 <IncludeRules context="apostrophed_rules" />
0764                                 <DetectChar attribute="Raw String" context="gdl_apostrophed_2_nested" char="{" />
0765                                 <DetectChar attribute="Raw String" context="#pop" char="}" />
0766                         </context>
0767 
0768                         <context name="gdl_apostrophed_3" attribute="Raw String" lineEndContext="#stay" >
0769                                 <IncludeRules context="apostrophed_rules" />
0770                                 <Detect2Chars attribute="Raw String" char="\" char1="]" context="#stay"/>
0771                                 <DetectChar attribute="Raw String" context="gdl_apostrophed_3_nested" char="[" />
0772                                 <DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" />
0773                         </context>
0774                         <context name="gdl_apostrophed_3_nested" attribute="Raw String" lineEndContext="#stay" >
0775                                 <IncludeRules context="apostrophed_rules" />
0776                                 <DetectChar attribute="Raw String" context="gdl_apostrophed_3_nested" char="[" />
0777                                 <DetectChar attribute="Raw String" context="#pop" char="]" />
0778                         </context>
0779 
0780                         <context name="gdl_apostrophed_4" attribute="Raw String" lineEndContext="#stay" >
0781                                 <IncludeRules context="apostrophed_rules" />
0782                                 <Detect2Chars attribute="Raw String" char="\" char1="&gt;" context="#stay"/>
0783                                 <DetectChar attribute="Raw String" context="gdl_apostrophed_4_nested" char="&lt;" />
0784                                 <DetectChar attribute="GDL input" context="#pop#pop" char="&gt;" endRegion="GdlInput" />
0785                         </context>
0786                         <context name="gdl_apostrophed_4_nested" attribute="Raw String" lineEndContext="#stay" >
0787                                 <IncludeRules context="apostrophed_rules" />
0788                                 <DetectChar attribute="Raw String" context="gdl_apostrophed_4_nested" char="&lt;" />
0789                                 <DetectChar attribute="Raw String" context="#pop" char="&gt;" />
0790                         </context>
0791 
0792                         <!-- this format doesn't allow nesting. it is terminated by the next occurrence of the
0793                                 delimiter character
0794                          -->
0795                         <context name="gdl_apostrophed_5" attribute="Raw String" lineEndContext="#stay" dynamic="true">
0796                                 <IncludeRules context="apostrophed_rules" />
0797                                 <StringDetect attribute="Raw String" String="\%1" context="#stay" dynamic="true"/>
0798                                 <RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" />
0799                         </context>
0800 
0801                         <!-- rules to be included in all apostrophed contexts -->
0802                         <context name="apostrophed_rules" attribute="Raw String" lineEndContext="#stay" >
0803                                 <Detect2Chars attribute="Raw String" char="\" char1="\" context="#stay"/>
0804                         </context>
0805 
0806                         <!-- shell command specific contexts -->
0807 
0808                         <context name="gdl_shell_command_1" attribute="Command" lineEndContext="#stay" >
0809                                 <IncludeRules context="shell_command_rules" />
0810                                 <Detect2Chars attribute="Command" char="\" char1=")" context="#stay"/>
0811                                 <DetectChar attribute="Command" context="gdl_shell_command_1_nested" char="(" />
0812                                 <DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" />
0813                         </context>
0814                         <context name="gdl_shell_command_1_nested" attribute="Command" lineEndContext="#stay" >
0815                                 <IncludeRules context="shell_command_rules" />
0816                                 <DetectChar attribute="Command" context="gdl_shell_command_1_nested" char="(" />
0817                                 <DetectChar attribute="Command" context="#pop" char=")" />
0818                         </context>
0819 
0820                         <context name="gdl_shell_command_2" attribute="Command" lineEndContext="#stay" >
0821                                 <IncludeRules context="shell_command_rules" />
0822                                 <Detect2Chars attribute="Command" char="\" char1="}" context="#stay"/>
0823                                 <DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" />
0824                                 <DetectChar attribute="Command" context="gdl_shell_command_2_nested" char="{" />
0825                         </context>
0826                         <context name="gdl_shell_command_2_nested" attribute="Command" lineEndContext="#stay" >
0827                                 <IncludeRules context="shell_command_rules" />
0828                                 <DetectChar attribute="Command" context="gdl_shell_command_2_nested" char="{" />
0829                                 <DetectChar attribute="Command" context="#pop" char="}" />
0830                         </context>
0831 
0832                         <context name="gdl_shell_command_3" attribute="Command" lineEndContext="#stay" >
0833                                 <IncludeRules context="shell_command_rules" />
0834                                 <Detect2Chars attribute="Command" char="\" char1="]" context="#stay"/>
0835                                 <DetectChar attribute="Command" context="gdl_shell_command_3_nested" char="[" />
0836                                 <DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" />
0837                         </context>
0838                         <context name="gdl_shell_command_3_nested" attribute="Command" lineEndContext="#stay" >
0839                                 <IncludeRules context="shell_command_rules" />
0840                                 <DetectChar attribute="Command" context="gdl_shell_command_3_nested" char="[" />
0841                                 <DetectChar attribute="Command" context="#pop" char="]" />
0842                         </context>
0843 
0844                         <context name="gdl_shell_command_4" attribute="Command" lineEndContext="#stay" >
0845                                 <IncludeRules context="shell_command_rules" />
0846                                 <Detect2Chars attribute="Command" char="\" char1="&gt;" context="#stay"/>
0847                                 <DetectChar attribute="Command" context="gdl_shell_command_4_nested" char="&lt;" />
0848                                 <DetectChar attribute="GDL input" context="#pop#pop" char="&gt;" endRegion="GdlInput" />
0849                         </context>
0850                         <context name="gdl_shell_command_4_nested" attribute="Command" lineEndContext="#stay" >
0851                                 <IncludeRules context="shell_command_rules" />
0852                                 <DetectChar attribute="Command" context="gdl_shell_command_4_nested" char="&lt;" />
0853                                 <DetectChar attribute="Command" context="#pop" char="&gt;" />
0854                         </context>
0855 
0856                         <!-- this format doesn't allow nesting. it is terminated by the next occurrence of the
0857                                 delimiter character
0858                          -->
0859                         <context name="gdl_shell_command_5" attribute="Command" lineEndContext="#stay" dynamic="true">
0860                                 <IncludeRules context="shell_command_rules" />
0861                                 <StringDetect attribute="Command" String="\%1" context="#stay" dynamic="true" />
0862                                 <RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" />
0863                         </context>
0864 
0865                         <!-- rules to be included in all shell_command contexts -->
0866                         <context name="shell_command_rules" attribute="Command" lineEndContext="#stay" >
0867                                 <Detect2Chars attribute="Command" char="\" char1="\" context="#stay"/>
0868                                 <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
0869                                 <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
0870                         </context>
0871 
0872                         <!-- regular expression specific contexts -->
0873 
0874                         <context name="gdl_regexpr_1" attribute="Regular Expression" lineEndContext="#stay" >
0875                                 <IncludeRules context="regexpr_rules" />
0876                                 <Detect2Chars attribute="Regular Expression" char="\" char1=")" context="#stay"/>
0877                                 <DetectChar attribute="Regular Expression" context="gdl_regexpr_1_nested" char="(" />
0878                                 <RegExpr attribute="GDL input" context="#pop#pop" String="\)[uiomxn]*" endRegion="GdlInput" />
0879                         </context>
0880                         <context name="gdl_regexpr_1_nested" attribute="Regular Expression" lineEndContext="#stay" >
0881                                 <IncludeRules context="regexpr_rules" />
0882                                 <DetectChar attribute="Regular Expression" context="gdl_regexpr_1_nested" char="(" />
0883                                 <DetectChar attribute="Regular Expression" context="#pop" char=")" />
0884                         </context>
0885 
0886                         <context name="gdl_regexpr_2" attribute="Regular Expression" lineEndContext="#stay" >
0887                                 <IncludeRules context="regexpr_rules" />
0888                                 <Detect2Chars attribute="Regular Expression" char="\" char1="}" context="#stay"/>
0889                                 <RegExpr attribute="GDL input" context="#pop#pop" String="\}[uiomxn]*" endRegion="GdlInput" />
0890                                 <DetectChar attribute="Regular Expression" context="gdl_regexpr_2_nested" char="{" />
0891                         </context>
0892                         <context name="gdl_regexpr_2_nested" attribute="Regular Expression" lineEndContext="#stay" >
0893                                 <IncludeRules context="regexpr_rules" />
0894                                 <DetectChar attribute="Regular Expression" context="gdl_regexpr_2_nested" char="{" />
0895                                 <DetectChar attribute="Regular Expression" context="#pop" char="}" />
0896                         </context>
0897 
0898                         <context name="gdl_regexpr_3" attribute="Regular Expression" lineEndContext="#stay" >
0899                                 <IncludeRules context="regexpr_rules" />
0900                                 <Detect2Chars attribute="Regular Expression" char="\" char1="]" context="#stay"/>
0901                                 <DetectChar attribute="Regular Expression" context="gdl_regexpr_3_nested" char="[" />
0902                                 <RegExpr attribute="GDL input" context="#pop#pop" String="\][uiomxn]*" endRegion="GdlInput" />
0903                         </context>
0904                         <context name="gdl_regexpr_3_nested" attribute="Regular Expression" lineEndContext="#stay" >
0905                                 <IncludeRules context="regexpr_rules" />
0906                                 <DetectChar attribute="Regular Expression" context="gdl_regexpr_3_nested" char="[" />
0907                                 <DetectChar attribute="Regular Expression" context="#pop" char="]" />
0908                         </context>
0909 
0910                         <context name="gdl_regexpr_4" attribute="Regular Expression" lineEndContext="#stay" >
0911                                 <IncludeRules context="regexpr_rules" />
0912                                 <Detect2Chars attribute="Regular Expression" char="\" char1="&gt;" context="#stay"/>
0913                                 <DetectChar attribute="Regular Expression" context="gdl_regexpr_4_nested" char="&lt;" />
0914                                 <RegExpr attribute="GDL input" context="#pop#pop" String="&gt;[uiomxn]*" endRegion="GdlInput" />
0915                         </context>
0916                         <context name="gdl_regexpr_4_nested" attribute="Regular Expression" lineEndContext="#stay" >
0917                                 <IncludeRules context="regexpr_rules" />
0918                                 <DetectChar attribute="Regular Expression" context="gdl_regexpr_4_nested" char="&lt;" />
0919                                 <DetectChar attribute="Regular Expression" context="#pop" char="&gt;" />
0920                         </context>
0921 
0922                         <!-- this format doesn't allow nesting. it is terminated by the next occurrence of the
0923                                 delimiter character
0924                          -->
0925                         <context name="gdl_regexpr_5" attribute="Regular Expression" lineEndContext="#stay" dynamic="true">
0926                                 <IncludeRules context="regexpr_rules" />
0927                                 <StringDetect attribute="Regular Expression" String="\%1" context="#stay" dynamic="true" />
0928                                 <RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1[uiomxn]*" dynamic="true" endRegion="GdlInput" />
0929                         </context>
0930 
0931                         <!-- rules to be included in all regexpr contexts -->
0932                         <context name="regexpr_rules" attribute="Regular Expression" lineEndContext="#stay" >
0933                                 <Detect2Chars attribute="Regular Expression" char="\" char1="\" context="#stay"/>
0934                                 <RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
0935                                 <Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
0936                         </context>
0937 
0938                         <!-- END of General delimited input support -->
0939 
0940                 </contexts>
0941 
0942                 <itemDatas>
0943                         <itemData name="Normal Text" defStyleNum="dsNormal"/>
0944 
0945                         <itemData name="Keyword" defStyleNum="dsControlFlow"/>
0946                         <itemData name="Attribute Definition" defStyleNum="dsOthers"/>
0947                         <itemData name="Access Control" defStyleNum="dsAttribute" bold="1"/> <!-- #0000FF -->
0948                         <itemData name="Definition" defStyleNum="dsKeyword"/>
0949                         <itemData name="Pseudo variable" defStyleNum="dsDecVal"/>
0950 
0951                         <itemData name="Dec" defStyleNum="dsDecVal"/>
0952                         <itemData name="Float" defStyleNum="dsFloat"/>
0953                         <itemData name="Char" defStyleNum="dsChar"/>
0954                         <itemData name="Octal" defStyleNum="dsBaseN"/>
0955                         <itemData name="Hex" defStyleNum="dsBaseN"/>
0956                         <itemData name="Bin" defStyleNum="dsBaseN"/>
0957 
0958                         <itemData name="Symbol" defStyleNum="dsWarning" bold="0" underline="0"/> <!-- #D40000 -->
0959                         <itemData name="String" defStyleNum="dsString"/>
0960                         <itemData name="Raw String" defStyleNum="dsVerbatimString" /> <!-- #DD4A4A -->
0961                         <itemData name="Command" defStyleNum="dsInformation"/> <!-- #AA3000 -->
0962                         <itemData name="Message" defStyleNum="dsAttribute" bold="0"/> <!-- #4000A7 -->
0963                         <itemData name="Regular Expression" defStyleNum="dsSpecialString"/> <!-- #4A5704 -->
0964                         <itemData name="Substitution"   defStyleNum="dsSpecialChar"/>
0965                         <!-- short for 'general delimited input' -->
0966                         <itemData name="GDL input" defStyleNum="dsOthers" />
0967 
0968                         <itemData name="Global Constant" defStyleNum="dsConstant" bold="1"/> <!-- #bb1188 -->
0969                         <itemData name="Constant" defStyleNum="dsDataType"/>
0970                         <itemData name="Constant Value" defStyleNum="dsConstant" bold="0"/> <!-- #bb1188 -->
0971                         <itemData name="Kernel methods" defStyleNum="dsFunction" bold="1"/> <!-- #CC0E86 -->
0972                         <itemData name="Module mixin methods" defStyleNum="dsFunction" bold="1"/> <!-- #CC0E86 -->
0973                         <itemData name="Member" defStyleNum="dsNormal"/>
0974                         <itemData name="Instance Variable" defStyleNum="dsOthers"/>
0975                         <itemData name="Class Variable" defStyleNum="dsOthers"/>
0976 
0977                         <itemData name="Comment" defStyleNum="dsComment"/>
0978 
0979                         <itemData name="Here Document" defStyleNum="dsDocumentation"/>
0980 
0981                         <itemData name="Delimiter" defStyleNum="dsKeyword"/> <!-- #FF9FEC -->
0982                         <itemData name="Operator" defStyleNum="dsKeyword"/> <!-- #FF9FEC -->
0983                 </itemDatas>
0984         </highlighting>
0985         <general>
0986                 <comments>
0987                         <comment name="singleLine" start="#" position="afterwhitespace"/>
0988                 </comments>
0989                 <keywords casesensitive="1" weakDeliminator="!?"/>
0990         </general>
0991 </language>
0992 
0993 <!-- kate: replace-tabs off; -->