-
Notifications
You must be signed in to change notification settings - Fork 3
/
_BaseVyperLexer.flex
158 lines (146 loc) · 6.41 KB
/
_BaseVyperLexer.flex
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package org.vyperlang.plugin.grammar;
import com.intellij.lexer.FlexLexer;
import com.intellij.psi.tree.IElementType;
import static com.intellij.psi.TokenType.BAD_CHARACTER;
import static com.intellij.psi.TokenType.WHITE_SPACE;
import static org.vyperlang.plugin.psi.VyperTypes.*;
%%
%{
public _BaseVyperLexer() {
this((java.io.Reader)null);
}
%}
%public
%class _BaseVyperLexer
%implements FlexLexer
%function advance
%type IElementType
%unicode
EOL=\R
WHITE_SPACE=\s+
COMMENT=(#.*)
HEXLITERAL=hex\"([0-9a-fA-F]+)\"
STRINGLITERALDOUBLE=(\"([^\"\r\n\\]|\\.)*\")
STRINGLITERALDOUBLEB=(b\"([^\"\r\n\\]|\\.)*\")
STRINGLITERALSINGLE=('([^'\r\n\\]|\\.)*')
STRINGLITERALSINGLEB=(b'([^'\r\n\\]|\\.)*')
MULTILINESTRINGTOKEN=(\"\"\"([^\"]|\"[^\"]|\"\"[^\"])*\"\"\")
DECIMALNUMBER=([0-9][_0-9]*)
FIXEDNUMBER=(([0-9][_0-9]*)+\.[_0-9]*|([0-9][_0-9]*)*\.([0-9][_0-9]*))
BOOLEANLITERAL=True|False
SCIENTIFICNUMBER=((([0-9][_0-9]*)+|([0-9][_0-9]*)+\.[_0-9]*|([0-9][_0-9]*|[0-9])*\.[_0-9]+)[Ee][+-]?[_0-9]+)
HEXNUMBER=(0[xX][_0-9a-fA-F]+)
INTM=(int[0-9]+)
UINTM=(uint[0-9]+)
BYTESM=(bytes[0-9]+)
NEWLINE=(\r?\n)
BREAK_LINE=([ \t\n\x0B\f\r]*\\[ \t\n\x0B\f\r]*\n)
IDENTIFIER=([A-Za-z_][a-zA-Z_0-9]*)
%%
<YYINITIAL> {
{WHITE_SPACE} { return WHITE_SPACE; }
"@" { return DECORATOR; }
";" { return SEMICOLON; }
"," { return COMMA; }
"." { return DOT; }
":" { return COLON; }
"[" { return LBRACKET; }
"]" { return RBRACKET; }
"{" { return LBRACE; }
"}" { return RBRACE; }
"(" { return LPAREN; }
")" { return RPAREN; }
"..." { return ELLIPSIS; }
"+" { return PLUS; }
"-" { return MINUS; }
"*" { return MULT; }
"/" { return DIV; }
"**" { return EXPONENT; }
"not" { return NOT; }
"=" { return ASSIGN; }
"=>" { return TO; }
"==" { return EQ; }
"!=" { return NEQ; }
"+=" { return PLUS_ASSIGN; }
"-=" { return MINUS_ASSIGN; }
"*=" { return MULT_ASSIGN; }
"/=" { return DIV_ASSIGN; }
"%=" { return PERCENT_ASSIGN; }
"<" { return LESS; }
"<=" { return LESSEQ; }
">" { return MORE; }
">=" { return MOREEQ; }
"and" { return AND; }
"or" { return OR; }
"?" { return QUESTION; }
"%" { return PERCENT; }
"~" { return TILDE; }
"<<" { return LSHIFT; }
">>" { return RSHIFT; }
"&" { return AMPERSAND; }
"|" { return PIPE; }
"^" { return CARET; }
"String" { return STRING; }
"Bytes" { return BYTES; }
"DynArray" { return DYNARRAY; }
"HashMap" { return HASHMAP; }
"constant" { return CONSTANT; }
"public" { return PUBLIC; }
"immutable" { return IMMUTABLE; }
"import" { return IMPORT; }
"as" { return AS; }
"from" { return FROM; }
"implements" { return IMPLEMENTS; }
"interface" { return INTERFACE; }
"def" { return DEF; }
"pure" { return PURE; }
"view" { return VIEW; }
"nonpayable" { return NONPAYABLE; }
"payable" { return PAYABLE; }
"struct" { return STRUCT; }
"enum" { return ENUM; }
"flag" { return FLAG; }
"event" { return EVENT; }
"indexed" { return INDEXED; }
"external" { return EXTERNAL; }
"internal" { return INTERNAL; }
"deploy" { return DEPLOY; }
"nonreentrant" { return NONREENTRANT; }
"elif" { return ELIF; }
"else" { return ELSE; }
"if" { return IF; }
"for" { return FOR; }
"in" { return IN; }
"continue" { return CONTINUE; }
"break" { return BREAK; }
"return" { return RETURN; }
"raise" { return RAISE; }
"PASS" { return PASS; }
"log" { return LOG; }
"extcall" { return EXTCALL; }
"staticcall" { return STATICCALL; }
"range" { return RANGE; }
"assert" { return ASSERT; }
"self" { return SELF; }
"address" { return ADDRESS; }
"bool" { return BOOL; }
{COMMENT} { return COMMENT; }
{HEXLITERAL} { return HEXLITERAL; }
{STRINGLITERALDOUBLE} { return STRINGLITERALDOUBLE; }
{STRINGLITERALDOUBLEB} { return STRINGLITERALDOUBLEB; }
{STRINGLITERALSINGLE} { return STRINGLITERALSINGLE; }
{STRINGLITERALSINGLEB} { return STRINGLITERALSINGLEB; }
{MULTILINESTRINGTOKEN} { return MULTILINESTRINGTOKEN; }
{DECIMALNUMBER} { return DECIMALNUMBER; }
{FIXEDNUMBER} { return FIXEDNUMBER; }
{BOOLEANLITERAL} { return BOOLEANLITERAL; }
{SCIENTIFICNUMBER} { return SCIENTIFICNUMBER; }
{HEXNUMBER} { return HEXNUMBER; }
{INTM} { return INTM; }
{UINTM} { return UINTM; }
{BYTESM} { return BYTESM; }
{NEWLINE} { return NEWLINE; }
{BREAK_LINE} { return BREAK_LINE; }
{IDENTIFIER} { return IDENTIFIER; }
}
[^] { return BAD_CHARACTER; }