OILS / _gen / frontend / id_kind.asdl.cc View on Github | oilshell.org

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