summaryrefslogtreecommitdiff
path: root/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/tex.xml
blob: 809bb9a2974fbccd1ea88b6927d78672378d9269 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<lexer>
  <config>
    <name>TeX</name>
    <alias>tex</alias>
    <alias>latex</alias>
    <filename>*.tex</filename>
    <filename>*.aux</filename>
    <filename>*.toc</filename>
    <mime_type>text/x-tex</mime_type>
    <mime_type>text/x-latex</mime_type>
  </config>
  <rules>
    <state name="displaymath">
      <rule pattern="\\\]">
        <token type="LiteralString"/>
        <pop depth="1"/>
      </rule>
      <rule pattern="\$\$">
        <token type="LiteralString"/>
        <pop depth="1"/>
      </rule>
      <rule pattern="\$">
        <token type="NameBuiltin"/>
      </rule>
      <rule>
        <include state="math"/>
      </rule>
    </state>
    <state name="command">
      <rule pattern="\[.*?\]">
        <token type="NameAttribute"/>
      </rule>
      <rule pattern="\*">
        <token type="Keyword"/>
      </rule>
      <rule>
        <pop depth="1"/>
      </rule>
    </state>
    <state name="general">
      <rule pattern="%.*?\n">
        <token type="Comment"/>
      </rule>
      <rule pattern="[{}]">
        <token type="NameBuiltin"/>
      </rule>
      <rule pattern="[&amp;_^]">
        <token type="NameBuiltin"/>
      </rule>
    </state>
    <state name="root">
      <rule pattern="\\\[">
        <token type="LiteralStringBacktick"/>
        <push state="displaymath"/>
      </rule>
      <rule pattern="\\\(">
        <token type="LiteralString"/>
        <push state="inlinemath"/>
      </rule>
      <rule pattern="\$\$">
        <token type="LiteralStringBacktick"/>
        <push state="displaymath"/>
      </rule>
      <rule pattern="\$">
        <token type="LiteralString"/>
        <push state="inlinemath"/>
      </rule>
      <rule pattern="\\([a-zA-Z]+|.)">
        <token type="Keyword"/>
        <push state="command"/>
      </rule>
      <rule pattern="\\$">
        <token type="Keyword"/>
      </rule>
      <rule>
        <include state="general"/>
      </rule>
      <rule pattern="[^\\$%&amp;_^{}]+">
        <token type="Text"/>
      </rule>
    </state>
    <state name="math">
      <rule pattern="\\([a-zA-Z]+|.)">
        <token type="NameVariable"/>
      </rule>
      <rule>
        <include state="general"/>
      </rule>
      <rule pattern="[0-9]+">
        <token type="LiteralNumber"/>
      </rule>
      <rule pattern="[-=!+*/()\[\]]">
        <token type="Operator"/>
      </rule>
      <rule pattern="[^=!+*/()\[\]\\$%&amp;_^{}0-9-]+">
        <token type="NameBuiltin"/>
      </rule>
    </state>
    <state name="inlinemath">
      <rule pattern="\\\)">
        <token type="LiteralString"/>
        <pop depth="1"/>
      </rule>
      <rule pattern="\$">
        <token type="LiteralString"/>
        <pop depth="1"/>
      </rule>
      <rule>
        <include state="math"/>
      </rule>
    </state>
  </rules>
</lexer>