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
368/// Each runtime kind id of `Ruby` with tree-sitter's `named` and
369/// `visible` flags, in id order. A label for the id the enum identifies,
370/// read by the role-coverage gate; the generator's ERROR sentinel has no
371/// entry.
372pub const RUBY_KIND_FLAGS: &[(u16, bool, bool)] = &[
373    (0, false, false),
374    (1, true, true),
375    (2, false, false),
376    (3, true, true),
377    (4, false, true),
378    (5, false, true),
379    (6, false, true),
380    (7, false, true),
381    (8, false, true),
382    (9, false, true),
383    (10, false, true),
384    (11, false, true),
385    (12, false, true),
386    (13, false, true),
387    (14, false, true),
388    (15, false, true),
389    (16, false, true),
390    (17, false, true),
391    (18, false, true),
392    (19, false, true),
393    (20, false, true),
394    (21, false, true),
395    (22, false, true),
396    (23, false, true),
397    (24, false, true),
398    (25, false, true),
399    (26, false, true),
400    (27, false, true),
401    (28, false, true),
402    (29, false, true),
403    (30, false, true),
404    (31, false, true),
405    (32, false, true),
406    (33, false, true),
407    (34, false, true),
408    (35, false, true),
409    (36, false, true),
410    (37, false, true),
411    (38, false, true),
412    (39, false, true),
413    (40, false, true),
414    (41, false, true),
415    (42, false, true),
416    (43, false, true),
417    (44, false, true),
418    (45, false, true),
419    (46, false, true),
420    (47, false, true),
421    (48, false, true),
422    (49, true, true),
423    (50, true, true),
424    (51, true, true),
425    (52, false, true),
426    (53, false, true),
427    (54, false, true),
428    (55, false, true),
429    (56, false, true),
430    (57, false, true),
431    (58, false, true),
432    (59, false, true),
433    (60, false, true),
434    (61, false, true),
435    (62, false, true),
436    (63, false, true),
437    (64, false, true),
438    (65, false, true),
439    (66, false, true),
440    (67, false, true),
441    (68, false, true),
442    (69, false, true),
443    (70, false, true),
444    (71, false, true),
445    (72, false, true),
446    (73, false, true),
447    (74, false, true),
448    (75, false, true),
449    (76, false, true),
450    (77, false, true),
451    (78, false, true),
452    (79, false, true),
453    (80, false, true),
454    (81, false, true),
455    (82, false, true),
456    (83, false, true),
457    (84, false, true),
458    (85, false, true),
459    (86, false, true),
460    (87, false, true),
461    (88, false, true),
462    (89, false, true),
463    (90, false, true),
464    (91, false, true),
465    (92, false, true),
466    (93, false, true),
467    (94, false, true),
468    (95, false, true),
469    (96, false, true),
470    (97, false, true),
471    (98, false, true),
472    (99, false, true),
473    (100, false, true),
474    (101, false, true),
475    (102, false, true),
476    (103, false, true),
477    (104, false, true),
478    (105, false, true),
479    (106, false, true),
480    (107, true, true),
481    (108, true, true),
482    (109, true, true),
483    (110, false, true),
484    (111, false, true),
485    (112, false, true),
486    (113, true, true),
487    (114, true, true),
488    (115, true, true),
489    (116, true, true),
490    (117, true, true),
491    (118, false, false),
492    (119, false, false),
493    (120, true, true),
494    (121, true, true),
495    (122, true, true),
496    (123, true, true),
497    (124, false, true),
498    (125, false, false),
499    (126, true, true),
500    (127, false, true),
501    (128, false, false),
502    (129, false, false),
503    (130, true, true),
504    (131, false, true),
505    (132, false, true),
506    (133, false, true),
507    (134, false, true),
508    (135, false, true),
509    (136, false, true),
510    (137, false, false),
511    (138, true, true),
512    (139, true, true),
513    (140, false, true),
514    (141, true, true),
515    (142, true, true),
516    (143, false, true),
517    (144, false, true),
518    (145, false, true),
519    (146, false, true),
520    (147, false, true),
521    (148, false, true),
522    (149, false, true),
523    (150, true, true),
524    (151, false, false),
525    (152, false, false),
526    (153, false, true),
527    (154, false, true),
528    (155, false, true),
529    (156, false, false),
530    (157, true, true),
531    (158, true, true),
532    (159, false, false),
533    (160, true, true),
534    (161, true, true),
535    (162, false, false),
536    (163, true, true),
537    (164, true, true),
538    (165, false, false),
539    (166, true, true),
540    (167, true, true),
541    (168, false, false),
542    (169, true, true),
543    (170, true, true),
544    (171, true, true),
545    (172, false, false),
546    (173, false, false),
547    (174, true, true),
548    (175, true, true),
549    (176, true, true),
550    (177, true, true),
551    (178, true, true),
552    (179, true, true),
553    (180, true, true),
554    (181, true, true),
555    (182, true, true),
556    (183, true, true),
557    (184, true, true),
558    (185, true, true),
559    (186, true, true),
560    (187, true, true),
561    (188, true, true),
562    (189, true, true),
563    (190, true, true),
564    (191, true, true),
565    (192, true, true),
566    (193, true, true),
567    (194, true, true),
568    (195, true, true),
569    (196, true, true),
570    (197, true, true),
571    (198, true, true),
572    (199, true, true),
573    (200, true, true),
574    (201, true, true),
575    (202, true, true),
576    (203, true, true),
577    (204, true, true),
578    (205, true, true),
579    (206, true, true),
580    (207, true, true),
581    (208, true, true),
582    (209, true, true),
583    (210, false, false),
584    (211, true, true),
585    (212, true, true),
586    (213, false, false),
587    (214, false, false),
588    (215, false, false),
589    (216, true, true),
590    (217, false, false),
591    (218, true, true),
592    (219, false, false),
593    (220, true, true),
594    (221, false, false),
595    (222, true, true),
596    (223, false, false),
597    (224, true, true),
598    (225, false, false),
599    (226, true, true),
600    (227, false, false),
601    (228, true, true),
602    (229, false, false),
603    (230, true, true),
604    (231, false, false),
605    (232, false, false),
606    (233, false, false),
607    (234, false, false),
608    (235, true, true),
609    (236, true, true),
610    (237, false, false),
611    (238, true, true),
612    (239, true, true),
613    (240, true, true),
614    (241, true, true),
615    (242, true, true),
616    (243, true, true),
617    (244, true, true),
618    (245, true, true),
619    (246, true, true),
620    (247, true, true),
621    (248, true, true),
622    (249, true, true),
623    (250, false, false),
624    (251, false, false),
625    (252, true, true),
626    (253, true, true),
627    (254, false, false),
628    (255, true, true),
629    (256, true, true),
630    (257, false, false),
631    (258, true, true),
632    (259, true, true),
633    (260, true, true),
634    (261, false, false),
635    (262, true, true),
636    (263, true, true),
637    (264, false, false),
638    (265, true, true),
639    (266, true, true),
640    (267, true, true),
641    (268, false, false),
642    (269, false, false),
643    (270, true, true),
644    (271, true, true),
645    (272, true, true),
646    (273, true, true),
647    (274, true, true),
648    (275, true, true),
649    (276, true, true),
650    (277, true, true),
651    (278, true, true),
652    (279, true, true),
653    (280, true, true),
654    (281, true, true),
655    (282, true, true),
656    (283, true, true),
657    (284, true, true),
658    (285, true, true),
659    (286, true, true),
660    (287, true, true),
661    (288, false, false),
662    (289, false, false),
663    (290, false, false),
664    (291, true, true),
665    (292, true, true),
666    (293, false, false),
667    (294, true, true),
668    (295, true, true),
669    (296, false, false),
670    (297, true, true),
671    (298, false, false),
672    (299, false, false),
673    (300, true, true),
674    (301, false, false),
675    (302, false, false),
676    (303, true, true),
677    (304, true, true),
678    (305, true, true),
679    (306, false, false),
680    (307, true, true),
681    (308, true, true),
682    (309, true, true),
683    (310, true, true),
684    (311, true, true),
685    (312, true, true),
686    (313, true, true),
687    (314, true, true),
688    (315, true, true),
689    (316, true, true),
690    (317, true, true),
691    (318, true, true),
692    (319, true, true),
693    (320, true, true),
694    (321, false, false),
695    (322, true, true),
696    (323, true, true),
697    (324, true, true),
698    (325, true, true),
699    (326, true, true),
700    (327, false, false),
701    (328, false, false),
702    (329, false, false),
703    (330, false, false),
704    (331, false, false),
705    (332, false, false),
706    (333, false, false),
707    (334, false, false),
708    (335, false, false),
709    (336, false, false),
710    (337, false, false),
711    (338, false, false),
712    (339, false, false),
713    (340, false, false),
714    (341, false, false),
715    (342, false, false),
716    (343, false, false),
717    (344, false, false),
718    (345, false, false),
719    (346, false, false),
720    (347, true, true),
721    (348, true, true),
722    (349, true, true),
723    (350, true, true),
724];
725
726impl From<Ruby> for &'static str {
727    #[inline]
728    fn from(tok: Ruby) -> Self {
729        match tok {
730            Ruby::End => "end",
731            Ruby::Identifier => "identifier",
732            Ruby::ProgramToken1 => "program_token1",
733            Ruby::Uninterpreted => "uninterpreted",
734            Ruby::BEGIN => "BEGIN",
735            Ruby::LBRACE => "{",
736            Ruby::RBRACE => "}",
737            Ruby::END => "END",
738            Ruby::Def => "def",
739            Ruby::LPAREN => "(",
740            Ruby::RPAREN => ")",
741            Ruby::DOT => ".",
742            Ruby::COLONCOLON => "::",
743            Ruby::End2 => "end",
744            Ruby::Rescue2 => "rescue",
745            Ruby::EQ => "=",
746            Ruby::COMMA => ",",
747            Ruby::PIPE => "|",
748            Ruby::SEMI => ";",
749            Ruby::DOTDOTDOT => "...",
750            Ruby::STAR => "*",
751            Ruby::STARSTAR => "**",
752            Ruby::Nil2 => "nil",
753            Ruby::AMP => "&",
754            Ruby::COLON => ":",
755            Ruby::Class2 => "class",
756            Ruby::LT => "<",
757            Ruby::Module2 => "module",
758            Ruby::Return3 => "return",
759            Ruby::Yield3 => "yield",
760            Ruby::Break3 => "break",
761            Ruby::Next3 => "next",
762            Ruby::Redo2 => "redo",
763            Ruby::Retry2 => "retry",
764            Ruby::If2 => "if",
765            Ruby::Unless2 => "unless",
766            Ruby::While2 => "while",
767            Ruby::Until2 => "until",
768            Ruby::For2 => "for",
769            Ruby::In2 => "in",
770            Ruby::Do2 => "do",
771            Ruby::Case2 => "case",
772            Ruby::When2 => "when",
773            Ruby::EQGT => "=>",
774            Ruby::LBRACK => "[",
775            Ruby::RBRACK => "]",
776            Ruby::LBRACK2 => "[",
777            Ruby::LPAREN2 => "(",
778            Ruby::DOTDOT => "..",
779            Ruby::Line => "line",
780            Ruby::File => "file",
781            Ruby::Encoding => "encoding",
782            Ruby::CARET => "^",
783            Ruby::Elsif2 => "elsif",
784            Ruby::Else2 => "else",
785            Ruby::Then2 => "then",
786            Ruby::Begin2 => "begin",
787            Ruby::Ensure2 => "ensure",
788            Ruby::COLONCOLON2 => "::",
789            Ruby::AMPDOT => "&.",
790            Ruby::PLUSEQ => "+=",
791            Ruby::DASHEQ => "-=",
792            Ruby::STAREQ => "*=",
793            Ruby::STARSTAREQ => "**=",
794            Ruby::SLASHEQ => "/=",
795            Ruby::PIPEPIPEEQ => "||=",
796            Ruby::PIPEEQ => "|=",
797            Ruby::AMPAMPEQ => "&&=",
798            Ruby::AMPEQ => "&=",
799            Ruby::PERCENTEQ => "%=",
800            Ruby::GTGTEQ => ">>=",
801            Ruby::LTLTEQ => "<<=",
802            Ruby::CARETEQ => "^=",
803            Ruby::QMARK => "?",
804            Ruby::COLON2 => ":",
805            Ruby::And => "and",
806            Ruby::Or => "or",
807            Ruby::PIPEPIPE => "||",
808            Ruby::AMPAMP => "&&",
809            Ruby::LTLT => "<<",
810            Ruby::GTGT => ">>",
811            Ruby::LTEQ => "<=",
812            Ruby::GT => ">",
813            Ruby::GTEQ => ">=",
814            Ruby::PLUS => "+",
815            Ruby::SLASH => "/",
816            Ruby::PERCENT => "%",
817            Ruby::EQEQ => "==",
818            Ruby::BANGEQ => "!=",
819            Ruby::EQEQEQ => "===",
820            Ruby::LTEQGT => "<=>",
821            Ruby::EQTILDE => "=~",
822            Ruby::BANGTILDE => "!~",
823            Ruby::DefinedQMARK => "defined?",
824            Ruby::Not => "not",
825            Ruby::BANG => "!",
826            Ruby::TILDE => "~",
827            Ruby::DASH => "-",
828            Ruby::PLUSAT => "+@",
829            Ruby::DASHAT => "-@",
830            Ruby::TILDEAT => "~@",
831            Ruby::LBRACKRBRACK => "[]",
832            Ruby::LBRACKRBRACKEQ => "[]=",
833            Ruby::BQUOTE => "`",
834            Ruby::EQ2 => "=",
835            Ruby::Undef2 => "undef",
836            Ruby::Alias2 => "alias",
837            Ruby::Comment => "comment",
838            Ruby::Integer => "integer",
839            Ruby::Float => "float",
840            Ruby::I => "i",
841            Ruby::Ri => "ri",
842            Ruby::R => "r",
843            Ruby::Super => "super",
844            Ruby::Zelf => "self",
845            Ruby::True => "true",
846            Ruby::False => "false",
847            Ruby::Constant => "constant",
848            Ruby::ConstantSuffixToken1 => "constant_suffix_token1",
849            Ruby::IdentifierSuffixToken1 => "identifier_suffix_token1",
850            Ruby::InstanceVariable => "instance_variable",
851            Ruby::ClassVariable => "class_variable",
852            Ruby::GlobalVariable => "global_variable",
853            Ruby::Character => "character",
854            Ruby::HASHLBRACE => "#{",
855            Ruby::StringArrayToken1 => "string_array_token1",
856            Ruby::EscapeSequence => "escape_sequence",
857            Ruby::DASHGT => "->",
858            Ruby::LineBreak => "_line_break",
859            Ruby::NoLineBreak => "_no_line_break",
860            Ruby::SimpleSymbol => "simple_symbol",
861            Ruby::DQUOTE => "\"",
862            Ruby::COLONDQUOTE => ":\"",
863            Ruby::BQUOTE2 => "`",
864            Ruby::SLASH2 => "/",
865            Ruby::PERCENTwLPAREN => "%w(",
866            Ruby::PERCENTiLPAREN => "%i(",
867            Ruby::HeredocBodyStart => "_heredoc_body_start",
868            Ruby::StringContent => "string_content",
869            Ruby::HeredocContent => "heredoc_content",
870            Ruby::RPAREN2 => ")",
871            Ruby::HeredocEnd => "heredoc_end",
872            Ruby::HeredocBeginning => "heredoc_beginning",
873            Ruby::AMP2 => "&",
874            Ruby::STAR2 => "*",
875            Ruby::DASH2 => "-",
876            Ruby::DASH3 => "-",
877            Ruby::DASH4 => "-",
878            Ruby::STAR3 => "*",
879            Ruby::LTLT2 => "<<",
880            Ruby::HashKeySymbol => "hash_key_symbol",
881            Ruby::IdentifierSuffix => "_identifier_suffix",
882            Ruby::ConstantSuffix => "_constant_suffix",
883            Ruby::STARSTAR2 => "**",
884            Ruby::STARSTAR3 => "**",
885            Ruby::LBRACK3 => "[",
886            Ruby::ShortInterpolation => "_short_interpolation",
887            Ruby::Program => "program",
888            Ruby::BlockBody => "block_body",
889            Ruby::Statements => "_statements",
890            Ruby::BeginBlock => "begin_block",
891            Ruby::EndBlock => "end_block",
892            Ruby::Statement => "_statement",
893            Ruby::Method => "method",
894            Ruby::SingletonMethod => "singleton_method",
895            Ruby::MethodRest => "_method_rest",
896            Ruby::RescueModifier => "rescue_modifier",
897            Ruby::RescueModifier2 => "rescue_modifier",
898            Ruby::BodyExpr => "_body_expr",
899            Ruby::MethodParameters => "method_parameters",
900            Ruby::MethodParameters2 => "method_parameters",
901            Ruby::BlockParameters => "block_parameters",
902            Ruby::FormalParameter => "_formal_parameter",
903            Ruby::SimpleFormalParameter => "_simple_formal_parameter",
904            Ruby::ForwardParameter => "forward_parameter",
905            Ruby::SplatParameter => "splat_parameter",
906            Ruby::HashSplatParameter => "hash_splat_parameter",
907            Ruby::HashSplatNil => "hash_splat_nil",
908            Ruby::BlockParameter => "block_parameter",
909            Ruby::KeywordParameter => "keyword_parameter",
910            Ruby::OptionalParameter => "optional_parameter",
911            Ruby::Class => "class",
912            Ruby::Superclass => "superclass",
913            Ruby::SingletonClass => "singleton_class",
914            Ruby::Module => "module",
915            Ruby::Return => "return",
916            Ruby::Yield => "yield",
917            Ruby::Break => "break",
918            Ruby::Next => "next",
919            Ruby::Return2 => "return",
920            Ruby::Yield2 => "yield",
921            Ruby::Break2 => "break",
922            Ruby::Next2 => "next",
923            Ruby::Redo => "redo",
924            Ruby::Retry => "retry",
925            Ruby::IfModifier => "if_modifier",
926            Ruby::UnlessModifier => "unless_modifier",
927            Ruby::WhileModifier => "while_modifier",
928            Ruby::UntilModifier => "until_modifier",
929            Ruby::RescueModifier3 => "rescue_modifier",
930            Ruby::While => "while",
931            Ruby::Until => "until",
932            Ruby::For => "for",
933            Ruby::In => "in",
934            Ruby::Do => "do",
935            Ruby::Case => "case",
936            Ruby::CaseMatch => "case_match",
937            Ruby::When => "when",
938            Ruby::InClause => "in_clause",
939            Ruby::Pattern => "pattern",
940            Ruby::Guard => "_guard",
941            Ruby::IfGuard => "if_guard",
942            Ruby::UnlessGuard => "unless_guard",
943            Ruby::PatternTopExprBody => "_pattern_top_expr_body",
944            Ruby::ArrayPatternN => "_array_pattern_n",
945            Ruby::PatternExpr => "_pattern_expr",
946            Ruby::AsPattern => "as_pattern",
947            Ruby::PatternExprAlt => "_pattern_expr_alt",
948            Ruby::AlternativePattern => "alternative_pattern",
949            Ruby::ArrayPatternBody => "_array_pattern_body",
950            Ruby::ArrayPattern => "array_pattern",
951            Ruby::FindPatternBody => "_find_pattern_body",
952            Ruby::FindPattern => "find_pattern",
953            Ruby::HashPatternBody => "_hash_pattern_body",
954            Ruby::KeywordPattern => "keyword_pattern",
955            Ruby::HashPatternAnyRest => "_hash_pattern_any_rest",
956            Ruby::HashPattern => "hash_pattern",
957            Ruby::PatternExprBasic => "_pattern_expr_basic",
958            Ruby::ParenthesizedPattern => "parenthesized_pattern",
959            Ruby::PatternValue => "_pattern_value",
960            Ruby::Range => "range",
961            Ruby::PatternPrimitive => "_pattern_primitive",
962            Ruby::PatternLambda => "_pattern_lambda",
963            Ruby::PatternLiteral => "_pattern_literal",
964            Ruby::KeywordVariable => "_keyword_variable",
965            Ruby::VariableReferencePattern => "variable_reference_pattern",
966            Ruby::ExpressionReferencePattern => "expression_reference_pattern",
967            Ruby::PatternConstant => "_pattern_constant",
968            Ruby::ScopeResolution => "scope_resolution",
969            Ruby::If => "if",
970            Ruby::Unless => "unless",
971            Ruby::Elsif => "elsif",
972            Ruby::Else => "else",
973            Ruby::Then => "then",
974            Ruby::Begin => "begin",
975            Ruby::Ensure => "ensure",
976            Ruby::Rescue => "rescue",
977            Ruby::Exceptions => "exceptions",
978            Ruby::ExceptionVariable => "exception_variable",
979            Ruby::BodyStatement => "body_statement",
980            Ruby::BodyStatement2 => "_body_statement",
981            Ruby::Expression => "_expression",
982            Ruby::MatchPattern => "match_pattern",
983            Ruby::TestPattern => "test_pattern",
984            Ruby::Arg => "_arg",
985            Ruby::Unary => "unary",
986            Ruby::Binary => "binary",
987            Ruby::Primary => "_primary",
988            Ruby::ParenthesizedStatements => "parenthesized_statements",
989            Ruby::ElementReference => "element_reference",
990            Ruby::ScopeResolution2 => "scope_resolution",
991            Ruby::Call5 => "_call",
992            Ruby::Call => "call",
993            Ruby::Call2 => "call",
994            Ruby::ChainedCommandCall => "_chained_command_call",
995            Ruby::Call3 => "call",
996            Ruby::ArgumentList => "argument_list",
997            Ruby::ArgumentList2 => "argument_list",
998            Ruby::ArgumentListWithTrailingComma => "_argument_list_with_trailing_comma",
999            Ruby::Argument => "_argument",
1000            Ruby::ForwardArgument => "forward_argument",
1001            Ruby::SplatArgument => "splat_argument",
1002            Ruby::HashSplatArgument => "hash_splat_argument",
1003            Ruby::BlockArgument => "block_argument",
1004            Ruby::DoBlock => "do_block",
1005            Ruby::Block => "block",
1006            Ruby::Assignment => "assignment",
1007            Ruby::Assignment2 => "assignment",
1008            Ruby::OperatorAssignment => "operator_assignment",
1009            Ruby::OperatorAssignment2 => "operator_assignment",
1010            Ruby::Conditional => "conditional",
1011            Ruby::Range2 => "range",
1012            Ruby::Binary2 => "binary",
1013            Ruby::Binary3 => "binary",
1014            Ruby::Unary2 => "unary",
1015            Ruby::Unary3 => "unary",
1016            Ruby::Unary4 => "unary",
1017            Ruby::Unary5 => "unary",
1018            Ruby::Literal => "_literal",
1019            Ruby::Numeric => "_numeric",
1020            Ruby::SimpleNumeric => "_simple_numeric",
1021            Ruby::RightAssignmentList => "right_assignment_list",
1022            Ruby::LeftAssignmentList => "left_assignment_list",
1023            Ruby::Mlhs => "_mlhs",
1024            Ruby::DestructuredLeftAssignment => "destructured_left_assignment",
1025            Ruby::RestAssignment => "rest_assignment",
1026            Ruby::FunctionIdentifier => "_function_identifier",
1027            Ruby::Call4 => "call",
1028            Ruby::Lhs => "_lhs",
1029            Ruby::Variable => "_variable",
1030            Ruby::Operator => "operator",
1031            Ruby::MethodName => "_method_name",
1032            Ruby::NonlocalVariable => "_nonlocal_variable",
1033            Ruby::Setter => "setter",
1034            Ruby::Undef => "undef",
1035            Ruby::Alias => "alias",
1036            Ruby::IntOrFloat => "_int_or_float",
1037            Ruby::Complex => "complex",
1038            Ruby::Rational => "rational",
1039            Ruby::Nil => "nil",
1040            Ruby::HashKeySymbol2 => "hash_key_symbol",
1041            Ruby::HashKeySymbol3 => "hash_key_symbol",
1042            Ruby::ChainedString => "chained_string",
1043            Ruby::Interpolation => "interpolation",
1044            Ruby::String => "string",
1045            Ruby::Subshell => "subshell",
1046            Ruby::StringArray => "string_array",
1047            Ruby::SymbolArray => "symbol_array",
1048            Ruby::DelimitedSymbol => "delimited_symbol",
1049            Ruby::Regex => "regex",
1050            Ruby::HeredocBody => "heredoc_body",
1051            Ruby::LiteralContents => "_literal_contents",
1052            Ruby::Array => "array",
1053            Ruby::Hash => "hash",
1054            Ruby::Pair => "pair",
1055            Ruby::Lambda => "lambda",
1056            Ruby::EmptyStatement => "empty_statement",
1057            Ruby::Terminator => "_terminator",
1058            Ruby::StatementsRepeat1 => "_statements_repeat1",
1059            Ruby::ParametersRepeat1 => "parameters_repeat1",
1060            Ruby::BlockParametersRepeat1 => "block_parameters_repeat1",
1061            Ruby::CaseRepeat1 => "case_repeat1",
1062            Ruby::CaseMatchRepeat1 => "case_match_repeat1",
1063            Ruby::WhenRepeat1 => "when_repeat1",
1064            Ruby::ArrayPatternNRepeat1 => "_array_pattern_n_repeat1",
1065            Ruby::AlternativePatternRepeat1 => "alternative_pattern_repeat1",
1066            Ruby::HashPatternBodyRepeat1 => "_hash_pattern_body_repeat1",
1067            Ruby::ExceptionsRepeat1 => "exceptions_repeat1",
1068            Ruby::BodyStatementRepeat1 => "_body_statement_repeat1",
1069            Ruby::CommandArgumentListRepeat1 => "command_argument_list_repeat1",
1070            Ruby::MlhsRepeat1 => "_mlhs_repeat1",
1071            Ruby::UndefRepeat1 => "undef_repeat1",
1072            Ruby::ChainedStringRepeat1 => "chained_string_repeat1",
1073            Ruby::StringArrayRepeat1 => "string_array_repeat1",
1074            Ruby::SymbolArrayRepeat1 => "symbol_array_repeat1",
1075            Ruby::HeredocBodyRepeat1 => "heredoc_body_repeat1",
1076            Ruby::HashRepeat1 => "hash_repeat1",
1077            Ruby::BareString => "bare_string",
1078            Ruby::BareSymbol => "bare_symbol",
1079            Ruby::DestructuredParameter => "destructured_parameter",
1080            Ruby::LambdaParameters => "lambda_parameters",
1081            Ruby::Error => "ERROR",
1082        }
1083    }
1084}
1085
1086impl From<u16> for Ruby {
1087    #[inline]
1088    fn from(x: u16) -> Self {
1089        num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
1090    }
1091}
1092
1093// Ruby == u16
1094impl PartialEq<u16> for Ruby {
1095    #[inline]
1096    fn eq(&self, x: &u16) -> bool {
1097        *self == Into::<Self>::into(*x)
1098    }
1099}
1100
1101// u16 == Ruby
1102impl PartialEq<Ruby> for u16 {
1103    #[inline]
1104    fn eq(&self, x: &Ruby) -> bool {
1105        *x == *self
1106    }
1107}