blob: 228ecffc8415ad97d834771003169a82d701c127 [file] [log] [blame]
Serhiy Storchaka8ac65812018-12-22 11:18:40 +02001/* Auto-generated by Tools/scripts/generate_token.py */
2
3#include "Python.h"
4#include "token.h"
5
6/* Token names */
7
8const 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",
Emily Morehouse8f59ee02019-01-24 16:49:56 -070062 "COLONEQUAL",
Serhiy Storchaka8ac65812018-12-22 11:18:40 +020063 "OP",
Guido van Rossumdcfcd142019-01-31 03:40:27 -080064 "TYPE_IGNORE",
65 "TYPE_COMMENT",
Serhiy Storchaka8ac65812018-12-22 11:18:40 +020066 "<ERRORTOKEN>",
67 "<COMMENT>",
68 "<NL>",
69 "<ENCODING>",
70 "<N_TOKENS>",
71};
72
73/* Return the token corresponding to a single character */
74
75int
76PyToken_OneChar(int c1)
77{
78 switch (c1) {
79 case '%': return PERCENT;
80 case '&': return AMPER;
81 case '(': return LPAR;
82 case ')': return RPAR;
83 case '*': return STAR;
84 case '+': return PLUS;
85 case ',': return COMMA;
86 case '-': return MINUS;
87 case '.': return DOT;
88 case '/': return SLASH;
89 case ':': return COLON;
90 case ';': return SEMI;
91 case '<': return LESS;
92 case '=': return EQUAL;
93 case '>': return GREATER;
94 case '@': return AT;
95 case '[': return LSQB;
96 case ']': return RSQB;
97 case '^': return CIRCUMFLEX;
98 case '{': return LBRACE;
99 case '|': return VBAR;
100 case '}': return RBRACE;
101 case '~': return TILDE;
102 }
103 return OP;
104}
105
106int
107PyToken_TwoChars(int c1, int c2)
108{
109 switch (c1) {
110 case '!':
111 switch (c2) {
112 case '=': return NOTEQUAL;
113 }
114 break;
115 case '%':
116 switch (c2) {
117 case '=': return PERCENTEQUAL;
118 }
119 break;
120 case '&':
121 switch (c2) {
122 case '=': return AMPEREQUAL;
123 }
124 break;
125 case '*':
126 switch (c2) {
127 case '*': return DOUBLESTAR;
128 case '=': return STAREQUAL;
129 }
130 break;
131 case '+':
132 switch (c2) {
133 case '=': return PLUSEQUAL;
134 }
135 break;
136 case '-':
137 switch (c2) {
138 case '=': return MINEQUAL;
139 case '>': return RARROW;
140 }
141 break;
142 case '/':
143 switch (c2) {
144 case '/': return DOUBLESLASH;
145 case '=': return SLASHEQUAL;
146 }
147 break;
Emily Morehouse8f59ee02019-01-24 16:49:56 -0700148 case ':':
149 switch (c2) {
150 case '=': return COLONEQUAL;
151 }
152 break;
Serhiy Storchaka8ac65812018-12-22 11:18:40 +0200153 case '<':
154 switch (c2) {
155 case '<': return LEFTSHIFT;
156 case '=': return LESSEQUAL;
157 case '>': return NOTEQUAL;
158 }
159 break;
160 case '=':
161 switch (c2) {
162 case '=': return EQEQUAL;
163 }
164 break;
165 case '>':
166 switch (c2) {
167 case '=': return GREATEREQUAL;
168 case '>': return RIGHTSHIFT;
169 }
170 break;
171 case '@':
172 switch (c2) {
173 case '=': return ATEQUAL;
174 }
175 break;
176 case '^':
177 switch (c2) {
178 case '=': return CIRCUMFLEXEQUAL;
179 }
180 break;
181 case '|':
182 switch (c2) {
183 case '=': return VBAREQUAL;
184 }
185 break;
186 }
187 return OP;
188}
189
190int
191PyToken_ThreeChars(int c1, int c2, int c3)
192{
193 switch (c1) {
194 case '*':
195 switch (c2) {
196 case '*':
197 switch (c3) {
198 case '=': return DOUBLESTAREQUAL;
199 }
200 break;
201 }
202 break;
203 case '.':
204 switch (c2) {
205 case '.':
206 switch (c3) {
207 case '.': return ELLIPSIS;
208 }
209 break;
210 }
211 break;
212 case '/':
213 switch (c2) {
214 case '/':
215 switch (c3) {
216 case '=': return DOUBLESLASHEQUAL;
217 }
218 break;
219 }
220 break;
221 case '<':
222 switch (c2) {
223 case '<':
224 switch (c3) {
225 case '=': return LEFTSHIFTEQUAL;
226 }
227 break;
228 }
229 break;
230 case '>':
231 switch (c2) {
232 case '>':
233 switch (c3) {
234 case '=': return RIGHTSHIFTEQUAL;
235 }
236 break;
237 }
238 break;
239 }
240 return OP;
241}