Skip to main content

big_code_analysis_ast/languages/
language_bash.rs

1// See `src/languages/mod.rs` for the rationale behind the per-file
2// pedantic carve-outs below.
3#![allow(clippy::match_same_arms, clippy::too_many_lines)]
4// One variant per grammar kind id, named after the rule; the name is
5// the documentation and there is nothing per-variant to add.
6#![allow(missing_docs)]
7
8// Code generated; DO NOT EDIT.
9
10use num_derive::FromPrimitive;
11
12#[derive(Clone, Debug, PartialEq, Eq, FromPrimitive)]
13pub enum Bash {
14    End = 0,
15    Word = 1,
16    For = 2,
17    Select = 3,
18    In = 4,
19    LPARENLPAREN = 5,
20    RPARENRPAREN = 6,
21    SEMI = 7,
22    COMMA = 8,
23    EQ = 9,
24    PLUSPLUS = 10,
25    DASHDASH = 11,
26    PLUSEQ = 12,
27    DASHEQ = 13,
28    STAREQ = 14,
29    SLASHEQ = 15,
30    PERCENTEQ = 16,
31    STARSTAREQ = 17,
32    LTLTEQ = 18,
33    GTGTEQ = 19,
34    AMPEQ = 20,
35    CARETEQ = 21,
36    PIPEEQ = 22,
37    PIPEPIPE = 23,
38    DASHo = 24,
39    AMPAMP = 25,
40    DASHa = 26,
41    PIPE = 27,
42    CARET = 28,
43    AMP = 29,
44    EQEQ = 30,
45    BANGEQ = 31,
46    LT = 32,
47    GT = 33,
48    LTEQ = 34,
49    GTEQ = 35,
50    LTLT = 36,
51    GTGT = 37,
52    PLUS = 38,
53    DASH = 39,
54    STAR = 40,
55    SLASH = 41,
56    PERCENT = 42,
57    STARSTAR = 43,
58    LPAREN = 44,
59    RPAREN = 45,
60    Word2 = 46,
61    While = 47,
62    Until = 48,
63    Do = 49,
64    Done = 50,
65    If = 51,
66    Then = 52,
67    Fi = 53,
68    Elif = 54,
69    Else = 55,
70    Case = 56,
71    Esac = 57,
72    SEMISEMI = 58,
73    SEMIAMP = 59,
74    SEMISEMIAMP = 60,
75    Function = 61,
76    LBRACE = 62,
77    RBRACE = 63,
78    PIPEAMP = 64,
79    BANG = 65,
80    LBRACK = 66,
81    RBRACK = 67,
82    LBRACKLBRACK = 68,
83    RBRACKRBRACK = 69,
84    Declare = 70,
85    Typeset = 71,
86    Export = 72,
87    Readonly = 73,
88    Local = 74,
89    Unset = 75,
90    Unsetenv = 76,
91    EQTILDE = 77,
92    AMPGT = 78,
93    AMPGTGT = 79,
94    LTAMP = 80,
95    GTAMP = 81,
96    GTPIPE = 82,
97    LTAMPDASH = 83,
98    GTAMPDASH = 84,
99    LTLTDASH = 85,
100    HeredocRedirectToken1 = 86,
101    LTLTLT = 87,
102    QMARK = 88,
103    COLON = 89,
104    PLUSPLUS2 = 90,
105    DASHDASH2 = 91,
106    DASH2 = 92,
107    PLUS2 = 93,
108    TILDE = 94,
109    DOLLARLPARENLPAREN = 95,
110    DOLLARLBRACK = 96,
111    Number = 97,
112    DOTDOT = 98,
113    RBRACE2 = 99,
114    BQUOTEBQUOTE = 100,
115    DOLLAR = 101,
116    SpecialCharacter = 102,
117    DQUOTE = 103,
118    StringContent = 104,
119    RawString = 105,
120    AnsiCString = 106,
121    NumberToken1 = 107,
122    NumberToken2 = 108,
123    HASH = 109,
124    DOLLARLBRACE = 110,
125    RBRACE3 = 111,
126    BANG2 = 112,
127    AT = 113,
128    STAR2 = 114,
129    HASH2 = 115,
130    EQ2 = 116,
131    COLONEQ = 117,
132    DASH3 = 118,
133    COLONDASH = 119,
134    PLUS3 = 120,
135    COLONPLUS = 121,
136    QMARK2 = 122,
137    COLONQMARK = 123,
138    PERCENTPERCENT = 124,
139    Regex = 125,
140    SLASHSLASH = 126,
141    SLASHHASH = 127,
142    SLASHPERCENT = 128,
143    COMMACOMMA = 129,
144    CARETCARET = 130,
145    U = 131,
146    U2 = 132,
147    L = 133,
148    Q = 134,
149    E = 135,
150    P = 136,
151    A = 137,
152    K = 138,
153    A2 = 139,
154    K2 = 140,
155    DOLLARLPAREN = 141,
156    BQUOTE = 142,
157    DOLLARBQUOTE = 143,
158    LTLPAREN = 144,
159    GTLPAREN = 145,
160    Comment = 146,
161    Word3 = 147,
162    VariableName = 148,
163    VariableName2 = 149,
164    SpecialVariableName = 150,
165    SpecialVariableName2 = 151,
166    HeredocStart = 152,
167    HeredocBody = 153,
168    HeredocBodyBeginning = 154,
169    HeredocContent = 155,
170    HeredocEnd = 156,
171    FileDescriptor = 157,
172    EmptyValue = 158,
173    Concat = 159,
174    VariableName3 = 160,
175    TestOperator = 161,
176    Regex2 = 162,
177    Regex3 = 163,
178    Regex4 = 164,
179    Word4 = 165,
180    ExtglobPattern = 166,
181    DOLLAR2 = 167,
182    LBRACE2 = 168,
183    HASHHASH = 169,
184    HASH3 = 170,
185    BANG3 = 171,
186    EQ3 = 172,
187    ErrorRecovery = 173,
188    Program = 174,
189    Statements = 175,
190    TerminatedStatement = 176,
191    StatementNotPipeline = 177,
192    RedirectedStatement = 178,
193    ForStatement = 179,
194    CStyleForStatement = 180,
195    ForBody = 181,
196    CExpression = 182,
197    CExpressionNotAssignment = 183,
198    VariableAssignment = 184,
199    UnaryExpression = 185,
200    BinaryExpression = 186,
201    PostfixExpression = 187,
202    ParenthesizedExpression = 188,
203    WhileStatement = 189,
204    DoGroup = 190,
205    IfStatement = 191,
206    ElifClause = 192,
207    ElseClause = 193,
208    CaseStatement = 194,
209    CaseItem = 195,
210    CaseItem2 = 196,
211    FunctionDefinition = 197,
212    CompoundStatement = 198,
213    Subshell = 199,
214    Pipeline = 200,
215    List = 201,
216    NegatedCommand = 202,
217    TestCommand = 203,
218    BinaryExpression2 = 204,
219    DeclarationCommand = 205,
220    UnsetCommand = 206,
221    Command = 207,
222    CommandName = 208,
223    VariableAssignment2 = 209,
224    VariableAssignments = 210,
225    Subscript = 211,
226    FileRedirect = 212,
227    HeredocRedirect = 213,
228    Pipeline2 = 214,
229    HeredocExpression = 215,
230    HeredocCommand = 216,
231    HeredocBody3 = 217,
232    HeredocBody2 = 218,
233    SimpleHeredocBody = 219,
234    HerestringRedirect = 220,
235    Expression = 221,
236    BinaryExpression3 = 222,
237    TernaryExpression = 223,
238    UnaryExpression2 = 224,
239    PostfixExpression2 = 225,
240    ParenthesizedExpression2 = 226,
241    ArithmeticExpansion = 227,
242    BraceExpression = 228,
243    ArithmeticExpression = 229,
244    ArithmeticLiteral = 230,
245    BinaryExpression4 = 231,
246    TernaryExpression2 = 232,
247    UnaryExpression3 = 233,
248    PostfixExpression3 = 234,
249    ParenthesizedExpression3 = 235,
250    Concatenation = 236,
251    String = 237,
252    TranslatedString = 238,
253    Array = 239,
254    Number2 = 240,
255    SimpleExpansion = 241,
256    Expansion = 242,
257    ExpansionBody = 243,
258    ExpansionExpression = 244,
259    ExpansionRegex = 245,
260    ExpansionRegexReplacement = 246,
261    ExpansionRegexRemoval = 247,
262    ExpansionMaxLength = 248,
263    ExpansionMaxLengthExpression = 249,
264    BinaryExpression5 = 250,
265    ExpansionOperator = 251,
266    Concatenation2 = 252,
267    CommandSubstitution = 253,
268    ProcessSubstitution = 254,
269    ExtglobBlob = 255,
270    CTerminator = 256,
271    StatementsRepeat1 = 257,
272    RedirectedStatementRepeat1 = 258,
273    RedirectedStatementRepeat2 = 259,
274    ForStatementRepeat1 = 260,
275    ForBodyRepeat1 = 261,
276    IfStatementRepeat1 = 262,
277    CaseStatementRepeat1 = 263,
278    CaseItemRepeat1 = 264,
279    CompoundStatementRepeat1 = 265,
280    PipelineRepeat1 = 266,
281    DeclarationCommandRepeat1 = 267,
282    UnsetCommandRepeat1 = 268,
283    CommandRepeat1 = 269,
284    CommandRepeat2 = 270,
285    VariableAssignmentsRepeat1 = 271,
286    HeredocBodyRepeat1 = 272,
287    LiteralRepeat1 = 273,
288    ArithmeticExpansionRepeat1 = 274,
289    ConcatenationRepeat1 = 275,
290    StringRepeat1 = 276,
291    ExpansionBodyRepeat1 = 277,
292    ExpansionRegexRepeat1 = 278,
293    ConcatenationInExpansionRepeat1 = 279,
294    Error = 280,
295}
296
297/// Each runtime kind id of `Bash` with tree-sitter's `named` and
298/// `visible` flags, in id order. A label for the id the enum identifies,
299/// read by the role-coverage gate; the generator's ERROR sentinel has no
300/// entry.
301pub const BASH_KIND_FLAGS: &[(u16, bool, bool)] = &[
302    (0, false, false),
303    (1, true, true),
304    (2, false, true),
305    (3, false, true),
306    (4, false, true),
307    (5, false, true),
308    (6, false, true),
309    (7, false, true),
310    (8, false, true),
311    (9, false, true),
312    (10, false, true),
313    (11, false, true),
314    (12, false, true),
315    (13, false, true),
316    (14, false, true),
317    (15, false, true),
318    (16, false, true),
319    (17, false, true),
320    (18, false, true),
321    (19, false, true),
322    (20, false, true),
323    (21, false, true),
324    (22, false, true),
325    (23, false, true),
326    (24, false, true),
327    (25, false, true),
328    (26, false, true),
329    (27, false, true),
330    (28, false, true),
331    (29, false, true),
332    (30, false, true),
333    (31, false, true),
334    (32, false, true),
335    (33, false, true),
336    (34, false, true),
337    (35, false, true),
338    (36, false, true),
339    (37, false, true),
340    (38, false, true),
341    (39, false, true),
342    (40, false, true),
343    (41, false, true),
344    (42, false, true),
345    (43, false, true),
346    (44, false, true),
347    (45, false, true),
348    (46, true, true),
349    (47, false, true),
350    (48, false, true),
351    (49, false, true),
352    (50, false, true),
353    (51, false, true),
354    (52, false, true),
355    (53, false, true),
356    (54, false, true),
357    (55, false, true),
358    (56, false, true),
359    (57, false, true),
360    (58, false, true),
361    (59, false, true),
362    (60, false, true),
363    (61, false, true),
364    (62, false, true),
365    (63, false, true),
366    (64, false, true),
367    (65, false, true),
368    (66, false, true),
369    (67, false, true),
370    (68, false, true),
371    (69, false, true),
372    (70, false, true),
373    (71, false, true),
374    (72, false, true),
375    (73, false, true),
376    (74, false, true),
377    (75, false, true),
378    (76, false, true),
379    (77, false, true),
380    (78, false, true),
381    (79, false, true),
382    (80, false, true),
383    (81, false, true),
384    (82, false, true),
385    (83, false, true),
386    (84, false, true),
387    (85, false, true),
388    (86, false, false),
389    (87, false, true),
390    (88, false, true),
391    (89, false, true),
392    (90, false, true),
393    (91, false, true),
394    (92, false, true),
395    (93, false, true),
396    (94, false, true),
397    (95, false, true),
398    (96, false, true),
399    (97, true, true),
400    (98, false, true),
401    (99, false, true),
402    (100, false, true),
403    (101, false, true),
404    (102, false, false),
405    (103, false, true),
406    (104, true, true),
407    (105, true, true),
408    (106, true, true),
409    (107, false, false),
410    (108, false, false),
411    (109, false, true),
412    (110, false, true),
413    (111, false, true),
414    (112, false, true),
415    (113, false, true),
416    (114, false, true),
417    (115, false, true),
418    (116, false, true),
419    (117, false, true),
420    (118, false, true),
421    (119, false, true),
422    (120, false, true),
423    (121, false, true),
424    (122, false, true),
425    (123, false, true),
426    (124, false, true),
427    (125, true, true),
428    (126, false, true),
429    (127, false, true),
430    (128, false, true),
431    (129, false, true),
432    (130, false, true),
433    (131, false, true),
434    (132, false, true),
435    (133, false, true),
436    (134, false, true),
437    (135, false, true),
438    (136, false, true),
439    (137, false, true),
440    (138, false, true),
441    (139, false, true),
442    (140, false, true),
443    (141, false, true),
444    (142, false, true),
445    (143, false, true),
446    (144, false, true),
447    (145, false, true),
448    (146, true, true),
449    (147, true, true),
450    (148, true, true),
451    (149, true, true),
452    (150, true, true),
453    (151, true, true),
454    (152, true, true),
455    (153, true, true),
456    (154, false, false),
457    (155, true, true),
458    (156, true, true),
459    (157, true, true),
460    (158, false, false),
461    (159, false, false),
462    (160, true, true),
463    (161, true, true),
464    (162, true, true),
465    (163, true, true),
466    (164, true, true),
467    (165, true, true),
468    (166, true, true),
469    (167, false, true),
470    (168, false, true),
471    (169, false, true),
472    (170, false, true),
473    (171, false, true),
474    (172, false, true),
475    (173, false, false),
476    (174, true, true),
477    (175, false, false),
478    (176, false, false),
479    (177, false, false),
480    (178, true, true),
481    (179, true, true),
482    (180, true, true),
483    (181, false, false),
484    (182, false, false),
485    (183, false, false),
486    (184, true, true),
487    (185, true, true),
488    (186, true, true),
489    (187, true, true),
490    (188, true, true),
491    (189, true, true),
492    (190, true, true),
493    (191, true, true),
494    (192, true, true),
495    (193, true, true),
496    (194, true, true),
497    (195, true, true),
498    (196, true, true),
499    (197, true, true),
500    (198, true, true),
501    (199, true, true),
502    (200, true, true),
503    (201, true, true),
504    (202, true, true),
505    (203, true, true),
506    (204, true, true),
507    (205, true, true),
508    (206, true, true),
509    (207, true, true),
510    (208, true, true),
511    (209, true, true),
512    (210, true, true),
513    (211, true, true),
514    (212, true, true),
515    (213, true, true),
516    (214, true, true),
517    (215, false, false),
518    (216, false, false),
519    (217, false, false),
520    (218, true, true),
521    (219, false, false),
522    (220, true, true),
523    (221, false, false),
524    (222, true, true),
525    (223, true, true),
526    (224, true, true),
527    (225, true, true),
528    (226, true, true),
529    (227, true, true),
530    (228, true, true),
531    (229, false, false),
532    (230, false, false),
533    (231, true, true),
534    (232, true, true),
535    (233, true, true),
536    (234, true, true),
537    (235, true, true),
538    (236, true, true),
539    (237, true, true),
540    (238, true, true),
541    (239, true, true),
542    (240, true, true),
543    (241, true, true),
544    (242, true, true),
545    (243, false, false),
546    (244, false, false),
547    (245, false, false),
548    (246, false, false),
549    (247, false, false),
550    (248, false, false),
551    (249, false, false),
552    (250, true, true),
553    (251, false, false),
554    (252, true, true),
555    (253, true, true),
556    (254, true, true),
557    (255, false, false),
558    (256, false, false),
559    (257, false, false),
560    (258, false, false),
561    (259, false, false),
562    (260, false, false),
563    (261, false, false),
564    (262, false, false),
565    (263, false, false),
566    (264, false, false),
567    (265, false, false),
568    (266, false, false),
569    (267, false, false),
570    (268, false, false),
571    (269, false, false),
572    (270, false, false),
573    (271, false, false),
574    (272, false, false),
575    (273, false, false),
576    (274, false, false),
577    (275, false, false),
578    (276, false, false),
579    (277, false, false),
580    (278, false, false),
581    (279, false, false),
582];
583
584impl From<Bash> for &'static str {
585    #[inline]
586    fn from(tok: Bash) -> Self {
587        match tok {
588            Bash::End => "end",
589            Bash::Word => "word",
590            Bash::For => "for",
591            Bash::Select => "select",
592            Bash::In => "in",
593            Bash::LPARENLPAREN => "((",
594            Bash::RPARENRPAREN => "))",
595            Bash::SEMI => ";",
596            Bash::COMMA => ",",
597            Bash::EQ => "=",
598            Bash::PLUSPLUS => "++",
599            Bash::DASHDASH => "--",
600            Bash::PLUSEQ => "+=",
601            Bash::DASHEQ => "-=",
602            Bash::STAREQ => "*=",
603            Bash::SLASHEQ => "/=",
604            Bash::PERCENTEQ => "%=",
605            Bash::STARSTAREQ => "**=",
606            Bash::LTLTEQ => "<<=",
607            Bash::GTGTEQ => ">>=",
608            Bash::AMPEQ => "&=",
609            Bash::CARETEQ => "^=",
610            Bash::PIPEEQ => "|=",
611            Bash::PIPEPIPE => "||",
612            Bash::DASHo => "-o",
613            Bash::AMPAMP => "&&",
614            Bash::DASHa => "-a",
615            Bash::PIPE => "|",
616            Bash::CARET => "^",
617            Bash::AMP => "&",
618            Bash::EQEQ => "==",
619            Bash::BANGEQ => "!=",
620            Bash::LT => "<",
621            Bash::GT => ">",
622            Bash::LTEQ => "<=",
623            Bash::GTEQ => ">=",
624            Bash::LTLT => "<<",
625            Bash::GTGT => ">>",
626            Bash::PLUS => "+",
627            Bash::DASH => "-",
628            Bash::STAR => "*",
629            Bash::SLASH => "/",
630            Bash::PERCENT => "%",
631            Bash::STARSTAR => "**",
632            Bash::LPAREN => "(",
633            Bash::RPAREN => ")",
634            Bash::Word2 => "word",
635            Bash::While => "while",
636            Bash::Until => "until",
637            Bash::Do => "do",
638            Bash::Done => "done",
639            Bash::If => "if",
640            Bash::Then => "then",
641            Bash::Fi => "fi",
642            Bash::Elif => "elif",
643            Bash::Else => "else",
644            Bash::Case => "case",
645            Bash::Esac => "esac",
646            Bash::SEMISEMI => ";;",
647            Bash::SEMIAMP => ";&",
648            Bash::SEMISEMIAMP => ";;&",
649            Bash::Function => "function",
650            Bash::LBRACE => "{",
651            Bash::RBRACE => "}",
652            Bash::PIPEAMP => "|&",
653            Bash::BANG => "!",
654            Bash::LBRACK => "[",
655            Bash::RBRACK => "]",
656            Bash::LBRACKLBRACK => "[[",
657            Bash::RBRACKRBRACK => "]]",
658            Bash::Declare => "declare",
659            Bash::Typeset => "typeset",
660            Bash::Export => "export",
661            Bash::Readonly => "readonly",
662            Bash::Local => "local",
663            Bash::Unset => "unset",
664            Bash::Unsetenv => "unsetenv",
665            Bash::EQTILDE => "=~",
666            Bash::AMPGT => "&>",
667            Bash::AMPGTGT => "&>>",
668            Bash::LTAMP => "<&",
669            Bash::GTAMP => ">&",
670            Bash::GTPIPE => ">|",
671            Bash::LTAMPDASH => "<&-",
672            Bash::GTAMPDASH => ">&-",
673            Bash::LTLTDASH => "<<-",
674            Bash::HeredocRedirectToken1 => "heredoc_redirect_token1",
675            Bash::LTLTLT => "<<<",
676            Bash::QMARK => "?",
677            Bash::COLON => ":",
678            Bash::PLUSPLUS2 => "++",
679            Bash::DASHDASH2 => "--",
680            Bash::DASH2 => "-",
681            Bash::PLUS2 => "+",
682            Bash::TILDE => "~",
683            Bash::DOLLARLPARENLPAREN => "$((",
684            Bash::DOLLARLBRACK => "$[",
685            Bash::Number => "number",
686            Bash::DOTDOT => "..",
687            Bash::RBRACE2 => "}",
688            Bash::BQUOTEBQUOTE => "``",
689            Bash::DOLLAR => "$",
690            Bash::SpecialCharacter => "_special_character",
691            Bash::DQUOTE => "\"",
692            Bash::StringContent => "string_content",
693            Bash::RawString => "raw_string",
694            Bash::AnsiCString => "ansi_c_string",
695            Bash::NumberToken1 => "number_token1",
696            Bash::NumberToken2 => "number_token2",
697            Bash::HASH => "#",
698            Bash::DOLLARLBRACE => "${",
699            Bash::RBRACE3 => "}",
700            Bash::BANG2 => "!",
701            Bash::AT => "@",
702            Bash::STAR2 => "*",
703            Bash::HASH2 => "#",
704            Bash::EQ2 => "=",
705            Bash::COLONEQ => ":=",
706            Bash::DASH3 => "-",
707            Bash::COLONDASH => ":-",
708            Bash::PLUS3 => "+",
709            Bash::COLONPLUS => ":+",
710            Bash::QMARK2 => "?",
711            Bash::COLONQMARK => ":?",
712            Bash::PERCENTPERCENT => "%%",
713            Bash::Regex => "regex",
714            Bash::SLASHSLASH => "//",
715            Bash::SLASHHASH => "/#",
716            Bash::SLASHPERCENT => "/%",
717            Bash::COMMACOMMA => ",,",
718            Bash::CARETCARET => "^^",
719            Bash::U => "U",
720            Bash::U2 => "u",
721            Bash::L => "L",
722            Bash::Q => "Q",
723            Bash::E => "E",
724            Bash::P => "P",
725            Bash::A => "A",
726            Bash::K => "K",
727            Bash::A2 => "a",
728            Bash::K2 => "k",
729            Bash::DOLLARLPAREN => "$(",
730            Bash::BQUOTE => "`",
731            Bash::DOLLARBQUOTE => "$`",
732            Bash::LTLPAREN => "<(",
733            Bash::GTLPAREN => ">(",
734            Bash::Comment => "comment",
735            Bash::Word3 => "word",
736            Bash::VariableName => "variable_name",
737            Bash::VariableName2 => "variable_name",
738            Bash::SpecialVariableName => "special_variable_name",
739            Bash::SpecialVariableName2 => "special_variable_name",
740            Bash::HeredocStart => "heredoc_start",
741            Bash::HeredocBody => "heredoc_body",
742            Bash::HeredocBodyBeginning => "_heredoc_body_beginning",
743            Bash::HeredocContent => "heredoc_content",
744            Bash::HeredocEnd => "heredoc_end",
745            Bash::FileDescriptor => "file_descriptor",
746            Bash::EmptyValue => "_empty_value",
747            Bash::Concat => "_concat",
748            Bash::VariableName3 => "variable_name",
749            Bash::TestOperator => "test_operator",
750            Bash::Regex2 => "regex",
751            Bash::Regex3 => "regex",
752            Bash::Regex4 => "regex",
753            Bash::Word4 => "word",
754            Bash::ExtglobPattern => "extglob_pattern",
755            Bash::DOLLAR2 => "$",
756            Bash::LBRACE2 => "{",
757            Bash::HASHHASH => "##",
758            Bash::HASH3 => "#",
759            Bash::BANG3 => "!",
760            Bash::EQ3 => "=",
761            Bash::ErrorRecovery => "__error_recovery",
762            Bash::Program => "program",
763            Bash::Statements => "_statements",
764            Bash::TerminatedStatement => "_terminated_statement",
765            Bash::StatementNotPipeline => "_statement_not_pipeline",
766            Bash::RedirectedStatement => "redirected_statement",
767            Bash::ForStatement => "for_statement",
768            Bash::CStyleForStatement => "c_style_for_statement",
769            Bash::ForBody => "_for_body",
770            Bash::CExpression => "_c_expression",
771            Bash::CExpressionNotAssignment => "_c_expression_not_assignment",
772            Bash::VariableAssignment => "variable_assignment",
773            Bash::UnaryExpression => "unary_expression",
774            Bash::BinaryExpression => "binary_expression",
775            Bash::PostfixExpression => "postfix_expression",
776            Bash::ParenthesizedExpression => "parenthesized_expression",
777            Bash::WhileStatement => "while_statement",
778            Bash::DoGroup => "do_group",
779            Bash::IfStatement => "if_statement",
780            Bash::ElifClause => "elif_clause",
781            Bash::ElseClause => "else_clause",
782            Bash::CaseStatement => "case_statement",
783            Bash::CaseItem => "case_item",
784            Bash::CaseItem2 => "case_item",
785            Bash::FunctionDefinition => "function_definition",
786            Bash::CompoundStatement => "compound_statement",
787            Bash::Subshell => "subshell",
788            Bash::Pipeline => "pipeline",
789            Bash::List => "list",
790            Bash::NegatedCommand => "negated_command",
791            Bash::TestCommand => "test_command",
792            Bash::BinaryExpression2 => "binary_expression",
793            Bash::DeclarationCommand => "declaration_command",
794            Bash::UnsetCommand => "unset_command",
795            Bash::Command => "command",
796            Bash::CommandName => "command_name",
797            Bash::VariableAssignment2 => "variable_assignment",
798            Bash::VariableAssignments => "variable_assignments",
799            Bash::Subscript => "subscript",
800            Bash::FileRedirect => "file_redirect",
801            Bash::HeredocRedirect => "heredoc_redirect",
802            Bash::Pipeline2 => "pipeline",
803            Bash::HeredocExpression => "_heredoc_expression",
804            Bash::HeredocCommand => "_heredoc_command",
805            Bash::HeredocBody3 => "_heredoc_body",
806            Bash::HeredocBody2 => "heredoc_body",
807            Bash::SimpleHeredocBody => "_simple_heredoc_body",
808            Bash::HerestringRedirect => "herestring_redirect",
809            Bash::Expression => "_expression",
810            Bash::BinaryExpression3 => "binary_expression",
811            Bash::TernaryExpression => "ternary_expression",
812            Bash::UnaryExpression2 => "unary_expression",
813            Bash::PostfixExpression2 => "postfix_expression",
814            Bash::ParenthesizedExpression2 => "parenthesized_expression",
815            Bash::ArithmeticExpansion => "arithmetic_expansion",
816            Bash::BraceExpression => "brace_expression",
817            Bash::ArithmeticExpression => "_arithmetic_expression",
818            Bash::ArithmeticLiteral => "_arithmetic_literal",
819            Bash::BinaryExpression4 => "binary_expression",
820            Bash::TernaryExpression2 => "ternary_expression",
821            Bash::UnaryExpression3 => "unary_expression",
822            Bash::PostfixExpression3 => "postfix_expression",
823            Bash::ParenthesizedExpression3 => "parenthesized_expression",
824            Bash::Concatenation => "concatenation",
825            Bash::String => "string",
826            Bash::TranslatedString => "translated_string",
827            Bash::Array => "array",
828            Bash::Number2 => "number",
829            Bash::SimpleExpansion => "simple_expansion",
830            Bash::Expansion => "expansion",
831            Bash::ExpansionBody => "_expansion_body",
832            Bash::ExpansionExpression => "_expansion_expression",
833            Bash::ExpansionRegex => "_expansion_regex",
834            Bash::ExpansionRegexReplacement => "_expansion_regex_replacement",
835            Bash::ExpansionRegexRemoval => "_expansion_regex_removal",
836            Bash::ExpansionMaxLength => "_expansion_max_length",
837            Bash::ExpansionMaxLengthExpression => "_expansion_max_length_expression",
838            Bash::BinaryExpression5 => "binary_expression",
839            Bash::ExpansionOperator => "_expansion_operator",
840            Bash::Concatenation2 => "concatenation",
841            Bash::CommandSubstitution => "command_substitution",
842            Bash::ProcessSubstitution => "process_substitution",
843            Bash::ExtglobBlob => "_extglob_blob",
844            Bash::CTerminator => "_c_terminator",
845            Bash::StatementsRepeat1 => "_statements_repeat1",
846            Bash::RedirectedStatementRepeat1 => "redirected_statement_repeat1",
847            Bash::RedirectedStatementRepeat2 => "redirected_statement_repeat2",
848            Bash::ForStatementRepeat1 => "for_statement_repeat1",
849            Bash::ForBodyRepeat1 => "_for_body_repeat1",
850            Bash::IfStatementRepeat1 => "if_statement_repeat1",
851            Bash::CaseStatementRepeat1 => "case_statement_repeat1",
852            Bash::CaseItemRepeat1 => "case_item_repeat1",
853            Bash::CompoundStatementRepeat1 => "compound_statement_repeat1",
854            Bash::PipelineRepeat1 => "pipeline_repeat1",
855            Bash::DeclarationCommandRepeat1 => "declaration_command_repeat1",
856            Bash::UnsetCommandRepeat1 => "unset_command_repeat1",
857            Bash::CommandRepeat1 => "command_repeat1",
858            Bash::CommandRepeat2 => "command_repeat2",
859            Bash::VariableAssignmentsRepeat1 => "variable_assignments_repeat1",
860            Bash::HeredocBodyRepeat1 => "heredoc_body_repeat1",
861            Bash::LiteralRepeat1 => "_literal_repeat1",
862            Bash::ArithmeticExpansionRepeat1 => "arithmetic_expansion_repeat1",
863            Bash::ConcatenationRepeat1 => "concatenation_repeat1",
864            Bash::StringRepeat1 => "string_repeat1",
865            Bash::ExpansionBodyRepeat1 => "_expansion_body_repeat1",
866            Bash::ExpansionRegexRepeat1 => "_expansion_regex_repeat1",
867            Bash::ConcatenationInExpansionRepeat1 => "_concatenation_in_expansion_repeat1",
868            Bash::Error => "ERROR",
869        }
870    }
871}
872
873impl From<u16> for Bash {
874    #[inline]
875    fn from(x: u16) -> Self {
876        num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
877    }
878}
879
880// Bash == u16
881impl PartialEq<u16> for Bash {
882    #[inline]
883    fn eq(&self, x: &u16) -> bool {
884        *self == Into::<Self>::into(*x)
885    }
886}
887
888// u16 == Bash
889impl PartialEq<Bash> for u16 {
890    #[inline]
891    fn eq(&self, x: &Bash) -> bool {
892        *x == *self
893    }
894}