summaryrefslogtreecommitdiff
path: root/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/brainfuck.xml
blob: 4c84c33082f1e14359d7baa3042cf6b2c2a36e3e (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
<lexer>
  <config>
    <name>Brainfuck</name>
    <alias>brainfuck</alias>
    <alias>bf</alias>
    <filename>*.bf</filename>
    <filename>*.b</filename>
    <mime_type>application/x-brainfuck</mime_type>
  </config>
  <rules>
    <state name="common">
      <rule pattern="[.,]+">
        <token type="NameTag"/>
      </rule>
      <rule pattern="[+-]+">
        <token type="NameBuiltin"/>
      </rule>
      <rule pattern="[&lt;&gt;]+">
        <token type="NameVariable"/>
      </rule>
      <rule pattern="[^.,+\-&lt;&gt;\[\]]+">
        <token type="Comment"/>
      </rule>
    </state>
    <state name="root">
      <rule pattern="\[">
        <token type="Keyword"/>
        <push state="loop"/>
      </rule>
      <rule pattern="\]">
        <token type="Error"/>
      </rule>
      <rule>
        <include state="common"/>
      </rule>
    </state>
    <state name="loop">
      <rule pattern="\[">
        <token type="Keyword"/>
        <push/>
      </rule>
      <rule pattern="\]">
        <token type="Keyword"/>
        <pop depth="1"/>
      </rule>
      <rule>
        <include state="common"/>
      </rule>
    </state>
  </rules>
</lexer>