#[derive(Clone, Debug, PartialEq, FromPrimitive)]
pub enum Java {
End = 0,
Identifier = 1,
DecimalIntegerLiteral = 2,
HexIntegerLiteral = 3,
OctalIntegerLiteral = 4,
BinaryIntegerLiteral = 5,
DecimalFloatingPointLiteral = 6,
HexFloatingPointLiteral = 7,
True = 8,
False = 9,
CharacterLiteral = 10,
StringLiteral = 11,
NullLiteral = 12,
LPAREN = 13,
AMP = 14,
RPAREN = 15,
EQ = 16,
PLUSEQ = 17,
DASHEQ = 18,
STAREQ = 19,
SLASHEQ = 20,
AMPEQ = 21,
PIPEEQ = 22,
CARETEQ = 23,
PERCENTEQ = 24,
LTLTEQ = 25,
GTGTEQ = 26,
GTGTGTEQ = 27,
GT = 28,
LT = 29,
EQEQ = 30,
GTEQ = 31,
LTEQ = 32,
BANGEQ = 33,
AMPAMP = 34,
PIPEPIPE = 35,
PLUS = 36,
DASH = 37,
STAR = 38,
SLASH = 39,
PIPE = 40,
CARET = 41,
PERCENT = 42,
LTLT = 43,
GTGT = 44,
GTGTGT = 45,
Instanceof = 46,
DASHGT = 47,
COMMA = 48,
QMARK = 49,
COLON = 50,
BANG = 51,
TILDE = 52,
PLUSPLUS = 53,
DASHDASH = 54,
New = 55,
LBRACK = 56,
RBRACK = 57,
DOT = 58,
Class = 59,
COLONCOLON = 60,
Extends = 61,
SEMI = 62,
LBRACE = 63,
RBRACE = 64,
Assert = 65,
Switch = 66,
Case = 67,
Default = 68,
Do = 69,
While = 70,
Break = 71,
Continue = 72,
Return = 73,
Synchronized = 74,
Throw = 75,
Try = 76,
Catch = 77,
Finally = 78,
If = 79,
Else = 80,
For = 81,
AT = 82,
Open = 83,
Module = 84,
Requires = 85,
Exports = 86,
To = 87,
Opens = 88,
Uses = 89,
Provides = 90,
With = 91,
Transitive = 92,
Static = 93,
Package = 94,
Import = 95,
Enum = 96,
Public = 97,
Protected = 98,
Private = 99,
Abstract = 100,
Final = 101,
Strictfp = 102,
Native = 103,
Transient = 104,
Volatile = 105,
Implements = 106,
ATinterface = 107,
Interface = 108,
Byte = 109,
Short = 110,
Int = 111,
Long = 112,
Char = 113,
Float = 114,
Double = 115,
BooleanType = 116,
VoidType = 117,
DOTDOTDOT = 118,
Throws2 = 119,
This = 120,
Super = 121,
Comment = 122,
Program = 123,
Literal = 124,
Expression = 125,
CastExpression = 126,
AssignmentExpression = 127,
BinaryExpression = 128,
InstanceofExpression = 129,
LambdaExpression = 130,
InferredParameters = 131,
TernaryExpression = 132,
UnaryExpression = 133,
UpdateExpression = 134,
PrimaryExpression = 135,
ArrayCreationExpression = 136,
DimensionsExpr = 137,
ParenthesizedExpression = 138,
ClassLiteral = 139,
ObjectCreationExpression = 140,
UnqualifiedObjectCreationExpression = 141,
FieldAccess = 142,
ArrayAccess = 143,
MethodInvocation = 144,
ArgumentList = 145,
MethodReference = 146,
TypeArguments = 147,
Wildcard = 148,
WildcardBounds = 149,
Dimensions = 150,
Statement = 151,
Block = 152,
ExpressionStatement = 153,
LabeledStatement = 154,
AssertStatement = 155,
SwitchStatement = 156,
SwitchBlock = 157,
SwitchLabel = 158,
DoStatement = 159,
BreakStatement = 160,
ContinueStatement = 161,
ReturnStatement = 162,
SynchronizedStatement = 163,
ThrowStatement = 164,
TryStatement = 165,
CatchClause = 166,
CatchFormalParameter = 167,
CatchType = 168,
FinallyClause = 169,
TryWithResourcesStatement = 170,
ResourceSpecification = 171,
Resource = 172,
IfStatement = 173,
WhileStatement = 174,
ForStatement = 175,
EnhancedForStatement = 176,
Annotation = 177,
MarkerAnnotation = 178,
Annotation2 = 179,
AnnotationArgumentList = 180,
ElementValuePair = 181,
ElementValue = 182,
ElementValueArrayInitializer = 183,
Declaration = 184,
ModuleDeclaration = 185,
ModuleBody = 186,
ModuleDirective = 187,
RequiresModifier = 188,
PackageDeclaration = 189,
ImportDeclaration = 190,
Asterisk = 191,
EnumDeclaration = 192,
EnumBody = 193,
EnumBodyDeclarations = 194,
EnumConstant = 195,
ClassDeclaration = 196,
Modifiers = 197,
TypeParameters = 198,
TypeParameter = 199,
TypeBound = 200,
Superclass = 201,
SuperInterfaces = 202,
InterfaceTypeList = 203,
ClassBody = 204,
StaticInitializer = 205,
ConstructorDeclaration = 206,
ConstructorDeclarator = 207,
ConstructorBody = 208,
ExplicitConstructorInvocation = 209,
ScopedIdentifier = 210,
FieldDeclaration = 211,
AnnotationTypeDeclaration = 212,
AnnotationTypeBody = 213,
AnnotationTypeElementDeclaration = 214,
DefaultValue = 215,
InterfaceDeclaration = 216,
ExtendsInterfaces = 217,
InterfaceBody = 218,
ConstantDeclaration = 219,
VariableDeclaratorList = 220,
VariableDeclarator = 221,
VariableDeclaratorId = 222,
ArrayInitializer = 223,
Type = 224,
UnannotatedType = 225,
AnnotatedType = 226,
ScopedTypeIdentifier = 227,
GenericType = 228,
ArrayType = 229,
IntegralType = 230,
FloatingPointType = 231,
MethodHeader = 232,
MethodDeclarator = 233,
FormalParameters = 234,
FormalParameter = 235,
ReceiverParameter = 236,
SpreadParameter = 237,
Throws = 238,
LocalVariableDeclaration = 239,
MethodDeclaration = 240,
ProgramRepeat1 = 241,
CastExpressionRepeat1 = 242,
InferredParametersRepeat1 = 243,
ArrayCreationExpressionRepeat1 = 244,
DimensionsExprRepeat1 = 245,
ArgumentListRepeat1 = 246,
TypeArgumentsRepeat1 = 247,
DimensionsRepeat1 = 248,
SwitchBlockRepeat1 = 249,
TryStatementRepeat1 = 250,
CatchTypeRepeat1 = 251,
ResourceSpecificationRepeat1 = 252,
ForStatementRepeat1 = 253,
ForStatementRepeat2 = 254,
AnnotationArgumentListRepeat1 = 255,
ElementValueArrayInitializerRepeat1 = 256,
ModuleBodyRepeat1 = 257,
ModuleDirectiveRepeat1 = 258,
ModuleDirectiveRepeat2 = 259,
EnumBodyRepeat1 = 260,
EnumBodyDeclarationsRepeat1 = 261,
ModifiersRepeat1 = 262,
TypeParametersRepeat1 = 263,
TypeBoundRepeat1 = 264,
InterfaceTypeListRepeat1 = 265,
AnnotationTypeBodyRepeat1 = 266,
InterfaceBodyRepeat1 = 267,
VariableDeclaratorListRepeat1 = 268,
ArrayInitializerRepeat1 = 269,
FormalParametersRepeat1 = 270,
TypeIdentifier = 271,
Error = 272,
}
#[allow(clippy::unreadable_literal)]
static KEYS: phf::Map<&'static str, Java> = ::phf::Map {
key: 3213172566270843353,
disps: ::phf::Slice::Static(&[
(0, 4),
(0, 9),
(0, 15),
(1, 260),
(0, 91),
(0, 18),
(0, 63),
(0, 49),
(0, 142),
(0, 11),
(0, 19),
(0, 28),
(0, 1),
(0, 36),
(0, 1),
(0, 0),
(0, 2),
(1, 106),
(0, 37),
(7, 86),
(0, 0),
(1, 36),
(12, 94),
(0, 5),
(0, 2),
(5, 56),
(2, 62),
(0, 25),
(6, 158),
(6, 7),
(2, 75),
(0, 53),
(2, 115),
(0, 1),
(3, 243),
(12, 216),
(2, 245),
(0, 6),
(4, 190),
(38, 170),
(0, 79),
(11, 103),
(0, 3),
(0, 0),
(2, 38),
(24, 69),
(1, 225),
(0, 48),
(120, 76),
(0, 8),
(0, 31),
(71, 167),
(0, 3),
(0, 187),
(0, 206),
]),
entries: ::phf::Slice::Static(&[
("field_declaration", Java::FieldDeclaration),
(":", Java::COLON),
("switch_block", Java::SwitchBlock),
("class_literal", Java::ClassLiteral),
("_variable_declarator_list", Java::VariableDeclaratorList),
("scoped_identifier", Java::ScopedIdentifier),
("if_statement", Java::IfStatement),
("@interface", Java::ATinterface),
("-", Java::DASH),
(
"annotation_argument_list_repeat1",
Java::AnnotationArgumentListRepeat1,
),
("module_directive_repeat2", Java::ModuleDirectiveRepeat2),
("block", Java::Block),
("implements", Java::Implements),
("%", Java::PERCENT),
("formal_parameters_repeat1", Java::FormalParametersRepeat1),
("char", Java::Char),
("type_parameters", Java::TypeParameters),
("interface_body", Java::InterfaceBody),
("static_initializer", Java::StaticInitializer),
("%=", Java::PERCENTEQ),
("dimensions_repeat1", Java::DimensionsRepeat1),
("~", Java::TILDE),
("type_parameters_repeat1", Java::TypeParametersRepeat1),
("continue_statement", Java::ContinueStatement),
("continue", Java::Continue),
("comment", Java::Comment),
("enum_body_declarations", Java::EnumBodyDeclarations),
("short", Java::Short),
("requires_modifier", Java::RequiresModifier),
("unary_expression", Java::UnaryExpression),
("catch_clause", Java::CatchClause),
("type_bound_repeat1", Java::TypeBoundRepeat1),
("element_value_pair", Java::ElementValuePair),
("formal_parameters", Java::FormalParameters),
("switch", Java::Switch),
(">>>", Java::GTGTGT),
("cast_expression_repeat1", Java::CastExpressionRepeat1),
("to", Java::To),
(
"explicit_constructor_invocation",
Java::ExplicitConstructorInvocation,
),
("argument_list", Java::ArgumentList),
("scoped_type_identifier", Java::ScopedTypeIdentifier),
("character_literal", Java::CharacterLiteral),
("type_arguments_repeat1", Java::TypeArgumentsRepeat1),
("assert_statement", Java::AssertStatement),
("?", Java::QMARK),
("switch_label", Java::SwitchLabel),
("native", Java::Native),
("_type", Java::Type),
("module_body_repeat1", Java::ModuleBodyRepeat1),
("end", Java::End),
("break", Java::Break),
("]", Java::RBRACK),
(
"annotation_type_element_declaration",
Java::AnnotationTypeElementDeclaration,
),
("with", Java::With),
(")", Java::RPAREN),
("+", Java::PLUS),
("++", Java::PLUSPLUS),
("super", Java::Super),
("&", Java::AMP),
("marker_annotation", Java::MarkerAnnotation),
("module", Java::Module),
("throw", Java::Throw),
("exports", Java::Exports),
("/=", Java::SLASHEQ),
(
"array_creation_expression_repeat1",
Java::ArrayCreationExpressionRepeat1,
),
("update_expression", Java::UpdateExpression),
("annotation_argument_list", Java::AnnotationArgumentList),
("method_reference", Java::MethodReference),
("_wildcard_bounds", Java::WildcardBounds),
("enum", Java::Enum),
("enum_constant", Java::EnumConstant),
("integral_type", Java::IntegralType),
("_constructor_declarator", Java::ConstructorDeclarator),
("<<", Java::LTLT),
("else", Java::Else),
("switch_block_repeat1", Java::SwitchBlockRepeat1),
("|", Java::PIPE),
("catch", Java::Catch),
(
"_unqualified_object_creation_expression",
Java::UnqualifiedObjectCreationExpression,
),
(
"_variable_declarator_list_repeat1",
Java::VariableDeclaratorListRepeat1,
),
("_method_declarator", Java::MethodDeclarator),
("_default_value", Java::DefaultValue),
("}", Java::RBRACE),
("constructor_declaration", Java::ConstructorDeclaration),
("--", Java::DASHDASH),
(">>>=", Java::GTGTGTEQ),
("+=", Java::PLUSEQ),
("switch_statement", Java::SwitchStatement),
("provides", Java::Provides),
("inferred_parameters", Java::InferredParameters),
("class_body", Java::ClassBody),
("expression_statement", Java::ExpressionStatement),
("synchronized_statement", Java::SynchronizedStatement),
("do_statement", Java::DoStatement),
("decimal_integer_literal", Java::DecimalIntegerLiteral),
("long", Java::Long),
(".", Java::DOT),
("instanceof_expression", Java::InstanceofExpression),
(
"element_value_array_initializer",
Java::ElementValueArrayInitializer,
),
("new", Java::New),
(
"annotation_type_body_repeat1",
Java::AnnotationTypeBodyRepeat1,
),
("requires", Java::Requires),
("catch_formal_parameter", Java::CatchFormalParameter),
("while", Java::While),
("==", Java::EQEQ),
("extends_interfaces", Java::ExtendsInterfaces),
("modifiers_repeat1", Java::ModifiersRepeat1),
("string_literal", Java::StringLiteral),
("hex_floating_point_literal", Java::HexFloatingPointLiteral),
("parenthesized_expression", Java::ParenthesizedExpression),
("instanceof", Java::Instanceof),
(";", Java::SEMI),
("constructor_body", Java::ConstructorBody),
("for_statement_repeat1", Java::ForStatementRepeat1),
("true", Java::True),
("class", Java::Class),
("if", Java::If),
("annotated_type", Java::AnnotatedType),
("=", Java::EQ),
("local_variable_declaration", Java::LocalVariableDeclaration),
("array_access", Java::ArrayAccess),
(
"annotation_type_declaration",
Java::AnnotationTypeDeclaration,
),
("-=", Java::DASHEQ),
("formal_parameter", Java::FormalParameter),
("_literal", Java::Literal),
("program", Java::Program),
("class_declaration", Java::ClassDeclaration),
("resource_specification", Java::ResourceSpecification),
("array_creation_expression", Java::ArrayCreationExpression),
("primary_expression", Java::PrimaryExpression),
("|=", Java::PIPEEQ),
("<", Java::LT),
("ternary_expression", Java::TernaryExpression),
("generic_type", Java::GenericType),
("byte", Java::Byte),
("[", Java::LBRACK),
("dimensions_expr", Java::DimensionsExpr),
("extends", Java::Extends),
("uses", Java::Uses),
("modifiers", Java::Modifiers),
("interface_body_repeat1", Java::InterfaceBodyRepeat1),
("try", Java::Try),
("type_bound", Java::TypeBound),
("volatile", Java::Volatile),
("object_creation_expression", Java::ObjectCreationExpression),
(
"decimal_floating_point_literal",
Java::DecimalFloatingPointLiteral,
),
("^", Java::CARET),
(
"element_value_array_initializer_repeat1",
Java::ElementValueArrayInitializerRepeat1,
),
("{", Java::LBRACE),
(
"resource_specification_repeat1",
Java::ResourceSpecificationRepeat1,
),
("module_body", Java::ModuleBody),
("private", Java::Private),
("transient", Java::Transient),
("do", Java::Do),
("boolean_type", Java::BooleanType),
("int", Java::Int),
("/", Java::SLASH),
("->", Java::DASHGT),
("abstract", Java::Abstract),
("_annotation", Java::Annotation),
("enum_declaration", Java::EnumDeclaration),
("wildcard", Java::Wildcard),
("method_invocation", Java::MethodInvocation),
("argument_list_repeat1", Java::ArgumentListRepeat1),
("throws", Java::Throws),
("||", Java::PIPEPIPE),
("finally", Java::Finally),
("type_parameter", Java::TypeParameter),
("void_type", Java::VoidType),
("!", Java::BANG),
("interface", Java::Interface),
("<<=", Java::LTLTEQ),
("type_arguments", Java::TypeArguments),
("statement", Java::Statement),
("field_access", Java::FieldAccess),
("*=", Java::STAREQ),
("_variable_declarator_id", Java::VariableDeclaratorId),
("(", Java::LPAREN),
("floating_point_type", Java::FloatingPointType),
(">=", Java::GTEQ),
("module_declaration", Java::ModuleDeclaration),
("*", Java::STAR),
(">>=", Java::GTGTEQ),
("opens", Java::Opens),
("enum_body_repeat1", Java::EnumBodyRepeat1),
("double", Java::Double),
("catch_type", Java::CatchType),
("for", Java::For),
("dimensions_expr_repeat1", Java::DimensionsExprRepeat1),
("_element_value", Java::ElementValue),
("declaration", Java::Declaration),
("interface_declaration", Java::InterfaceDeclaration),
("finally_clause", Java::FinallyClause),
("constant_declaration", Java::ConstantDeclaration),
("binary_integer_literal", Java::BinaryIntegerLiteral),
("asterisk", Java::Asterisk),
("synchronized", Java::Synchronized),
("annotation_type_body", Java::AnnotationTypeBody),
("float", Java::Float),
("identifier", Java::Identifier),
("import_declaration", Java::ImportDeclaration),
("cast_expression", Java::CastExpression),
("enhanced_for_statement", Java::EnhancedForStatement),
("octal_integer_literal", Java::OctalIntegerLiteral),
("interface_type_list", Java::InterfaceTypeList),
("transitive", Java::Transitive),
("public", Java::Public),
(
"interface_type_list_repeat1",
Java::InterfaceTypeListRepeat1,
),
("resource", Java::Resource),
("module_directive", Java::ModuleDirective),
("spread_parameter", Java::SpreadParameter),
("strictfp", Java::Strictfp),
("method_declaration", Java::MethodDeclaration),
("...", Java::DOTDOTDOT),
(">", Java::GT),
("array_initializer", Java::ArrayInitializer),
(
"enum_body_declarations_repeat1",
Java::EnumBodyDeclarationsRepeat1,
),
("break_statement", Java::BreakStatement),
(",", Java::COMMA),
("catch_type_repeat1", Java::CatchTypeRepeat1),
(">>", Java::GTGT),
("protected", Java::Protected),
("while_statement", Java::WhileStatement),
("receiver_parameter", Java::ReceiverParameter),
("array_type", Java::ArrayType),
("default", Java::Default),
("package", Java::Package),
("!=", Java::BANGEQ),
("for_statement_repeat2", Java::ForStatementRepeat2),
("try_statement", Java::TryStatement),
("ERROR", Java::Error),
("return_statement", Java::ReturnStatement),
("binary_expression", Java::BinaryExpression),
("type_identifier", Java::TypeIdentifier),
("_method_header", Java::MethodHeader),
("case", Java::Case),
("null_literal", Java::NullLiteral),
("superclass", Java::Superclass),
("<=", Java::LTEQ),
("dimensions", Java::Dimensions),
("expression", Java::Expression),
("&=", Java::AMPEQ),
("open", Java::Open),
("this", Java::This),
("hex_integer_literal", Java::HexIntegerLiteral),
("labeled_statement", Java::LabeledStatement),
("array_initializer_repeat1", Java::ArrayInitializerRepeat1),
("variable_declarator", Java::VariableDeclarator),
("lambda_expression", Java::LambdaExpression),
(
"try_with_resources_statement",
Java::TryWithResourcesStatement,
),
("final", Java::Final),
("@", Java::AT),
("throw_statement", Java::ThrowStatement),
("assignment_expression", Java::AssignmentExpression),
("return", Java::Return),
("assert", Java::Assert),
("for_statement", Java::ForStatement),
("super_interfaces", Java::SuperInterfaces),
("try_statement_repeat1", Java::TryStatementRepeat1),
("^=", Java::CARETEQ),
(
"inferred_parameters_repeat1",
Java::InferredParametersRepeat1,
),
("&&", Java::AMPAMP),
("enum_body", Java::EnumBody),
("::", Java::COLONCOLON),
("false", Java::False),
("program_repeat1", Java::ProgramRepeat1),
("package_declaration", Java::PackageDeclaration),
("import", Java::Import),
("_unannotated_type", Java::UnannotatedType),
("static", Java::Static),
("module_directive_repeat1", Java::ModuleDirectiveRepeat1),
]),
};
impl From<&str> for Java {
#[inline(always)]
fn from(key: &str) -> Self {
KEYS.get(key).unwrap().clone()
}
}
impl From<u16> for Java {
#[inline(always)]
fn from(x: u16) -> Self {
num::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
}
}
impl PartialEq<u16> for Java {
#[inline(always)]
fn eq(&self, x: &u16) -> bool {
*self == Java::from(*x)
}
}
impl PartialEq<Java> for u16 {
#[inline(always)]
fn eq(&self, x: &Java) -> bool {
*x == *self
}
}