Skip to main content

big_code_analysis_ast/languages/
language_ruby.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 Ruby {
14    End = 0,
15    Identifier = 1,
16    ProgramToken1 = 2,
17    Uninterpreted = 3,
18    BEGIN = 4,
19    LBRACE = 5,
20    RBRACE = 6,
21    END = 7,
22    Def = 8,
23    LPAREN = 9,
24    RPAREN = 10,
25    DOT = 11,
26    COLONCOLON = 12,
27    End2 = 13,
28    Rescue2 = 14,
29    EQ = 15,
30    COMMA = 16,
31    PIPE = 17,
32    SEMI = 18,
33    DOTDOTDOT = 19,
34    STAR = 20,
35    STARSTAR = 21,
36    Nil2 = 22,
37    AMP = 23,
38    COLON = 24,
39    Class2 = 25,
40    LT = 26,
41    Module2 = 27,
42    Return3 = 28,
43    Yield3 = 29,
44    Break3 = 30,
45    Next3 = 31,
46    Redo2 = 32,
47    Retry2 = 33,
48    If2 = 34,
49    Unless2 = 35,
50    While2 = 36,
51    Until2 = 37,
52    For2 = 38,
53    In2 = 39,
54    Do2 = 40,
55    Case2 = 41,
56    When2 = 42,
57    EQGT = 43,
58    LBRACK = 44,
59    RBRACK = 45,
60    LBRACK2 = 46,
61    LPAREN2 = 47,
62    DOTDOT = 48,
63    Line = 49,
64    File = 50,
65    Encoding = 51,
66    CARET = 52,
67    Elsif2 = 53,
68    Else2 = 54,
69    Then2 = 55,
70    Begin2 = 56,
71    Ensure2 = 57,
72    COLONCOLON2 = 58,
73    AMPDOT = 59,
74    PLUSEQ = 60,
75    DASHEQ = 61,
76    STAREQ = 62,
77    STARSTAREQ = 63,
78    SLASHEQ = 64,
79    PIPEPIPEEQ = 65,
80    PIPEEQ = 66,
81    AMPAMPEQ = 67,
82    AMPEQ = 68,
83    PERCENTEQ = 69,
84    GTGTEQ = 70,
85    LTLTEQ = 71,
86    CARETEQ = 72,
87    QMARK = 73,
88    COLON2 = 74,
89    And = 75,
90    Or = 76,
91    PIPEPIPE = 77,
92    AMPAMP = 78,
93    LTLT = 79,
94    GTGT = 80,
95    LTEQ = 81,
96    GT = 82,
97    GTEQ = 83,
98    PLUS = 84,
99    SLASH = 85,
100    PERCENT = 86,
101    EQEQ = 87,
102    BANGEQ = 88,
103    EQEQEQ = 89,
104    LTEQGT = 90,
105    EQTILDE = 91,
106    BANGTILDE = 92,
107    DefinedQMARK = 93,
108    Not = 94,
109    BANG = 95,
110    TILDE = 96,
111    DASH = 97,
112    PLUSAT = 98,
113    DASHAT = 99,
114    TILDEAT = 100,
115    LBRACKRBRACK = 101,
116    LBRACKRBRACKEQ = 102,
117    BQUOTE = 103,
118    EQ2 = 104,
119    Undef2 = 105,
120    Alias2 = 106,
121    Comment = 107,
122    Integer = 108,
123    Float = 109,
124    I = 110,
125    Ri = 111,
126    R = 112,
127    Super = 113,
128    Zelf = 114,
129    True = 115,
130    False = 116,
131    Constant = 117,
132    ConstantSuffixToken1 = 118,
133    IdentifierSuffixToken1 = 119,
134    InstanceVariable = 120,
135    ClassVariable = 121,
136    GlobalVariable = 122,
137    Character = 123,
138    HASHLBRACE = 124,
139    StringArrayToken1 = 125,
140    EscapeSequence = 126,
141    DASHGT = 127,
142    LineBreak = 128,
143    NoLineBreak = 129,
144    SimpleSymbol = 130,
145    DQUOTE = 131,
146    COLONDQUOTE = 132,
147    BQUOTE2 = 133,
148    SLASH2 = 134,
149    PERCENTwLPAREN = 135,
150    PERCENTiLPAREN = 136,
151    HeredocBodyStart = 137,
152    StringContent = 138,
153    HeredocContent = 139,
154    RPAREN2 = 140,
155    HeredocEnd = 141,
156    HeredocBeginning = 142,
157    AMP2 = 143,
158    STAR2 = 144,
159    DASH2 = 145,
160    DASH3 = 146,
161    DASH4 = 147,
162    STAR3 = 148,
163    LTLT2 = 149,
164    HashKeySymbol = 150,
165    IdentifierSuffix = 151,
166    ConstantSuffix = 152,
167    STARSTAR2 = 153,
168    STARSTAR3 = 154,
169    LBRACK3 = 155,
170    ShortInterpolation = 156,
171    Program = 157,
172    BlockBody = 158,
173    Statements = 159,
174    BeginBlock = 160,
175    EndBlock = 161,
176    Statement = 162,
177    Method = 163,
178    SingletonMethod = 164,
179    MethodRest = 165,
180    RescueModifier = 166,
181    RescueModifier2 = 167,
182    BodyExpr = 168,
183    MethodParameters = 169,
184    MethodParameters2 = 170,
185    BlockParameters = 171,
186    FormalParameter = 172,
187    SimpleFormalParameter = 173,
188    ForwardParameter = 174,
189    SplatParameter = 175,
190    HashSplatParameter = 176,
191    HashSplatNil = 177,
192    BlockParameter = 178,
193    KeywordParameter = 179,
194    OptionalParameter = 180,
195    Class = 181,
196    Superclass = 182,
197    SingletonClass = 183,
198    Module = 184,
199    Return = 185,
200    Yield = 186,
201    Break = 187,
202    Next = 188,
203    Return2 = 189,
204    Yield2 = 190,
205    Break2 = 191,
206    Next2 = 192,
207    Redo = 193,
208    Retry = 194,
209    IfModifier = 195,
210    UnlessModifier = 196,
211    WhileModifier = 197,
212    UntilModifier = 198,
213    RescueModifier3 = 199,
214    While = 200,
215    Until = 201,
216    For = 202,
217    In = 203,
218    Do = 204,
219    Case = 205,
220    CaseMatch = 206,
221    When = 207,
222    InClause = 208,
223    Pattern = 209,
224    Guard = 210,
225    IfGuard = 211,
226    UnlessGuard = 212,
227    PatternTopExprBody = 213,
228    ArrayPatternN = 214,
229    PatternExpr = 215,
230    AsPattern = 216,
231    PatternExprAlt = 217,
232    AlternativePattern = 218,
233    ArrayPatternBody = 219,
234    ArrayPattern = 220,
235    FindPatternBody = 221,
236    FindPattern = 222,
237    HashPatternBody = 223,
238    KeywordPattern = 224,
239    HashPatternAnyRest = 225,
240    HashPattern = 226,
241    PatternExprBasic = 227,
242    ParenthesizedPattern = 228,
243    PatternValue = 229,
244    Range = 230,
245    PatternPrimitive = 231,
246    PatternLambda = 232,
247    PatternLiteral = 233,
248    KeywordVariable = 234,
249    VariableReferencePattern = 235,
250    ExpressionReferencePattern = 236,
251    PatternConstant = 237,
252    ScopeResolution = 238,
253    If = 239,
254    Unless = 240,
255    Elsif = 241,
256    Else = 242,
257    Then = 243,
258    Begin = 244,
259    Ensure = 245,
260    Rescue = 246,
261    Exceptions = 247,
262    ExceptionVariable = 248,
263    BodyStatement = 249,
264    BodyStatement2 = 250,
265    Expression = 251,
266    MatchPattern = 252,
267    TestPattern = 253,
268    Arg = 254,
269    Unary = 255,
270    Binary = 256,
271    Primary = 257,
272    ParenthesizedStatements = 258,
273    ElementReference = 259,
274    ScopeResolution2 = 260,
275    Call5 = 261,
276    Call = 262,
277    Call2 = 263,
278    ChainedCommandCall = 264,
279    Call3 = 265,
280    ArgumentList = 266,
281    ArgumentList2 = 267,
282    ArgumentListWithTrailingComma = 268,
283    Argument = 269,
284    ForwardArgument = 270,
285    SplatArgument = 271,
286    HashSplatArgument = 272,
287    BlockArgument = 273,
288    DoBlock = 274,
289    Block = 275,
290    Assignment = 276,
291    Assignment2 = 277,
292    OperatorAssignment = 278,
293    OperatorAssignment2 = 279,
294    Conditional = 280,
295    Range2 = 281,
296    Binary2 = 282,
297    Binary3 = 283,
298    Unary2 = 284,
299    Unary3 = 285,
300    Unary4 = 286,
301    Unary5 = 287,
302    Literal = 288,
303    Numeric = 289,
304    SimpleNumeric = 290,
305    RightAssignmentList = 291,
306    LeftAssignmentList = 292,
307    Mlhs = 293,
308    DestructuredLeftAssignment = 294,
309    RestAssignment = 295,
310    FunctionIdentifier = 296,
311    Call4 = 297,
312    Lhs = 298,
313    Variable = 299,
314    Operator = 300,
315    MethodName = 301,
316    NonlocalVariable = 302,
317    Setter = 303,
318    Undef = 304,
319    Alias = 305,
320    IntOrFloat = 306,
321    Complex = 307,
322    Rational = 308,
323    Nil = 309,
324    HashKeySymbol2 = 310,
325    HashKeySymbol3 = 311,
326    ChainedString = 312,
327    Interpolation = 313,
328    String = 314,
329    Subshell = 315,
330    StringArray = 316,
331    SymbolArray = 317,
332    DelimitedSymbol = 318,
333    Regex = 319,
334    HeredocBody = 320,
335    LiteralContents = 321,
336    Array = 322,
337    Hash = 323,
338    Pair = 324,
339    Lambda = 325,
340    EmptyStatement = 326,
341    Terminator = 327,
342    StatementsRepeat1 = 328,
343    ParametersRepeat1 = 329,
344    BlockParametersRepeat1 = 330,
345    CaseRepeat1 = 331,
346    CaseMatchRepeat1 = 332,
347    WhenRepeat1 = 333,
348    ArrayPatternNRepeat1 = 334,
349    AlternativePatternRepeat1 = 335,
350    HashPatternBodyRepeat1 = 336,
351    ExceptionsRepeat1 = 337,
352    BodyStatementRepeat1 = 338,
353    CommandArgumentListRepeat1 = 339,
354    MlhsRepeat1 = 340,
355    UndefRepeat1 = 341,
356    ChainedStringRepeat1 = 342,
357    StringArrayRepeat1 = 343,
358    SymbolArrayRepeat1 = 344,
359    HeredocBodyRepeat1 = 345,
360    HashRepeat1 = 346,
361    BareString = 347,
362    BareSymbol = 348,
363    DestructuredParameter = 349,
364    LambdaParameters = 350,
365    Error = 351,
366}
367
368impl From<Ruby> for &'static str {
369    #[inline]
370    fn from(tok: Ruby) -> Self {
371        match tok {
372            Ruby::End => "end",
373            Ruby::Identifier => "identifier",
374            Ruby::ProgramToken1 => "program_token1",
375            Ruby::Uninterpreted => "uninterpreted",
376            Ruby::BEGIN => "BEGIN",
377            Ruby::LBRACE => "{",
378            Ruby::RBRACE => "}",
379            Ruby::END => "END",
380            Ruby::Def => "def",
381            Ruby::LPAREN => "(",
382            Ruby::RPAREN => ")",
383            Ruby::DOT => ".",
384            Ruby::COLONCOLON => "::",
385            Ruby::End2 => "end",
386            Ruby::Rescue2 => "rescue",
387            Ruby::EQ => "=",
388            Ruby::COMMA => ",",
389            Ruby::PIPE => "|",
390            Ruby::SEMI => ";",
391            Ruby::DOTDOTDOT => "...",
392            Ruby::STAR => "*",
393            Ruby::STARSTAR => "**",
394            Ruby::Nil2 => "nil",
395            Ruby::AMP => "&",
396            Ruby::COLON => ":",
397            Ruby::Class2 => "class",
398            Ruby::LT => "<",
399            Ruby::Module2 => "module",
400            Ruby::Return3 => "return",
401            Ruby::Yield3 => "yield",
402            Ruby::Break3 => "break",
403            Ruby::Next3 => "next",
404            Ruby::Redo2 => "redo",
405            Ruby::Retry2 => "retry",
406            Ruby::If2 => "if",
407            Ruby::Unless2 => "unless",
408            Ruby::While2 => "while",
409            Ruby::Until2 => "until",
410            Ruby::For2 => "for",
411            Ruby::In2 => "in",
412            Ruby::Do2 => "do",
413            Ruby::Case2 => "case",
414            Ruby::When2 => "when",
415            Ruby::EQGT => "=>",
416            Ruby::LBRACK => "[",
417            Ruby::RBRACK => "]",
418            Ruby::LBRACK2 => "[",
419            Ruby::LPAREN2 => "(",
420            Ruby::DOTDOT => "..",
421            Ruby::Line => "line",
422            Ruby::File => "file",
423            Ruby::Encoding => "encoding",
424            Ruby::CARET => "^",
425            Ruby::Elsif2 => "elsif",
426            Ruby::Else2 => "else",
427            Ruby::Then2 => "then",
428            Ruby::Begin2 => "begin",
429            Ruby::Ensure2 => "ensure",
430            Ruby::COLONCOLON2 => "::",
431            Ruby::AMPDOT => "&.",
432            Ruby::PLUSEQ => "+=",
433            Ruby::DASHEQ => "-=",
434            Ruby::STAREQ => "*=",
435            Ruby::STARSTAREQ => "**=",
436            Ruby::SLASHEQ => "/=",
437            Ruby::PIPEPIPEEQ => "||=",
438            Ruby::PIPEEQ => "|=",
439            Ruby::AMPAMPEQ => "&&=",
440            Ruby::AMPEQ => "&=",
441            Ruby::PERCENTEQ => "%=",
442            Ruby::GTGTEQ => ">>=",
443            Ruby::LTLTEQ => "<<=",
444            Ruby::CARETEQ => "^=",
445            Ruby::QMARK => "?",
446            Ruby::COLON2 => ":",
447            Ruby::And => "and",
448            Ruby::Or => "or",
449            Ruby::PIPEPIPE => "||",
450            Ruby::AMPAMP => "&&",
451            Ruby::LTLT => "<<",
452            Ruby::GTGT => ">>",
453            Ruby::LTEQ => "<=",
454            Ruby::GT => ">",
455            Ruby::GTEQ => ">=",
456            Ruby::PLUS => "+",
457            Ruby::SLASH => "/",
458            Ruby::PERCENT => "%",
459            Ruby::EQEQ => "==",
460            Ruby::BANGEQ => "!=",
461            Ruby::EQEQEQ => "===",
462            Ruby::LTEQGT => "<=>",
463            Ruby::EQTILDE => "=~",
464            Ruby::BANGTILDE => "!~",
465            Ruby::DefinedQMARK => "defined?",
466            Ruby::Not => "not",
467            Ruby::BANG => "!",
468            Ruby::TILDE => "~",
469            Ruby::DASH => "-",
470            Ruby::PLUSAT => "+@",
471            Ruby::DASHAT => "-@",
472            Ruby::TILDEAT => "~@",
473            Ruby::LBRACKRBRACK => "[]",
474            Ruby::LBRACKRBRACKEQ => "[]=",
475            Ruby::BQUOTE => "`",
476            Ruby::EQ2 => "=",
477            Ruby::Undef2 => "undef",
478            Ruby::Alias2 => "alias",
479            Ruby::Comment => "comment",
480            Ruby::Integer => "integer",
481            Ruby::Float => "float",
482            Ruby::I => "i",
483            Ruby::Ri => "ri",
484            Ruby::R => "r",
485            Ruby::Super => "super",
486            Ruby::Zelf => "self",
487            Ruby::True => "true",
488            Ruby::False => "false",
489            Ruby::Constant => "constant",
490            Ruby::ConstantSuffixToken1 => "constant_suffix_token1",
491            Ruby::IdentifierSuffixToken1 => "identifier_suffix_token1",
492            Ruby::InstanceVariable => "instance_variable",
493            Ruby::ClassVariable => "class_variable",
494            Ruby::GlobalVariable => "global_variable",
495            Ruby::Character => "character",
496            Ruby::HASHLBRACE => "#{",
497            Ruby::StringArrayToken1 => "string_array_token1",
498            Ruby::EscapeSequence => "escape_sequence",
499            Ruby::DASHGT => "->",
500            Ruby::LineBreak => "_line_break",
501            Ruby::NoLineBreak => "_no_line_break",
502            Ruby::SimpleSymbol => "simple_symbol",
503            Ruby::DQUOTE => "\"",
504            Ruby::COLONDQUOTE => ":\"",
505            Ruby::BQUOTE2 => "`",
506            Ruby::SLASH2 => "/",
507            Ruby::PERCENTwLPAREN => "%w(",
508            Ruby::PERCENTiLPAREN => "%i(",
509            Ruby::HeredocBodyStart => "_heredoc_body_start",
510            Ruby::StringContent => "string_content",
511            Ruby::HeredocContent => "heredoc_content",
512            Ruby::RPAREN2 => ")",
513            Ruby::HeredocEnd => "heredoc_end",
514            Ruby::HeredocBeginning => "heredoc_beginning",
515            Ruby::AMP2 => "&",
516            Ruby::STAR2 => "*",
517            Ruby::DASH2 => "-",
518            Ruby::DASH3 => "-",
519            Ruby::DASH4 => "-",
520            Ruby::STAR3 => "*",
521            Ruby::LTLT2 => "<<",
522            Ruby::HashKeySymbol => "hash_key_symbol",
523            Ruby::IdentifierSuffix => "_identifier_suffix",
524            Ruby::ConstantSuffix => "_constant_suffix",
525            Ruby::STARSTAR2 => "**",
526            Ruby::STARSTAR3 => "**",
527            Ruby::LBRACK3 => "[",
528            Ruby::ShortInterpolation => "_short_interpolation",
529            Ruby::Program => "program",
530            Ruby::BlockBody => "block_body",
531            Ruby::Statements => "_statements",
532            Ruby::BeginBlock => "begin_block",
533            Ruby::EndBlock => "end_block",
534            Ruby::Statement => "_statement",
535            Ruby::Method => "method",
536            Ruby::SingletonMethod => "singleton_method",
537            Ruby::MethodRest => "_method_rest",
538            Ruby::RescueModifier => "rescue_modifier",
539            Ruby::RescueModifier2 => "rescue_modifier",
540            Ruby::BodyExpr => "_body_expr",
541            Ruby::MethodParameters => "method_parameters",
542            Ruby::MethodParameters2 => "method_parameters",
543            Ruby::BlockParameters => "block_parameters",
544            Ruby::FormalParameter => "_formal_parameter",
545            Ruby::SimpleFormalParameter => "_simple_formal_parameter",
546            Ruby::ForwardParameter => "forward_parameter",
547            Ruby::SplatParameter => "splat_parameter",
548            Ruby::HashSplatParameter => "hash_splat_parameter",
549            Ruby::HashSplatNil => "hash_splat_nil",
550            Ruby::BlockParameter => "block_parameter",
551            Ruby::KeywordParameter => "keyword_parameter",
552            Ruby::OptionalParameter => "optional_parameter",
553            Ruby::Class => "class",
554            Ruby::Superclass => "superclass",
555            Ruby::SingletonClass => "singleton_class",
556            Ruby::Module => "module",
557            Ruby::Return => "return",
558            Ruby::Yield => "yield",
559            Ruby::Break => "break",
560            Ruby::Next => "next",
561            Ruby::Return2 => "return",
562            Ruby::Yield2 => "yield",
563            Ruby::Break2 => "break",
564            Ruby::Next2 => "next",
565            Ruby::Redo => "redo",
566            Ruby::Retry => "retry",
567            Ruby::IfModifier => "if_modifier",
568            Ruby::UnlessModifier => "unless_modifier",
569            Ruby::WhileModifier => "while_modifier",
570            Ruby::UntilModifier => "until_modifier",
571            Ruby::RescueModifier3 => "rescue_modifier",
572            Ruby::While => "while",
573            Ruby::Until => "until",
574            Ruby::For => "for",
575            Ruby::In => "in",
576            Ruby::Do => "do",
577            Ruby::Case => "case",
578            Ruby::CaseMatch => "case_match",
579            Ruby::When => "when",
580            Ruby::InClause => "in_clause",
581            Ruby::Pattern => "pattern",
582            Ruby::Guard => "_guard",
583            Ruby::IfGuard => "if_guard",
584            Ruby::UnlessGuard => "unless_guard",
585            Ruby::PatternTopExprBody => "_pattern_top_expr_body",
586            Ruby::ArrayPatternN => "_array_pattern_n",
587            Ruby::PatternExpr => "_pattern_expr",
588            Ruby::AsPattern => "as_pattern",
589            Ruby::PatternExprAlt => "_pattern_expr_alt",
590            Ruby::AlternativePattern => "alternative_pattern",
591            Ruby::ArrayPatternBody => "_array_pattern_body",
592            Ruby::ArrayPattern => "array_pattern",
593            Ruby::FindPatternBody => "_find_pattern_body",
594            Ruby::FindPattern => "find_pattern",
595            Ruby::HashPatternBody => "_hash_pattern_body",
596            Ruby::KeywordPattern => "keyword_pattern",
597            Ruby::HashPatternAnyRest => "_hash_pattern_any_rest",
598            Ruby::HashPattern => "hash_pattern",
599            Ruby::PatternExprBasic => "_pattern_expr_basic",
600            Ruby::ParenthesizedPattern => "parenthesized_pattern",
601            Ruby::PatternValue => "_pattern_value",
602            Ruby::Range => "range",
603            Ruby::PatternPrimitive => "_pattern_primitive",
604            Ruby::PatternLambda => "_pattern_lambda",
605            Ruby::PatternLiteral => "_pattern_literal",
606            Ruby::KeywordVariable => "_keyword_variable",
607            Ruby::VariableReferencePattern => "variable_reference_pattern",
608            Ruby::ExpressionReferencePattern => "expression_reference_pattern",
609            Ruby::PatternConstant => "_pattern_constant",
610            Ruby::ScopeResolution => "scope_resolution",
611            Ruby::If => "if",
612            Ruby::Unless => "unless",
613            Ruby::Elsif => "elsif",
614            Ruby::Else => "else",
615            Ruby::Then => "then",
616            Ruby::Begin => "begin",
617            Ruby::Ensure => "ensure",
618            Ruby::Rescue => "rescue",
619            Ruby::Exceptions => "exceptions",
620            Ruby::ExceptionVariable => "exception_variable",
621            Ruby::BodyStatement => "body_statement",
622            Ruby::BodyStatement2 => "_body_statement",
623            Ruby::Expression => "_expression",
624            Ruby::MatchPattern => "match_pattern",
625            Ruby::TestPattern => "test_pattern",
626            Ruby::Arg => "_arg",
627            Ruby::Unary => "unary",
628            Ruby::Binary => "binary",
629            Ruby::Primary => "_primary",
630            Ruby::ParenthesizedStatements => "parenthesized_statements",
631            Ruby::ElementReference => "element_reference",
632            Ruby::ScopeResolution2 => "scope_resolution",
633            Ruby::Call5 => "_call",
634            Ruby::Call => "call",
635            Ruby::Call2 => "call",
636            Ruby::ChainedCommandCall => "_chained_command_call",
637            Ruby::Call3 => "call",
638            Ruby::ArgumentList => "argument_list",
639            Ruby::ArgumentList2 => "argument_list",
640            Ruby::ArgumentListWithTrailingComma => "_argument_list_with_trailing_comma",
641            Ruby::Argument => "_argument",
642            Ruby::ForwardArgument => "forward_argument",
643            Ruby::SplatArgument => "splat_argument",
644            Ruby::HashSplatArgument => "hash_splat_argument",
645            Ruby::BlockArgument => "block_argument",
646            Ruby::DoBlock => "do_block",
647            Ruby::Block => "block",
648            Ruby::Assignment => "assignment",
649            Ruby::Assignment2 => "assignment",
650            Ruby::OperatorAssignment => "operator_assignment",
651            Ruby::OperatorAssignment2 => "operator_assignment",
652            Ruby::Conditional => "conditional",
653            Ruby::Range2 => "range",
654            Ruby::Binary2 => "binary",
655            Ruby::Binary3 => "binary",
656            Ruby::Unary2 => "unary",
657            Ruby::Unary3 => "unary",
658            Ruby::Unary4 => "unary",
659            Ruby::Unary5 => "unary",
660            Ruby::Literal => "_literal",
661            Ruby::Numeric => "_numeric",
662            Ruby::SimpleNumeric => "_simple_numeric",
663            Ruby::RightAssignmentList => "right_assignment_list",
664            Ruby::LeftAssignmentList => "left_assignment_list",
665            Ruby::Mlhs => "_mlhs",
666            Ruby::DestructuredLeftAssignment => "destructured_left_assignment",
667            Ruby::RestAssignment => "rest_assignment",
668            Ruby::FunctionIdentifier => "_function_identifier",
669            Ruby::Call4 => "call",
670            Ruby::Lhs => "_lhs",
671            Ruby::Variable => "_variable",
672            Ruby::Operator => "operator",
673            Ruby::MethodName => "_method_name",
674            Ruby::NonlocalVariable => "_nonlocal_variable",
675            Ruby::Setter => "setter",
676            Ruby::Undef => "undef",
677            Ruby::Alias => "alias",
678            Ruby::IntOrFloat => "_int_or_float",
679            Ruby::Complex => "complex",
680            Ruby::Rational => "rational",
681            Ruby::Nil => "nil",
682            Ruby::HashKeySymbol2 => "hash_key_symbol",
683            Ruby::HashKeySymbol3 => "hash_key_symbol",
684            Ruby::ChainedString => "chained_string",
685            Ruby::Interpolation => "interpolation",
686            Ruby::String => "string",
687            Ruby::Subshell => "subshell",
688            Ruby::StringArray => "string_array",
689            Ruby::SymbolArray => "symbol_array",
690            Ruby::DelimitedSymbol => "delimited_symbol",
691            Ruby::Regex => "regex",
692            Ruby::HeredocBody => "heredoc_body",
693            Ruby::LiteralContents => "_literal_contents",
694            Ruby::Array => "array",
695            Ruby::Hash => "hash",
696            Ruby::Pair => "pair",
697            Ruby::Lambda => "lambda",
698            Ruby::EmptyStatement => "empty_statement",
699            Ruby::Terminator => "_terminator",
700            Ruby::StatementsRepeat1 => "_statements_repeat1",
701            Ruby::ParametersRepeat1 => "parameters_repeat1",
702            Ruby::BlockParametersRepeat1 => "block_parameters_repeat1",
703            Ruby::CaseRepeat1 => "case_repeat1",
704            Ruby::CaseMatchRepeat1 => "case_match_repeat1",
705            Ruby::WhenRepeat1 => "when_repeat1",
706            Ruby::ArrayPatternNRepeat1 => "_array_pattern_n_repeat1",
707            Ruby::AlternativePatternRepeat1 => "alternative_pattern_repeat1",
708            Ruby::HashPatternBodyRepeat1 => "_hash_pattern_body_repeat1",
709            Ruby::ExceptionsRepeat1 => "exceptions_repeat1",
710            Ruby::BodyStatementRepeat1 => "_body_statement_repeat1",
711            Ruby::CommandArgumentListRepeat1 => "command_argument_list_repeat1",
712            Ruby::MlhsRepeat1 => "_mlhs_repeat1",
713            Ruby::UndefRepeat1 => "undef_repeat1",
714            Ruby::ChainedStringRepeat1 => "chained_string_repeat1",
715            Ruby::StringArrayRepeat1 => "string_array_repeat1",
716            Ruby::SymbolArrayRepeat1 => "symbol_array_repeat1",
717            Ruby::HeredocBodyRepeat1 => "heredoc_body_repeat1",
718            Ruby::HashRepeat1 => "hash_repeat1",
719            Ruby::BareString => "bare_string",
720            Ruby::BareSymbol => "bare_symbol",
721            Ruby::DestructuredParameter => "destructured_parameter",
722            Ruby::LambdaParameters => "lambda_parameters",
723            Ruby::Error => "ERROR",
724        }
725    }
726}
727
728impl From<u16> for Ruby {
729    #[inline]
730    fn from(x: u16) -> Self {
731        num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
732    }
733}
734
735// Ruby == u16
736impl PartialEq<u16> for Ruby {
737    #[inline]
738    fn eq(&self, x: &u16) -> bool {
739        *self == Into::<Self>::into(*x)
740    }
741}
742
743// u16 == Ruby
744impl PartialEq<Ruby> for u16 {
745    #[inline]
746    fn eq(&self, x: &Ruby) -> bool {
747        *x == *self
748    }
749}