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
372impl From<Rust> for &'static str {
373    #[inline]
374    fn from(tok: Rust) -> Self {
375        match tok {
376            Rust::End => "end",
377            Rust::Identifier => "identifier",
378            Rust::SEMI => ";",
379            Rust::MacroRulesBANG => "macro_rules!",
380            Rust::LPAREN => "(",
381            Rust::RPAREN => ")",
382            Rust::LBRACK => "[",
383            Rust::RBRACK => "]",
384            Rust::LBRACE => "{",
385            Rust::RBRACE => "}",
386            Rust::EQGT => "=>",
387            Rust::COLON => ":",
388            Rust::DOLLAR => "$",
389            Rust::TokenRepetitionPatternToken1 => "token_repetition_pattern_token1",
390            Rust::PLUS => "+",
391            Rust::STAR => "*",
392            Rust::QMARK => "?",
393            Rust::Block2 => "block",
394            Rust::Expr => "expr",
395            Rust::Expr2021 => "expr_2021",
396            Rust::Ident => "ident",
397            Rust::Item => "item",
398            Rust::Lifetime2 => "lifetime",
399            Rust::Literal => "literal",
400            Rust::Meta => "meta",
401            Rust::Pat => "pat",
402            Rust::PatParam => "pat_param",
403            Rust::Path => "path",
404            Rust::Stmt => "stmt",
405            Rust::Tt => "tt",
406            Rust::Ty => "ty",
407            Rust::Vis => "vis",
408            Rust::PrimitiveType => "primitive_type",
409            Rust::PrimitiveType2 => "primitive_type",
410            Rust::PrimitiveType3 => "primitive_type",
411            Rust::PrimitiveType4 => "primitive_type",
412            Rust::PrimitiveType5 => "primitive_type",
413            Rust::PrimitiveType6 => "primitive_type",
414            Rust::PrimitiveType7 => "primitive_type",
415            Rust::PrimitiveType8 => "primitive_type",
416            Rust::PrimitiveType9 => "primitive_type",
417            Rust::PrimitiveType10 => "primitive_type",
418            Rust::PrimitiveType11 => "primitive_type",
419            Rust::PrimitiveType12 => "primitive_type",
420            Rust::PrimitiveType13 => "primitive_type",
421            Rust::PrimitiveType14 => "primitive_type",
422            Rust::PrimitiveType15 => "primitive_type",
423            Rust::PrimitiveType16 => "primitive_type",
424            Rust::PrimitiveType17 => "primitive_type",
425            Rust::DASH => "-",
426            Rust::SLASH => "/",
427            Rust::PERCENT => "%",
428            Rust::CARET => "^",
429            Rust::BANG => "!",
430            Rust::AMP => "&",
431            Rust::PIPE => "|",
432            Rust::AMPAMP => "&&",
433            Rust::PIPEPIPE => "||",
434            Rust::LTLT => "<<",
435            Rust::GTGT => ">>",
436            Rust::PLUSEQ => "+=",
437            Rust::DASHEQ => "-=",
438            Rust::STAREQ => "*=",
439            Rust::SLASHEQ => "/=",
440            Rust::PERCENTEQ => "%=",
441            Rust::CARETEQ => "^=",
442            Rust::AMPEQ => "&=",
443            Rust::PIPEEQ => "|=",
444            Rust::LTLTEQ => "<<=",
445            Rust::GTGTEQ => ">>=",
446            Rust::EQ => "=",
447            Rust::EQEQ => "==",
448            Rust::BANGEQ => "!=",
449            Rust::GT => ">",
450            Rust::LT => "<",
451            Rust::GTEQ => ">=",
452            Rust::LTEQ => "<=",
453            Rust::AT => "@",
454            Rust::UNDERSCORE => "_",
455            Rust::DOT => ".",
456            Rust::DOTDOT => "..",
457            Rust::DOTDOTDOT => "...",
458            Rust::DOTDOTEQ => "..=",
459            Rust::COMMA => ",",
460            Rust::COLONCOLON => "::",
461            Rust::DASHGT => "->",
462            Rust::HASH => "#",
463            Rust::SQUOTE => "'",
464            Rust::As => "as",
465            Rust::Async => "async",
466            Rust::Await => "await",
467            Rust::Break => "break",
468            Rust::Const => "const",
469            Rust::Continue => "continue",
470            Rust::Default => "default",
471            Rust::Enum => "enum",
472            Rust::Fn => "fn",
473            Rust::For => "for",
474            Rust::Gen => "gen",
475            Rust::If => "if",
476            Rust::Impl => "impl",
477            Rust::Let => "let",
478            Rust::Loop => "loop",
479            Rust::Match => "match",
480            Rust::Mod => "mod",
481            Rust::Pub => "pub",
482            Rust::Return => "return",
483            Rust::Static => "static",
484            Rust::Struct => "struct",
485            Rust::Trait => "trait",
486            Rust::Type => "type",
487            Rust::Union => "union",
488            Rust::Unsafe => "unsafe",
489            Rust::Use => "use",
490            Rust::Where => "where",
491            Rust::While => "while",
492            Rust::Extern => "extern",
493            Rust::Ref => "ref",
494            Rust::Else => "else",
495            Rust::In => "in",
496            Rust::LT2 => "<",
497            Rust::Dyn => "dyn",
498            Rust::MutableSpecifier => "mutable_specifier",
499            Rust::Raw => "raw",
500            Rust::Yield => "yield",
501            Rust::Move => "move",
502            Rust::Try => "try",
503            Rust::IntegerLiteral => "integer_literal",
504            Rust::DQUOTE => "\"",
505            Rust::CharLiteral => "char_literal",
506            Rust::EscapeSequence => "escape_sequence",
507            Rust::True => "true",
508            Rust::False => "false",
509            Rust::SLASHSLASH => "//",
510            Rust::LineCommentToken1 => "line_comment_token1",
511            Rust::LineCommentToken2 => "line_comment_token2",
512            Rust::LineCommentToken3 => "line_comment_token3",
513            Rust::BANG2 => "!",
514            Rust::SLASH2 => "/",
515            Rust::SLASHSTAR => "/*",
516            Rust::STARSLASH => "*/",
517            Rust::Shebang => "shebang",
518            Rust::Zelf => "self",
519            Rust::Super => "super",
520            Rust::Crate => "crate",
521            Rust::Metavariable => "metavariable",
522            Rust::StringContent => "string_content",
523            Rust::DQUOTE2 => "\"",
524            Rust::RawStringLiteralStart => "_raw_string_literal_start",
525            Rust::StringContent2 => "string_content",
526            Rust::RawStringLiteralEnd => "_raw_string_literal_end",
527            Rust::FloatLiteral => "float_literal",
528            Rust::OuterDocCommentMarker => "outer_doc_comment_marker",
529            Rust::InnerDocCommentMarker => "inner_doc_comment_marker",
530            Rust::BlockCommentContent => "_block_comment_content",
531            Rust::DocComment => "doc_comment",
532            Rust::ErrorSentinel => "_error_sentinel",
533            Rust::SourceFile => "source_file",
534            Rust::Statement => "_statement",
535            Rust::EmptyStatement => "empty_statement",
536            Rust::ExpressionStatement => "expression_statement",
537            Rust::MacroDefinition => "macro_definition",
538            Rust::MacroRule => "macro_rule",
539            Rust::TokenPattern => "_token_pattern",
540            Rust::TokenTreePattern => "token_tree_pattern",
541            Rust::TokenBindingPattern => "token_binding_pattern",
542            Rust::TokenRepetitionPattern => "token_repetition_pattern",
543            Rust::FragmentSpecifier => "fragment_specifier",
544            Rust::TokenTree => "token_tree",
545            Rust::TokenRepetition => "token_repetition",
546            Rust::AttributeItem => "attribute_item",
547            Rust::InnerAttributeItem => "inner_attribute_item",
548            Rust::Attribute => "attribute",
549            Rust::ModItem => "mod_item",
550            Rust::ForeignModItem => "foreign_mod_item",
551            Rust::DeclarationList => "declaration_list",
552            Rust::StructItem => "struct_item",
553            Rust::UnionItem => "union_item",
554            Rust::EnumItem => "enum_item",
555            Rust::EnumVariantList => "enum_variant_list",
556            Rust::EnumVariant => "enum_variant",
557            Rust::FieldDeclarationList => "field_declaration_list",
558            Rust::FieldDeclaration => "field_declaration",
559            Rust::OrderedFieldDeclarationList => "ordered_field_declaration_list",
560            Rust::ExternCrateDeclaration => "extern_crate_declaration",
561            Rust::ConstItem => "const_item",
562            Rust::StaticItem => "static_item",
563            Rust::TypeItem => "type_item",
564            Rust::FunctionItem => "function_item",
565            Rust::FunctionSignatureItem => "function_signature_item",
566            Rust::FunctionModifiers => "function_modifiers",
567            Rust::WhereClause => "where_clause",
568            Rust::WherePredicate => "where_predicate",
569            Rust::ImplItem => "impl_item",
570            Rust::TraitItem => "trait_item",
571            Rust::AssociatedType => "associated_type",
572            Rust::TraitBounds => "trait_bounds",
573            Rust::HigherRankedTraitBound => "higher_ranked_trait_bound",
574            Rust::RemovedTraitBound => "removed_trait_bound",
575            Rust::TypeParameters => "type_parameters",
576            Rust::ConstParameter => "const_parameter",
577            Rust::TypeParameter => "type_parameter",
578            Rust::LifetimeParameter => "lifetime_parameter",
579            Rust::LetDeclaration => "let_declaration",
580            Rust::UseDeclaration => "use_declaration",
581            Rust::UseClause => "_use_clause",
582            Rust::ScopedUseList => "scoped_use_list",
583            Rust::UseList => "use_list",
584            Rust::UseAsClause => "use_as_clause",
585            Rust::UseWildcard => "use_wildcard",
586            Rust::Parameters => "parameters",
587            Rust::SelfParameter => "self_parameter",
588            Rust::VariadicParameter => "variadic_parameter",
589            Rust::Parameter => "parameter",
590            Rust::ExternModifier => "extern_modifier",
591            Rust::VisibilityModifier => "visibility_modifier",
592            Rust::Type2 => "_type",
593            Rust::BracketedType => "bracketed_type",
594            Rust::QualifiedType => "qualified_type",
595            Rust::Lifetime => "lifetime",
596            Rust::ArrayType => "array_type",
597            Rust::ForLifetimes => "for_lifetimes",
598            Rust::FunctionType => "function_type",
599            Rust::TupleType => "tuple_type",
600            Rust::UnitType => "unit_type",
601            Rust::GenericFunction => "generic_function",
602            Rust::GenericType => "generic_type",
603            Rust::GenericTypeWithTurbofish => "generic_type_with_turbofish",
604            Rust::BoundedType => "bounded_type",
605            Rust::UseBounds => "use_bounds",
606            Rust::TypeArguments => "type_arguments",
607            Rust::TypeBinding => "type_binding",
608            Rust::ReferenceType => "reference_type",
609            Rust::PointerType => "pointer_type",
610            Rust::NeverType => "never_type",
611            Rust::AbstractType => "abstract_type",
612            Rust::DynamicType => "dynamic_type",
613            Rust::ExpressionExceptRange => "_expression_except_range",
614            Rust::Expression => "_expression",
615            Rust::MacroInvocation => "macro_invocation",
616            Rust::TokenTree2 => "token_tree",
617            Rust::DelimTokens => "_delim_tokens",
618            Rust::NonDelimToken => "_non_delim_token",
619            Rust::ScopedIdentifier => "scoped_identifier",
620            Rust::ScopedTypeIdentifier => "scoped_type_identifier",
621            Rust::ScopedTypeIdentifier2 => "scoped_type_identifier",
622            Rust::RangeExpression => "range_expression",
623            Rust::UnaryExpression => "unary_expression",
624            Rust::TryExpression => "try_expression",
625            Rust::ReferenceExpression => "reference_expression",
626            Rust::BinaryExpression => "binary_expression",
627            Rust::AssignmentExpression => "assignment_expression",
628            Rust::CompoundAssignmentExpr => "compound_assignment_expr",
629            Rust::TypeCastExpression => "type_cast_expression",
630            Rust::ReturnExpression => "return_expression",
631            Rust::YieldExpression => "yield_expression",
632            Rust::CallExpression => "call_expression",
633            Rust::Arguments => "arguments",
634            Rust::ArrayExpression => "array_expression",
635            Rust::ParenthesizedExpression => "parenthesized_expression",
636            Rust::TupleExpression => "tuple_expression",
637            Rust::UnitExpression => "unit_expression",
638            Rust::StructExpression => "struct_expression",
639            Rust::FieldInitializerList => "field_initializer_list",
640            Rust::ShorthandFieldInitializer => "shorthand_field_initializer",
641            Rust::FieldInitializer => "field_initializer",
642            Rust::BaseFieldInitializer => "base_field_initializer",
643            Rust::IfExpression => "if_expression",
644            Rust::LetCondition => "let_condition",
645            Rust::LetChain2 => "_let_chain",
646            Rust::Condition => "_condition",
647            Rust::ElseClause => "else_clause",
648            Rust::MatchExpression => "match_expression",
649            Rust::MatchBlock => "match_block",
650            Rust::MatchArm => "match_arm",
651            Rust::MatchArm2 => "match_arm",
652            Rust::MatchPattern => "match_pattern",
653            Rust::WhileExpression => "while_expression",
654            Rust::LoopExpression => "loop_expression",
655            Rust::ForExpression => "for_expression",
656            Rust::ConstBlock => "const_block",
657            Rust::ClosureExpression => "closure_expression",
658            Rust::ClosureParameters => "closure_parameters",
659            Rust::Label => "label",
660            Rust::BreakExpression => "break_expression",
661            Rust::ContinueExpression => "continue_expression",
662            Rust::IndexExpression => "index_expression",
663            Rust::AwaitExpression => "await_expression",
664            Rust::FieldExpression => "field_expression",
665            Rust::UnsafeBlock => "unsafe_block",
666            Rust::AsyncBlock => "async_block",
667            Rust::GenBlock => "gen_block",
668            Rust::TryBlock => "try_block",
669            Rust::Block => "block",
670            Rust::Pattern => "_pattern",
671            Rust::GenericPattern => "generic_pattern",
672            Rust::TuplePattern => "tuple_pattern",
673            Rust::SlicePattern => "slice_pattern",
674            Rust::TupleStructPattern => "tuple_struct_pattern",
675            Rust::StructPattern => "struct_pattern",
676            Rust::FieldPattern => "field_pattern",
677            Rust::RemainingFieldPattern => "remaining_field_pattern",
678            Rust::MutPattern => "mut_pattern",
679            Rust::RangePattern => "range_pattern",
680            Rust::RefPattern => "ref_pattern",
681            Rust::CapturedPattern => "captured_pattern",
682            Rust::ReferencePattern => "reference_pattern",
683            Rust::OrPattern => "or_pattern",
684            Rust::Literal2 => "_literal",
685            Rust::LiteralPattern => "_literal_pattern",
686            Rust::NegativeLiteral => "negative_literal",
687            Rust::StringLiteral => "string_literal",
688            Rust::RawStringLiteral => "raw_string_literal",
689            Rust::BooleanLiteral => "boolean_literal",
690            Rust::LineComment => "line_comment",
691            Rust::LineDocCommentMarker => "_line_doc_comment_marker",
692            Rust::InnerDocCommentMarker2 => "inner_doc_comment_marker",
693            Rust::OuterDocCommentMarker2 => "outer_doc_comment_marker",
694            Rust::BlockComment => "block_comment",
695            Rust::BlockDocCommentMarker => "_block_doc_comment_marker",
696            Rust::SourceFileRepeat1 => "source_file_repeat1",
697            Rust::MacroDefinitionRepeat1 => "macro_definition_repeat1",
698            Rust::TokenTreePatternRepeat1 => "token_tree_pattern_repeat1",
699            Rust::TokenTreeRepeat1 => "token_tree_repeat1",
700            Rust::NonSpecialTokenRepeat1 => "_non_special_token_repeat1",
701            Rust::DeclarationListRepeat1 => "declaration_list_repeat1",
702            Rust::EnumVariantListRepeat1 => "enum_variant_list_repeat1",
703            Rust::EnumVariantListRepeat2 => "enum_variant_list_repeat2",
704            Rust::FieldDeclarationListRepeat1 => "field_declaration_list_repeat1",
705            Rust::OrderedFieldDeclarationListRepeat1 => "ordered_field_declaration_list_repeat1",
706            Rust::FunctionModifiersRepeat1 => "function_modifiers_repeat1",
707            Rust::WhereClauseRepeat1 => "where_clause_repeat1",
708            Rust::TraitBoundsRepeat1 => "trait_bounds_repeat1",
709            Rust::TypeParametersRepeat1 => "type_parameters_repeat1",
710            Rust::UseListRepeat1 => "use_list_repeat1",
711            Rust::ParametersRepeat1 => "parameters_repeat1",
712            Rust::ForLifetimesRepeat1 => "for_lifetimes_repeat1",
713            Rust::TupleTypeRepeat1 => "tuple_type_repeat1",
714            Rust::UseBoundsRepeat1 => "use_bounds_repeat1",
715            Rust::TypeArgumentsRepeat1 => "type_arguments_repeat1",
716            Rust::DelimTokenTreeRepeat1 => "delim_token_tree_repeat1",
717            Rust::ArgumentsRepeat1 => "arguments_repeat1",
718            Rust::TupleExpressionRepeat1 => "tuple_expression_repeat1",
719            Rust::FieldInitializerListRepeat1 => "field_initializer_list_repeat1",
720            Rust::MatchBlockRepeat1 => "match_block_repeat1",
721            Rust::MatchArmRepeat1 => "match_arm_repeat1",
722            Rust::ClosureParametersRepeat1 => "closure_parameters_repeat1",
723            Rust::TuplePatternRepeat1 => "tuple_pattern_repeat1",
724            Rust::SlicePatternRepeat1 => "slice_pattern_repeat1",
725            Rust::StructPatternRepeat1 => "struct_pattern_repeat1",
726            Rust::StringLiteralRepeat1 => "string_literal_repeat1",
727            Rust::FieldIdentifier => "field_identifier",
728            Rust::LetChain => "let_chain",
729            Rust::ShorthandFieldIdentifier => "shorthand_field_identifier",
730            Rust::TypeIdentifier => "type_identifier",
731            Rust::Error => "ERROR",
732        }
733    }
734}
735
736impl From<u16> for Rust {
737    #[inline]
738    fn from(x: u16) -> Self {
739        num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
740    }
741}
742
743// Rust == u16
744impl PartialEq<u16> for Rust {
745    #[inline]
746    fn eq(&self, x: &u16) -> bool {
747        *self == Into::<Self>::into(*x)
748    }
749}
750
751// u16 == Rust
752impl PartialEq<Rust> for u16 {
753    #[inline]
754    fn eq(&self, x: &Rust) -> bool {
755        *x == *self
756    }
757}