1 | #include <assert.h>
|
2 | #include "_gen/frontend/id_kind.asdl.h"
|
3 | #include "mycpp/gc_alloc.h" // StrFromC()
|
4 |
|
5 | namespace id_kind_asdl {
|
6 |
|
7 | BigStr* Id_str(int tag, bool dot) {
|
8 | char buf[32];
|
9 | const char* v = nullptr;
|
10 | switch (tag) {
|
11 | case Id::Word_Compound:
|
12 | v = "Word_Compound"; break;
|
13 | case Id::Arith_Semi:
|
14 | v = "Arith_Semi"; break;
|
15 | case Id::Arith_Comma:
|
16 | v = "Arith_Comma"; break;
|
17 | case Id::Arith_Plus:
|
18 | v = "Arith_Plus"; break;
|
19 | case Id::Arith_Minus:
|
20 | v = "Arith_Minus"; break;
|
21 | case Id::Arith_Star:
|
22 | v = "Arith_Star"; break;
|
23 | case Id::Arith_Slash:
|
24 | v = "Arith_Slash"; break;
|
25 | case Id::Arith_Percent:
|
26 | v = "Arith_Percent"; break;
|
27 | case Id::Arith_DPlus:
|
28 | v = "Arith_DPlus"; break;
|
29 | case Id::Arith_DMinus:
|
30 | v = "Arith_DMinus"; break;
|
31 | case Id::Arith_DStar:
|
32 | v = "Arith_DStar"; break;
|
33 | case Id::Arith_LParen:
|
34 | v = "Arith_LParen"; break;
|
35 | case Id::Arith_RParen:
|
36 | v = "Arith_RParen"; break;
|
37 | case Id::Arith_LBracket:
|
38 | v = "Arith_LBracket"; break;
|
39 | case Id::Arith_RBracket:
|
40 | v = "Arith_RBracket"; break;
|
41 | case Id::Arith_RBrace:
|
42 | v = "Arith_RBrace"; break;
|
43 | case Id::Arith_QMark:
|
44 | v = "Arith_QMark"; break;
|
45 | case Id::Arith_Colon:
|
46 | v = "Arith_Colon"; break;
|
47 | case Id::Arith_LessEqual:
|
48 | v = "Arith_LessEqual"; break;
|
49 | case Id::Arith_Less:
|
50 | v = "Arith_Less"; break;
|
51 | case Id::Arith_GreatEqual:
|
52 | v = "Arith_GreatEqual"; break;
|
53 | case Id::Arith_Great:
|
54 | v = "Arith_Great"; break;
|
55 | case Id::Arith_DEqual:
|
56 | v = "Arith_DEqual"; break;
|
57 | case Id::Arith_NEqual:
|
58 | v = "Arith_NEqual"; break;
|
59 | case Id::Arith_DAmp:
|
60 | v = "Arith_DAmp"; break;
|
61 | case Id::Arith_DPipe:
|
62 | v = "Arith_DPipe"; break;
|
63 | case Id::Arith_Bang:
|
64 | v = "Arith_Bang"; break;
|
65 | case Id::Arith_DGreat:
|
66 | v = "Arith_DGreat"; break;
|
67 | case Id::Arith_DLess:
|
68 | v = "Arith_DLess"; break;
|
69 | case Id::Arith_Amp:
|
70 | v = "Arith_Amp"; break;
|
71 | case Id::Arith_Pipe:
|
72 | v = "Arith_Pipe"; break;
|
73 | case Id::Arith_Caret:
|
74 | v = "Arith_Caret"; break;
|
75 | case Id::Arith_Tilde:
|
76 | v = "Arith_Tilde"; break;
|
77 | case Id::Arith_Equal:
|
78 | v = "Arith_Equal"; break;
|
79 | case Id::Arith_PlusEqual:
|
80 | v = "Arith_PlusEqual"; break;
|
81 | case Id::Arith_MinusEqual:
|
82 | v = "Arith_MinusEqual"; break;
|
83 | case Id::Arith_StarEqual:
|
84 | v = "Arith_StarEqual"; break;
|
85 | case Id::Arith_SlashEqual:
|
86 | v = "Arith_SlashEqual"; break;
|
87 | case Id::Arith_PercentEqual:
|
88 | v = "Arith_PercentEqual"; break;
|
89 | case Id::Arith_DGreatEqual:
|
90 | v = "Arith_DGreatEqual"; break;
|
91 | case Id::Arith_DLessEqual:
|
92 | v = "Arith_DLessEqual"; break;
|
93 | case Id::Arith_AmpEqual:
|
94 | v = "Arith_AmpEqual"; break;
|
95 | case Id::Arith_CaretEqual:
|
96 | v = "Arith_CaretEqual"; break;
|
97 | case Id::Arith_PipeEqual:
|
98 | v = "Arith_PipeEqual"; break;
|
99 | case Id::Eof_Real:
|
100 | v = "Eof_Real"; break;
|
101 | case Id::Eof_RParen:
|
102 | v = "Eof_RParen"; break;
|
103 | case Id::Eof_Backtick:
|
104 | v = "Eof_Backtick"; break;
|
105 | case Id::Undefined_Tok:
|
106 | v = "Undefined_Tok"; break;
|
107 | case Id::Unknown_Tok:
|
108 | v = "Unknown_Tok"; break;
|
109 | case Id::Unknown_Backslash:
|
110 | v = "Unknown_Backslash"; break;
|
111 | case Id::Unknown_DEqual:
|
112 | v = "Unknown_DEqual"; break;
|
113 | case Id::Eol_Tok:
|
114 | v = "Eol_Tok"; break;
|
115 | case Id::Ignored_LineCont:
|
116 | v = "Ignored_LineCont"; break;
|
117 | case Id::Ignored_Space:
|
118 | v = "Ignored_Space"; break;
|
119 | case Id::Ignored_Comment:
|
120 | v = "Ignored_Comment"; break;
|
121 | case Id::Ignored_Newline:
|
122 | v = "Ignored_Newline"; break;
|
123 | case Id::WS_Space:
|
124 | v = "WS_Space"; break;
|
125 | case Id::Lit_Chars:
|
126 | v = "Lit_Chars"; break;
|
127 | case Id::Lit_CharsWithoutPrefix:
|
128 | v = "Lit_CharsWithoutPrefix"; break;
|
129 | case Id::Lit_VarLike:
|
130 | v = "Lit_VarLike"; break;
|
131 | case Id::Lit_ArrayLhsOpen:
|
132 | v = "Lit_ArrayLhsOpen"; break;
|
133 | case Id::Lit_ArrayLhsClose:
|
134 | v = "Lit_ArrayLhsClose"; break;
|
135 | case Id::Lit_Splice:
|
136 | v = "Lit_Splice"; break;
|
137 | case Id::Lit_AtLBracket:
|
138 | v = "Lit_AtLBracket"; break;
|
139 | case Id::Lit_AtLBraceDot:
|
140 | v = "Lit_AtLBraceDot"; break;
|
141 | case Id::Lit_Other:
|
142 | v = "Lit_Other"; break;
|
143 | case Id::Lit_EscapedChar:
|
144 | v = "Lit_EscapedChar"; break;
|
145 | case Id::Lit_LBracket:
|
146 | v = "Lit_LBracket"; break;
|
147 | case Id::Lit_RBracket:
|
148 | v = "Lit_RBracket"; break;
|
149 | case Id::Lit_Star:
|
150 | v = "Lit_Star"; break;
|
151 | case Id::Lit_QMark:
|
152 | v = "Lit_QMark"; break;
|
153 | case Id::Lit_LBrace:
|
154 | v = "Lit_LBrace"; break;
|
155 | case Id::Lit_RBrace:
|
156 | v = "Lit_RBrace"; break;
|
157 | case Id::Lit_Comma:
|
158 | v = "Lit_Comma"; break;
|
159 | case Id::Lit_Equals:
|
160 | v = "Lit_Equals"; break;
|
161 | case Id::Lit_Dollar:
|
162 | v = "Lit_Dollar"; break;
|
163 | case Id::Lit_DRightBracket:
|
164 | v = "Lit_DRightBracket"; break;
|
165 | case Id::Lit_Tilde:
|
166 | v = "Lit_Tilde"; break;
|
167 | case Id::Lit_Pound:
|
168 | v = "Lit_Pound"; break;
|
169 | case Id::Lit_TPound:
|
170 | v = "Lit_TPound"; break;
|
171 | case Id::Lit_TDot:
|
172 | v = "Lit_TDot"; break;
|
173 | case Id::Lit_Slash:
|
174 | v = "Lit_Slash"; break;
|
175 | case Id::Lit_Percent:
|
176 | v = "Lit_Percent"; break;
|
177 | case Id::Lit_Colon:
|
178 | v = "Lit_Colon"; break;
|
179 | case Id::Lit_Digits:
|
180 | v = "Lit_Digits"; break;
|
181 | case Id::Lit_At:
|
182 | v = "Lit_At"; break;
|
183 | case Id::Lit_ArithVarLike:
|
184 | v = "Lit_ArithVarLike"; break;
|
185 | case Id::Lit_BadBackslash:
|
186 | v = "Lit_BadBackslash"; break;
|
187 | case Id::Lit_CompDummy:
|
188 | v = "Lit_CompDummy"; break;
|
189 | case Id::Backtick_Right:
|
190 | v = "Backtick_Right"; break;
|
191 | case Id::Backtick_Quoted:
|
192 | v = "Backtick_Quoted"; break;
|
193 | case Id::Backtick_DoubleQuote:
|
194 | v = "Backtick_DoubleQuote"; break;
|
195 | case Id::Backtick_Other:
|
196 | v = "Backtick_Other"; break;
|
197 | case Id::History_Op:
|
198 | v = "History_Op"; break;
|
199 | case Id::History_Num:
|
200 | v = "History_Num"; break;
|
201 | case Id::History_Search:
|
202 | v = "History_Search"; break;
|
203 | case Id::History_Other:
|
204 | v = "History_Other"; break;
|
205 | case Id::Op_Newline:
|
206 | v = "Op_Newline"; break;
|
207 | case Id::Op_Amp:
|
208 | v = "Op_Amp"; break;
|
209 | case Id::Op_Pipe:
|
210 | v = "Op_Pipe"; break;
|
211 | case Id::Op_PipeAmp:
|
212 | v = "Op_PipeAmp"; break;
|
213 | case Id::Op_DAmp:
|
214 | v = "Op_DAmp"; break;
|
215 | case Id::Op_DPipe:
|
216 | v = "Op_DPipe"; break;
|
217 | case Id::Op_Semi:
|
218 | v = "Op_Semi"; break;
|
219 | case Id::Op_DSemi:
|
220 | v = "Op_DSemi"; break;
|
221 | case Id::Op_SemiAmp:
|
222 | v = "Op_SemiAmp"; break;
|
223 | case Id::Op_DSemiAmp:
|
224 | v = "Op_DSemiAmp"; break;
|
225 | case Id::Op_LParen:
|
226 | v = "Op_LParen"; break;
|
227 | case Id::Op_RParen:
|
228 | v = "Op_RParen"; break;
|
229 | case Id::Op_DLeftParen:
|
230 | v = "Op_DLeftParen"; break;
|
231 | case Id::Op_DRightParen:
|
232 | v = "Op_DRightParen"; break;
|
233 | case Id::Op_Less:
|
234 | v = "Op_Less"; break;
|
235 | case Id::Op_Great:
|
236 | v = "Op_Great"; break;
|
237 | case Id::Op_Bang:
|
238 | v = "Op_Bang"; break;
|
239 | case Id::Op_LBracket:
|
240 | v = "Op_LBracket"; break;
|
241 | case Id::Op_RBracket:
|
242 | v = "Op_RBracket"; break;
|
243 | case Id::Op_LBrace:
|
244 | v = "Op_LBrace"; break;
|
245 | case Id::Op_RBrace:
|
246 | v = "Op_RBrace"; break;
|
247 | case Id::Expr_Reserved:
|
248 | v = "Expr_Reserved"; break;
|
249 | case Id::Expr_Symbol:
|
250 | v = "Expr_Symbol"; break;
|
251 | case Id::Expr_Name:
|
252 | v = "Expr_Name"; break;
|
253 | case Id::Expr_DecInt:
|
254 | v = "Expr_DecInt"; break;
|
255 | case Id::Expr_BinInt:
|
256 | v = "Expr_BinInt"; break;
|
257 | case Id::Expr_OctInt:
|
258 | v = "Expr_OctInt"; break;
|
259 | case Id::Expr_HexInt:
|
260 | v = "Expr_HexInt"; break;
|
261 | case Id::Expr_Float:
|
262 | v = "Expr_Float"; break;
|
263 | case Id::Expr_Bang:
|
264 | v = "Expr_Bang"; break;
|
265 | case Id::Expr_Dot:
|
266 | v = "Expr_Dot"; break;
|
267 | case Id::Expr_DDot:
|
268 | v = "Expr_DDot"; break;
|
269 | case Id::Expr_Colon:
|
270 | v = "Expr_Colon"; break;
|
271 | case Id::Expr_RArrow:
|
272 | v = "Expr_RArrow"; break;
|
273 | case Id::Expr_RDArrow:
|
274 | v = "Expr_RDArrow"; break;
|
275 | case Id::Expr_DSlash:
|
276 | v = "Expr_DSlash"; break;
|
277 | case Id::Expr_TEqual:
|
278 | v = "Expr_TEqual"; break;
|
279 | case Id::Expr_NotDEqual:
|
280 | v = "Expr_NotDEqual"; break;
|
281 | case Id::Expr_TildeDEqual:
|
282 | v = "Expr_TildeDEqual"; break;
|
283 | case Id::Expr_At:
|
284 | v = "Expr_At"; break;
|
285 | case Id::Expr_DoubleAt:
|
286 | v = "Expr_DoubleAt"; break;
|
287 | case Id::Expr_Ellipsis:
|
288 | v = "Expr_Ellipsis"; break;
|
289 | case Id::Expr_Dollar:
|
290 | v = "Expr_Dollar"; break;
|
291 | case Id::Expr_NotTilde:
|
292 | v = "Expr_NotTilde"; break;
|
293 | case Id::Expr_DTilde:
|
294 | v = "Expr_DTilde"; break;
|
295 | case Id::Expr_NotDTilde:
|
296 | v = "Expr_NotDTilde"; break;
|
297 | case Id::Expr_DStarEqual:
|
298 | v = "Expr_DStarEqual"; break;
|
299 | case Id::Expr_DSlashEqual:
|
300 | v = "Expr_DSlashEqual"; break;
|
301 | case Id::Expr_CastedDummy:
|
302 | v = "Expr_CastedDummy"; break;
|
303 | case Id::Expr_Null:
|
304 | v = "Expr_Null"; break;
|
305 | case Id::Expr_True:
|
306 | v = "Expr_True"; break;
|
307 | case Id::Expr_False:
|
308 | v = "Expr_False"; break;
|
309 | case Id::Expr_And:
|
310 | v = "Expr_And"; break;
|
311 | case Id::Expr_Or:
|
312 | v = "Expr_Or"; break;
|
313 | case Id::Expr_Not:
|
314 | v = "Expr_Not"; break;
|
315 | case Id::Expr_For:
|
316 | v = "Expr_For"; break;
|
317 | case Id::Expr_Is:
|
318 | v = "Expr_Is"; break;
|
319 | case Id::Expr_In:
|
320 | v = "Expr_In"; break;
|
321 | case Id::Expr_If:
|
322 | v = "Expr_If"; break;
|
323 | case Id::Expr_Else:
|
324 | v = "Expr_Else"; break;
|
325 | case Id::Expr_Func:
|
326 | v = "Expr_Func"; break;
|
327 | case Id::Expr_Capture:
|
328 | v = "Expr_Capture"; break;
|
329 | case Id::Expr_As:
|
330 | v = "Expr_As"; break;
|
331 | case Id::Char_OneChar:
|
332 | v = "Char_OneChar"; break;
|
333 | case Id::Char_Stop:
|
334 | v = "Char_Stop"; break;
|
335 | case Id::Char_Hex:
|
336 | v = "Char_Hex"; break;
|
337 | case Id::Char_YHex:
|
338 | v = "Char_YHex"; break;
|
339 | case Id::Char_Octal3:
|
340 | v = "Char_Octal3"; break;
|
341 | case Id::Char_Octal4:
|
342 | v = "Char_Octal4"; break;
|
343 | case Id::Char_Unicode4:
|
344 | v = "Char_Unicode4"; break;
|
345 | case Id::Char_SurrogatePair:
|
346 | v = "Char_SurrogatePair"; break;
|
347 | case Id::Char_Unicode8:
|
348 | v = "Char_Unicode8"; break;
|
349 | case Id::Char_UBraced:
|
350 | v = "Char_UBraced"; break;
|
351 | case Id::Char_Pound:
|
352 | v = "Char_Pound"; break;
|
353 | case Id::Char_AsciiControl:
|
354 | v = "Char_AsciiControl"; break;
|
355 | case Id::BashRegex_LParen:
|
356 | v = "BashRegex_LParen"; break;
|
357 | case Id::BashRegex_AllowedInParens:
|
358 | v = "BashRegex_AllowedInParens"; break;
|
359 | case Id::Eggex_Start:
|
360 | v = "Eggex_Start"; break;
|
361 | case Id::Eggex_End:
|
362 | v = "Eggex_End"; break;
|
363 | case Id::Eggex_Dot:
|
364 | v = "Eggex_Dot"; break;
|
365 | case Id::Redir_Less:
|
366 | v = "Redir_Less"; break;
|
367 | case Id::Redir_Great:
|
368 | v = "Redir_Great"; break;
|
369 | case Id::Redir_DLess:
|
370 | v = "Redir_DLess"; break;
|
371 | case Id::Redir_TLess:
|
372 | v = "Redir_TLess"; break;
|
373 | case Id::Redir_DGreat:
|
374 | v = "Redir_DGreat"; break;
|
375 | case Id::Redir_GreatAnd:
|
376 | v = "Redir_GreatAnd"; break;
|
377 | case Id::Redir_LessAnd:
|
378 | v = "Redir_LessAnd"; break;
|
379 | case Id::Redir_DLessDash:
|
380 | v = "Redir_DLessDash"; break;
|
381 | case Id::Redir_LessGreat:
|
382 | v = "Redir_LessGreat"; break;
|
383 | case Id::Redir_Clobber:
|
384 | v = "Redir_Clobber"; break;
|
385 | case Id::Redir_AndGreat:
|
386 | v = "Redir_AndGreat"; break;
|
387 | case Id::Redir_AndDGreat:
|
388 | v = "Redir_AndDGreat"; break;
|
389 | case Id::Left_DoubleQuote:
|
390 | v = "Left_DoubleQuote"; break;
|
391 | case Id::Left_JDoubleQuote:
|
392 | v = "Left_JDoubleQuote"; break;
|
393 | case Id::Left_SingleQuote:
|
394 | v = "Left_SingleQuote"; break;
|
395 | case Id::Left_DollarSingleQuote:
|
396 | v = "Left_DollarSingleQuote"; break;
|
397 | case Id::Left_RSingleQuote:
|
398 | v = "Left_RSingleQuote"; break;
|
399 | case Id::Left_USingleQuote:
|
400 | v = "Left_USingleQuote"; break;
|
401 | case Id::Left_BSingleQuote:
|
402 | v = "Left_BSingleQuote"; break;
|
403 | case Id::Left_TDoubleQuote:
|
404 | v = "Left_TDoubleQuote"; break;
|
405 | case Id::Left_DollarTDoubleQuote:
|
406 | v = "Left_DollarTDoubleQuote"; break;
|
407 | case Id::Left_TSingleQuote:
|
408 | v = "Left_TSingleQuote"; break;
|
409 | case Id::Left_RTSingleQuote:
|
410 | v = "Left_RTSingleQuote"; break;
|
411 | case Id::Left_UTSingleQuote:
|
412 | v = "Left_UTSingleQuote"; break;
|
413 | case Id::Left_BTSingleQuote:
|
414 | v = "Left_BTSingleQuote"; break;
|
415 | case Id::Left_Backtick:
|
416 | v = "Left_Backtick"; break;
|
417 | case Id::Left_DollarParen:
|
418 | v = "Left_DollarParen"; break;
|
419 | case Id::Left_DollarBrace:
|
420 | v = "Left_DollarBrace"; break;
|
421 | case Id::Left_DollarBraceZsh:
|
422 | v = "Left_DollarBraceZsh"; break;
|
423 | case Id::Left_DollarDParen:
|
424 | v = "Left_DollarDParen"; break;
|
425 | case Id::Left_DollarBracket:
|
426 | v = "Left_DollarBracket"; break;
|
427 | case Id::Left_DollarDoubleQuote:
|
428 | v = "Left_DollarDoubleQuote"; break;
|
429 | case Id::Left_ProcSubIn:
|
430 | v = "Left_ProcSubIn"; break;
|
431 | case Id::Left_ProcSubOut:
|
432 | v = "Left_ProcSubOut"; break;
|
433 | case Id::Left_AtParen:
|
434 | v = "Left_AtParen"; break;
|
435 | case Id::Left_CaretParen:
|
436 | v = "Left_CaretParen"; break;
|
437 | case Id::Left_CaretBracket:
|
438 | v = "Left_CaretBracket"; break;
|
439 | case Id::Left_CaretBrace:
|
440 | v = "Left_CaretBrace"; break;
|
441 | case Id::Left_CaretDoubleQuote:
|
442 | v = "Left_CaretDoubleQuote"; break;
|
443 | case Id::Left_ColonPipe:
|
444 | v = "Left_ColonPipe"; break;
|
445 | case Id::Left_PercentParen:
|
446 | v = "Left_PercentParen"; break;
|
447 | case Id::Right_DoubleQuote:
|
448 | v = "Right_DoubleQuote"; break;
|
449 | case Id::Right_SingleQuote:
|
450 | v = "Right_SingleQuote"; break;
|
451 | case Id::Right_Backtick:
|
452 | v = "Right_Backtick"; break;
|
453 | case Id::Right_DollarBrace:
|
454 | v = "Right_DollarBrace"; break;
|
455 | case Id::Right_DollarDParen:
|
456 | v = "Right_DollarDParen"; break;
|
457 | case Id::Right_DollarDoubleQuote:
|
458 | v = "Right_DollarDoubleQuote"; break;
|
459 | case Id::Right_DollarSingleQuote:
|
460 | v = "Right_DollarSingleQuote"; break;
|
461 | case Id::Right_Subshell:
|
462 | v = "Right_Subshell"; break;
|
463 | case Id::Right_ShFunction:
|
464 | v = "Right_ShFunction"; break;
|
465 | case Id::Right_CasePat:
|
466 | v = "Right_CasePat"; break;
|
467 | case Id::Right_ShArrayLiteral:
|
468 | v = "Right_ShArrayLiteral"; break;
|
469 | case Id::Right_ExtGlob:
|
470 | v = "Right_ExtGlob"; break;
|
471 | case Id::Right_BashRegexGroup:
|
472 | v = "Right_BashRegexGroup"; break;
|
473 | case Id::Right_BlockLiteral:
|
474 | v = "Right_BlockLiteral"; break;
|
475 | case Id::ExtGlob_Comma:
|
476 | v = "ExtGlob_Comma"; break;
|
477 | case Id::ExtGlob_At:
|
478 | v = "ExtGlob_At"; break;
|
479 | case Id::ExtGlob_Star:
|
480 | v = "ExtGlob_Star"; break;
|
481 | case Id::ExtGlob_Plus:
|
482 | v = "ExtGlob_Plus"; break;
|
483 | case Id::ExtGlob_QMark:
|
484 | v = "ExtGlob_QMark"; break;
|
485 | case Id::ExtGlob_Bang:
|
486 | v = "ExtGlob_Bang"; break;
|
487 | case Id::VSub_DollarName:
|
488 | v = "VSub_DollarName"; break;
|
489 | case Id::VSub_Name:
|
490 | v = "VSub_Name"; break;
|
491 | case Id::VSub_Number:
|
492 | v = "VSub_Number"; break;
|
493 | case Id::VSub_Bang:
|
494 | v = "VSub_Bang"; break;
|
495 | case Id::VSub_At:
|
496 | v = "VSub_At"; break;
|
497 | case Id::VSub_Pound:
|
498 | v = "VSub_Pound"; break;
|
499 | case Id::VSub_Dollar:
|
500 | v = "VSub_Dollar"; break;
|
501 | case Id::VSub_Star:
|
502 | v = "VSub_Star"; break;
|
503 | case Id::VSub_Hyphen:
|
504 | v = "VSub_Hyphen"; break;
|
505 | case Id::VSub_QMark:
|
506 | v = "VSub_QMark"; break;
|
507 | case Id::VSub_Dot:
|
508 | v = "VSub_Dot"; break;
|
509 | case Id::VTest_ColonHyphen:
|
510 | v = "VTest_ColonHyphen"; break;
|
511 | case Id::VTest_Hyphen:
|
512 | v = "VTest_Hyphen"; break;
|
513 | case Id::VTest_ColonEquals:
|
514 | v = "VTest_ColonEquals"; break;
|
515 | case Id::VTest_Equals:
|
516 | v = "VTest_Equals"; break;
|
517 | case Id::VTest_ColonQMark:
|
518 | v = "VTest_ColonQMark"; break;
|
519 | case Id::VTest_QMark:
|
520 | v = "VTest_QMark"; break;
|
521 | case Id::VTest_ColonPlus:
|
522 | v = "VTest_ColonPlus"; break;
|
523 | case Id::VTest_Plus:
|
524 | v = "VTest_Plus"; break;
|
525 | case Id::VOp0_Q:
|
526 | v = "VOp0_Q"; break;
|
527 | case Id::VOp0_E:
|
528 | v = "VOp0_E"; break;
|
529 | case Id::VOp0_P:
|
530 | v = "VOp0_P"; break;
|
531 | case Id::VOp0_A:
|
532 | v = "VOp0_A"; break;
|
533 | case Id::VOp0_a:
|
534 | v = "VOp0_a"; break;
|
535 | case Id::VOp1_Percent:
|
536 | v = "VOp1_Percent"; break;
|
537 | case Id::VOp1_DPercent:
|
538 | v = "VOp1_DPercent"; break;
|
539 | case Id::VOp1_Pound:
|
540 | v = "VOp1_Pound"; break;
|
541 | case Id::VOp1_DPound:
|
542 | v = "VOp1_DPound"; break;
|
543 | case Id::VOp1_Caret:
|
544 | v = "VOp1_Caret"; break;
|
545 | case Id::VOp1_DCaret:
|
546 | v = "VOp1_DCaret"; break;
|
547 | case Id::VOp1_Comma:
|
548 | v = "VOp1_Comma"; break;
|
549 | case Id::VOp1_DComma:
|
550 | v = "VOp1_DComma"; break;
|
551 | case Id::VOpYsh_Pipe:
|
552 | v = "VOpYsh_Pipe"; break;
|
553 | case Id::VOpYsh_Space:
|
554 | v = "VOpYsh_Space"; break;
|
555 | case Id::VOp2_Slash:
|
556 | v = "VOp2_Slash"; break;
|
557 | case Id::VOp2_Colon:
|
558 | v = "VOp2_Colon"; break;
|
559 | case Id::VOp2_LBracket:
|
560 | v = "VOp2_LBracket"; break;
|
561 | case Id::VOp2_RBracket:
|
562 | v = "VOp2_RBracket"; break;
|
563 | case Id::VOp3_At:
|
564 | v = "VOp3_At"; break;
|
565 | case Id::VOp3_Star:
|
566 | v = "VOp3_Star"; break;
|
567 | case Id::Node_PostDPlus:
|
568 | v = "Node_PostDPlus"; break;
|
569 | case Id::Node_PostDMinus:
|
570 | v = "Node_PostDMinus"; break;
|
571 | case Id::Node_UnaryPlus:
|
572 | v = "Node_UnaryPlus"; break;
|
573 | case Id::Node_UnaryMinus:
|
574 | v = "Node_UnaryMinus"; break;
|
575 | case Id::Node_NotIn:
|
576 | v = "Node_NotIn"; break;
|
577 | case Id::Node_IsNot:
|
578 | v = "Node_IsNot"; break;
|
579 | case Id::KW_DLeftBracket:
|
580 | v = "KW_DLeftBracket"; break;
|
581 | case Id::KW_Bang:
|
582 | v = "KW_Bang"; break;
|
583 | case Id::KW_For:
|
584 | v = "KW_For"; break;
|
585 | case Id::KW_While:
|
586 | v = "KW_While"; break;
|
587 | case Id::KW_Until:
|
588 | v = "KW_Until"; break;
|
589 | case Id::KW_Do:
|
590 | v = "KW_Do"; break;
|
591 | case Id::KW_Done:
|
592 | v = "KW_Done"; break;
|
593 | case Id::KW_In:
|
594 | v = "KW_In"; break;
|
595 | case Id::KW_Case:
|
596 | v = "KW_Case"; break;
|
597 | case Id::KW_Esac:
|
598 | v = "KW_Esac"; break;
|
599 | case Id::KW_If:
|
600 | v = "KW_If"; break;
|
601 | case Id::KW_Fi:
|
602 | v = "KW_Fi"; break;
|
603 | case Id::KW_Then:
|
604 | v = "KW_Then"; break;
|
605 | case Id::KW_Else:
|
606 | v = "KW_Else"; break;
|
607 | case Id::KW_Elif:
|
608 | v = "KW_Elif"; break;
|
609 | case Id::KW_Function:
|
610 | v = "KW_Function"; break;
|
611 | case Id::KW_Time:
|
612 | v = "KW_Time"; break;
|
613 | case Id::KW_Const:
|
614 | v = "KW_Const"; break;
|
615 | case Id::KW_Var:
|
616 | v = "KW_Var"; break;
|
617 | case Id::KW_SetVar:
|
618 | v = "KW_SetVar"; break;
|
619 | case Id::KW_SetGlobal:
|
620 | v = "KW_SetGlobal"; break;
|
621 | case Id::KW_Call:
|
622 | v = "KW_Call"; break;
|
623 | case Id::KW_Proc:
|
624 | v = "KW_Proc"; break;
|
625 | case Id::KW_Typed:
|
626 | v = "KW_Typed"; break;
|
627 | case Id::KW_Func:
|
628 | v = "KW_Func"; break;
|
629 | case Id::ControlFlow_Break:
|
630 | v = "ControlFlow_Break"; break;
|
631 | case Id::ControlFlow_Continue:
|
632 | v = "ControlFlow_Continue"; break;
|
633 | case Id::ControlFlow_Return:
|
634 | v = "ControlFlow_Return"; break;
|
635 | case Id::ControlFlow_Exit:
|
636 | v = "ControlFlow_Exit"; break;
|
637 | case Id::LookAhead_FuncParens:
|
638 | v = "LookAhead_FuncParens"; break;
|
639 | case Id::Glob_LBracket:
|
640 | v = "Glob_LBracket"; break;
|
641 | case Id::Glob_RBracket:
|
642 | v = "Glob_RBracket"; break;
|
643 | case Id::Glob_Star:
|
644 | v = "Glob_Star"; break;
|
645 | case Id::Glob_QMark:
|
646 | v = "Glob_QMark"; break;
|
647 | case Id::Glob_Bang:
|
648 | v = "Glob_Bang"; break;
|
649 | case Id::Glob_Caret:
|
650 | v = "Glob_Caret"; break;
|
651 | case Id::Glob_EscapedChar:
|
652 | v = "Glob_EscapedChar"; break;
|
653 | case Id::Glob_BadBackslash:
|
654 | v = "Glob_BadBackslash"; break;
|
655 | case Id::Glob_CleanLiterals:
|
656 | v = "Glob_CleanLiterals"; break;
|
657 | case Id::Glob_OtherLiteral:
|
658 | v = "Glob_OtherLiteral"; break;
|
659 | case Id::Format_EscapedPercent:
|
660 | v = "Format_EscapedPercent"; break;
|
661 | case Id::Format_Percent:
|
662 | v = "Format_Percent"; break;
|
663 | case Id::Format_Flag:
|
664 | v = "Format_Flag"; break;
|
665 | case Id::Format_Num:
|
666 | v = "Format_Num"; break;
|
667 | case Id::Format_Dot:
|
668 | v = "Format_Dot"; break;
|
669 | case Id::Format_Type:
|
670 | v = "Format_Type"; break;
|
671 | case Id::Format_Star:
|
672 | v = "Format_Star"; break;
|
673 | case Id::Format_Time:
|
674 | v = "Format_Time"; break;
|
675 | case Id::Format_Zero:
|
676 | v = "Format_Zero"; break;
|
677 | case Id::PS_Subst:
|
678 | v = "PS_Subst"; break;
|
679 | case Id::PS_Octal3:
|
680 | v = "PS_Octal3"; break;
|
681 | case Id::PS_LBrace:
|
682 | v = "PS_LBrace"; break;
|
683 | case Id::PS_RBrace:
|
684 | v = "PS_RBrace"; break;
|
685 | case Id::PS_Literals:
|
686 | v = "PS_Literals"; break;
|
687 | case Id::PS_BadBackslash:
|
688 | v = "PS_BadBackslash"; break;
|
689 | case Id::Range_Int:
|
690 | v = "Range_Int"; break;
|
691 | case Id::Range_Char:
|
692 | v = "Range_Char"; break;
|
693 | case Id::Range_Dots:
|
694 | v = "Range_Dots"; break;
|
695 | case Id::Range_Other:
|
696 | v = "Range_Other"; break;
|
697 | case Id::J8_LBracket:
|
698 | v = "J8_LBracket"; break;
|
699 | case Id::J8_RBracket:
|
700 | v = "J8_RBracket"; break;
|
701 | case Id::J8_LBrace:
|
702 | v = "J8_LBrace"; break;
|
703 | case Id::J8_RBrace:
|
704 | v = "J8_RBrace"; break;
|
705 | case Id::J8_Comma:
|
706 | v = "J8_Comma"; break;
|
707 | case Id::J8_Colon:
|
708 | v = "J8_Colon"; break;
|
709 | case Id::J8_Null:
|
710 | v = "J8_Null"; break;
|
711 | case Id::J8_Bool:
|
712 | v = "J8_Bool"; break;
|
713 | case Id::J8_Int:
|
714 | v = "J8_Int"; break;
|
715 | case Id::J8_Float:
|
716 | v = "J8_Float"; break;
|
717 | case Id::J8_String:
|
718 | v = "J8_String"; break;
|
719 | case Id::J8_Identifier:
|
720 | v = "J8_Identifier"; break;
|
721 | case Id::J8_Newline:
|
722 | v = "J8_Newline"; break;
|
723 | case Id::J8_Tab:
|
724 | v = "J8_Tab"; break;
|
725 | case Id::J8_LParen:
|
726 | v = "J8_LParen"; break;
|
727 | case Id::J8_RParen:
|
728 | v = "J8_RParen"; break;
|
729 | case Id::J8_Operator:
|
730 | v = "J8_Operator"; break;
|
731 | case Id::BoolUnary_z:
|
732 | v = "BoolUnary_z"; break;
|
733 | case Id::BoolUnary_n:
|
734 | v = "BoolUnary_n"; break;
|
735 | case Id::BoolUnary_o:
|
736 | v = "BoolUnary_o"; break;
|
737 | case Id::BoolUnary_t:
|
738 | v = "BoolUnary_t"; break;
|
739 | case Id::BoolUnary_v:
|
740 | v = "BoolUnary_v"; break;
|
741 | case Id::BoolUnary_R:
|
742 | v = "BoolUnary_R"; break;
|
743 | case Id::BoolUnary_a:
|
744 | v = "BoolUnary_a"; break;
|
745 | case Id::BoolUnary_b:
|
746 | v = "BoolUnary_b"; break;
|
747 | case Id::BoolUnary_c:
|
748 | v = "BoolUnary_c"; break;
|
749 | case Id::BoolUnary_d:
|
750 | v = "BoolUnary_d"; break;
|
751 | case Id::BoolUnary_e:
|
752 | v = "BoolUnary_e"; break;
|
753 | case Id::BoolUnary_f:
|
754 | v = "BoolUnary_f"; break;
|
755 | case Id::BoolUnary_g:
|
756 | v = "BoolUnary_g"; break;
|
757 | case Id::BoolUnary_h:
|
758 | v = "BoolUnary_h"; break;
|
759 | case Id::BoolUnary_k:
|
760 | v = "BoolUnary_k"; break;
|
761 | case Id::BoolUnary_L:
|
762 | v = "BoolUnary_L"; break;
|
763 | case Id::BoolUnary_p:
|
764 | v = "BoolUnary_p"; break;
|
765 | case Id::BoolUnary_r:
|
766 | v = "BoolUnary_r"; break;
|
767 | case Id::BoolUnary_s:
|
768 | v = "BoolUnary_s"; break;
|
769 | case Id::BoolUnary_S:
|
770 | v = "BoolUnary_S"; break;
|
771 | case Id::BoolUnary_u:
|
772 | v = "BoolUnary_u"; break;
|
773 | case Id::BoolUnary_w:
|
774 | v = "BoolUnary_w"; break;
|
775 | case Id::BoolUnary_x:
|
776 | v = "BoolUnary_x"; break;
|
777 | case Id::BoolUnary_O:
|
778 | v = "BoolUnary_O"; break;
|
779 | case Id::BoolUnary_G:
|
780 | v = "BoolUnary_G"; break;
|
781 | case Id::BoolUnary_N:
|
782 | v = "BoolUnary_N"; break;
|
783 | case Id::BoolBinary_GlobEqual:
|
784 | v = "BoolBinary_GlobEqual"; break;
|
785 | case Id::BoolBinary_GlobDEqual:
|
786 | v = "BoolBinary_GlobDEqual"; break;
|
787 | case Id::BoolBinary_GlobNEqual:
|
788 | v = "BoolBinary_GlobNEqual"; break;
|
789 | case Id::BoolBinary_EqualTilde:
|
790 | v = "BoolBinary_EqualTilde"; break;
|
791 | case Id::BoolBinary_ef:
|
792 | v = "BoolBinary_ef"; break;
|
793 | case Id::BoolBinary_nt:
|
794 | v = "BoolBinary_nt"; break;
|
795 | case Id::BoolBinary_ot:
|
796 | v = "BoolBinary_ot"; break;
|
797 | case Id::BoolBinary_eq:
|
798 | v = "BoolBinary_eq"; break;
|
799 | case Id::BoolBinary_ne:
|
800 | v = "BoolBinary_ne"; break;
|
801 | case Id::BoolBinary_gt:
|
802 | v = "BoolBinary_gt"; break;
|
803 | case Id::BoolBinary_ge:
|
804 | v = "BoolBinary_ge"; break;
|
805 | case Id::BoolBinary_lt:
|
806 | v = "BoolBinary_lt"; break;
|
807 | case Id::BoolBinary_le:
|
808 | v = "BoolBinary_le"; break;
|
809 | case Id::BoolBinary_Equal:
|
810 | v = "BoolBinary_Equal"; break;
|
811 | case Id::BoolBinary_DEqual:
|
812 | v = "BoolBinary_DEqual"; break;
|
813 | case Id::BoolBinary_NEqual:
|
814 | v = "BoolBinary_NEqual"; break;
|
815 | default:
|
816 | assert(0);
|
817 | }
|
818 | if (dot) {
|
819 | snprintf(buf, 32, "Id.%s", v);
|
820 | return StrFromC(buf);
|
821 | } else {
|
822 | return StrFromC(v);
|
823 | }
|
824 | }
|
825 | BigStr* Kind_str(Kind tag, bool dot) {
|
826 | char buf[32];
|
827 | const char* v = nullptr;
|
828 | switch (tag) {
|
829 | case Kind::Word:
|
830 | v = "Word"; break;
|
831 | case Kind::Arith:
|
832 | v = "Arith"; break;
|
833 | case Kind::Eof:
|
834 | v = "Eof"; break;
|
835 | case Kind::Undefined:
|
836 | v = "Undefined"; break;
|
837 | case Kind::Unknown:
|
838 | v = "Unknown"; break;
|
839 | case Kind::Eol:
|
840 | v = "Eol"; break;
|
841 | case Kind::Ignored:
|
842 | v = "Ignored"; break;
|
843 | case Kind::WS:
|
844 | v = "WS"; break;
|
845 | case Kind::Lit:
|
846 | v = "Lit"; break;
|
847 | case Kind::Backtick:
|
848 | v = "Backtick"; break;
|
849 | case Kind::History:
|
850 | v = "History"; break;
|
851 | case Kind::Op:
|
852 | v = "Op"; break;
|
853 | case Kind::Expr:
|
854 | v = "Expr"; break;
|
855 | case Kind::Char:
|
856 | v = "Char"; break;
|
857 | case Kind::BashRegex:
|
858 | v = "BashRegex"; break;
|
859 | case Kind::Eggex:
|
860 | v = "Eggex"; break;
|
861 | case Kind::Redir:
|
862 | v = "Redir"; break;
|
863 | case Kind::Left:
|
864 | v = "Left"; break;
|
865 | case Kind::Right:
|
866 | v = "Right"; break;
|
867 | case Kind::ExtGlob:
|
868 | v = "ExtGlob"; break;
|
869 | case Kind::VSub:
|
870 | v = "VSub"; break;
|
871 | case Kind::VTest:
|
872 | v = "VTest"; break;
|
873 | case Kind::VOp0:
|
874 | v = "VOp0"; break;
|
875 | case Kind::VOp1:
|
876 | v = "VOp1"; break;
|
877 | case Kind::VOpYsh:
|
878 | v = "VOpYsh"; break;
|
879 | case Kind::VOp2:
|
880 | v = "VOp2"; break;
|
881 | case Kind::VOp3:
|
882 | v = "VOp3"; break;
|
883 | case Kind::Node:
|
884 | v = "Node"; break;
|
885 | case Kind::KW:
|
886 | v = "KW"; break;
|
887 | case Kind::ControlFlow:
|
888 | v = "ControlFlow"; break;
|
889 | case Kind::LookAhead:
|
890 | v = "LookAhead"; break;
|
891 | case Kind::Glob:
|
892 | v = "Glob"; break;
|
893 | case Kind::Format:
|
894 | v = "Format"; break;
|
895 | case Kind::PS:
|
896 | v = "PS"; break;
|
897 | case Kind::Range:
|
898 | v = "Range"; break;
|
899 | case Kind::J8:
|
900 | v = "J8"; break;
|
901 | case Kind::BoolUnary:
|
902 | v = "BoolUnary"; break;
|
903 | case Kind::BoolBinary:
|
904 | v = "BoolBinary"; break;
|
905 | default:
|
906 | assert(0);
|
907 | }
|
908 | if (dot) {
|
909 | snprintf(buf, 32, "Kind.%s", v);
|
910 | return StrFromC(buf);
|
911 | } else {
|
912 | return StrFromC(v);
|
913 | }
|
914 | }
|
915 | } // namespace id_kind_asdl
|