mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-13 23:12:24 +00:00
70 lines
1.9 KiB
XML
70 lines
1.9 KiB
XML
<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?"[^"]*?"">
|
|
<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="[=<>{}\[\]()*.,!:;]">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
</state>
|
|
<state name="macro">
|
|
<rule pattern="(#include\s+)("[^"]*")">
|
|
<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>
|