...

Text file src/github.com/alecthomas/chroma/v2/lexers/embedded/antlr.xml

Documentation: github.com/alecthomas/chroma/v2/lexers/embedded

     1<lexer>
     2  <config>
     3    <name>ANTLR</name>
     4    <alias>antlr</alias>
     5  </config>
     6  <rules>
     7    <state name="nested-arg-action">
     8      <rule pattern="([^$\[\]\&#39;&#34;/]+|&#34;(\\\\|\\&#34;|[^&#34;])*&#34;|&#39;(\\\\|\\&#39;|[^&#39;])*&#39;|//.*$\n?|/\*(.|\n)*?\*/|/(?!\*)(\\\\|\\/|[^/])*/|/)+">
     9        <token type="Other"/>
    10      </rule>
    11      <rule pattern="\[">
    12        <token type="Punctuation"/>
    13        <push/>
    14      </rule>
    15      <rule pattern="\]">
    16        <token type="Punctuation"/>
    17        <pop depth="1"/>
    18      </rule>
    19      <rule pattern="(\$[a-zA-Z]+)(\.?)(text|value)?">
    20        <bygroups>
    21          <token type="NameVariable"/>
    22          <token type="Punctuation"/>
    23          <token type="NameProperty"/>
    24        </bygroups>
    25      </rule>
    26      <rule pattern="(\\\\|\\\]|\\\[|[^\[\]])+">
    27        <token type="Other"/>
    28      </rule>
    29    </state>
    30    <state name="exception">
    31      <rule pattern="\n">
    32        <token type="TextWhitespace"/>
    33        <pop depth="1"/>
    34      </rule>
    35      <rule pattern="\s">
    36        <token type="TextWhitespace"/>
    37      </rule>
    38      <rule>
    39        <include state="comments"/>
    40      </rule>
    41      <rule pattern="\[">
    42        <token type="Punctuation"/>
    43        <push state="nested-arg-action"/>
    44      </rule>
    45      <rule pattern="\{">
    46        <token type="Punctuation"/>
    47        <push state="action"/>
    48      </rule>
    49    </state>
    50    <state name="whitespace">
    51      <rule pattern="\s+">
    52        <token type="TextWhitespace"/>
    53      </rule>
    54    </state>
    55    <state name="root">
    56      <rule>
    57        <include state="whitespace"/>
    58      </rule>
    59      <rule>
    60        <include state="comments"/>
    61      </rule>
    62      <rule pattern="(lexer|parser|tree)?(\s*)(grammar\b)(\s*)([A-Za-z]\w*)(;)">
    63        <bygroups>
    64          <token type="Keyword"/>
    65          <token type="TextWhitespace"/>
    66          <token type="Keyword"/>
    67          <token type="TextWhitespace"/>
    68          <token type="NameClass"/>
    69          <token type="Punctuation"/>
    70        </bygroups>
    71      </rule>
    72      <rule pattern="options\b">
    73        <token type="Keyword"/>
    74        <push state="options"/>
    75      </rule>
    76      <rule pattern="tokens\b">
    77        <token type="Keyword"/>
    78        <push state="tokens"/>
    79      </rule>
    80      <rule pattern="(scope)(\s*)([A-Za-z]\w*)(\s*)(\{)">
    81        <bygroups>
    82          <token type="Keyword"/>
    83          <token type="TextWhitespace"/>
    84          <token type="NameVariable"/>
    85          <token type="TextWhitespace"/>
    86          <token type="Punctuation"/>
    87        </bygroups>
    88        <push state="action"/>
    89      </rule>
    90      <rule pattern="(catch|finally)\b">
    91        <token type="Keyword"/>
    92        <push state="exception"/>
    93      </rule>
    94      <rule pattern="(@[A-Za-z]\w*)(\s*)(::)?(\s*)([A-Za-z]\w*)(\s*)(\{)">
    95        <bygroups>
    96          <token type="NameLabel"/>
    97          <token type="TextWhitespace"/>
    98          <token type="Punctuation"/>
    99          <token type="TextWhitespace"/>
   100          <token type="NameLabel"/>
   101          <token type="TextWhitespace"/>
   102          <token type="Punctuation"/>
   103        </bygroups>
   104        <push state="action"/>
   105      </rule>
   106      <rule pattern="((?:protected|private|public|fragment)\b)?(\s*)([A-Za-z]\w*)(!)?">
   107        <bygroups>
   108          <token type="Keyword"/>
   109          <token type="TextWhitespace"/>
   110          <token type="NameLabel"/>
   111          <token type="Punctuation"/>
   112        </bygroups>
   113        <push state="rule-alts" state="rule-prelims"/>
   114      </rule>
   115    </state>
   116    <state name="tokens">
   117      <rule>
   118        <include state="whitespace"/>
   119      </rule>
   120      <rule>
   121        <include state="comments"/>
   122      </rule>
   123      <rule pattern="\{">
   124        <token type="Punctuation"/>
   125      </rule>
   126      <rule pattern="([A-Z]\w*)(\s*)(=)?(\s*)(\&#39;(?:\\\\|\\\&#39;|[^\&#39;]*)\&#39;)?(\s*)(;)">
   127        <bygroups>
   128          <token type="NameLabel"/>
   129          <token type="TextWhitespace"/>
   130          <token type="Punctuation"/>
   131          <token type="TextWhitespace"/>
   132          <token type="LiteralString"/>
   133          <token type="TextWhitespace"/>
   134          <token type="Punctuation"/>
   135        </bygroups>
   136      </rule>
   137      <rule pattern="\}">
   138        <token type="Punctuation"/>
   139        <pop depth="1"/>
   140      </rule>
   141    </state>
   142    <state name="options">
   143      <rule>
   144        <include state="whitespace"/>
   145      </rule>
   146      <rule>
   147        <include state="comments"/>
   148      </rule>
   149      <rule pattern="\{">
   150        <token type="Punctuation"/>
   151      </rule>
   152      <rule pattern="([A-Za-z]\w*)(\s*)(=)(\s*)([A-Za-z]\w*|\&#39;(?:\\\\|\\\&#39;|[^\&#39;]*)\&#39;|[0-9]+|\*)(\s*)(;)">
   153        <bygroups>
   154          <token type="NameVariable"/>
   155          <token type="TextWhitespace"/>
   156          <token type="Punctuation"/>
   157          <token type="TextWhitespace"/>
   158          <token type="Text"/>
   159          <token type="TextWhitespace"/>
   160          <token type="Punctuation"/>
   161        </bygroups>
   162      </rule>
   163      <rule pattern="\}">
   164        <token type="Punctuation"/>
   165        <pop depth="1"/>
   166      </rule>
   167    </state>
   168    <state name="rule-alts">
   169      <rule>
   170        <include state="whitespace"/>
   171      </rule>
   172      <rule>
   173        <include state="comments"/>
   174      </rule>
   175      <rule pattern="options\b">
   176        <token type="Keyword"/>
   177        <push state="options"/>
   178      </rule>
   179      <rule pattern=":">
   180        <token type="Punctuation"/>
   181      </rule>
   182      <rule pattern="&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
   183        <token type="LiteralString"/>
   184      </rule>
   185      <rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
   186        <token type="LiteralString"/>
   187      </rule>
   188      <rule pattern="&lt;&lt;([^&gt;]|&gt;[^&gt;])&gt;&gt;">
   189        <token type="LiteralString"/>
   190      </rule>
   191      <rule pattern="\$?[A-Z_]\w*">
   192        <token type="NameConstant"/>
   193      </rule>
   194      <rule pattern="\$?[a-z_]\w*">
   195        <token type="NameVariable"/>
   196      </rule>
   197      <rule pattern="(\+|\||-&gt;|=&gt;|=|\(|\)|\.\.|\.|\?|\*|\^|!|\#|~)">
   198        <token type="Operator"/>
   199      </rule>
   200      <rule pattern=",">
   201        <token type="Punctuation"/>
   202      </rule>
   203      <rule pattern="\[">
   204        <token type="Punctuation"/>
   205        <push state="nested-arg-action"/>
   206      </rule>
   207      <rule pattern="\{">
   208        <token type="Punctuation"/>
   209        <push state="action"/>
   210      </rule>
   211      <rule pattern=";">
   212        <token type="Punctuation"/>
   213        <pop depth="1"/>
   214      </rule>
   215    </state>
   216    <state name="rule-prelims">
   217      <rule>
   218        <include state="whitespace"/>
   219      </rule>
   220      <rule>
   221        <include state="comments"/>
   222      </rule>
   223      <rule pattern="returns\b">
   224        <token type="Keyword"/>
   225      </rule>
   226      <rule pattern="\[">
   227        <token type="Punctuation"/>
   228        <push state="nested-arg-action"/>
   229      </rule>
   230      <rule pattern="\{">
   231        <token type="Punctuation"/>
   232        <push state="action"/>
   233      </rule>
   234      <rule pattern="(throws)(\s+)([A-Za-z]\w*)">
   235        <bygroups>
   236          <token type="Keyword"/>
   237          <token type="TextWhitespace"/>
   238          <token type="NameLabel"/>
   239        </bygroups>
   240      </rule>
   241      <rule pattern="(,)(\s*)([A-Za-z]\w*)">
   242        <bygroups>
   243          <token type="Punctuation"/>
   244          <token type="TextWhitespace"/>
   245          <token type="NameLabel"/>
   246        </bygroups>
   247      </rule>
   248      <rule pattern="options\b">
   249        <token type="Keyword"/>
   250        <push state="options"/>
   251      </rule>
   252      <rule pattern="(scope)(\s+)(\{)">
   253        <bygroups>
   254          <token type="Keyword"/>
   255          <token type="TextWhitespace"/>
   256          <token type="Punctuation"/>
   257        </bygroups>
   258        <push state="action"/>
   259      </rule>
   260      <rule pattern="(scope)(\s+)([A-Za-z]\w*)(\s*)(;)">
   261        <bygroups>
   262          <token type="Keyword"/>
   263          <token type="TextWhitespace"/>
   264          <token type="NameLabel"/>
   265          <token type="TextWhitespace"/>
   266          <token type="Punctuation"/>
   267        </bygroups>
   268      </rule>
   269      <rule pattern="(@[A-Za-z]\w*)(\s*)(\{)">
   270        <bygroups>
   271          <token type="NameLabel"/>
   272          <token type="TextWhitespace"/>
   273          <token type="Punctuation"/>
   274        </bygroups>
   275        <push state="action"/>
   276      </rule>
   277      <rule pattern=":">
   278        <token type="Punctuation"/>
   279        <pop depth="1"/>
   280      </rule>
   281    </state>
   282    <state name="action">
   283      <rule pattern="([^${}\&#39;&#34;/\\]+|&#34;(\\\\|\\&#34;|[^&#34;])*&#34;|&#39;(\\\\|\\&#39;|[^&#39;])*&#39;|//.*$\n?|/\*(.|\n)*?\*/|/(?!\*)(\\\\|\\/|[^/])*/|\\(?!%)|/)+">
   284        <token type="Other"/>
   285      </rule>
   286      <rule pattern="(\\)(%)">
   287        <bygroups>
   288          <token type="Punctuation"/>
   289          <token type="Other"/>
   290        </bygroups>
   291      </rule>
   292      <rule pattern="(\$[a-zA-Z]+)(\.?)(text|value)?">
   293        <bygroups>
   294          <token type="NameVariable"/>
   295          <token type="Punctuation"/>
   296          <token type="NameProperty"/>
   297        </bygroups>
   298      </rule>
   299      <rule pattern="\{">
   300        <token type="Punctuation"/>
   301        <push/>
   302      </rule>
   303      <rule pattern="\}">
   304        <token type="Punctuation"/>
   305        <pop depth="1"/>
   306      </rule>
   307    </state>
   308    <state name="comments">
   309      <rule pattern="//.*$">
   310        <token type="Comment"/>
   311      </rule>
   312      <rule pattern="/\*(.|\n)*?\*/">
   313        <token type="Comment"/>
   314      </rule>
   315    </state>
   316  </rules>
   317</lexer>

View as plain text