summaryrefslogtreecommitdiff
path: root/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/tablegen.xml
blob: a020ce804b2b7fba468aa84efe70989bd6c08e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<lexer>
  <config>
    <name>TableGen</name>
    <alias>tablegen</alias>
    <filename>*.td</filename>
    <mime_type>text/x-tablegen</mime_type>
  </config>
  <rules>
    <state name="whitespace">
      <rule pattern="(\n|\s)+">
        <token type="Text"/>
      </rule>
      <rule pattern="//.*?\n">
        <token type="Comment"/>
      </rule>
    </state>
    <state name="keyword">
      <rule pattern="(multiclass|foreach|string|class|field|defm|bits|code|list|def|int|let|dag|bit|in)\b">
        <token type="Keyword"/>
      </rule>
    </state>
    <state name="root">
      <rule>
        <include state="macro"/>
      </rule>
      <rule>
        <include state="whitespace"/>
      </rule>
      <rule pattern="c?&#34;[^&#34;]*?&#34;">
        <token type="LiteralString"/>
      </rule>
      <rule>
        <include state="keyword"/>
      </rule>
      <rule pattern="\$[_a-zA-Z][_\w]*">
        <token type="NameVariable"/>
      </rule>
      <rule pattern="\d*[_a-zA-Z][_\w]*">
        <token type="NameVariable"/>
      </rule>
      <rule pattern="\[\{[\w\W]*?\}\]">
        <token type="LiteralString"/>
      </rule>
      <rule pattern="[+-]?\d+|0x[\da-fA-F]+|0b[01]+">
        <token type="LiteralNumber"/>
      </rule>
      <rule pattern="[=&lt;&gt;{}\[\]()*.,!:;]">
        <token type="Punctuation"/>
      </rule>
    </state>
    <state name="macro">
      <rule pattern="(#include\s+)(&#34;[^&#34;]*&#34;)">
        <bygroups>
          <token type="CommentPreproc"/>
          <token type="LiteralString"/>
        </bygroups>
      </rule>
      <rule pattern="^\s*#(ifdef|ifndef)\s+[_\w][_\w\d]*">
        <token type="CommentPreproc"/>
      </rule>
      <rule pattern="^\s*#define\s+[_\w][_\w\d]*">
        <token type="CommentPreproc"/>
      </rule>
      <rule pattern="^\s*#endif">
        <token type="CommentPreproc"/>
      </rule>
    </state>
  </rules>
</lexer>