tartrazine/lexers/brainfuck.xml

51 lines
1.1 KiB
XML
Raw Normal View History

2024-08-02 20:03:49 +00:00
<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>