Skip to main content

big_code_analysis_ast/languages/
language_java.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 Java {
14    End = 0,
15    Identifier = 1,
16    DecimalIntegerLiteral = 2,
17    HexIntegerLiteral = 3,
18    OctalIntegerLiteral = 4,
19    BinaryIntegerLiteral = 5,
20    DecimalFloatingPointLiteral = 6,
21    HexFloatingPointLiteral = 7,
22    True = 8,
23    False = 9,
24    CharacterLiteral = 10,
25    DQUOTE = 11,
26    DQUOTEDQUOTEDQUOTE = 12,
27    StringFragment = 13,
28    MultilineStringFragmentToken1 = 14,
29    MultilineStringFragmentToken2 = 15,
30    BSLASHLBRACE = 16,
31    RBRACE = 17,
32    EscapeSequenceToken1 = 18,
33    EscapeSequence = 19,
34    NullLiteral = 20,
35    LPAREN = 21,
36    RPAREN = 22,
37    AMP = 23,
38    EQ = 24,
39    PLUSEQ = 25,
40    DASHEQ = 26,
41    STAREQ = 27,
42    SLASHEQ = 28,
43    AMPEQ = 29,
44    PIPEEQ = 30,
45    CARETEQ = 31,
46    PERCENTEQ = 32,
47    LTLTEQ = 33,
48    GTGTEQ = 34,
49    GTGTGTEQ = 35,
50    GT = 36,
51    LT = 37,
52    GTEQ = 38,
53    LTEQ = 39,
54    EQEQ = 40,
55    BANGEQ = 41,
56    AMPAMP = 42,
57    PIPEPIPE = 43,
58    PLUS = 44,
59    DASH = 45,
60    STAR = 46,
61    SLASH = 47,
62    PIPE = 48,
63    CARET = 49,
64    PERCENT = 50,
65    LTLT = 51,
66    GTGT = 52,
67    GTGTGT = 53,
68    Instanceof = 54,
69    Final = 55,
70    DASHGT = 56,
71    COMMA = 57,
72    QMARK = 58,
73    COLON = 59,
74    BANG = 60,
75    TILDE = 61,
76    PLUSPLUS = 62,
77    DASHDASH = 63,
78    New = 64,
79    LBRACK = 65,
80    RBRACK = 66,
81    DOT = 67,
82    Class = 68,
83    COLONCOLON = 69,
84    Extends = 70,
85    Switch = 71,
86    LBRACE = 72,
87    Case = 73,
88    Default = 74,
89    UnderscorePattern = 75,
90    When = 76,
91    SEMI = 77,
92    Assert = 78,
93    Do = 79,
94    While = 80,
95    Break = 81,
96    Continue = 82,
97    Return = 83,
98    Yield = 84,
99    Synchronized = 85,
100    Throw = 86,
101    Try = 87,
102    Catch = 88,
103    Finally = 89,
104    If = 90,
105    Else = 91,
106    For = 92,
107    AT = 93,
108    Open = 94,
109    Module = 95,
110    Requires = 96,
111    Transitive = 97,
112    Static = 98,
113    Exports = 99,
114    To = 100,
115    Opens = 101,
116    Uses = 102,
117    Provides = 103,
118    With = 104,
119    Package = 105,
120    Import = 106,
121    Enum = 107,
122    Public = 108,
123    Protected = 109,
124    Private = 110,
125    Abstract = 111,
126    Strictfp = 112,
127    Native = 113,
128    Transient = 114,
129    Volatile = 115,
130    Sealed = 116,
131    NonDASHsealed = 117,
132    Implements = 118,
133    Permits2 = 119,
134    Record = 120,
135    ATinterface = 121,
136    Interface = 122,
137    Byte = 123,
138    Short = 124,
139    Int = 125,
140    Long = 126,
141    Char = 127,
142    Float = 128,
143    Double = 129,
144    BooleanType = 130,
145    VoidType = 131,
146    DOTDOTDOT = 132,
147    Throws2 = 133,
148    This = 134,
149    Super = 135,
150    LineComment = 136,
151    BlockComment = 137,
152    Program = 138,
153    ToplevelStatement = 139,
154    Literal = 140,
155    StringLiteral = 141,
156    StringLiteral2 = 142,
157    MultilineStringLiteral = 143,
158    MultilineStringFragment = 144,
159    StringInterpolation = 145,
160    EscapeSequence2 = 146,
161    Expression = 147,
162    CastExpression = 148,
163    AssignmentExpression = 149,
164    BinaryExpression = 150,
165    InstanceofExpression = 151,
166    LambdaExpression = 152,
167    InferredParameters = 153,
168    TernaryExpression = 154,
169    UnaryExpression = 155,
170    UpdateExpression = 156,
171    PrimaryExpression = 157,
172    ArrayCreationExpression = 158,
173    DimensionsExpr = 159,
174    ParenthesizedExpression = 160,
175    ClassLiteral = 161,
176    ObjectCreationExpression = 162,
177    UnqualifiedObjectCreationExpression = 163,
178    FieldAccess = 164,
179    TemplateExpression = 165,
180    ArrayAccess = 166,
181    MethodInvocation = 167,
182    ArgumentList = 168,
183    MethodReference = 169,
184    TypeArguments = 170,
185    Wildcard = 171,
186    WildcardBounds = 172,
187    Dimensions = 173,
188    SwitchExpression = 174,
189    SwitchBlock = 175,
190    SwitchBlockStatementGroup = 176,
191    SwitchRule = 177,
192    SwitchLabel = 178,
193    Pattern = 179,
194    TypePattern = 180,
195    RecordPattern = 181,
196    RecordPatternBody = 182,
197    RecordPatternComponent = 183,
198    Guard = 184,
199    Statement = 185,
200    Block = 186,
201    ExpressionStatement = 187,
202    LabeledStatement = 188,
203    AssertStatement = 189,
204    DoStatement = 190,
205    BreakStatement = 191,
206    ContinueStatement = 192,
207    ReturnStatement = 193,
208    YieldStatement = 194,
209    SynchronizedStatement = 195,
210    ThrowStatement = 196,
211    TryStatement = 197,
212    CatchClause = 198,
213    CatchFormalParameter = 199,
214    CatchType = 200,
215    FinallyClause = 201,
216    TryWithResourcesStatement = 202,
217    ResourceSpecification = 203,
218    Resource = 204,
219    IfStatement = 205,
220    WhileStatement = 206,
221    ForStatement = 207,
222    EnhancedForStatement = 208,
223    Annotation2 = 209,
224    MarkerAnnotation = 210,
225    Annotation = 211,
226    AnnotationArgumentList = 212,
227    ElementValuePair = 213,
228    ElementValue = 214,
229    ElementValueArrayInitializer = 215,
230    Declaration = 216,
231    ModuleDeclaration = 217,
232    ModuleBody = 218,
233    ModuleDirective = 219,
234    RequiresModuleDirective = 220,
235    RequiresModifier = 221,
236    ExportsModuleDirective = 222,
237    OpensModuleDirective = 223,
238    UsesModuleDirective = 224,
239    ProvidesModuleDirective = 225,
240    PackageDeclaration = 226,
241    ImportDeclaration = 227,
242    Asterisk = 228,
243    EnumDeclaration = 229,
244    EnumBody = 230,
245    EnumBodyDeclarations = 231,
246    EnumConstant = 232,
247    ClassDeclaration = 233,
248    Modifiers = 234,
249    TypeParameters = 235,
250    TypeParameter = 236,
251    TypeBound = 237,
252    Superclass = 238,
253    SuperInterfaces = 239,
254    TypeList = 240,
255    Permits = 241,
256    ClassBody = 242,
257    StaticInitializer = 243,
258    ConstructorDeclaration = 244,
259    ConstructorDeclarator = 245,
260    ConstructorBody = 246,
261    ExplicitConstructorInvocation = 247,
262    ScopedIdentifier = 248,
263    FieldDeclaration = 249,
264    RecordDeclaration = 250,
265    AnnotationTypeDeclaration = 251,
266    AnnotationTypeBody = 252,
267    AnnotationTypeElementDeclaration = 253,
268    DefaultValue = 254,
269    InterfaceDeclaration = 255,
270    ExtendsInterfaces = 256,
271    InterfaceBody = 257,
272    ConstantDeclaration = 258,
273    VariableDeclaratorList = 259,
274    VariableDeclarator = 260,
275    VariableDeclaratorId = 261,
276    ArrayInitializer = 262,
277    Type = 263,
278    UnannotatedType = 264,
279    AnnotatedType = 265,
280    ScopedTypeIdentifier = 266,
281    GenericType = 267,
282    ArrayType = 268,
283    IntegralType = 269,
284    FloatingPointType = 270,
285    MethodHeader = 271,
286    MethodDeclarator = 272,
287    FormalParameters = 273,
288    FormalParameter = 274,
289    ReceiverParameter = 275,
290    SpreadParameter = 276,
291    Throws = 277,
292    LocalVariableDeclaration = 278,
293    MethodDeclaration = 279,
294    CompactConstructorDeclaration = 280,
295    ReservedIdentifier = 281,
296    ProgramRepeat1 = 282,
297    StringLiteralRepeat1 = 283,
298    MultilineStringLiteralRepeat1 = 284,
299    CastExpressionRepeat1 = 285,
300    InferredParametersRepeat1 = 286,
301    ArrayCreationExpressionRepeat1 = 287,
302    ArrayCreationExpressionRepeat2 = 288,
303    ArgumentListRepeat1 = 289,
304    TypeArgumentsRepeat1 = 290,
305    DimensionsRepeat1 = 291,
306    SwitchBlockRepeat1 = 292,
307    SwitchBlockRepeat2 = 293,
308    SwitchBlockStatementGroupRepeat1 = 294,
309    SwitchBlockStatementGroupRepeat2 = 295,
310    RecordPatternBodyRepeat1 = 296,
311    TryStatementRepeat1 = 297,
312    CatchTypeRepeat1 = 298,
313    ResourceSpecificationRepeat1 = 299,
314    ForStatementRepeat1 = 300,
315    ForStatementRepeat2 = 301,
316    AnnotationArgumentListRepeat1 = 302,
317    ElementValueArrayInitializerRepeat1 = 303,
318    ModuleBodyRepeat1 = 304,
319    RequiresModuleDirectiveRepeat1 = 305,
320    ExportsModuleDirectiveRepeat1 = 306,
321    ProvidesModuleDirectiveRepeat1 = 307,
322    EnumBodyRepeat1 = 308,
323    EnumBodyDeclarationsRepeat1 = 309,
324    ModifiersRepeat1 = 310,
325    TypeParametersRepeat1 = 311,
326    TypeBoundRepeat1 = 312,
327    TypeListRepeat1 = 313,
328    AnnotationTypeBodyRepeat1 = 314,
329    InterfaceBodyRepeat1 = 315,
330    VariableDeclaratorListRepeat1 = 316,
331    ArrayInitializerRepeat1 = 317,
332    FormalParametersRepeat1 = 318,
333    ReceiverParameterRepeat1 = 319,
334    TypeIdentifier = 320,
335    Error = 321,
336}
337
338impl From<Java> for &'static str {
339    #[inline]
340    fn from(tok: Java) -> Self {
341        match tok {
342            Java::End => "end",
343            Java::Identifier => "identifier",
344            Java::DecimalIntegerLiteral => "decimal_integer_literal",
345            Java::HexIntegerLiteral => "hex_integer_literal",
346            Java::OctalIntegerLiteral => "octal_integer_literal",
347            Java::BinaryIntegerLiteral => "binary_integer_literal",
348            Java::DecimalFloatingPointLiteral => "decimal_floating_point_literal",
349            Java::HexFloatingPointLiteral => "hex_floating_point_literal",
350            Java::True => "true",
351            Java::False => "false",
352            Java::CharacterLiteral => "character_literal",
353            Java::DQUOTE => "\"",
354            Java::DQUOTEDQUOTEDQUOTE => "\"\"\"",
355            Java::StringFragment => "string_fragment",
356            Java::MultilineStringFragmentToken1 => "_multiline_string_fragment_token1",
357            Java::MultilineStringFragmentToken2 => "_multiline_string_fragment_token2",
358            Java::BSLASHLBRACE => "\\{",
359            Java::RBRACE => "}",
360            Java::EscapeSequenceToken1 => "_escape_sequence_token1",
361            Java::EscapeSequence => "escape_sequence",
362            Java::NullLiteral => "null_literal",
363            Java::LPAREN => "(",
364            Java::RPAREN => ")",
365            Java::AMP => "&",
366            Java::EQ => "=",
367            Java::PLUSEQ => "+=",
368            Java::DASHEQ => "-=",
369            Java::STAREQ => "*=",
370            Java::SLASHEQ => "/=",
371            Java::AMPEQ => "&=",
372            Java::PIPEEQ => "|=",
373            Java::CARETEQ => "^=",
374            Java::PERCENTEQ => "%=",
375            Java::LTLTEQ => "<<=",
376            Java::GTGTEQ => ">>=",
377            Java::GTGTGTEQ => ">>>=",
378            Java::GT => ">",
379            Java::LT => "<",
380            Java::GTEQ => ">=",
381            Java::LTEQ => "<=",
382            Java::EQEQ => "==",
383            Java::BANGEQ => "!=",
384            Java::AMPAMP => "&&",
385            Java::PIPEPIPE => "||",
386            Java::PLUS => "+",
387            Java::DASH => "-",
388            Java::STAR => "*",
389            Java::SLASH => "/",
390            Java::PIPE => "|",
391            Java::CARET => "^",
392            Java::PERCENT => "%",
393            Java::LTLT => "<<",
394            Java::GTGT => ">>",
395            Java::GTGTGT => ">>>",
396            Java::Instanceof => "instanceof",
397            Java::Final => "final",
398            Java::DASHGT => "->",
399            Java::COMMA => ",",
400            Java::QMARK => "?",
401            Java::COLON => ":",
402            Java::BANG => "!",
403            Java::TILDE => "~",
404            Java::PLUSPLUS => "++",
405            Java::DASHDASH => "--",
406            Java::New => "new",
407            Java::LBRACK => "[",
408            Java::RBRACK => "]",
409            Java::DOT => ".",
410            Java::Class => "class",
411            Java::COLONCOLON => "::",
412            Java::Extends => "extends",
413            Java::Switch => "switch",
414            Java::LBRACE => "{",
415            Java::Case => "case",
416            Java::Default => "default",
417            Java::UnderscorePattern => "underscore_pattern",
418            Java::When => "when",
419            Java::SEMI => ";",
420            Java::Assert => "assert",
421            Java::Do => "do",
422            Java::While => "while",
423            Java::Break => "break",
424            Java::Continue => "continue",
425            Java::Return => "return",
426            Java::Yield => "yield",
427            Java::Synchronized => "synchronized",
428            Java::Throw => "throw",
429            Java::Try => "try",
430            Java::Catch => "catch",
431            Java::Finally => "finally",
432            Java::If => "if",
433            Java::Else => "else",
434            Java::For => "for",
435            Java::AT => "@",
436            Java::Open => "open",
437            Java::Module => "module",
438            Java::Requires => "requires",
439            Java::Transitive => "transitive",
440            Java::Static => "static",
441            Java::Exports => "exports",
442            Java::To => "to",
443            Java::Opens => "opens",
444            Java::Uses => "uses",
445            Java::Provides => "provides",
446            Java::With => "with",
447            Java::Package => "package",
448            Java::Import => "import",
449            Java::Enum => "enum",
450            Java::Public => "public",
451            Java::Protected => "protected",
452            Java::Private => "private",
453            Java::Abstract => "abstract",
454            Java::Strictfp => "strictfp",
455            Java::Native => "native",
456            Java::Transient => "transient",
457            Java::Volatile => "volatile",
458            Java::Sealed => "sealed",
459            Java::NonDASHsealed => "non-sealed",
460            Java::Implements => "implements",
461            Java::Permits2 => "permits",
462            Java::Record => "record",
463            Java::ATinterface => "@interface",
464            Java::Interface => "interface",
465            Java::Byte => "byte",
466            Java::Short => "short",
467            Java::Int => "int",
468            Java::Long => "long",
469            Java::Char => "char",
470            Java::Float => "float",
471            Java::Double => "double",
472            Java::BooleanType => "boolean_type",
473            Java::VoidType => "void_type",
474            Java::DOTDOTDOT => "...",
475            Java::Throws2 => "throws",
476            Java::This => "this",
477            Java::Super => "super",
478            Java::LineComment => "line_comment",
479            Java::BlockComment => "block_comment",
480            Java::Program => "program",
481            Java::ToplevelStatement => "_toplevel_statement",
482            Java::Literal => "_literal",
483            Java::StringLiteral => "string_literal",
484            Java::StringLiteral2 => "_string_literal",
485            Java::MultilineStringLiteral => "_multiline_string_literal",
486            Java::MultilineStringFragment => "multiline_string_fragment",
487            Java::StringInterpolation => "string_interpolation",
488            Java::EscapeSequence2 => "_escape_sequence",
489            Java::Expression => "expression",
490            Java::CastExpression => "cast_expression",
491            Java::AssignmentExpression => "assignment_expression",
492            Java::BinaryExpression => "binary_expression",
493            Java::InstanceofExpression => "instanceof_expression",
494            Java::LambdaExpression => "lambda_expression",
495            Java::InferredParameters => "inferred_parameters",
496            Java::TernaryExpression => "ternary_expression",
497            Java::UnaryExpression => "unary_expression",
498            Java::UpdateExpression => "update_expression",
499            Java::PrimaryExpression => "primary_expression",
500            Java::ArrayCreationExpression => "array_creation_expression",
501            Java::DimensionsExpr => "dimensions_expr",
502            Java::ParenthesizedExpression => "parenthesized_expression",
503            Java::ClassLiteral => "class_literal",
504            Java::ObjectCreationExpression => "object_creation_expression",
505            Java::UnqualifiedObjectCreationExpression => "_unqualified_object_creation_expression",
506            Java::FieldAccess => "field_access",
507            Java::TemplateExpression => "template_expression",
508            Java::ArrayAccess => "array_access",
509            Java::MethodInvocation => "method_invocation",
510            Java::ArgumentList => "argument_list",
511            Java::MethodReference => "method_reference",
512            Java::TypeArguments => "type_arguments",
513            Java::Wildcard => "wildcard",
514            Java::WildcardBounds => "_wildcard_bounds",
515            Java::Dimensions => "dimensions",
516            Java::SwitchExpression => "switch_expression",
517            Java::SwitchBlock => "switch_block",
518            Java::SwitchBlockStatementGroup => "switch_block_statement_group",
519            Java::SwitchRule => "switch_rule",
520            Java::SwitchLabel => "switch_label",
521            Java::Pattern => "pattern",
522            Java::TypePattern => "type_pattern",
523            Java::RecordPattern => "record_pattern",
524            Java::RecordPatternBody => "record_pattern_body",
525            Java::RecordPatternComponent => "record_pattern_component",
526            Java::Guard => "guard",
527            Java::Statement => "statement",
528            Java::Block => "block",
529            Java::ExpressionStatement => "expression_statement",
530            Java::LabeledStatement => "labeled_statement",
531            Java::AssertStatement => "assert_statement",
532            Java::DoStatement => "do_statement",
533            Java::BreakStatement => "break_statement",
534            Java::ContinueStatement => "continue_statement",
535            Java::ReturnStatement => "return_statement",
536            Java::YieldStatement => "yield_statement",
537            Java::SynchronizedStatement => "synchronized_statement",
538            Java::ThrowStatement => "throw_statement",
539            Java::TryStatement => "try_statement",
540            Java::CatchClause => "catch_clause",
541            Java::CatchFormalParameter => "catch_formal_parameter",
542            Java::CatchType => "catch_type",
543            Java::FinallyClause => "finally_clause",
544            Java::TryWithResourcesStatement => "try_with_resources_statement",
545            Java::ResourceSpecification => "resource_specification",
546            Java::Resource => "resource",
547            Java::IfStatement => "if_statement",
548            Java::WhileStatement => "while_statement",
549            Java::ForStatement => "for_statement",
550            Java::EnhancedForStatement => "enhanced_for_statement",
551            Java::Annotation2 => "_annotation",
552            Java::MarkerAnnotation => "marker_annotation",
553            Java::Annotation => "annotation",
554            Java::AnnotationArgumentList => "annotation_argument_list",
555            Java::ElementValuePair => "element_value_pair",
556            Java::ElementValue => "_element_value",
557            Java::ElementValueArrayInitializer => "element_value_array_initializer",
558            Java::Declaration => "declaration",
559            Java::ModuleDeclaration => "module_declaration",
560            Java::ModuleBody => "module_body",
561            Java::ModuleDirective => "module_directive",
562            Java::RequiresModuleDirective => "requires_module_directive",
563            Java::RequiresModifier => "requires_modifier",
564            Java::ExportsModuleDirective => "exports_module_directive",
565            Java::OpensModuleDirective => "opens_module_directive",
566            Java::UsesModuleDirective => "uses_module_directive",
567            Java::ProvidesModuleDirective => "provides_module_directive",
568            Java::PackageDeclaration => "package_declaration",
569            Java::ImportDeclaration => "import_declaration",
570            Java::Asterisk => "asterisk",
571            Java::EnumDeclaration => "enum_declaration",
572            Java::EnumBody => "enum_body",
573            Java::EnumBodyDeclarations => "enum_body_declarations",
574            Java::EnumConstant => "enum_constant",
575            Java::ClassDeclaration => "class_declaration",
576            Java::Modifiers => "modifiers",
577            Java::TypeParameters => "type_parameters",
578            Java::TypeParameter => "type_parameter",
579            Java::TypeBound => "type_bound",
580            Java::Superclass => "superclass",
581            Java::SuperInterfaces => "super_interfaces",
582            Java::TypeList => "type_list",
583            Java::Permits => "permits",
584            Java::ClassBody => "class_body",
585            Java::StaticInitializer => "static_initializer",
586            Java::ConstructorDeclaration => "constructor_declaration",
587            Java::ConstructorDeclarator => "_constructor_declarator",
588            Java::ConstructorBody => "constructor_body",
589            Java::ExplicitConstructorInvocation => "explicit_constructor_invocation",
590            Java::ScopedIdentifier => "scoped_identifier",
591            Java::FieldDeclaration => "field_declaration",
592            Java::RecordDeclaration => "record_declaration",
593            Java::AnnotationTypeDeclaration => "annotation_type_declaration",
594            Java::AnnotationTypeBody => "annotation_type_body",
595            Java::AnnotationTypeElementDeclaration => "annotation_type_element_declaration",
596            Java::DefaultValue => "_default_value",
597            Java::InterfaceDeclaration => "interface_declaration",
598            Java::ExtendsInterfaces => "extends_interfaces",
599            Java::InterfaceBody => "interface_body",
600            Java::ConstantDeclaration => "constant_declaration",
601            Java::VariableDeclaratorList => "_variable_declarator_list",
602            Java::VariableDeclarator => "variable_declarator",
603            Java::VariableDeclaratorId => "_variable_declarator_id",
604            Java::ArrayInitializer => "array_initializer",
605            Java::Type => "_type",
606            Java::UnannotatedType => "_unannotated_type",
607            Java::AnnotatedType => "annotated_type",
608            Java::ScopedTypeIdentifier => "scoped_type_identifier",
609            Java::GenericType => "generic_type",
610            Java::ArrayType => "array_type",
611            Java::IntegralType => "integral_type",
612            Java::FloatingPointType => "floating_point_type",
613            Java::MethodHeader => "_method_header",
614            Java::MethodDeclarator => "_method_declarator",
615            Java::FormalParameters => "formal_parameters",
616            Java::FormalParameter => "formal_parameter",
617            Java::ReceiverParameter => "receiver_parameter",
618            Java::SpreadParameter => "spread_parameter",
619            Java::Throws => "throws",
620            Java::LocalVariableDeclaration => "local_variable_declaration",
621            Java::MethodDeclaration => "method_declaration",
622            Java::CompactConstructorDeclaration => "compact_constructor_declaration",
623            Java::ReservedIdentifier => "_reserved_identifier",
624            Java::ProgramRepeat1 => "program_repeat1",
625            Java::StringLiteralRepeat1 => "_string_literal_repeat1",
626            Java::MultilineStringLiteralRepeat1 => "_multiline_string_literal_repeat1",
627            Java::CastExpressionRepeat1 => "cast_expression_repeat1",
628            Java::InferredParametersRepeat1 => "inferred_parameters_repeat1",
629            Java::ArrayCreationExpressionRepeat1 => "array_creation_expression_repeat1",
630            Java::ArrayCreationExpressionRepeat2 => "array_creation_expression_repeat2",
631            Java::ArgumentListRepeat1 => "argument_list_repeat1",
632            Java::TypeArgumentsRepeat1 => "type_arguments_repeat1",
633            Java::DimensionsRepeat1 => "dimensions_repeat1",
634            Java::SwitchBlockRepeat1 => "switch_block_repeat1",
635            Java::SwitchBlockRepeat2 => "switch_block_repeat2",
636            Java::SwitchBlockStatementGroupRepeat1 => "switch_block_statement_group_repeat1",
637            Java::SwitchBlockStatementGroupRepeat2 => "switch_block_statement_group_repeat2",
638            Java::RecordPatternBodyRepeat1 => "record_pattern_body_repeat1",
639            Java::TryStatementRepeat1 => "try_statement_repeat1",
640            Java::CatchTypeRepeat1 => "catch_type_repeat1",
641            Java::ResourceSpecificationRepeat1 => "resource_specification_repeat1",
642            Java::ForStatementRepeat1 => "for_statement_repeat1",
643            Java::ForStatementRepeat2 => "for_statement_repeat2",
644            Java::AnnotationArgumentListRepeat1 => "annotation_argument_list_repeat1",
645            Java::ElementValueArrayInitializerRepeat1 => "element_value_array_initializer_repeat1",
646            Java::ModuleBodyRepeat1 => "module_body_repeat1",
647            Java::RequiresModuleDirectiveRepeat1 => "requires_module_directive_repeat1",
648            Java::ExportsModuleDirectiveRepeat1 => "exports_module_directive_repeat1",
649            Java::ProvidesModuleDirectiveRepeat1 => "provides_module_directive_repeat1",
650            Java::EnumBodyRepeat1 => "enum_body_repeat1",
651            Java::EnumBodyDeclarationsRepeat1 => "enum_body_declarations_repeat1",
652            Java::ModifiersRepeat1 => "modifiers_repeat1",
653            Java::TypeParametersRepeat1 => "type_parameters_repeat1",
654            Java::TypeBoundRepeat1 => "type_bound_repeat1",
655            Java::TypeListRepeat1 => "type_list_repeat1",
656            Java::AnnotationTypeBodyRepeat1 => "annotation_type_body_repeat1",
657            Java::InterfaceBodyRepeat1 => "interface_body_repeat1",
658            Java::VariableDeclaratorListRepeat1 => "_variable_declarator_list_repeat1",
659            Java::ArrayInitializerRepeat1 => "array_initializer_repeat1",
660            Java::FormalParametersRepeat1 => "formal_parameters_repeat1",
661            Java::ReceiverParameterRepeat1 => "receiver_parameter_repeat1",
662            Java::TypeIdentifier => "type_identifier",
663            Java::Error => "ERROR",
664        }
665    }
666}
667
668impl From<u16> for Java {
669    #[inline]
670    fn from(x: u16) -> Self {
671        num_traits::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
672    }
673}
674
675// Java == u16
676impl PartialEq<u16> for Java {
677    #[inline]
678    fn eq(&self, x: &u16) -> bool {
679        *self == Into::<Self>::into(*x)
680    }
681}
682
683// u16 == Java
684impl PartialEq<Java> for u16 {
685    #[inline]
686    fn eq(&self, x: &Java) -> bool {
687        *x == *self
688    }
689}