source: doc/proposals/modules-alvin/3_implementation_details/prototype/parser/CMODLexer.py@ a9049dd

Last change on this file since a9049dd was a9049dd, checked in by Alvin Zhang <alvin.zhang@…>, 8 weeks ago

Prototype code for modules

  • Property mode set to 100644
File size: 9.3 KB
Line 
1# Generated from parser/CMOD.g4 by ANTLR 4.13.2
2from antlr4 import *
3from io import StringIO
4import sys
5if sys.version_info[1] > 5:
6 from typing import TextIO
7else:
8 from typing.io import TextIO
9
10
11def serializedATN():
12 return [
13 4,0,39,272,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,
14 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,
15 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,
16 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,
17 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,
18 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,
19 39,7,39,2,40,7,40,2,41,7,41,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,
20 1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,4,1,4,
21 1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,9,1,9,1,10,
22 1,10,1,11,1,11,1,12,1,12,1,12,1,13,1,13,1,14,1,14,1,15,1,15,1,16,
23 1,16,1,17,1,17,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,22,1,22,
24 1,23,1,23,1,24,1,24,1,25,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,
25 1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,29,1,29,
26 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,
27 1,31,1,31,1,31,1,32,1,32,1,32,5,32,198,8,32,10,32,12,32,201,9,32,
28 1,33,4,33,204,8,33,11,33,12,33,205,1,33,1,33,5,33,210,8,33,10,33,
29 12,33,213,9,33,3,33,215,8,33,1,34,1,34,1,35,1,35,1,36,1,36,5,36,
30 223,8,36,10,36,12,36,226,9,36,1,36,1,36,1,37,1,37,1,38,4,38,233,
31 8,38,11,38,12,38,234,1,38,1,38,1,39,1,39,3,39,241,8,39,1,39,3,39,
32 244,8,39,1,39,1,39,1,40,1,40,1,40,1,40,5,40,252,8,40,10,40,12,40,
33 255,9,40,1,40,1,40,1,40,1,40,1,40,1,41,1,41,1,41,1,41,5,41,266,8,
34 41,10,41,12,41,269,9,41,1,41,1,41,1,253,0,42,1,1,3,2,5,3,7,4,9,5,
35 11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,
36 17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,
37 28,57,29,59,30,61,31,63,32,65,33,67,34,69,0,71,0,73,35,75,0,77,36,
38 79,37,81,38,83,39,1,0,5,4,0,36,36,65,90,95,95,97,122,1,0,48,57,3,
39 0,10,10,13,13,34,34,2,0,9,9,32,32,2,0,10,10,13,13,279,0,1,1,0,0,
40 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,
41 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,
42 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,
43 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,
44 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,
45 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,
46 63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,73,1,0,0,0,0,77,1,0,0,0,0,
47 79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,1,85,1,0,0,0,3,92,1,0,0,0,5,
48 94,1,0,0,0,7,101,1,0,0,0,9,108,1,0,0,0,11,115,1,0,0,0,13,117,1,0,
49 0,0,15,119,1,0,0,0,17,121,1,0,0,0,19,123,1,0,0,0,21,125,1,0,0,0,
50 23,127,1,0,0,0,25,129,1,0,0,0,27,132,1,0,0,0,29,134,1,0,0,0,31,136,
51 1,0,0,0,33,138,1,0,0,0,35,140,1,0,0,0,37,142,1,0,0,0,39,144,1,0,
52 0,0,41,146,1,0,0,0,43,148,1,0,0,0,45,150,1,0,0,0,47,152,1,0,0,0,
53 49,154,1,0,0,0,51,156,1,0,0,0,53,161,1,0,0,0,55,166,1,0,0,0,57,172,
54 1,0,0,0,59,176,1,0,0,0,61,181,1,0,0,0,63,187,1,0,0,0,65,194,1,0,
55 0,0,67,203,1,0,0,0,69,216,1,0,0,0,71,218,1,0,0,0,73,220,1,0,0,0,
56 75,229,1,0,0,0,77,232,1,0,0,0,79,243,1,0,0,0,81,247,1,0,0,0,83,261,
57 1,0,0,0,85,86,5,109,0,0,86,87,5,111,0,0,87,88,5,100,0,0,88,89,5,
58 117,0,0,89,90,5,108,0,0,90,91,5,101,0,0,91,2,1,0,0,0,92,93,5,59,
59 0,0,93,4,1,0,0,0,94,95,5,105,0,0,95,96,5,109,0,0,96,97,5,112,0,0,
60 97,98,5,111,0,0,98,99,5,114,0,0,99,100,5,116,0,0,100,6,1,0,0,0,101,
61 102,5,101,0,0,102,103,5,120,0,0,103,104,5,112,0,0,104,105,5,111,
62 0,0,105,106,5,114,0,0,106,107,5,116,0,0,107,8,1,0,0,0,108,109,5,
63 115,0,0,109,110,5,116,0,0,110,111,5,114,0,0,111,112,5,117,0,0,112,
64 113,5,99,0,0,113,114,5,116,0,0,114,10,1,0,0,0,115,116,5,123,0,0,
65 116,12,1,0,0,0,117,118,5,125,0,0,118,14,1,0,0,0,119,120,5,61,0,0,
66 120,16,1,0,0,0,121,122,5,40,0,0,122,18,1,0,0,0,123,124,5,41,0,0,
67 124,20,1,0,0,0,125,126,5,44,0,0,126,22,1,0,0,0,127,128,5,46,0,0,
68 128,24,1,0,0,0,129,130,5,45,0,0,130,131,5,62,0,0,131,26,1,0,0,0,
69 132,133,5,42,0,0,133,28,1,0,0,0,134,135,5,47,0,0,135,30,1,0,0,0,
70 136,137,5,43,0,0,137,32,1,0,0,0,138,139,5,45,0,0,139,34,1,0,0,0,
71 140,141,5,38,0,0,141,36,1,0,0,0,142,143,5,124,0,0,143,38,1,0,0,0,
72 144,145,5,63,0,0,145,40,1,0,0,0,146,147,5,58,0,0,147,42,1,0,0,0,
73 148,149,5,60,0,0,149,44,1,0,0,0,150,151,5,62,0,0,151,46,1,0,0,0,
74 152,153,5,91,0,0,153,48,1,0,0,0,154,155,5,93,0,0,155,50,1,0,0,0,
75 156,157,5,118,0,0,157,158,5,111,0,0,158,159,5,105,0,0,159,160,5,
76 100,0,0,160,52,1,0,0,0,161,162,5,99,0,0,162,163,5,104,0,0,163,164,
77 5,97,0,0,164,165,5,114,0,0,165,54,1,0,0,0,166,167,5,115,0,0,167,
78 168,5,104,0,0,168,169,5,111,0,0,169,170,5,114,0,0,170,171,5,116,
79 0,0,171,56,1,0,0,0,172,173,5,105,0,0,173,174,5,110,0,0,174,175,5,
80 116,0,0,175,58,1,0,0,0,176,177,5,108,0,0,177,178,5,111,0,0,178,179,
81 5,110,0,0,179,180,5,103,0,0,180,60,1,0,0,0,181,182,5,102,0,0,182,
82 183,5,108,0,0,183,184,5,111,0,0,184,185,5,97,0,0,185,186,5,116,0,
83 0,186,62,1,0,0,0,187,188,5,100,0,0,188,189,5,111,0,0,189,190,5,117,
84 0,0,190,191,5,98,0,0,191,192,5,108,0,0,192,193,5,101,0,0,193,64,
85 1,0,0,0,194,199,3,69,34,0,195,198,3,69,34,0,196,198,3,71,35,0,197,
86 195,1,0,0,0,197,196,1,0,0,0,198,201,1,0,0,0,199,197,1,0,0,0,199,
87 200,1,0,0,0,200,66,1,0,0,0,201,199,1,0,0,0,202,204,3,71,35,0,203,
88 202,1,0,0,0,204,205,1,0,0,0,205,203,1,0,0,0,205,206,1,0,0,0,206,
89 214,1,0,0,0,207,211,5,46,0,0,208,210,3,71,35,0,209,208,1,0,0,0,210,
90 213,1,0,0,0,211,209,1,0,0,0,211,212,1,0,0,0,212,215,1,0,0,0,213,
91 211,1,0,0,0,214,207,1,0,0,0,214,215,1,0,0,0,215,68,1,0,0,0,216,217,
92 7,0,0,0,217,70,1,0,0,0,218,219,7,1,0,0,219,72,1,0,0,0,220,224,5,
93 34,0,0,221,223,3,75,37,0,222,221,1,0,0,0,223,226,1,0,0,0,224,222,
94 1,0,0,0,224,225,1,0,0,0,225,227,1,0,0,0,226,224,1,0,0,0,227,228,
95 5,34,0,0,228,74,1,0,0,0,229,230,8,2,0,0,230,76,1,0,0,0,231,233,7,
96 3,0,0,232,231,1,0,0,0,233,234,1,0,0,0,234,232,1,0,0,0,234,235,1,
97 0,0,0,235,236,1,0,0,0,236,237,6,38,0,0,237,78,1,0,0,0,238,240,5,
98 13,0,0,239,241,5,10,0,0,240,239,1,0,0,0,240,241,1,0,0,0,241,244,
99 1,0,0,0,242,244,5,10,0,0,243,238,1,0,0,0,243,242,1,0,0,0,244,245,
100 1,0,0,0,245,246,6,39,0,0,246,80,1,0,0,0,247,248,5,47,0,0,248,249,
101 5,42,0,0,249,253,1,0,0,0,250,252,9,0,0,0,251,250,1,0,0,0,252,255,
102 1,0,0,0,253,254,1,0,0,0,253,251,1,0,0,0,254,256,1,0,0,0,255,253,
103 1,0,0,0,256,257,5,42,0,0,257,258,5,47,0,0,258,259,1,0,0,0,259,260,
104 6,40,0,0,260,82,1,0,0,0,261,262,5,47,0,0,262,263,5,47,0,0,263,267,
105 1,0,0,0,264,266,8,4,0,0,265,264,1,0,0,0,266,269,1,0,0,0,267,265,
106 1,0,0,0,267,268,1,0,0,0,268,270,1,0,0,0,269,267,1,0,0,0,270,271,
107 6,41,0,0,271,84,1,0,0,0,12,0,197,199,205,211,214,224,234,240,243,
108 253,267,1,0,1,0
109 ]
110
111class CMODLexer(Lexer):
112
113 atn = ATNDeserializer().deserialize(serializedATN())
114
115 decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
116
117 T__0 = 1
118 T__1 = 2
119 T__2 = 3
120 T__3 = 4
121 T__4 = 5
122 T__5 = 6
123 T__6 = 7
124 T__7 = 8
125 T__8 = 9
126 T__9 = 10
127 T__10 = 11
128 T__11 = 12
129 T__12 = 13
130 T__13 = 14
131 T__14 = 15
132 T__15 = 16
133 T__16 = 17
134 T__17 = 18
135 T__18 = 19
136 T__19 = 20
137 T__20 = 21
138 T__21 = 22
139 T__22 = 23
140 T__23 = 24
141 T__24 = 25
142 T__25 = 26
143 T__26 = 27
144 T__27 = 28
145 T__28 = 29
146 T__29 = 30
147 T__30 = 31
148 T__31 = 32
149 Identifier = 33
150 Number = 34
151 StringLiteral = 35
152 Whitespace = 36
153 Newline = 37
154 BlockComment = 38
155 LineComment = 39
156
157 channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ]
158
159 modeNames = [ "DEFAULT_MODE" ]
160
161 literalNames = [ "<INVALID>",
162 "'module'", "';'", "'import'", "'export'", "'struct'", "'{'",
163 "'}'", "'='", "'('", "')'", "','", "'.'", "'->'", "'*'", "'/'",
164 "'+'", "'-'", "'&'", "'|'", "'?'", "':'", "'<'", "'>'", "'['",
165 "']'", "'void'", "'char'", "'short'", "'int'", "'long'", "'float'",
166 "'double'" ]
167
168 symbolicNames = [ "<INVALID>",
169 "Identifier", "Number", "StringLiteral", "Whitespace", "Newline",
170 "BlockComment", "LineComment" ]
171
172 ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
173 "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13",
174 "T__14", "T__15", "T__16", "T__17", "T__18", "T__19",
175 "T__20", "T__21", "T__22", "T__23", "T__24", "T__25",
176 "T__26", "T__27", "T__28", "T__29", "T__30", "T__31",
177 "Identifier", "Number", "Nondigit", "Digit", "StringLiteral",
178 "SChar", "Whitespace", "Newline", "BlockComment", "LineComment" ]
179
180 grammarFileName = "CMOD.g4"
181
182 def __init__(self, input=None, output:TextIO = sys.stdout):
183 super().__init__(input, output)
184 self.checkVersion("4.13.2")
185 self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
186 self._actions = None
187 self._predicates = None
188
189
Note: See TracBrowser for help on using the repository browser.