1. <lexer>
    
  2.   <config>
    
  3.     <name>Batchfile</name>
    
  4.     <alias>bat</alias>
    
  5.     <alias>batch</alias>
    
  6.     <alias>dosbatch</alias>
    
  7.     <alias>winbatch</alias>
    
  8.     <filename>*.bat</filename>
    
  9.     <filename>*.cmd</filename>
    
  10.     <mime_type>application/x-dos-batch</mime_type>
    
  11.     <case_insensitive>true</case_insensitive>
    
  12.   </config>
    
  13.   <rules>
    
  14.     <state name="arithmetic">
    
  15.       <rule pattern="0[0-7]+">
    
  16.         <token type="LiteralNumberOct"/>
    
  17.       </rule>
    
  18.       <rule pattern="0x[\da-f]+">
    
  19.         <token type="LiteralNumberHex"/>
    
  20.       </rule>
    
  21.       <rule pattern="\d+">
    
  22.         <token type="LiteralNumberInteger"/>
    
  23.       </rule>
    
  24.       <rule pattern="[(),]+">
    
  25.         <token type="Punctuation"/>
    
  26.       </rule>
    
  27.       <rule pattern="([=+\-*/!~]|%|\^\^)+">
    
  28.         <token type="Operator"/>
    
  29.       </rule>
    
  30.       <rule pattern="((?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(\^[\n\x1a]?)?[^()=+\-*/!~%^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0]|\^[\n\x1a\t\v\f\r ,;=\xa0]?[\w\W])+">
    
  31.         <usingself state="variable"/>
    
  32.       </rule>
    
  33.       <rule pattern="(?=[\x00|&amp;])">
    
  34.         <token type="Text"/>
    
  35.         <pop depth="1"/>
    
  36.       </rule>
    
  37.       <rule>
    
  38.         <include state="follow"/>
    
  39.       </rule>
    
  40.     </state>
    
  41.     <state name="else?">
    
  42.       <rule pattern="(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)">
    
  43.         <usingself state="text"/>
    
  44.       </rule>
    
  45.       <rule pattern="else(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])">
    
  46.         <token type="Keyword"/>
    
  47.         <pop depth="1"/>
    
  48.       </rule>
    
  49.       <rule>
    
  50.         <pop depth="1"/>
    
  51.       </rule>
    
  52.     </state>
    
  53.     <state name="sqstring">
    
  54.       <rule>
    
  55.         <include state="variable-or-escape"/>
    
  56.       </rule>
    
  57.       <rule pattern="[^%]+|%">
    
  58.         <token type="LiteralStringSingle"/>
    
  59.       </rule>
    
  60.     </state>
    
  61.     <state name="root">
    
  62.       <rule pattern="\)((?=\()|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))(?:(?:[^\n\x1a^]|\^[\n\x1a]?[\w\W])*)">
    
  63.         <token type="CommentSingle"/>
    
  64.       </rule>
    
  65.       <rule pattern="(?=((?:(?&lt;=^[^:])|^[^:]?)[\t\v\f\r ,;=\xa0]*)(:))">
    
  66.         <token type="Text"/>
    
  67.         <push state="follow"/>
    
  68.       </rule>
    
  69.       <rule pattern="(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)">
    
  70.         <usingself state="text"/>
    
  71.       </rule>
    
  72.       <rule>
    
  73.         <include state="redirect"/>
    
  74.       </rule>
    
  75.       <rule pattern="[\n\x1a]+">
    
  76.         <token type="Text"/>
    
  77.       </rule>
    
  78.       <rule pattern="\(">
    
  79.         <token type="Punctuation"/>
    
  80.         <push state="root/compound"/>
    
  81.       </rule>
    
  82.       <rule pattern="@+">
    
  83.         <token type="Punctuation"/>
    
  84.       </rule>
    
  85.       <rule pattern="((?:for|if|rem)(?:(?=(?:\^[\n\x1a]?)?/)|(?:(?!\^)|(?&lt;=m))(?:(?=\()|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0])+)?(?:\^[\n\x1a]?)?/(?:\^[\n\x1a]?)?\?)">
    
  86.         <bygroups>
    
  87.           <token type="Keyword"/>
    
  88.           <usingself state="text"/>
    
  89.         </bygroups>
    
  90.         <push state="follow"/>
    
  91.       </rule>
    
  92.       <rule pattern="(goto(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(]))((?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[^&#34;%\n\x1a&amp;&lt;&gt;|])*(?:\^[\n\x1a]?)?/(?:\^[\n\x1a]?)?\?(?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[^&#34;%\n\x1a&amp;&lt;&gt;|])*)">
    
  93.         <bygroups>
    
  94.           <token type="Keyword"/>
    
  95.           <usingself state="text"/>
    
  96.         </bygroups>
    
  97.         <push state="follow"/>
    
  98.       </rule>
    
  99.       <rule pattern="(setlocal|endlocal|prompt|verify|rename|mklink|rmdir|shift|start|color|dpath|title|chdir|erase|pushd|ftype|break|pause|mkdir|assoc|date|path|time|popd|keys|exit|type|copy|echo|move|dir|del|ren|ver|cls|vol|rd|md|cd)(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(])">
    
  100.         <token type="Keyword"/>
    
  101.         <push state="follow"/>
    
  102.       </rule>
    
  103.       <rule pattern="(call)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)(:)">
    
  104.         <bygroups>
    
  105.           <token type="Keyword"/>
    
  106.           <usingself state="text"/>
    
  107.           <token type="Punctuation"/>
    
  108.         </bygroups>
    
  109.         <push state="call"/>
    
  110.       </rule>
    
  111.       <rule pattern="call(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(])">
    
  112.         <token type="Keyword"/>
    
  113.       </rule>
    
  114.       <rule pattern="(for(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(/f(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))">
    
  115.         <bygroups>
    
  116.           <token type="Keyword"/>
    
  117.           <usingself state="text"/>
    
  118.           <token type="Keyword"/>
    
  119.         </bygroups>
    
  120.         <push state="for/f" state="for"/>
    
  121.       </rule>
    
  122.       <rule pattern="(for(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(/l(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))">
    
  123.         <bygroups>
    
  124.           <token type="Keyword"/>
    
  125.           <usingself state="text"/>
    
  126.           <token type="Keyword"/>
    
  127.         </bygroups>
    
  128.         <push state="for/l" state="for"/>
    
  129.       </rule>
    
  130.       <rule pattern="for(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])(?!\^)">
    
  131.         <token type="Keyword"/>
    
  132.         <push state="for2" state="for"/>
    
  133.       </rule>
    
  134.       <rule pattern="(goto(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(]))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)(:?)">
    
  135.         <bygroups>
    
  136.           <token type="Keyword"/>
    
  137.           <usingself state="text"/>
    
  138.           <token type="Punctuation"/>
    
  139.         </bygroups>
    
  140.         <push state="label"/>
    
  141.       </rule>
    
  142.       <rule pattern="(if(?:(?=\()|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)((?:/i(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))?)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)((?:not(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))?)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)">
    
  143.         <bygroups>
    
  144.           <token type="Keyword"/>
    
  145.           <usingself state="text"/>
    
  146.           <token type="Keyword"/>
    
  147.           <usingself state="text"/>
    
  148.           <token type="Keyword"/>
    
  149.           <usingself state="text"/>
    
  150.         </bygroups>
    
  151.         <push state="(?" state="if"/>
    
  152.       </rule>
    
  153.       <rule pattern="rem(((?=\()|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:[&amp;&lt;&gt;|]+|(?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0])+))+)?.*|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(])(?:(?:[^\n\x1a^]|\^[\n\x1a]?[\w\W])*))">
    
  154.         <token type="CommentSingle"/>
    
  155.         <push state="follow"/>
    
  156.       </rule>
    
  157.       <rule pattern="(set(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(]))((?:(?:\^[\n\x1a]?)?[^\S\n])*)(/a)">
    
  158.         <bygroups>
    
  159.           <token type="Keyword"/>
    
  160.           <usingself state="text"/>
    
  161.           <token type="Keyword"/>
    
  162.         </bygroups>
    
  163.         <push state="arithmetic"/>
    
  164.       </rule>
    
  165.       <rule pattern="(set(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(]))((?:(?:\^[\n\x1a]?)?[^\S\n])*)((?:/p)?)((?:(?:\^[\n\x1a]?)?[^\S\n])*)((?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|^=]|\^[\n\x1a]?[^&#34;=])+)?)((?:(?:\^[\n\x1a]?)?=)?)">
    
  166.         <bygroups>
    
  167.           <token type="Keyword"/>
    
  168.           <usingself state="text"/>
    
  169.           <token type="Keyword"/>
    
  170.           <usingself state="text"/>
    
  171.           <usingself state="variable"/>
    
  172.           <token type="Punctuation"/>
    
  173.         </bygroups>
    
  174.         <push state="follow"/>
    
  175.       </rule>
    
  176.       <rule>
    
  177.         <push state="follow"/>
    
  178.       </rule>
    
  179.     </state>
    
  180.     <state name="follow">
    
  181.       <rule pattern="((?:(?&lt;=^[^:])|^[^:]?)[\t\v\f\r ,;=\xa0]*)(:)([\t\v\f\r ,;=\xa0]*)((?:(?:[^\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0+:^]|\^[\n\x1a]?[\w\W])*))(.*)">
    
  182.         <bygroups>
    
  183.           <token type="Text"/>
    
  184.           <token type="Punctuation"/>
    
  185.           <token type="Text"/>
    
  186.           <token type="NameLabel"/>
    
  187.           <token type="CommentSingle"/>
    
  188.         </bygroups>
    
  189.       </rule>
    
  190.       <rule>
    
  191.         <include state="redirect"/>
    
  192.       </rule>
    
  193.       <rule pattern="(?=[\n\x1a])">
    
  194.         <token type="Text"/>
    
  195.         <pop depth="1"/>
    
  196.       </rule>
    
  197.       <rule pattern="\|\|?|&amp;&amp;?">
    
  198.         <token type="Punctuation"/>
    
  199.         <pop depth="1"/>
    
  200.       </rule>
    
  201.       <rule>
    
  202.         <include state="text"/>
    
  203.       </rule>
    
  204.     </state>
    
  205.     <state name="bqstring">
    
  206.       <rule>
    
  207.         <include state="variable-or-escape"/>
    
  208.       </rule>
    
  209.       <rule pattern="[^%]+|%">
    
  210.         <token type="LiteralStringBacktick"/>
    
  211.       </rule>
    
  212.     </state>
    
  213.     <state name="for2">
    
  214.       <rule pattern="\)">
    
  215.         <token type="Punctuation"/>
    
  216.       </rule>
    
  217.       <rule pattern="((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(do(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))">
    
  218.         <bygroups>
    
  219.           <usingself state="text"/>
    
  220.           <token type="Keyword"/>
    
  221.         </bygroups>
    
  222.         <pop depth="1"/>
    
  223.       </rule>
    
  224.       <rule pattern="[\n\x1a]+">
    
  225.         <token type="Text"/>
    
  226.       </rule>
    
  227.       <rule>
    
  228.         <include state="follow"/>
    
  229.       </rule>
    
  230.     </state>
    
  231.     <state name="label/compound">
    
  232.       <rule pattern="(?=\))">
    
  233.         <token type="Text"/>
    
  234.         <pop depth="1"/>
    
  235.       </rule>
    
  236.       <rule pattern="((?:(?:[^\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0+:^)]|\^[\n\x1a]?[^)])*)?)((?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|\^[\n\x1a]?[^)]|[^&#34;%^\n\x1a&amp;&lt;&gt;|)])*)">
    
  237.         <bygroups>
    
  238.           <token type="NameLabel"/>
    
  239.           <token type="CommentSingle"/>
    
  240.         </bygroups>
    
  241.         <pop depth="1"/>
    
  242.       </rule>
    
  243.     </state>
    
  244.     <state name="for">
    
  245.       <rule pattern="((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(in)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(\()">
    
  246.         <bygroups>
    
  247.           <usingself state="text"/>
    
  248.           <token type="Keyword"/>
    
  249.           <usingself state="text"/>
    
  250.           <token type="Punctuation"/>
    
  251.         </bygroups>
    
  252.         <pop depth="1"/>
    
  253.       </rule>
    
  254.       <rule>
    
  255.         <include state="follow"/>
    
  256.       </rule>
    
  257.     </state>
    
  258.     <state name="redirect/compound">
    
  259.       <rule pattern="((?:(?&lt;=[\n\x1a\t\v\f\r ,;=\xa0])\d)?)(&gt;&gt;?&amp;|&lt;&amp;)([\n\x1a\t\v\f\r ,;=\xa0]*)(\d)">
    
  260.         <bygroups>
    
  261.           <token type="LiteralNumberInteger"/>
    
  262.           <token type="Punctuation"/>
    
  263.           <token type="Text"/>
    
  264.           <token type="LiteralNumberInteger"/>
    
  265.         </bygroups>
    
  266.       </rule>
    
  267.       <rule pattern="((?:(?&lt;=[\n\x1a\t\v\f\r ,;=\xa0])(?&lt;!\^[\n\x1a])\d)?)(&gt;&gt;?|&lt;)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:[&amp;&lt;&gt;|]+|(?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0)])+))+))">
    
  268.         <bygroups>
    
  269.           <token type="LiteralNumberInteger"/>
    
  270.           <token type="Punctuation"/>
    
  271.           <usingself state="text"/>
    
  272.         </bygroups>
    
  273.       </rule>
    
  274.     </state>
    
  275.     <state name="if">
    
  276.       <rule pattern="((?:cmdextversion|errorlevel)(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(\d+)">
    
  277.         <bygroups>
    
  278.           <token type="Keyword"/>
    
  279.           <usingself state="text"/>
    
  280.           <token type="LiteralNumberInteger"/>
    
  281.         </bygroups>
    
  282.         <pop depth="1"/>
    
  283.       </rule>
    
  284.       <rule pattern="(defined(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))((?:[&amp;&lt;&gt;|]+|(?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0])+))+))">
    
  285.         <bygroups>
    
  286.           <token type="Keyword"/>
    
  287.           <usingself state="text"/>
    
  288.           <usingself state="variable"/>
    
  289.         </bygroups>
    
  290.         <pop depth="1"/>
    
  291.       </rule>
    
  292.       <rule pattern="(exist(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)(?:[&amp;&lt;&gt;|]+|(?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0])+))+))">
    
  293.         <bygroups>
    
  294.           <token type="Keyword"/>
    
  295.           <usingself state="text"/>
    
  296.         </bygroups>
    
  297.         <pop depth="1"/>
    
  298.       </rule>
    
  299.       <rule pattern="((?:-?(?:0[0-7]+|0x[\da-f]+|\d+)(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))((?:equ|geq|gtr|leq|lss|neq))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)(?:-?(?:0[0-7]+|0x[\da-f]+|\d+)(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])))">
    
  300.         <bygroups>
    
  301.           <usingself state="arithmetic"/>
    
  302.           <token type="OperatorWord"/>
    
  303.           <usingself state="arithmetic"/>
    
  304.         </bygroups>
    
  305.         <pop depth="1"/>
    
  306.       </rule>
    
  307.       <rule pattern="(?:[&amp;&lt;&gt;|]+|(?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0])+))+)">
    
  308.         <usingself state="text"/>
    
  309.         <push state="#pop" state="if2"/>
    
  310.       </rule>
    
  311.     </state>
    
  312.     <state name="root/compound">
    
  313.       <rule pattern="\)">
    
  314.         <token type="Punctuation"/>
    
  315.         <pop depth="1"/>
    
  316.       </rule>
    
  317.       <rule pattern="(?=((?:(?&lt;=^[^:])|^[^:]?)[\t\v\f\r ,;=\xa0]*)(:))">
    
  318.         <token type="Text"/>
    
  319.         <push state="follow/compound"/>
    
  320.       </rule>
    
  321.       <rule pattern="(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)">
    
  322.         <usingself state="text"/>
    
  323.       </rule>
    
  324.       <rule>
    
  325.         <include state="redirect/compound"/>
    
  326.       </rule>
    
  327.       <rule pattern="[\n\x1a]+">
    
  328.         <token type="Text"/>
    
  329.       </rule>
    
  330.       <rule pattern="\(">
    
  331.         <token type="Punctuation"/>
    
  332.         <push state="root/compound"/>
    
  333.       </rule>
    
  334.       <rule pattern="@+">
    
  335.         <token type="Punctuation"/>
    
  336.       </rule>
    
  337.       <rule pattern="((?:for|if|rem)(?:(?=(?:\^[\n\x1a]?)?/)|(?:(?!\^)|(?&lt;=m))(?:(?=\()|(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])))))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0)])+)?(?:\^[\n\x1a]?)?/(?:\^[\n\x1a]?)?\?)">
    
  338.         <bygroups>
    
  339.           <token type="Keyword"/>
    
  340.           <usingself state="text"/>
    
  341.         </bygroups>
    
  342.         <push state="follow/compound"/>
    
  343.       </rule>
    
  344.       <rule pattern="(goto(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(])))((?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[^&#34;%\n\x1a&amp;&lt;&gt;|)])*(?:\^[\n\x1a]?)?/(?:\^[\n\x1a]?)?\?(?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[^&#34;%\n\x1a&amp;&lt;&gt;|)])*)">
    
  345.         <bygroups>
    
  346.           <token type="Keyword"/>
    
  347.           <usingself state="text"/>
    
  348.         </bygroups>
    
  349.         <push state="follow/compound"/>
    
  350.       </rule>
    
  351.       <rule pattern="(setlocal|endlocal|prompt|verify|rename|mklink|rmdir|shift|start|color|dpath|title|chdir|erase|pushd|ftype|break|pause|mkdir|assoc|date|path|time|popd|keys|exit|type|copy|echo|move|dir|del|ren|ver|cls|vol|rd|md|cd)(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(]))">
    
  352.         <token type="Keyword"/>
    
  353.         <push state="follow/compound"/>
    
  354.       </rule>
    
  355.       <rule pattern="(call)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)(:)">
    
  356.         <bygroups>
    
  357.           <token type="Keyword"/>
    
  358.           <usingself state="text"/>
    
  359.           <token type="Punctuation"/>
    
  360.         </bygroups>
    
  361.         <push state="call/compound"/>
    
  362.       </rule>
    
  363.       <rule pattern="call(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(]))">
    
  364.         <token type="Keyword"/>
    
  365.       </rule>
    
  366.       <rule pattern="(for(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(/f(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])))">
    
  367.         <bygroups>
    
  368.           <token type="Keyword"/>
    
  369.           <usingself state="text"/>
    
  370.           <token type="Keyword"/>
    
  371.         </bygroups>
    
  372.         <push state="for/f" state="for"/>
    
  373.       </rule>
    
  374.       <rule pattern="(for(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))(/l(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])))">
    
  375.         <bygroups>
    
  376.           <token type="Keyword"/>
    
  377.           <usingself state="text"/>
    
  378.           <token type="Keyword"/>
    
  379.         </bygroups>
    
  380.         <push state="for/l" state="for"/>
    
  381.       </rule>
    
  382.       <rule pattern="for(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a]))(?!\^)">
    
  383.         <token type="Keyword"/>
    
  384.         <push state="for2" state="for"/>
    
  385.       </rule>
    
  386.       <rule pattern="(goto(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(])))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)(:?)">
    
  387.         <bygroups>
    
  388.           <token type="Keyword"/>
    
  389.           <usingself state="text"/>
    
  390.           <token type="Punctuation"/>
    
  391.         </bygroups>
    
  392.         <push state="label/compound"/>
    
  393.       </rule>
    
  394.       <rule pattern="(if(?:(?=\()|(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])))(?!\^))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)((?:/i(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])))?)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)((?:not(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])))?)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)">
    
  395.         <bygroups>
    
  396.           <token type="Keyword"/>
    
  397.           <usingself state="text"/>
    
  398.           <token type="Keyword"/>
    
  399.           <usingself state="text"/>
    
  400.           <token type="Keyword"/>
    
  401.           <usingself state="text"/>
    
  402.         </bygroups>
    
  403.         <push state="(?" state="if"/>
    
  404.       </rule>
    
  405.       <rule pattern="rem(((?=\()|(?:(?=\))|(?=\^?[\t\v\f\r ,;=\xa0]|[&amp;&lt;&gt;|\n\x1a])))(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:[&amp;&lt;&gt;|]+|(?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0])+))+)?.*|(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(]))(?:(?:[^\n\x1a^)]|\^[\n\x1a]?[^)])*))">
    
  406.         <token type="CommentSingle"/>
    
  407.         <push state="follow/compound"/>
    
  408.       </rule>
    
  409.       <rule pattern="(set(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(])))((?:(?:\^[\n\x1a]?)?[^\S\n])*)(/a)">
    
  410.         <bygroups>
    
  411.           <token type="Keyword"/>
    
  412.           <usingself state="text"/>
    
  413.           <token type="Keyword"/>
    
  414.         </bygroups>
    
  415.         <push state="arithmetic/compound"/>
    
  416.       </rule>
    
  417.       <rule pattern="(set(?:(?=\))|(?=(?:\^[\n\x1a]?)?[\t\v\f\r ,;=\xa0+./:[\\\]]|[\n\x1a&amp;&lt;&gt;|(])))((?:(?:\^[\n\x1a]?)?[^\S\n])*)((?:/p)?)((?:(?:\^[\n\x1a]?)?[^\S\n])*)((?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|^=)]|\^[\n\x1a]?[^&#34;=])+)?)((?:(?:\^[\n\x1a]?)?=)?)">
    
  418.         <bygroups>
    
  419.           <token type="Keyword"/>
    
  420.           <usingself state="text"/>
    
  421.           <token type="Keyword"/>
    
  422.           <usingself state="text"/>
    
  423.           <usingself state="variable"/>
    
  424.           <token type="Punctuation"/>
    
  425.         </bygroups>
    
  426.         <push state="follow/compound"/>
    
  427.       </rule>
    
  428.       <rule>
    
  429.         <push state="follow/compound"/>
    
  430.       </rule>
    
  431.     </state>
    
  432.     <state name="follow/compound">
    
  433.       <rule pattern="(?=\))">
    
  434.         <token type="Text"/>
    
  435.         <pop depth="1"/>
    
  436.       </rule>
    
  437.       <rule pattern="((?:(?&lt;=^[^:])|^[^:]?)[\t\v\f\r ,;=\xa0]*)(:)([\t\v\f\r ,;=\xa0]*)((?:(?:[^\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0+:^)]|\^[\n\x1a]?[^)])*))(.*)">
    
  438.         <bygroups>
    
  439.           <token type="Text"/>
    
  440.           <token type="Punctuation"/>
    
  441.           <token type="Text"/>
    
  442.           <token type="NameLabel"/>
    
  443.           <token type="CommentSingle"/>
    
  444.         </bygroups>
    
  445.       </rule>
    
  446.       <rule>
    
  447.         <include state="redirect/compound"/>
    
  448.       </rule>
    
  449.       <rule pattern="(?=[\n\x1a])">
    
  450.         <token type="Text"/>
    
  451.         <pop depth="1"/>
    
  452.       </rule>
    
  453.       <rule pattern="\|\|?|&amp;&amp;?">
    
  454.         <token type="Punctuation"/>
    
  455.         <pop depth="1"/>
    
  456.       </rule>
    
  457.       <rule>
    
  458.         <include state="text"/>
    
  459.       </rule>
    
  460.     </state>
    
  461.     <state name="text">
    
  462.       <rule pattern="&#34;">
    
  463.         <token type="LiteralStringDouble"/>
    
  464.         <push state="string"/>
    
  465.       </rule>
    
  466.       <rule>
    
  467.         <include state="variable-or-escape"/>
    
  468.       </rule>
    
  469.       <rule pattern="[^&#34;%^\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0\d)]+|.">
    
  470.         <token type="Text"/>
    
  471.       </rule>
    
  472.     </state>
    
  473.     <state name="redirect">
    
  474.       <rule pattern="((?:(?&lt;=[\n\x1a\t\v\f\r ,;=\xa0])\d)?)(&gt;&gt;?&amp;|&lt;&amp;)([\n\x1a\t\v\f\r ,;=\xa0]*)(\d)">
    
  475.         <bygroups>
    
  476.           <token type="LiteralNumberInteger"/>
    
  477.           <token type="Punctuation"/>
    
  478.           <token type="Text"/>
    
  479.           <token type="LiteralNumberInteger"/>
    
  480.         </bygroups>
    
  481.       </rule>
    
  482.       <rule pattern="((?:(?&lt;=[\n\x1a\t\v\f\r ,;=\xa0])(?&lt;!\^[\n\x1a])\d)?)(&gt;&gt;?|&lt;)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:[&amp;&lt;&gt;|]+|(?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0])+))+))">
    
  483.         <bygroups>
    
  484.           <token type="LiteralNumberInteger"/>
    
  485.           <token type="Punctuation"/>
    
  486.           <usingself state="text"/>
    
  487.         </bygroups>
    
  488.       </rule>
    
  489.     </state>
    
  490.     <state name="label">
    
  491.       <rule pattern="((?:(?:[^\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0+:^]|\^[\n\x1a]?[\w\W])*)?)((?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|\^[\n\x1a]?[\w\W]|[^&#34;%^\n\x1a&amp;&lt;&gt;|])*)">
    
  492.         <bygroups>
    
  493.           <token type="NameLabel"/>
    
  494.           <token type="CommentSingle"/>
    
  495.         </bygroups>
    
  496.         <pop depth="1"/>
    
  497.       </rule>
    
  498.     </state>
    
  499.     <state name="arithmetic/compound">
    
  500.       <rule pattern="(?=\))">
    
  501.         <token type="Text"/>
    
  502.         <pop depth="1"/>
    
  503.       </rule>
    
  504.       <rule pattern="0[0-7]+">
    
  505.         <token type="LiteralNumberOct"/>
    
  506.       </rule>
    
  507.       <rule pattern="0x[\da-f]+">
    
  508.         <token type="LiteralNumberHex"/>
    
  509.       </rule>
    
  510.       <rule pattern="\d+">
    
  511.         <token type="LiteralNumberInteger"/>
    
  512.       </rule>
    
  513.       <rule pattern="[(),]+">
    
  514.         <token type="Punctuation"/>
    
  515.       </rule>
    
  516.       <rule pattern="([=+\-*/!~]|%|\^\^)+">
    
  517.         <token type="Operator"/>
    
  518.       </rule>
    
  519.       <rule pattern="((?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(\^[\n\x1a]?)?[^()=+\-*/!~%^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0]|\^[\n\x1a\t\v\f\r ,;=\xa0]?[^)])+">
    
  520.         <usingself state="variable"/>
    
  521.       </rule>
    
  522.       <rule pattern="(?=[\x00|&amp;])">
    
  523.         <token type="Text"/>
    
  524.         <pop depth="1"/>
    
  525.       </rule>
    
  526.       <rule>
    
  527.         <include state="follow"/>
    
  528.       </rule>
    
  529.     </state>
    
  530.     <state name="string">
    
  531.       <rule pattern="&#34;">
    
  532.         <token type="LiteralStringDouble"/>
    
  533.         <pop depth="1"/>
    
  534.       </rule>
    
  535.       <rule pattern="(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))">
    
  536.         <token type="NameVariable"/>
    
  537.       </rule>
    
  538.       <rule pattern="\^!|%%">
    
  539.         <token type="LiteralStringEscape"/>
    
  540.       </rule>
    
  541.       <rule pattern="[^&#34;%^\n\x1a]+|[%^]">
    
  542.         <token type="LiteralStringDouble"/>
    
  543.       </rule>
    
  544.       <rule>
    
  545.         <pop depth="1"/>
    
  546.       </rule>
    
  547.     </state>
    
  548.     <state name="variable">
    
  549.       <rule pattern="&#34;">
    
  550.         <token type="LiteralStringDouble"/>
    
  551.         <push state="string"/>
    
  552.       </rule>
    
  553.       <rule>
    
  554.         <include state="variable-or-escape"/>
    
  555.       </rule>
    
  556.       <rule pattern="[^&#34;%^\n\x1a]+|.">
    
  557.         <token type="NameVariable"/>
    
  558.       </rule>
    
  559.     </state>
    
  560.     <state name="call/compound">
    
  561.       <rule pattern="(?=\))">
    
  562.         <token type="Text"/>
    
  563.         <pop depth="1"/>
    
  564.       </rule>
    
  565.       <rule pattern="(:?)((?:(?:[^\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0+:^)]|\^[\n\x1a]?[^)])*))">
    
  566.         <bygroups>
    
  567.           <token type="Punctuation"/>
    
  568.           <token type="NameLabel"/>
    
  569.         </bygroups>
    
  570.         <pop depth="1"/>
    
  571.       </rule>
    
  572.     </state>
    
  573.     <state name="for/f">
    
  574.       <rule pattern="(&#34;)((?:(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[^&#34;])*?&#34;)([\n\x1a\t\v\f\r ,;=\xa0]*)(\))">
    
  575.         <bygroups>
    
  576.           <token type="LiteralStringDouble"/>
    
  577.           <usingself state="string"/>
    
  578.           <token type="Text"/>
    
  579.           <token type="Punctuation"/>
    
  580.         </bygroups>
    
  581.       </rule>
    
  582.       <rule pattern="&#34;">
    
  583.         <token type="LiteralStringDouble"/>
    
  584.         <push state="#pop" state="for2" state="string"/>
    
  585.       </rule>
    
  586.       <rule pattern="(&#39;(?:%%|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[\w\W])*?&#39;)([\n\x1a\t\v\f\r ,;=\xa0]*)(\))">
    
  587.         <bygroups>
    
  588.           <usingself state="sqstring"/>
    
  589.           <token type="Text"/>
    
  590.           <token type="Punctuation"/>
    
  591.         </bygroups>
    
  592.       </rule>
    
  593.       <rule pattern="(`(?:%%|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|[\w\W])*?`)([\n\x1a\t\v\f\r ,;=\xa0]*)(\))">
    
  594.         <bygroups>
    
  595.           <usingself state="bqstring"/>
    
  596.           <token type="Text"/>
    
  597.           <token type="Punctuation"/>
    
  598.         </bygroups>
    
  599.       </rule>
    
  600.       <rule>
    
  601.         <include state="for2"/>
    
  602.       </rule>
    
  603.     </state>
    
  604.     <state name="for/l">
    
  605.       <rule pattern="-?\d+">
    
  606.         <token type="LiteralNumberInteger"/>
    
  607.       </rule>
    
  608.       <rule>
    
  609.         <include state="for2"/>
    
  610.       </rule>
    
  611.     </state>
    
  612.     <state name="if2">
    
  613.       <rule pattern="((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?)(==)((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)?(?:[&amp;&lt;&gt;|]+|(?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0])+))+))">
    
  614.         <bygroups>
    
  615.           <usingself state="text"/>
    
  616.           <token type="Operator"/>
    
  617.           <usingself state="text"/>
    
  618.         </bygroups>
    
  619.         <pop depth="1"/>
    
  620.       </rule>
    
  621.       <rule pattern="((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+))((?:equ|geq|gtr|leq|lss|neq))((?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)(?:[&amp;&lt;&gt;|]+|(?:(?:&#34;[^\n\x1a&#34;]*(?:&#34;|(?=[\n\x1a])))|(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))|(?:(?:(?:\^[\n\x1a]?)?[^&#34;\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0])+))+))">
    
  622.         <bygroups>
    
  623.           <usingself state="text"/>
    
  624.           <token type="OperatorWord"/>
    
  625.           <usingself state="text"/>
    
  626.         </bygroups>
    
  627.         <pop depth="1"/>
    
  628.       </rule>
    
  629.     </state>
    
  630.     <state name="(?">
    
  631.       <rule pattern="(?:(?:(?:\^[\n\x1a])?[\t\v\f\r ,;=\xa0])+)">
    
  632.         <usingself state="text"/>
    
  633.       </rule>
    
  634.       <rule pattern="\(">
    
  635.         <token type="Punctuation"/>
    
  636.         <push state="#pop" state="else?" state="root/compound"/>
    
  637.       </rule>
    
  638.       <rule>
    
  639.         <pop depth="1"/>
    
  640.       </rule>
    
  641.     </state>
    
  642.     <state name="call">
    
  643.       <rule pattern="(:?)((?:(?:[^\n\x1a&amp;&lt;&gt;|\t\v\f\r ,;=\xa0+:^]|\^[\n\x1a]?[\w\W])*))">
    
  644.         <bygroups>
    
  645.           <token type="Punctuation"/>
    
  646.           <token type="NameLabel"/>
    
  647.         </bygroups>
    
  648.         <pop depth="1"/>
    
  649.       </rule>
    
  650.     </state>
    
  651.     <state name="variable-or-escape">
    
  652.       <rule pattern="(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%\n\x1a^]|\^[^%\n\x1a])[^=\n\x1a]*=(?:[^%\n\x1a^]|\^[^%\n\x1a])*)?)?%))|(?:\^?![^!:\n\x1a]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!\n\x1a^]|\^[^!\n\x1a])[^=\n\x1a]*=(?:[^!\n\x1a^]|\^[^!\n\x1a])*)?)?\^?!))">
    
  653.         <token type="NameVariable"/>
    
  654.       </rule>
    
  655.       <rule pattern="%%|\^[\n\x1a]?(\^!|[\w\W])">
    
  656.         <token type="LiteralStringEscape"/>
    
  657.       </rule>
    
  658.     </state>
    
  659.   </rules>
    
  660. </lexer>