-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyGrammarLexer.py
240 lines (225 loc) · 12.3 KB
/
MyGrammarLexer.py
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# Generated from MyGrammar.g4 by ANTLR 4.12.0
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
from typing import TextIO
else:
from typing.io import TextIO
def serializedATN():
return [
4,0,51,366,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,
2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,
13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,
19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,
26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,
32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,
39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,
45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,1,0,1,0,1,1,
1,1,1,1,1,2,1,2,1,2,1,3,1,3,1,3,1,4,1,4,1,4,1,5,1,5,1,5,1,6,1,6,
1,6,1,7,1,7,1,8,1,8,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,
13,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,
18,1,18,1,18,1,18,1,19,1,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,
20,1,20,1,21,1,21,1,21,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,23,1,
23,1,23,1,23,1,24,1,24,1,24,1,24,1,24,1,24,1,25,1,25,1,26,1,26,1,
26,1,27,1,27,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,
30,1,30,1,30,1,31,1,31,1,31,1,31,1,32,1,32,1,33,1,33,1,34,1,34,1,
34,1,34,1,34,1,34,1,34,1,34,1,34,1,35,1,35,1,35,1,35,1,35,1,35,1,
35,1,35,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,37,1,37,1,
37,1,38,1,38,1,38,1,39,1,39,1,40,4,40,248,8,40,11,40,12,40,249,1,
41,1,41,1,41,1,41,1,41,1,41,1,42,1,42,1,42,1,42,1,42,1,42,1,42,1,
42,1,42,1,43,1,43,5,43,269,8,43,10,43,12,43,272,9,43,1,44,1,44,1,
44,1,44,1,44,1,44,1,44,3,44,281,8,44,1,45,1,45,1,45,5,45,286,8,45,
10,45,12,45,289,9,45,1,45,1,45,1,45,1,45,5,45,295,8,45,10,45,12,
45,298,9,45,1,45,3,45,301,8,45,1,46,4,46,304,8,46,11,46,12,46,305,
1,47,5,47,309,8,47,10,47,12,47,312,9,47,1,47,1,47,4,47,316,8,47,
11,47,12,47,317,1,47,4,47,321,8,47,11,47,12,47,322,1,47,1,47,5,47,
327,8,47,10,47,12,47,330,9,47,3,47,332,8,47,1,48,1,48,1,48,1,48,
5,48,338,8,48,10,48,12,48,341,9,48,1,48,3,48,344,8,48,1,48,1,48,
1,49,1,49,1,49,1,49,5,49,352,8,49,10,49,12,49,355,9,49,1,49,1,49,
1,49,1,50,4,50,361,8,50,11,50,12,50,362,1,50,1,50,2,339,353,0,51,
1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,
27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,
49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,
71,36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,44,89,45,91,46,
93,47,95,48,97,49,99,50,101,51,1,0,7,2,0,65,90,97,122,4,0,48,57,
65,90,95,95,97,122,1,0,39,39,1,0,92,92,1,0,34,34,1,0,48,57,3,0,9,
10,13,13,32,32,383,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,
0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,
0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,
0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,
0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,
0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,
0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,
0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,
0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0,
0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,
0,0,99,1,0,0,0,0,101,1,0,0,0,1,103,1,0,0,0,3,105,1,0,0,0,5,108,1,
0,0,0,7,111,1,0,0,0,9,114,1,0,0,0,11,117,1,0,0,0,13,120,1,0,0,0,
15,123,1,0,0,0,17,125,1,0,0,0,19,127,1,0,0,0,21,129,1,0,0,0,23,131,
1,0,0,0,25,133,1,0,0,0,27,135,1,0,0,0,29,137,1,0,0,0,31,139,1,0,
0,0,33,141,1,0,0,0,35,143,1,0,0,0,37,149,1,0,0,0,39,153,1,0,0,0,
41,159,1,0,0,0,43,164,1,0,0,0,45,169,1,0,0,0,47,171,1,0,0,0,49,178,
1,0,0,0,51,184,1,0,0,0,53,186,1,0,0,0,55,189,1,0,0,0,57,191,1,0,
0,0,59,193,1,0,0,0,61,198,1,0,0,0,63,204,1,0,0,0,65,208,1,0,0,0,
67,210,1,0,0,0,69,212,1,0,0,0,71,221,1,0,0,0,73,231,1,0,0,0,75,238,
1,0,0,0,77,241,1,0,0,0,79,244,1,0,0,0,81,247,1,0,0,0,83,251,1,0,
0,0,85,257,1,0,0,0,87,266,1,0,0,0,89,280,1,0,0,0,91,300,1,0,0,0,
93,303,1,0,0,0,95,331,1,0,0,0,97,333,1,0,0,0,99,347,1,0,0,0,101,
360,1,0,0,0,103,104,5,59,0,0,104,2,1,0,0,0,105,106,5,38,0,0,106,
107,5,38,0,0,107,4,1,0,0,0,108,109,5,124,0,0,109,110,5,124,0,0,110,
6,1,0,0,0,111,112,5,61,0,0,112,113,5,61,0,0,113,8,1,0,0,0,114,115,
5,60,0,0,115,116,5,61,0,0,116,10,1,0,0,0,117,118,5,62,0,0,118,119,
5,61,0,0,119,12,1,0,0,0,120,121,5,33,0,0,121,122,5,61,0,0,122,14,
1,0,0,0,123,124,5,60,0,0,124,16,1,0,0,0,125,126,5,62,0,0,126,18,
1,0,0,0,127,128,5,43,0,0,128,20,1,0,0,0,129,130,5,45,0,0,130,22,
1,0,0,0,131,132,5,47,0,0,132,24,1,0,0,0,133,134,5,37,0,0,134,26,
1,0,0,0,135,136,5,33,0,0,136,28,1,0,0,0,137,138,5,40,0,0,138,30,
1,0,0,0,139,140,5,41,0,0,140,32,1,0,0,0,141,142,5,61,0,0,142,34,
1,0,0,0,143,144,5,99,0,0,144,145,5,111,0,0,145,146,5,110,0,0,146,
147,5,115,0,0,147,148,5,116,0,0,148,36,1,0,0,0,149,150,5,105,0,0,
150,151,5,110,0,0,151,152,5,116,0,0,152,38,1,0,0,0,153,154,5,102,
0,0,154,155,5,108,0,0,155,156,5,111,0,0,156,157,5,97,0,0,157,158,
5,116,0,0,158,40,1,0,0,0,159,160,5,99,0,0,160,161,5,104,0,0,161,
162,5,97,0,0,162,163,5,114,0,0,163,42,1,0,0,0,164,165,5,118,0,0,
165,166,5,111,0,0,166,167,5,105,0,0,167,168,5,100,0,0,168,44,1,0,
0,0,169,170,5,38,0,0,170,46,1,0,0,0,171,172,5,112,0,0,172,173,5,
114,0,0,173,174,5,105,0,0,174,175,5,110,0,0,175,176,5,116,0,0,176,
177,5,102,0,0,177,48,1,0,0,0,178,179,5,115,0,0,179,180,5,99,0,0,
180,181,5,97,0,0,181,182,5,110,0,0,182,183,5,102,0,0,183,50,1,0,
0,0,184,185,5,44,0,0,185,52,1,0,0,0,186,187,5,105,0,0,187,188,5,
102,0,0,188,54,1,0,0,0,189,190,5,123,0,0,190,56,1,0,0,0,191,192,
5,125,0,0,192,58,1,0,0,0,193,194,5,101,0,0,194,195,5,108,0,0,195,
196,5,115,0,0,196,197,5,101,0,0,197,60,1,0,0,0,198,199,5,119,0,0,
199,200,5,104,0,0,200,201,5,105,0,0,201,202,5,108,0,0,202,203,5,
101,0,0,203,62,1,0,0,0,204,205,5,102,0,0,205,206,5,111,0,0,206,207,
5,114,0,0,207,64,1,0,0,0,208,209,5,91,0,0,209,66,1,0,0,0,210,211,
5,93,0,0,211,68,1,0,0,0,212,213,5,35,0,0,213,214,5,105,0,0,214,215,
5,110,0,0,215,216,5,99,0,0,216,217,5,108,0,0,217,218,5,117,0,0,218,
219,5,100,0,0,219,220,5,101,0,0,220,70,1,0,0,0,221,222,5,60,0,0,
222,223,5,115,0,0,223,224,5,116,0,0,224,225,5,100,0,0,225,226,5,
105,0,0,226,227,5,111,0,0,227,228,5,46,0,0,228,229,5,104,0,0,229,
230,5,62,0,0,230,72,1,0,0,0,231,232,5,114,0,0,232,233,5,101,0,0,
233,234,5,116,0,0,234,235,5,117,0,0,235,236,5,114,0,0,236,237,5,
110,0,0,237,74,1,0,0,0,238,239,5,43,0,0,239,240,5,43,0,0,240,76,
1,0,0,0,241,242,5,45,0,0,242,243,5,45,0,0,243,78,1,0,0,0,244,245,
5,42,0,0,245,80,1,0,0,0,246,248,5,42,0,0,247,246,1,0,0,0,248,249,
1,0,0,0,249,247,1,0,0,0,249,250,1,0,0,0,250,82,1,0,0,0,251,252,5,
98,0,0,252,253,5,114,0,0,253,254,5,101,0,0,254,255,5,97,0,0,255,
256,5,107,0,0,256,84,1,0,0,0,257,258,5,99,0,0,258,259,5,111,0,0,
259,260,5,110,0,0,260,261,5,116,0,0,261,262,5,105,0,0,262,263,5,
110,0,0,263,264,5,117,0,0,264,265,5,101,0,0,265,86,1,0,0,0,266,270,
7,0,0,0,267,269,7,1,0,0,268,267,1,0,0,0,269,272,1,0,0,0,270,268,
1,0,0,0,270,271,1,0,0,0,271,88,1,0,0,0,272,270,1,0,0,0,273,274,7,
2,0,0,274,275,9,0,0,0,275,281,7,2,0,0,276,277,7,2,0,0,277,278,7,
3,0,0,278,279,9,0,0,0,279,281,7,2,0,0,280,273,1,0,0,0,280,276,1,
0,0,0,281,90,1,0,0,0,282,287,5,39,0,0,283,286,8,4,0,0,284,286,5,
39,0,0,285,283,1,0,0,0,285,284,1,0,0,0,286,289,1,0,0,0,287,285,1,
0,0,0,287,288,1,0,0,0,288,290,1,0,0,0,289,287,1,0,0,0,290,301,5,
39,0,0,291,296,5,34,0,0,292,295,8,4,0,0,293,295,5,39,0,0,294,292,
1,0,0,0,294,293,1,0,0,0,295,298,1,0,0,0,296,294,1,0,0,0,296,297,
1,0,0,0,297,299,1,0,0,0,298,296,1,0,0,0,299,301,5,34,0,0,300,282,
1,0,0,0,300,291,1,0,0,0,301,92,1,0,0,0,302,304,7,5,0,0,303,302,1,
0,0,0,304,305,1,0,0,0,305,303,1,0,0,0,305,306,1,0,0,0,306,94,1,0,
0,0,307,309,7,5,0,0,308,307,1,0,0,0,309,312,1,0,0,0,310,308,1,0,
0,0,310,311,1,0,0,0,311,313,1,0,0,0,312,310,1,0,0,0,313,315,5,46,
0,0,314,316,7,5,0,0,315,314,1,0,0,0,316,317,1,0,0,0,317,315,1,0,
0,0,317,318,1,0,0,0,318,332,1,0,0,0,319,321,7,5,0,0,320,319,1,0,
0,0,321,322,1,0,0,0,322,320,1,0,0,0,322,323,1,0,0,0,323,324,1,0,
0,0,324,328,5,46,0,0,325,327,7,5,0,0,326,325,1,0,0,0,327,330,1,0,
0,0,328,326,1,0,0,0,328,329,1,0,0,0,329,332,1,0,0,0,330,328,1,0,
0,0,331,310,1,0,0,0,331,320,1,0,0,0,332,96,1,0,0,0,333,334,5,47,
0,0,334,335,5,47,0,0,335,339,1,0,0,0,336,338,9,0,0,0,337,336,1,0,
0,0,338,341,1,0,0,0,339,340,1,0,0,0,339,337,1,0,0,0,340,343,1,0,
0,0,341,339,1,0,0,0,342,344,5,13,0,0,343,342,1,0,0,0,343,344,1,0,
0,0,344,345,1,0,0,0,345,346,5,10,0,0,346,98,1,0,0,0,347,348,5,47,
0,0,348,349,5,42,0,0,349,353,1,0,0,0,350,352,9,0,0,0,351,350,1,0,
0,0,352,355,1,0,0,0,353,354,1,0,0,0,353,351,1,0,0,0,354,356,1,0,
0,0,355,353,1,0,0,0,356,357,5,42,0,0,357,358,5,47,0,0,358,100,1,
0,0,0,359,361,7,6,0,0,360,359,1,0,0,0,361,362,1,0,0,0,362,360,1,
0,0,0,362,363,1,0,0,0,363,364,1,0,0,0,364,365,6,50,0,0,365,102,1,
0,0,0,19,0,249,270,280,285,287,294,296,300,305,310,317,322,328,331,
339,343,353,362,1,6,0,0
]
class MyGrammarLexer(Lexer):
atn = ATNDeserializer().deserialize(serializedATN())
decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
T__0 = 1
T__1 = 2
T__2 = 3
T__3 = 4
T__4 = 5
T__5 = 6
T__6 = 7
T__7 = 8
T__8 = 9
T__9 = 10
T__10 = 11
T__11 = 12
T__12 = 13
T__13 = 14
T__14 = 15
T__15 = 16
T__16 = 17
T__17 = 18
T__18 = 19
T__19 = 20
T__20 = 21
T__21 = 22
T__22 = 23
T__23 = 24
T__24 = 25
T__25 = 26
T__26 = 27
T__27 = 28
T__28 = 29
T__29 = 30
T__30 = 31
T__31 = 32
T__32 = 33
T__33 = 34
T__34 = 35
T__35 = 36
T__36 = 37
T__37 = 38
T__38 = 39
POINTER = 40
POINTERS = 41
BREAK = 42
CONTINUE = 43
ID = 44
CHAR = 45
STRING = 46
INT = 47
FLOAT = 48
COMMENT = 49
BLOCK_COMMENT = 50
WS = 51
channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ]
modeNames = [ "DEFAULT_MODE" ]
literalNames = [ "<INVALID>",
"';'", "'&&'", "'||'", "'=='", "'<='", "'>='", "'!='", "'<'",
"'>'", "'+'", "'-'", "'/'", "'%'", "'!'", "'('", "')'", "'='",
"'const'", "'int'", "'float'", "'char'", "'void'", "'&'", "'printf'",
"'scanf'", "','", "'if'", "'{'", "'}'", "'else'", "'while'",
"'for'", "'['", "']'", "'#include'", "'<stdio.h>'", "'return'",
"'++'", "'--'", "'*'", "'break'", "'continue'" ]
symbolicNames = [ "<INVALID>",
"POINTER", "POINTERS", "BREAK", "CONTINUE", "ID", "CHAR", "STRING",
"INT", "FLOAT", "COMMENT", "BLOCK_COMMENT", "WS" ]
ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
"T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13",
"T__14", "T__15", "T__16", "T__17", "T__18", "T__19",
"T__20", "T__21", "T__22", "T__23", "T__24", "T__25",
"T__26", "T__27", "T__28", "T__29", "T__30", "T__31",
"T__32", "T__33", "T__34", "T__35", "T__36", "T__37",
"T__38", "POINTER", "POINTERS", "BREAK", "CONTINUE", "ID",
"CHAR", "STRING", "INT", "FLOAT", "COMMENT", "BLOCK_COMMENT",
"WS" ]
grammarFileName = "MyGrammar.g4"
def __init__(self, input=None, output:TextIO = sys.stdout):
super().__init__(input, output)
self.checkVersion("4.12.0")
self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
self._actions = None
self._predicates = None