/
stas.xml
85 lines (85 loc) · 2.62 KB
/
stas.xml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<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>