mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-04-03 14:58:22 +00:00
58 lines
2.6 KiB
XML
58 lines
2.6 KiB
XML
|
|
<lexer>
|
|
<config>
|
|
<name>SNBT</name>
|
|
<alias>snbt</alias>
|
|
<filename>*.snbt</filename>
|
|
<mime_type>text/snbt</mime_type>
|
|
</config>
|
|
<rules>
|
|
<state name="root">
|
|
<rule pattern="\{"><token type="Punctuation"/><push state="compound"/></rule>
|
|
<rule pattern="[^\{]+"><token type="Text"/></rule>
|
|
</state>
|
|
<state name="whitespace">
|
|
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
|
|
</state>
|
|
<state name="operators">
|
|
<rule pattern="[,:;]"><token type="Punctuation"/></rule>
|
|
</state>
|
|
<state name="literals">
|
|
<rule pattern="(true|false)"><token type="KeywordConstant"/></rule>
|
|
<rule pattern="-?\d+[eE]-?\d+"><token type="LiteralNumberFloat"/></rule>
|
|
<rule pattern="-?\d*\.\d+[fFdD]?"><token type="LiteralNumberFloat"/></rule>
|
|
<rule pattern="-?\d+[bBsSlLfFdD]?"><token type="LiteralNumberInteger"/></rule>
|
|
<rule pattern="""><token type="LiteralStringDouble"/><push state="literals.string_double"/></rule>
|
|
<rule pattern="'"><token type="LiteralStringSingle"/><push state="literals.string_single"/></rule>
|
|
</state>
|
|
<state name="literals.string_double">
|
|
<rule pattern="\\."><token type="LiteralStringEscape"/></rule>
|
|
<rule pattern="[^\\"\n]+"><token type="LiteralStringDouble"/></rule>
|
|
<rule pattern="""><token type="LiteralStringDouble"/><pop depth="1"/></rule>
|
|
</state>
|
|
<state name="literals.string_single">
|
|
<rule pattern="\\."><token type="LiteralStringEscape"/></rule>
|
|
<rule pattern="[^\\'\n]+"><token type="LiteralStringSingle"/></rule>
|
|
<rule pattern="'"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
|
|
</state>
|
|
<state name="compound">
|
|
<rule pattern="[A-Z_a-z]+"><token type="NameAttribute"/></rule>
|
|
<rule><include state="operators"/></rule>
|
|
<rule><include state="whitespace"/></rule>
|
|
<rule><include state="literals"/></rule>
|
|
<rule pattern="\{"><token type="Punctuation"/><push/></rule>
|
|
<rule pattern="\["><token type="Punctuation"/><push state="list"/></rule>
|
|
<rule pattern="\}"><token type="Punctuation"/><pop depth="1"/></rule>
|
|
</state>
|
|
<state name="list">
|
|
<rule pattern="[A-Z_a-z]+"><token type="NameAttribute"/></rule>
|
|
<rule><include state="literals"/></rule>
|
|
<rule><include state="operators"/></rule>
|
|
<rule><include state="whitespace"/></rule>
|
|
<rule pattern="\["><token type="Punctuation"/><push/></rule>
|
|
<rule pattern="\{"><token type="Punctuation"/><push state="compound"/></rule>
|
|
<rule pattern="\]"><token type="Punctuation"/><pop depth="1"/></rule>
|
|
</state>
|
|
</rules>
|
|
</lexer>
|