85 lines
2.6 KiB
XML
85 lines
2.6 KiB
XML
|
<lexer>
|
||
|
<config>
|
||
|
<name>stas</name>
|
||
|
<filename>*.stas</filename>
|
||
|
</config>
|
||
|
<rules>
|
||
|
<state name="string-double-quoted">
|
||
|
<rule pattern="\\.">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="[^\\"]+">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern=""">
|
||
|
<token type="LiteralString"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="string-single-quoted">
|
||
|
<rule pattern="\\.">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="[^\\']+">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern="'">
|
||
|
<token type="LiteralString"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="string-char-literal">
|
||
|
<rule pattern="\\.">
|
||
|
<token type="LiteralStringEscape"/>
|
||
|
</rule>
|
||
|
<rule pattern="[^\\`]+">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern="`">
|
||
|
<token type="LiteralStringChar"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="root">
|
||
|
<rule pattern="(\n|\s)+">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="(?<!\S)(fn|argc|argv|swap|dup|over|over2|rot|rot4|drop|w8|w16|w32|w64|r8|r16|r32|r64|syscall0|syscall1|syscall2|syscall3|syscall4|syscall5|syscall6|_breakpoint|assert|const|auto|reserve|pop|include|addr|if|else|elif|while|break|continue|ret)(?!\S)">
|
||
|
<token type="Keyword"/>
|
||
|
</rule>
|
||
|
<rule pattern="(?<!\S)(\+|\-|\*|\/|\%|\%\%|\+\+|\-\-|>>|<<)(?!\S)">
|
||
|
<token type="Operator"/>
|
||
|
</rule>
|
||
|
<rule pattern="(?<!\S)(\=|\!\=|>|<|>\=|<\=|>s|<s|>\=s|<\=s)(?!\S)">
|
||
|
<token type="Operator"/>
|
||
|
</rule>
|
||
|
<rule pattern="(?<!\S)(\&|\||\^|\~|\!|-\>)(?!\S)">
|
||
|
<token type="Operator"/>
|
||
|
</rule>
|
||
|
<rule pattern="(?<!\S)\-?(\d+)(?!\S)">
|
||
|
<token type="LiteralNumber"/>
|
||
|
</rule>
|
||
|
<rule pattern="(?<!\S);.*(\S|\n)">
|
||
|
<token type="Comment"/>
|
||
|
</rule>
|
||
|
<rule pattern="'">
|
||
|
<token type="LiteralString"/>
|
||
|
<push state="string-single-quoted"/>
|
||
|
</rule>
|
||
|
<rule pattern=""">
|
||
|
<token type="LiteralString"/>
|
||
|
<push state="string-double-quoted"/>
|
||
|
</rule>
|
||
|
<rule pattern="`">
|
||
|
<token type="LiteralStringChar"/>
|
||
|
<push state="string-char-literal"/>
|
||
|
</rule>
|
||
|
<rule pattern="(?<!\S)[{}](?!\S)">
|
||
|
<token type="Punctuation"/>
|
||
|
</rule>
|
||
|
<rule pattern="(?<!\S)[^\s]+(?!\S)">
|
||
|
<token type="Name"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
</rules>
|
||
|
</lexer>
|