1 /* Auto-generated by Tools/scripts/generate_token.py */
2
3 #include "Python.h"
4 #include "token.h"
5
6 /* Token names */
7
8 const char * const _PyParser_TokenNames[] = {
9 "ENDMARKER",
10 "NAME",
11 "NUMBER",
12 "STRING",
13 "NEWLINE",
14 "INDENT",
15 "DEDENT",
16 "LPAR",
17 "RPAR",
18 "LSQB",
19 "RSQB",
20 "COLON",
21 "COMMA",
22 "SEMI",
23 "PLUS",
24 "MINUS",
25 "STAR",
26 "SLASH",
27 "VBAR",
28 "AMPER",
29 "LESS",
30 "GREATER",
31 "EQUAL",
32 "DOT",
33 "PERCENT",
34 "LBRACE",
35 "RBRACE",
36 "EQEQUAL",
37 "NOTEQUAL",
38 "LESSEQUAL",
39 "GREATEREQUAL",
40 "TILDE",
41 "CIRCUMFLEX",
42 "LEFTSHIFT",
43 "RIGHTSHIFT",
44 "DOUBLESTAR",
45 "PLUSEQUAL",
46 "MINEQUAL",
47 "STAREQUAL",
48 "SLASHEQUAL",
49 "PERCENTEQUAL",
50 "AMPEREQUAL",
51 "VBAREQUAL",
52 "CIRCUMFLEXEQUAL",
53 "LEFTSHIFTEQUAL",
54 "RIGHTSHIFTEQUAL",
55 "DOUBLESTAREQUAL",
56 "DOUBLESLASH",
57 "DOUBLESLASHEQUAL",
58 "AT",
59 "ATEQUAL",
60 "RARROW",
61 "ELLIPSIS",
62 "COLONEQUAL",
63 "OP",
64 "AWAIT",
65 "ASYNC",
66 "TYPE_IGNORE",
67 "TYPE_COMMENT",
68 "<ERRORTOKEN>",
69 "<COMMENT>",
70 "<NL>",
71 "<ENCODING>",
72 "<N_TOKENS>",
73 };
74
75 /* Return the token corresponding to a single character */
76
77 int
PyToken_OneChar(int c1)78 PyToken_OneChar(int c1)
79 {
80 switch (c1) {
81 case '%': return PERCENT;
82 case '&': return AMPER;
83 case '(': return LPAR;
84 case ')': return RPAR;
85 case '*': return STAR;
86 case '+': return PLUS;
87 case ',': return COMMA;
88 case '-': return MINUS;
89 case '.': return DOT;
90 case '/': return SLASH;
91 case ':': return COLON;
92 case ';': return SEMI;
93 case '<': return LESS;
94 case '=': return EQUAL;
95 case '>': return GREATER;
96 case '@': return AT;
97 case '[': return LSQB;
98 case ']': return RSQB;
99 case '^': return CIRCUMFLEX;
100 case '{': return LBRACE;
101 case '|': return VBAR;
102 case '}': return RBRACE;
103 case '~': return TILDE;
104 }
105 return OP;
106 }
107
108 int
PyToken_TwoChars(int c1,int c2)109 PyToken_TwoChars(int c1, int c2)
110 {
111 switch (c1) {
112 case '!':
113 switch (c2) {
114 case '=': return NOTEQUAL;
115 }
116 break;
117 case '%':
118 switch (c2) {
119 case '=': return PERCENTEQUAL;
120 }
121 break;
122 case '&':
123 switch (c2) {
124 case '=': return AMPEREQUAL;
125 }
126 break;
127 case '*':
128 switch (c2) {
129 case '*': return DOUBLESTAR;
130 case '=': return STAREQUAL;
131 }
132 break;
133 case '+':
134 switch (c2) {
135 case '=': return PLUSEQUAL;
136 }
137 break;
138 case '-':
139 switch (c2) {
140 case '=': return MINEQUAL;
141 case '>': return RARROW;
142 }
143 break;
144 case '/':
145 switch (c2) {
146 case '/': return DOUBLESLASH;
147 case '=': return SLASHEQUAL;
148 }
149 break;
150 case ':':
151 switch (c2) {
152 case '=': return COLONEQUAL;
153 }
154 break;
155 case '<':
156 switch (c2) {
157 case '<': return LEFTSHIFT;
158 case '=': return LESSEQUAL;
159 case '>': return NOTEQUAL;
160 }
161 break;
162 case '=':
163 switch (c2) {
164 case '=': return EQEQUAL;
165 }
166 break;
167 case '>':
168 switch (c2) {
169 case '=': return GREATEREQUAL;
170 case '>': return RIGHTSHIFT;
171 }
172 break;
173 case '@':
174 switch (c2) {
175 case '=': return ATEQUAL;
176 }
177 break;
178 case '^':
179 switch (c2) {
180 case '=': return CIRCUMFLEXEQUAL;
181 }
182 break;
183 case '|':
184 switch (c2) {
185 case '=': return VBAREQUAL;
186 }
187 break;
188 }
189 return OP;
190 }
191
192 int
PyToken_ThreeChars(int c1,int c2,int c3)193 PyToken_ThreeChars(int c1, int c2, int c3)
194 {
195 switch (c1) {
196 case '*':
197 switch (c2) {
198 case '*':
199 switch (c3) {
200 case '=': return DOUBLESTAREQUAL;
201 }
202 break;
203 }
204 break;
205 case '.':
206 switch (c2) {
207 case '.':
208 switch (c3) {
209 case '.': return ELLIPSIS;
210 }
211 break;
212 }
213 break;
214 case '/':
215 switch (c2) {
216 case '/':
217 switch (c3) {
218 case '=': return DOUBLESLASHEQUAL;
219 }
220 break;
221 }
222 break;
223 case '<':
224 switch (c2) {
225 case '<':
226 switch (c3) {
227 case '=': return LEFTSHIFTEQUAL;
228 }
229 break;
230 }
231 break;
232 case '>':
233 switch (c2) {
234 case '>':
235 switch (c3) {
236 case '=': return RIGHTSHIFTEQUAL;
237 }
238 break;
239 }
240 break;
241 }
242 return OP;
243 }
244