Skip to main content

big_code_analysis_ast/languages/
language_rust.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 Rust {
14    End = 0,
15    Identifier = 1,
16    SEMI = 2,
17    MacroRulesBANG = 3,
18    LPAREN = 4,
19    RPAREN = 5,
20    LBRACK = 6,
21    RBRACK = 7,
22    LBRACE = 8,
23    RBRACE = 9,
24    EQGT = 10,
25    COLON = 11,
26    DOLLAR = 12,
27    TokenRepetitionPatternToken1 = 13,
28    PLUS = 14,
29    STAR = 15,
30    QMARK = 16,
31    Block2 = 17,
32    Expr = 18,
33    Expr2021 = 19,
34    Ident = 20,
35    Item = 21,
36    Lifetime2 = 22,
37    Literal = 23,
38    Meta = 24,
39    Pat = 25,
40    PatParam = 26,
41    Path = 27,
42    Stmt = 28,
43    Tt = 29,
44    Ty = 30,
45    Vis = 31,
46    PrimitiveType = 32,
47    PrimitiveType2 = 33,
48    PrimitiveType3 = 34,
49    PrimitiveType4 = 35,
50    PrimitiveType5 = 36,
51    PrimitiveType6 = 37,
52    PrimitiveType7 = 38,
53    PrimitiveType8 = 39,
54    PrimitiveType9 = 40,
55    PrimitiveType10 = 41,
56    PrimitiveType11 = 42,
57    PrimitiveType12 = 43,
58    PrimitiveType13 = 44,
59    PrimitiveType14 = 45,
60    PrimitiveType15 = 46,
61    PrimitiveType16 = 47,
62    PrimitiveType17 = 48,
63    DASH = 49,
64    SLASH = 50,
65    PERCENT = 51,
66    CARET = 52,
67    BANG = 53,
68    AMP = 54,
69    PIPE = 55,
70    AMPAMP = 56,
71    PIPEPIPE = 57,
72    LTLT = 58,
73    GTGT = 59,
74    PLUSEQ = 60,
75    DASHEQ = 61,
76    STAREQ = 62,
77    SLASHEQ = 63,
78    PERCENTEQ = 64,
79    CARETEQ = 65,
80    AMPEQ = 66,
81    PIPEEQ = 67,
82    LTLTEQ = 68,
83    GTGTEQ = 69,
84    EQ = 70,
85    EQEQ = 71,
86    BANGEQ = 72,
87    GT = 73,
88    LT = 74,
89    GTEQ = 75,
90    LTEQ = 76,
91    AT = 77,
92    UNDERSCORE = 78,
93    DOT = 79,
94    DOTDOT = 80,
95    DOTDOTDOT = 81,
96    DOTDOTEQ = 82,
97    COMMA = 83,
98    COLONCOLON = 84,
99    DASHGT = 85,
100    HASH = 86,
101    SQUOTE = 87,
102    As = 88,
103    Async = 89,
104    Await = 90,
105    Break = 91,
106    Const = 92,
107    Continue = 93,
108    Default = 94,
109    Enum = 95,
110    Fn = 96,
111    For = 97,
112    Gen = 98,
113    If = 99,
114    Impl = 100,
115    Let = 101,
116    Loop = 102,
117    Match = 103,
118    Mod = 104,
119    Pub = 105,
120    Return = 106,
121    Static = 107,
122    Struct = 108,
123    Trait = 109,
124    Type = 110,
125    Union = 111,
126    Unsafe = 112,
127    Use = 113,
128    Where = 114,
129    While = 115,
130    Extern = 116,
131    Ref = 117,
132    Else = 118,
133    In = 119,
134    LT2 = 120,
135    Dyn = 121,
136    MutableSpecifier = 122,
137    Raw = 123,
138    Yield = 124,
139    Move = 125,
140    Try = 126,
141    IntegerLiteral = 127,
142    DQUOTE = 128,
143    CharLiteral = 129,
144    EscapeSequence = 130,
145    True = 131,
146    False = 132,
147    SLASHSLASH = 133,
148    LineCommentToken1 = 134,
149    LineCommentToken2 = 135,
150    LineCommentToken3 = 136,
151    BANG2 = 137,
152    SLASH2 = 138,
153    SLASHSTAR = 139,
154    STARSLASH = 140,
155    Shebang = 141,
156    Zelf = 142,
157    Super = 143,
158    Crate = 144,
159    Metavariable = 145,
160    StringContent = 146,
161    DQUOTE2 = 147,
162    RawStringLiteralStart = 148,
163    StringContent2 = 149,
164    RawStringLiteralEnd = 150,
165    FloatLiteral = 151,
166    OuterDocCommentMarker = 152,
167    InnerDocCommentMarker = 153,
168    BlockCommentContent = 154,
169    DocComment = 155,
170    ErrorSentinel = 156,
171    SourceFile = 157,
172    Statement = 158,
173    EmptyStatement = 159,
174    ExpressionStatement = 160,
175    MacroDefinition = 161,
176    MacroRule = 162,
177    TokenPattern = 163,
178    TokenTreePattern = 164,
179    TokenBindingPattern = 165,
180    TokenRepetitionPattern = 166,
181    FragmentSpecifier = 167,
182    TokenTree = 168,
183    TokenRepetition = 169,
184    AttributeItem = 170,
185    InnerAttributeItem = 171,
186    Attribute = 172,
187    ModItem = 173,
188    ForeignModItem = 174,
189    DeclarationList = 175,
190    StructItem = 176,
191    UnionItem = 177,
192    EnumItem = 178,
193    EnumVariantList = 179,
194    EnumVariant = 180,
195    FieldDeclarationList = 181,
196    FieldDeclaration = 182,
197    OrderedFieldDeclarationList = 183,
198    ExternCrateDeclaration = 184,
199    ConstItem = 185,
200    StaticItem = 186,
201    TypeItem = 187,
202    FunctionItem = 188,
203    FunctionSignatureItem = 189,
204    FunctionModifiers = 190,
205    WhereClause = 191,
206    WherePredicate = 192,
207    ImplItem = 193,
208    TraitItem = 194,
209    AssociatedType = 195,
210    TraitBounds = 196,
211    HigherRankedTraitBound = 197,
212    RemovedTraitBound = 198,
213    TypeParameters = 199,
214    ConstParameter = 200,
215    TypeParameter = 201,
216    LifetimeParameter = 202,
217    LetDeclaration = 203,
218    UseDeclaration = 204,
219    UseClause = 205,
220    ScopedUseList = 206,
221    UseList = 207,
222    UseAsClause = 208,
223    UseWildcard = 209,
224    Parameters = 210,
225    SelfParameter = 211,
226    VariadicParameter = 212,
227    Parameter = 213,
228    ExternModifier = 214,
229    VisibilityModifier = 215,
230    Type2 = 216,
231    BracketedType = 217,
232    QualifiedType = 218,
233    Lifetime = 219,
234    ArrayType = 220,
235    ForLifetimes = 221,
236    FunctionType = 222,
237    TupleType = 223,
238    UnitType = 224,
239    GenericFunction = 225,
240    GenericType = 226,
241    GenericTypeWithTurbofish = 227,
242    BoundedType = 228,
243    UseBounds = 229,
244    TypeArguments = 230,
245    TypeBinding = 231,
246    ReferenceType = 232,
247    PointerType = 233,
248    NeverType = 234,
249    AbstractType = 235,
250    DynamicType = 236,
251    ExpressionExceptRange = 237,
252    Expression = 238,
253    MacroInvocation = 239,
254    TokenTree2 = 240,
255    DelimTokens = 241,
256    NonDelimToken = 242,
257    ScopedIdentifier = 243,
258    ScopedTypeIdentifier = 244,
259    ScopedTypeIdentifier2 = 245,
260    RangeExpression = 246,
261    UnaryExpression = 247,
262    TryExpression = 248,
263    ReferenceExpression = 249,
264    BinaryExpression = 250,
265    AssignmentExpression = 251,
266    CompoundAssignmentExpr = 252,
267    TypeCastExpression = 253,
268    ReturnExpression = 254,
269    YieldExpression = 255,
270    CallExpression = 256,
271    Arguments = 257,
272    ArrayExpression = 258,
273    ParenthesizedExpression = 259,
274    TupleExpression = 260,
275    UnitExpression = 261,
276    StructExpression = 262,
277    FieldInitializerList = 263,
278    ShorthandFieldInitializer = 264,
279    FieldInitializer = 265,
280    BaseFieldInitializer = 266,
281    IfExpression = 267,
282    LetCondition = 268,
283    LetChain2 = 269,
284    Condition = 270,
285    ElseClause = 271,
286    MatchExpression = 272,
287    MatchBlock = 273,
288    MatchArm = 274,
289    MatchArm2 = 275,
290    MatchPattern = 276,
291    WhileExpression = 277,
292    LoopExpression = 278,
293    ForExpression = 279,
294    ConstBlock = 280,
295    ClosureExpression = 281,
296    ClosureParameters = 282,
297    Label = 283,
298    BreakExpression = 284,
299    ContinueExpression = 285,
300    IndexExpression = 286,
301    AwaitExpression = 287,
302    FieldExpression = 288,
303    UnsafeBlock = 289,
304    AsyncBlock = 290,
305    GenBlock = 291,
306    TryBlock = 292,
307    Block = 293,
308    Pattern = 294,
309    GenericPattern = 295,
310    TuplePattern = 296,
311    SlicePattern = 297,
312    TupleStructPattern = 298,
313    StructPattern = 299,
314    FieldPattern = 300,
315    RemainingFieldPattern = 301,
316    MutPattern = 302,
317    RangePattern = 303,
318    RefPattern = 304,
319    CapturedPattern = 305,
320    ReferencePattern = 306,
321    OrPattern = 307,
322    Literal2 = 308,
323    LiteralPattern = 309,
324    NegativeLiteral = 310,
325    StringLiteral = 311,
326    RawStringLiteral = 312,
327    BooleanLiteral = 313,
328    LineComment = 314,
329    LineDocCommentMarker = 315,
330    InnerDocCommentMarker2 = 316,
331    OuterDocCommentMarker2 = 317,
332    BlockComment = 318,
333    BlockDocCommentMarker = 319,
334    SourceFileRepeat1 = 320,
335    MacroDefinitionRepeat1 = 321,
336    TokenTreePatternRepeat1 = 322,
337    TokenTreeRepeat1 = 323,
338    NonSpecialTokenRepeat1 = 324,
339    DeclarationListRepeat1 = 325,
340    EnumVariantListRepeat1 = 326,
341    EnumVariantListRepeat2 = 327,
342    FieldDeclarationListRepeat1 = 328,
343    OrderedFieldDeclarationListRepeat1 = 329,
344    FunctionModifiersRepeat1 = 330,
345    WhereClauseRepeat1 = 331,
346    TraitBoundsRepeat1 = 332,
347    TypeParametersRepeat1 = 333,
348    UseListRepeat1 = 334,
349    ParametersRepeat1 = 335,
350    ForLifetimesRepeat1 = 336,
351    TupleTypeRepeat1 = 337,
352    UseBoundsRepeat1 = 338,
353    TypeArgumentsRepeat1 = 339,
354    DelimTokenTreeRepeat1 = 340,
355    ArgumentsRepeat1 = 341,
356    TupleExpressionRepeat1 = 342,
357    FieldInitializerListRepeat1 = 343,
358    MatchBlockRepeat1 = 344,
359    MatchArmRepeat1 = 345,
360    ClosureParametersRepeat1 = 346,
361    TuplePatternRepeat1 = 347,
362    SlicePatternRepeat1 = 348,
363    StructPatternRepeat1 = 349,
364    StringLiteralRepeat1 = 350,
365    FieldIdentifier = 351,
366    LetChain = 352,
367    ShorthandFieldIdentifier = 353,
368    TypeIdentifier = 354,
369    Error = 355,
370}
371
372/// Each runtime kind id of `Rust` with tree-sitter's `named` and
373/// `visible` flags, in id order. A label for the id the enum identifies,
374/// read by the role-coverage gate; the generator's ERROR sentinel has no
375/// entry.
376pub const RUST_KIND_FLAGS: &[(u16, bool, bool)] = &[
377    (0, false, false),
378    (1, true, true),
379    (2, false, true),
380    (3, false, true),
381    (4, false, true),
382    (5, false, true),
383    (6, false, true),
384    (7, false, true),
385    (8, false, true),
386    (9, false, true),
387    (10, false, true),
388    (11, false, true),
389    (12, false, true),
390    (13, false, false),
391    (14, false, true),
392    (15, false, true),
393    (16, false, true),
394    (17, false, true),
395    (18, false, true),
396    (19, false, true),
397    (20, false, true),
398    (21, false, true),
399    (22, false, true),
400    (23, false, true),
401    (24, false, true),
402    (25, false, true),
403    (26, false, true),
404    (27, false, true),
405    (28, false, true),
406    (29, false, true),
407    (30, false, true),
408    (31, false, true),
409    (32, true, true),
410    (33, true, true),
411    (34, true, true),
412    (35, true, true),
413    (36, true, true),
414    (37, true, true),
415    (38, true, true),
416    (39, true, true),
417    (40, true, true),
418    (41, true, true),
419    (42, true, true),
420    (43, true, true),
421    (44, true, true),
422    (45, true, true),
423    (46, true, true),
424    (47, true, true),
425    (48, true, true),
426    (49, false, true),
427    (50, false, true),
428    (51, false, true),
429    (52, false, true),
430    (53, false, true),
431    (54, false, true),
432    (55, false, true),
433    (56, false, true),
434    (57, false, true),
435    (58, false, true),
436    (59, false, true),
437    (60, false, true),
438    (61, false, true),
439    (62, false, true),
440    (63, false, true),
441    (64, false, true),
442    (65, false, true),
443    (66, false, true),
444    (67, false, true),
445    (68, false, true),
446    (69, false, true),
447    (70, false, true),
448    (71, false, true),
449    (72, false, true),
450    (73, false, true),
451    (74, false, true),
452    (75, false, true),
453    (76, false, true),
454    (77, false, true),
455    (78, false, true),
456    (79, false, true),
457    (80, false, true),
458    (81, false, true),
459    (82, false, true),
460    (83, false, true),
461    (84, false, true),
462    (85, false, true),
463    (86, false, true),
464    (87, false, true),
465    (88, false, true),
466    (89, false, true),
467    (90, false, true),
468    (91, false, true),
469    (92, false, true),
470    (93, false, true),
471    (94, false, true),
472    (95, false, true),
473    (96, false, true),
474    (97, false, true),
475    (98, false, true),
476    (99, false, true),
477    (100, false, true),
478    (101, false, true),
479    (102, false, true),
480    (103, false, true),
481    (104, false, true),
482    (105, false, true),
483    (106, false, true),
484    (107, false, true),
485    (108, false, true),
486    (109, false, true),
487    (110, false, true),
488    (111, false, true),
489    (112, false, true),
490    (113, false, true),
491    (114, false, true),
492    (115, false, true),
493    (116, false, true),
494    (117, false, true),
495    (118, false, true),
496    (119, false, true),
497    (120, false, true),
498    (121, false, true),
499    (122, true, true),
500    (123, false, true),
501    (124, false, true),
502    (125, false, true),
503    (126, false, true),
504    (127, true, true),
505    (128, false, true),
506    (129, true, true),
507    (130, true, true),
508    (131, false, true),
509    (132, false, true),
510    (133, false, true),
511    (134, false, false),
512    (135, false, false),
513    (136, false, false),
514    (137, false, true),
515    (138, false, true),
516    (139, false, true),
517    (140, false, true),
518    (141, true, true),
519    (142, true, true),
520    (143, true, true),
521    (144, true, true),
522    (145, true, true),
523    (146, true, true),
524    (147, false, true),
525    (148, false, false),
526    (149, true, true),
527    (150, false, false),
528    (151, true, true),
529    (152, true, true),
530    (153, true, true),
531    (154, false, false),
532    (155, true, true),
533    (156, false, false),
534    (157, true, true),
535    (158, false, false),
536    (159, true, true),
537    (160, true, true),
538    (161, true, true),
539    (162, true, true),
540    (163, false, false),
541    (164, true, true),
542    (165, true, true),
543    (166, true, true),
544    (167, true, true),
545    (168, true, true),
546    (169, true, true),
547    (170, true, true),
548    (171, true, true),
549    (172, true, true),
550    (173, true, true),
551    (174, true, true),
552    (175, true, true),
553    (176, true, true),
554    (177, true, true),
555    (178, true, true),
556    (179, true, true),
557    (180, true, true),
558    (181, true, true),
559    (182, true, true),
560    (183, true, true),
561    (184, true, true),
562    (185, true, true),
563    (186, true, true),
564    (187, true, true),
565    (188, true, true),
566    (189, true, true),
567    (190, true, true),
568    (191, true, true),
569    (192, true, true),
570    (193, true, true),
571    (194, true, true),
572    (195, true, true),
573    (196, true, true),
574    (197, true, true),
575    (198, true, true),
576    (199, true, true),
577    (200, true, true),
578    (201, true, true),
579    (202, true, true),
580    (203, true, true),
581    (204, true, true),
582    (205, false, false),
583    (206, true, true),
584    (207, true, true),
585    (208, true, true),
586    (209, true, true),
587    (210, true, true),
588    (211, true, true),
589    (212, true, true),
590    (213, true, true),
591    (214, true, true),
592    (215, true, true),
593    (216, false, false),
594    (217, true, true),
595    (218, true, true),
596    (219, true, true),
597    (220, true, true),
598    (221, true, true),
599    (222, true, true),
600    (223, true, true),
601    (224, true, true),
602    (225, true, true),
603    (226, true, true),
604    (227, true, true),
605    (228, true, true),
606    (229, true, true),
607    (230, true, true),
608    (231, true, true),
609    (232, true, true),
610    (233, true, true),
611    (234, true, true),
612    (235, true, true),
613    (236, true, true),
614    (237, false, false),
615    (238, false, false),
616    (239, true, true),
617    (240, true, true),
618    (241, false, false),
619    (242, false, false),
620    (243, true, true),
621    (244, true, true),
622    (245, true, true),
623    (246, true, true),
624    (247, true, true),
625    (248, true, true),
626    (249, true, true),
627    (250, true, true),
628    (251, true, true),
629    (252, true, true),
630    (253, true, true),
631    (254, true, true),
632    (255, true, true),
633    (256, true, true),
634    (257, true, true),
635    (258, true, true),
636    (259, true, true),
637    (260, true, true),
638    (261, true, true),
639    (262, true, true),
640    (263, true, true),
641    (264, true, true),
642    (265, true, true),
643    (266, true, true),
644    (267, true, true),
645    (268, true, true),
646    (269, false, false),
647    (270, false, false),
648    (271, true, true),
649    (272, true, true),
650    (273, true, true),
651    (274, true, true),
652    (275, true, true),
653    (276, true, true),
654    (277, true, true),
655    (278, true, true),
656    (279, true, true),
657    (280, true, true),
658    (281, true, true),
659    (282, true, true),
660    (283, true, true),
661    (284, true, true),
662    (285, true, true),
663    (286, true, true),
664    (287, true, true),
665    (288, true, true),
666    (289, true, true),
667    (290, true, true),
668    (291, true, true),
669    (292, true, true),
670    (293, true, true),
671    (294, false, false),
672    (295, true, true),
673    (296, true, true),
674    (297, true, true),
675    (298, true, true),
676    (299, true, true),
677    (300, true, true),
678    (301, true, true),
679    (302, true, true),
680    (303, true, true),
681    (304, true, true),
682    (305, true, true),
683    (306, true, true),
684    (307, true, true),
685    (308, false, false),
686    (309, false, false),
687    (310, true, true),
688    (311, true, true),
689    (312, true, true),
690    (313, true, true),
691    (314, true, true),
692    (315, false, false),
693    (316, true, true),
694    (317, true, true),
695    (318, true, true),
696    (319, false, false),
697    (320, false, false),
698    (321, false, false),
699    (322, false, false),
700    (323, false, false),
701    (324, false, false),
702    (325, false, false),
703    (326, false, false),
704    (327, false, false),
705    (328, false, false),
706    (329, false, false),
707    (330, false, false),
708    (331, false, false),
709    (332, false, false),
710    (333, false, false),
711    (334, false, false),
712    (335, false, false),
713    (336, false, false),
714    (337, false, false),
715    (338, false, false),
716    (339, false, false),
717    (340, false, false),
718    (341, false, false),
719    (342, false, false),
720    (343, false, false),
721    (344, false, false),
722    (345, false, false),
723    (346, false, false),
724    (347, false, false),
725    (348, false, false),
726    (349, false, false),
727    (350, false, false),
728    (351, true, true),
729    (352, true, true),
730    (353, true, true),
731    (354, true, true),
732];
733
734impl From<Rust> for &'static str {
735    #[inline]
736    fn from(tok: Rust) -> Self {
737        match tok {
738            Rust::End => "end",
739            Rust::Identifier => "identifier",
740            Rust::SEMI => ";",
741            Rust::MacroRulesBANG => "macro_rules!",
742            Rust::LPAREN => "(",
743            Rust::RPAREN => ")",
744            Rust::LBRACK => "[",
745            Rust::RBRACK => "]",
746            Rust::LBRACE => "{",
747            Rust::RBRACE => "}",
748            Rust::EQGT => "=>",
749            Rust::COLON => ":",
750            Rust::DOLLAR => "$",
751            Rust::TokenRepetitionPatternToken1 => "token_repetition_pattern_token1",
752            Rust::PLUS => "+",
753            Rust::STAR => "*",
754            Rust::QMARK => "?",
755            Rust::Block2 => "block",
756            Rust::Expr => "expr",
757            Rust::Expr2021 => "expr_2021",
758            Rust::Ident => "ident",
759            Rust::Item => "item",
760            Rust::Lifetime2 => "lifetime",
761            Rust::Literal => "literal",
762            Rust::Meta => "meta",
763            Rust::Pat => "pat",
764            Rust::PatParam => "pat_param",
765            Rust::Path => "path",
766            Rust::Stmt => "stmt",
767            Rust::Tt => "tt",
768            Rust::Ty => "ty",
769            Rust::Vis => "vis",
770            Rust::PrimitiveType => "primitive_type",
771            Rust::PrimitiveType2 => "primitive_type",
772            Rust::PrimitiveType3 => "primitive_type",
773            Rust::PrimitiveType4 => "primitive_type",
774            Rust::PrimitiveType5 => "primitive_type",
775            Rust::PrimitiveType6 => "primitive_type",
776            Rust::PrimitiveType7 => "primitive_type",
777            Rust::PrimitiveType8 => "primitive_type",
778            Rust::PrimitiveType9 => "primitive_type",
779            Rust::PrimitiveType10 => "primitive_type",
780            Rust::PrimitiveType11 => "primitive_type",
781            Rust::PrimitiveType12 => "primitive_type",
782            Rust::PrimitiveType13 => "primitive_type",
783            Rust::PrimitiveType14 => "primitive_type",
784            Rust::PrimitiveType15 => "primitive_type",
785            Rust::PrimitiveType16 => "primitive_type",
786            Rust::PrimitiveType17 => "primitive_type",
787            Rust::DASH => "-",
788            Rust::SLASH => "/",
789            Rust::PERCENT => "%",
790            Rust::CARET => "^",
791            Rust::BANG => "!",
792            Rust::AMP => "&",
793            Rust::PIPE => "|",
794            Rust::AMPAMP => "&&",
795            Rust::PIPEPIPE => "||",
796            Rust::LTLT => "<<",
797            Rust::GTGT => ">>",
798            Rust::PLUSEQ => "+=",
799            Rust::DASHEQ => "-=",
800            Rust::STAREQ => "*=",
801            Rust::SLASHEQ => "/=",
802            Rust::PERCENTEQ => "%=",
803            Rust::CARETEQ => "^=",
804            Rust::AMPEQ => "&=",
805            Rust::PIPEEQ => "|=",
806            Rust::LTLTEQ => "<<=",
807            Rust::GTGTEQ => ">>=",
808            Rust::EQ => "=",
809            Rust::EQEQ => "==",
810            Rust::BANGEQ => "!=",
811            Rust::GT => ">",
812            Rust::LT => "<",
813            Rust::GTEQ => ">=",
814            Rust::LTEQ => "<=",
815            Rust::AT => "@",
816            Rust::UNDERSCORE => "_",
817            Rust::DOT => ".",
818            Rust::DOTDOT => "..",
819            Rust::DOTDOTDOT => "...",
820            Rust::DOTDOTEQ => "..=",
821            Rust::COMMA => ",",
822            Rust::COLONCOLON => "::",
823            Rust::DASHGT => "->",
824            Rust::HASH => "#",
825            Rust::SQUOTE => "'",
826            Rust::As => "as",
827            Rust::Async => "async",
828            Rust::Await => "await",
829            Rust::Break => "break",
830            Rust::Const => "const",
831            Rust::Continue => "continue",
832            Rust::Default => "default",
833            Rust::Enum => "enum",
834            Rust::Fn => "fn",
835            Rust::For => "for",
836            Rust::Gen => "gen",
837            Rust::If => "if",
838            Rust::Impl => "impl",
839            Rust::Let => "let",
840            Rust::Loop => "loop",
841            Rust::Match => "match",
842            Rust::Mod => "mod",
843            Rust::Pub => "pub",
844            Rust::Return => "return",
845            Rust::Static => "static",
846            Rust::Struct => "struct",
847            Rust::Trait => "trait",
848            Rust::Type => "type",
849            Rust::Union => "union",
850            Rust::Unsafe => "unsafe",
851            Rust::Use => "use",
852            Rust::Where => "where",
853            Rust::While => "while",
854            Rust::Extern => "extern",
855            Rust::Ref => "ref",
856            Rust::Else => "else",
857            Rust::In => "in",
858            Rust::LT2 => "<",
859            Rust::Dyn => "dyn",
860            Rust::MutableSpecifier => "mutable_specifier",
861            Rust::Raw => "raw",
862            Rust::Yield => "yield",
863            Rust::Move => "move",
864            Rust::Try => "try",
865            Rust::IntegerLiteral => "integer_literal",
866            Rust::DQUOTE => "\"",
867            Rust::CharLiteral => "char_literal",
868            Rust::EscapeSequence => "escape_sequence",
869            Rust::True => "true",
870            Rust::False => "false",
871            Rust::SLASHSLASH => "//",
872            Rust::LineCommentToken1 => "line_comment_token1",
873            Rust::LineCommentToken2 => "line_comment_token2",
874            Rust::LineCommentToken3 => "line_comment_token3",
875            Rust::BANG2 => "!",
876            Rust::SLASH2 => "/",
877            Rust::SLASHSTAR => "/*",
878            Rust::STARSLASH => "*/",
879            Rust::Shebang => "shebang",
880            Rust::Zelf => "self",
881            Rust::Super => "super",
882            Rust::Crate => "crate",
883            Rust::Metavariable => "metavariable",
884            Rust::StringContent => "string_content",
885            Rust::DQUOTE2 => "\"",
886            Rust::RawStringLiteralStart => "_raw_string_literal_start",
887            Rust::StringContent2 => "string_content",
888            Rust::RawStringLiteralEnd => "_raw_string_literal_end",
889            Rust::FloatLiteral => "float_literal",
890            Rust::OuterDocCommentMarker => "outer_doc_comment_marker",
891            Rust::InnerDocCommentMarker => "inner_doc_comment_marker",
892            Rust::BlockCommentContent => "_block_comment_content",
893            Rust::DocComment => "doc_comment",
894            Rust::ErrorSentinel => "_error_sentinel",
895            Rust::SourceFile => "source_file",
896            Rust::Statement => "_statement",
897            Rust::EmptyStatement => "empty_statement",
898            Rust::ExpressionStatement => "expression_statement",
899            Rust::MacroDefinition => "macro_definition",
900            Rust::MacroRule => "macro_rule",
901            Rust::TokenPattern => "_token_pattern",
902            Rust::TokenTreePattern => "token_tree_pattern",
903            Rust::TokenBindingPattern => "token_binding_pattern",
904            Rust::TokenRepetitionPattern => "token_repetition_pattern",
905            Rust::FragmentSpecifier => "fragment_specifier",
906            Rust::TokenTree => "token_tree",
907            Rust::TokenRepetition => "token_repetition",
908            Rust::AttributeItem => "attribute_item",
909            Rust::InnerAttributeItem => "inner_attribute_item",
910            Rust::Attribute => "attribute",
911            Rust::ModItem => "mod_item",
912            Rust::ForeignModItem => "foreign_mod_item",
913            Rust::DeclarationList => "declaration_list",
914            Rust::StructItem => "struct_item",
915            Rust::UnionItem => "union_item",
916            Rust::EnumItem => "enum_item",
917            Rust::EnumVariantList => "enum_variant_list",
918            Rust::EnumVariant => "enum_variant",
919            Rust::FieldDeclarationList => "field_declaration_list",
920            Rust::FieldDeclaration => "field_declaration",
921            Rust::OrderedFieldDeclarationList => "ordered_field_declaration_list",
922            Rust::ExternCrateDeclaration => "extern_crate_declaration",
923            Rust::ConstItem => "const_item",
924            Rust::StaticItem => "static_item",
925            Rust::TypeItem => "type_item",
926            Rust::FunctionItem => "function_item",
927            Rust::FunctionSignatureItem => "function_signature_item",
928            Rust::FunctionModifiers => "function_modifiers",
929            Rust::WhereClause => "where_clause",
930            Rust::WherePredicate => "where_predicate",
931            Rust::ImplItem => "impl_item",
932            Rust::TraitItem => "trait_item",
933            Rust::AssociatedType => "associated_type",
934            Rust::TraitBounds => "trait_bounds",
935            Rust::HigherRankedTraitBound => "higher_ranked_trait_bound",
936            Rust::RemovedTraitBound => "removed_trait_bound",
937            Rust::TypeParameters => "type_parameters",
938            Rust::ConstParameter => "const_parameter",
939            Rust::TypeParameter => "type_parameter",
940            Rust::LifetimeParameter => "lifetime_parameter",
941            Rust::LetDeclaration => "let_declaration",
942            Rust::UseDeclaration => "use_declaration",
943            Rust::UseClause => "_use_clause",
944            Rust::ScopedUseList => "scoped_use_list",
945            Rust::UseList => "use_list",
946            Rust::UseAsClause => "use_as_clause",
947            Rust::UseWildcard => "use_wildcard",
948            Rust::Parameters => "parameters",
949            Rust::SelfParameter => "self_parameter",
950            Rust::VariadicParameter => "variadic_parameter",
951            Rust::Parameter => "parameter",
952            Rust::ExternModifier => "extern_modifier",
953            Rust::VisibilityModifier => "visibility_modifier",
954            Rust::Type2 => "_type",
955            Rust::BracketedType => "bracketed_type",
956            Rust::QualifiedType => "qualified_type",
957            Rust::Lifetime => "lifetime",
958            Rust::ArrayType => "array_type",
959            Rust::ForLifetimes => "for_lifetimes",
960            Rust::FunctionType => "function_type",
961            Rust::TupleType => "tuple_type",
962            Rust::UnitType => "unit_type",
963            Rust::GenericFunction => "generic_function",
964            Rust::GenericType => "generic_type",
965            Rust::GenericTypeWithTurbofish => "generic_type_with_turbofish",
966            Rust::BoundedType => "bounded_type",
967            Rust::UseBounds => "use_bounds",
968            Rust::TypeArguments => "type_arguments",
969            Rust::TypeBinding => "type_binding",
970            Rust::ReferenceType => "reference_type",
971            Rust::PointerType => "pointer_type",
972            Rust::NeverType => "never_type",
973            Rust::AbstractType => "abstract_type",
974            Rust::DynamicType => "dynamic_type",
975            Rust::ExpressionExceptRange => "_expression_except_range",
976            Rust::Expression => "_expression",
977            Rust::MacroInvocation => "macro_invocation",
978            Rust::TokenTree2 => "token_tree",
979            Rust::DelimTokens => "_delim_tokens",
980            Rust::NonDelimToken => "_non_delim_token",
981            Rust::ScopedIdentifier => "scoped_identifier",
982            Rust::ScopedTypeIdentifier => "scoped_type_identifier",
983            Rust::ScopedTypeIdentifier2 => "scoped_type_identifier",
984            Rust::RangeExpression => "range_expression",
985            Rust::UnaryExpression => "unary_expression",
986            Rust::TryExpression => "try_expression",
987            Rust::ReferenceExpression => "reference_expression",
988            Rust::BinaryExpression => "binary_expression",
989            Rust::AssignmentExpression => "assignment_expression",
990            Rust::CompoundAssignmentExpr => "compound_assignment_expr",
991            Rust::TypeCastExpression => "type_cast_expression",
992            Rust::ReturnExpression => "return_expression",
993            Rust::YieldExpression => "yield_expression",
994            Rust::CallExpression => "call_expression",
995            Rust::Arguments => "arguments",
996            Rust::ArrayExpression => "array_expression",
997            Rust::ParenthesizedExpression => "parenthesized_expression",
998            Rust::TupleExpression => "tuple_expression",
999            Rust::UnitExpression => "unit_expression",
1000            Rust::StructExpression => "struct_expression",
1001            Rust::FieldInitializerList => "field_initializer_list",
1002            Rust::ShorthandFieldInitializer => "shorthand_field_initializer",
1003            Rust::FieldInitializer => "field_initializer",
1004            Rust::BaseFieldInitializer => "base_field_initializer",
1005            Rust::IfExpression => "if_expression",
1006            Rust::LetCondition => "let_condition",
1007            Rust::LetChain2 => "_let_chain",
1008            Rust::Condition => "_condition",
1009            Rust::ElseClause => "else_clause",
1010            Rust::MatchExpression => "match_expression",
1011            Rust::MatchBlock => "match_block",
1012            Rust::MatchArm => "match_arm",
1013            Rust::MatchArm2 => "match_arm",
1014            Rust::MatchPattern => "match_pattern",
1015            Rust::WhileExpression => "while_expression",
1016            Rust::LoopExpression => "loop_expression",
1017            Rust::ForExpression => "for_expression",
1018            Rust::ConstBlock => "const_block",
1019            Rust::ClosureExpression => "closure_expression",
1020            Rust::ClosureParameters => "closure_parameters",
1021            Rust::Label => "label",
1022            Rust::BreakExpression => "break_expression",
1023            Rust::ContinueExpression => "continue_expression",
1024            Rust::IndexExpression => "index_expression",
1025            Rust::AwaitExpression => "await_expression",
1026            Rust::FieldExpression => "field_expression",
1027            Rust::UnsafeBlock => "unsafe_block",
1028            Rust::AsyncBlock => "async_block",
1029            Rust::GenBlock => "gen_block",
1030            Rust::TryBlock => "try_block",
1031            Rust::Block => "block",
1032            Rust::Pattern => "_pattern",
1033            Rust::GenericPattern => "generic_pattern",
1034            Rust::TuplePattern => "tuple_pattern",
1035            Rust::SlicePattern => "slice_pattern",
1036            Rust::TupleStructPattern => "tuple_struct_pattern",
1037            Rust::StructPattern => "struct_pattern",
1038            Rust::FieldPattern => "field_pattern",
1039            Rust::RemainingFieldPattern => "remaining_field_pattern",
1040            Rust::MutPattern => "mut_pattern",
1041            Rust::RangePattern => "range_pattern",
1042            Rust::RefPattern => "ref_pattern",
1043            Rust::CapturedPattern => "captured_pattern",
1044            Rust::ReferencePattern => "reference_pattern",
1045            Rust::OrPattern => "or_pattern",
1046            Rust::Literal2 => "_literal",
1047            Rust::LiteralPattern => "_literal_pattern",
1048            Rust::NegativeLiteral => "negative_literal",
1049            Rust::StringLiteral => "string_literal",
1050            Rust::RawStringLiteral => "raw_string_literal",
1051            Rust::BooleanLiteral => "boolean_literal",
1052            Rust::LineComment => "line_comment",
1053            Rust::LineDocCommentMarker => "_line_doc_comment_marker",
1054            Rust::InnerDocCommentMarker2 => "inner_doc_comment_marker",
1055            Rust::OuterDocCommentMarker2 => "outer_doc_comment_marker",
1056            Rust::BlockComment => "block_comment",
1057            Rust::BlockDocCommentMarker => "_block_doc_comment_marker",
1058            Rust::SourceFileRepeat1 => "source_file_repeat1",
1059            Rust::MacroDefinitionRepeat1 => "macro_definition_repeat1",
1060            Rust::TokenTreePatternRepeat1 => "token_tree_pattern_repeat1",
1061            Rust::TokenTreeRepeat1 => "token_tree_repeat1",
1062            Rust::NonSpecialTokenRepeat1 => "_non_special_token_repeat1",
1063            Rust::DeclarationListRepeat1 => "declaration_list_repeat1",
1064            Rust::EnumVariantListRepeat1 => "enum_variant_list_repeat1",
1065            Rust::EnumVariantListRepeat2 => "enum_variant_list_repeat2",
1066            Rust::FieldDeclarationListRepeat1 => "field_declaration_list_repeat1",
1067            Rust::OrderedFieldDeclarationListRepeat1 => "ordered_field_declaration_list_repeat1",
1068            Rust::FunctionModifiersRepeat1 => "function_modifiers_repeat1",
1069            Rust::WhereClauseRepeat1 => "where_clause_repeat1",
1070            Rust::TraitBoundsRepeat1 => "trait_bounds_repeat1",
1071            Rust::TypeParametersRepeat1 => "type_parameters_repeat1",
1072            Rust::UseListRepeat1 => "use_list_repeat1",
1073            Rust::ParametersRepeat1 => "parameters_repeat1",
1074            Rust::ForLifetimesRepeat1 => "for_lifetimes_repeat1",
1075            Rust::TupleTypeRepeat1 => "tuple_type_repeat1",
1076            Rust::UseBoundsRepeat1 => "use_bounds_repeat1",
1077            Rust::TypeArgumentsRepeat1 => "type_arguments_repeat1",
1078            Rust::DelimTokenTreeRepeat1 => "delim_token_tree_repeat1",
1079            Rust::ArgumentsRepeat1 => "arguments_repeat1",
1080            Rust::TupleExpressionRepeat1 => "tuple_expression_repeat1",
1081            Rust::FieldInitializerListRepeat1 => "field_initializer_list_repeat1",
1082            Rust::MatchBlockRepeat1 => "match_block_repeat1",
1083            Rust::MatchArmRepeat1 => "match_arm_repeat1",
1084            Rust::ClosureParametersRepeat1 => "closure_parameters_repeat1",
1085            Rust::TuplePatternRepeat1 => "tuple_pattern_repeat1",
1086            Rust::SlicePatternRepeat1 => "slice_pattern_repeat1",
1087            Rust::StructPatternRepeat1 => "struct_pattern_repeat1",
1088            Rust::StringLiteralRepeat1 => "string_literal_repeat1",
1089            Rust::FieldIdentifier => "field_identifier",
1090            Rust::LetChain => "let_chain",
1091            Rust::ShorthandFieldIdentifier => "shorthand_field_identifier",
1092            Rust::TypeIdentifier => "type_identifier",
1093            Rust::Error => "ERROR",
1094        }
1095    }
1096}
1097
1098impl From<u16> for Rust {
1099    #[inline]
1100    fn from(x: u16) -> Self {
1101        num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
1102    }
1103}
1104
1105// Rust == u16
1106impl PartialEq<u16> for Rust {
1107    #[inline]
1108    fn eq(&self, x: &u16) -> bool {
1109        *self == Into::<Self>::into(*x)
1110    }
1111}
1112
1113// u16 == Rust
1114impl PartialEq<Rust> for u16 {
1115    #[inline]
1116    fn eq(&self, x: &Rust) -> bool {
1117        *x == *self
1118    }
1119}