#[derive(Clone, Debug, PartialEq, FromPrimitive)]
pub enum Rust {
End = 0,
Identifier = 1,
SEMI = 2,
MacroRulesBANG = 3,
LPAREN = 4,
RPAREN = 5,
LBRACE = 6,
RBRACE = 7,
EQGT = 8,
LBRACK = 9,
RBRACK = 10,
COLON = 11,
DOLLAR = 12,
TokenRepetitionPatternToken1 = 13,
PLUS = 14,
STAR = 15,
QMARK = 16,
Block2 = 17,
Expr = 18,
Ident = 19,
Item = 20,
Lifetime2 = 21,
Literal2 = 22,
Meta = 23,
Pat = 24,
Path = 25,
Stmt = 26,
Tt = 27,
Ty = 28,
Vis = 29,
PrimitiveType = 30,
PrimitiveType2 = 31,
PrimitiveType3 = 32,
PrimitiveType4 = 33,
PrimitiveType5 = 34,
PrimitiveType6 = 35,
PrimitiveType7 = 36,
PrimitiveType8 = 37,
PrimitiveType9 = 38,
PrimitiveType10 = 39,
PrimitiveType11 = 40,
PrimitiveType12 = 41,
PrimitiveType13 = 42,
PrimitiveType14 = 43,
PrimitiveType15 = 44,
PrimitiveType16 = 45,
PrimitiveType17 = 46,
NonSpecialTokenToken1 = 47,
SQUOTE = 48,
As = 49,
Async = 50,
Await = 51,
Break = 52,
Const = 53,
Continue = 54,
Default = 55,
Enum = 56,
Fn = 57,
For = 58,
If = 59,
Impl = 60,
Let = 61,
Loop = 62,
Match = 63,
Mod = 64,
Pub = 65,
Return = 66,
Static = 67,
Struct = 68,
Trait = 69,
Type2 = 70,
Union = 71,
Unsafe = 72,
Use = 73,
Where = 74,
While = 75,
HASH = 76,
BANG = 77,
EQ = 78,
COMMA = 79,
Extern = 80,
Ref = 81,
DASHGT = 82,
LT = 83,
GT = 84,
COLONCOLON = 85,
UNDERSCORE = 86,
AMP = 87,
DOTDOTDOT = 88,
In = 89,
LT2 = 90,
Dyn = 91,
MutableSpecifier = 92,
DOTDOT = 93,
DOTDOTEQ = 94,
DASH = 95,
AMPAMP = 96,
PIPEPIPE = 97,
PIPE = 98,
CARET = 99,
EQEQ = 100,
BANGEQ = 101,
LTEQ = 102,
GTEQ = 103,
LTLT = 104,
GTGT = 105,
SLASH = 106,
PERCENT = 107,
PLUSEQ = 108,
DASHEQ = 109,
STAREQ = 110,
SLASHEQ = 111,
PERCENTEQ = 112,
AMPEQ = 113,
PIPEEQ = 114,
CARETEQ = 115,
LTLTEQ = 116,
GTGTEQ = 117,
Else = 118,
Move = 119,
DOT = 120,
AT = 121,
IntegerLiteral = 122,
DQUOTE = 123,
DQUOTE2 = 124,
CharLiteral = 125,
EscapeSequence = 126,
True = 127,
False = 128,
LineComment = 129,
Zelf = 130,
Super = 131,
Crate = 132,
Metavariable = 133,
StringContent = 134,
RawStringLiteral = 135,
FloatLiteral = 136,
BlockComment = 137,
SourceFile = 138,
Statement = 139,
EmptyStatement = 140,
ExpressionStatement = 141,
MacroDefinition = 142,
MacroRule = 143,
TokenPattern = 144,
TokenTreePattern = 145,
TokenBindingPattern = 146,
TokenRepetitionPattern = 147,
FragmentSpecifier = 148,
TokenTree = 149,
TokenRepetition = 150,
AttributeItem = 151,
InnerAttributeItem = 152,
MetaItem = 153,
MetaArguments = 154,
ModItem = 155,
ForeignModItem = 156,
DeclarationList = 157,
StructItem = 158,
UnionItem = 159,
EnumItem = 160,
EnumVariantList = 161,
EnumVariant = 162,
FieldDeclarationList = 163,
FieldDeclaration = 164,
OrderedFieldDeclarationList = 165,
ExternCrateDeclaration = 166,
ConstItem = 167,
StaticItem = 168,
TypeItem = 169,
FunctionItem = 170,
FunctionSignatureItem = 171,
FunctionModifiers = 172,
WhereClause = 173,
WherePredicate = 174,
ImplItem = 175,
TraitItem = 176,
AssociatedType = 177,
TraitBounds = 178,
HigherRankedTraitBound = 179,
RemovedTraitBound = 180,
TypeParameters = 181,
ConstParameter = 182,
ConstrainedTypeParameter = 183,
OptionalTypeParameter = 184,
LetDeclaration = 185,
UseDeclaration = 186,
UseClause = 187,
ScopedUseList = 188,
UseList = 189,
UseAsClause = 190,
UseWildcard = 191,
Parameters = 192,
SelfParameter = 193,
VariadicParameter = 194,
Parameter = 195,
ExternModifier = 196,
VisibilityModifier = 197,
Type = 198,
BracketedType = 199,
QualifiedType = 200,
Lifetime = 201,
ArrayType = 202,
ForLifetimes = 203,
FunctionType = 204,
TupleType = 205,
UnitType = 206,
GenericFunction = 207,
GenericType = 208,
GenericTypeWithTurbofish = 209,
BoundedType = 210,
TypeArguments = 211,
TypeBinding = 212,
ReferenceType = 213,
PointerType = 214,
EmptyType = 215,
AbstractType = 216,
DynamicType = 217,
Expression = 218,
MacroInvocation = 219,
ScopedIdentifier = 220,
ScopedTypeIdentifier = 221,
ScopedTypeIdentifier2 = 222,
RangeExpression = 223,
UnaryExpression = 224,
TryExpression = 225,
ReferenceExpression = 226,
BinaryExpression = 227,
AssignmentExpression = 228,
CompoundAssignmentExpr = 229,
TypeCastExpression = 230,
ReturnExpression = 231,
CallExpression = 232,
Arguments = 233,
ArrayExpression = 234,
ParenthesizedExpression = 235,
TupleExpression = 236,
UnitExpression = 237,
StructExpression = 238,
FieldInitializerList = 239,
ShorthandFieldInitializer = 240,
FieldInitializer = 241,
BaseFieldInitializer = 242,
IfExpression = 243,
IfLetExpression = 244,
ElseClause = 245,
MatchExpression = 246,
MatchBlock = 247,
MatchArm = 248,
MatchArm2 = 249,
MatchPattern = 250,
WhileExpression = 251,
WhileLetExpression = 252,
LoopExpression = 253,
ForExpression = 254,
ConstBlock = 255,
ClosureExpression = 256,
ClosureParameters = 257,
LoopLabel = 258,
BreakExpression = 259,
ContinueExpression = 260,
IndexExpression = 261,
AwaitExpression = 262,
FieldExpression = 263,
UnsafeBlock = 264,
AsyncBlock = 265,
Block = 266,
Pattern = 267,
TuplePattern = 268,
SlicePattern = 269,
TupleStructPattern = 270,
StructPattern = 271,
FieldPattern = 272,
RemainingFieldPattern = 273,
MutPattern = 274,
RangePattern = 275,
RefPattern = 276,
CapturedPattern = 277,
ReferencePattern = 278,
OrPattern = 279,
Literal = 280,
LiteralPattern = 281,
NegativeLiteral = 282,
StringLiteral = 283,
BooleanLiteral = 284,
SourceFileRepeat1 = 285,
MacroDefinitionRepeat1 = 286,
TokenTreePatternRepeat1 = 287,
TokenTreeRepeat1 = 288,
MetaArgumentsRepeat1 = 289,
DeclarationListRepeat1 = 290,
EnumVariantListRepeat1 = 291,
EnumVariantListRepeat2 = 292,
FieldDeclarationListRepeat1 = 293,
OrderedFieldDeclarationListRepeat1 = 294,
FunctionModifiersRepeat1 = 295,
WhereClauseRepeat1 = 296,
TraitBoundsRepeat1 = 297,
TypeParametersRepeat1 = 298,
UseListRepeat1 = 299,
ParametersRepeat1 = 300,
ForLifetimesRepeat1 = 301,
TupleTypeRepeat1 = 302,
TypeArgumentsRepeat1 = 303,
ArgumentsRepeat1 = 304,
ArrayExpressionRepeat1 = 305,
TupleExpressionRepeat1 = 306,
FieldInitializerListRepeat1 = 307,
MatchBlockRepeat1 = 308,
ClosureParametersRepeat1 = 309,
TuplePatternRepeat1 = 310,
StructPatternRepeat1 = 311,
StringLiteralRepeat1 = 312,
FieldIdentifier = 313,
ShorthandFieldIdentifier = 314,
TypeIdentifier = 315,
Error = 316,
}
#[allow(clippy::unreadable_literal)]
static KEYS: phf::Map<&'static str, Rust> = ::phf::Map {
key: 3213172566270843353,
disps: ::phf::Slice::Static(&[
(0, 0),
(0, 36),
(2, 282),
(0, 107),
(0, 118),
(0, 2),
(1, 1),
(0, 12),
(0, 2),
(0, 45),
(1, 15),
(0, 11),
(1, 72),
(1, 140),
(0, 0),
(0, 2),
(2, 90),
(0, 4),
(0, 7),
(0, 207),
(0, 1),
(1, 25),
(0, 48),
(0, 208),
(0, 5),
(8, 105),
(1, 3),
(0, 29),
(0, 192),
(0, 2),
(4, 44),
(0, 10),
(9, 241),
(0, 10),
(1, 77),
(0, 72),
(1, 96),
(0, 33),
(1, 111),
(7, 192),
(1, 66),
(0, 7),
(0, 107),
(0, 277),
(4, 159),
(0, 112),
(1, 191),
(0, 285),
(0, 0),
(8, 138),
(5, 49),
(8, 4),
(10, 164),
(2, 48),
(3, 207),
(0, 8),
(7, 222),
(0, 2),
(2, 267),
]),
entries: ::phf::Slice::Static(&[
("break_expression", Rust::BreakExpression),
("extern", Rust::Extern),
("type_parameters", Rust::TypeParameters),
("struct_item", Rust::StructItem),
("union_item", Rust::UnionItem),
("type_parameters_repeat1", Rust::TypeParametersRepeat1),
("attribute_item", Rust::AttributeItem),
("field_expression", Rust::FieldExpression),
("where_clause", Rust::WhereClause),
("let_declaration", Rust::LetDeclaration),
("escape_sequence", Rust::EscapeSequence),
("_pattern", Rust::Pattern),
("for_lifetimes", Rust::ForLifetimes),
("\\\"", Rust::DQUOTE),
("enum_variant", Rust::EnumVariant),
("string_literal_repeat1", Rust::StringLiteralRepeat1),
("&", Rust::AMP),
("where_predicate", Rust::WherePredicate),
("token_binding_pattern", Rust::TokenBindingPattern),
("token_tree_pattern_repeat1", Rust::TokenTreePatternRepeat1),
("binary_expression", Rust::BinaryExpression),
("field_declaration_list", Rust::FieldDeclarationList),
("tuple_expression", Rust::TupleExpression),
("in", Rust::In),
("higher_ranked_trait_bound", Rust::HigherRankedTraitBound),
("path", Rust::Path),
("block_comment", Rust::BlockComment),
("-=", Rust::DASHEQ),
("=>", Rust::EQGT),
("range_pattern", Rust::RangePattern),
("as", Rust::As),
("use_wildcard", Rust::UseWildcard),
("captured_pattern", Rust::CapturedPattern),
("tuple_type_repeat1", Rust::TupleTypeRepeat1),
("char_literal", Rust::CharLiteral),
("expr", Rust::Expr),
("...", Rust::DOTDOTDOT),
("<<=", Rust::LTLTEQ),
("&&", Rust::AMPAMP),
(
"token_repetition_pattern_token1",
Rust::TokenRepetitionPatternToken1,
),
("->", Rust::DASHGT),
("stmt", Rust::Stmt),
("field_identifier", Rust::FieldIdentifier),
("scoped_identifier", Rust::ScopedIdentifier),
("macro_definition", Rust::MacroDefinition),
("const_item", Rust::ConstItem),
("array_expression", Rust::ArrayExpression),
("remaining_field_pattern", Rust::RemainingFieldPattern),
("*", Rust::STAR),
("async_block", Rust::AsyncBlock),
("type_cast_expression", Rust::TypeCastExpression),
("tuple_type", Rust::TupleType),
("enum_variant_list", Rust::EnumVariantList),
("use_declaration", Rust::UseDeclaration),
("metavariable", Rust::Metavariable),
("unary_expression", Rust::UnaryExpression),
("trait_item", Rust::TraitItem),
("variadic_parameter", Rust::VariadicParameter),
("static", Rust::Static),
("range_expression", Rust::RangeExpression),
("for_lifetimes_repeat1", Rust::ForLifetimesRepeat1),
("trait_bounds_repeat1", Rust::TraitBoundsRepeat1),
("match_block_repeat1", Rust::MatchBlockRepeat1),
("match_block", Rust::MatchBlock),
("boolean_literal", Rust::BooleanLiteral),
("assignment_expression", Rust::AssignmentExpression),
("fn", Rust::Fn),
("mutable_specifier", Rust::MutableSpecifier),
("match_expression", Rust::MatchExpression),
("compound_assignment_expr", Rust::CompoundAssignmentExpr),
("@", Rust::AT),
("mod_item", Rust::ModItem),
("declaration_list_repeat1", Rust::DeclarationListRepeat1),
("^=", Rust::CARETEQ),
("..=", Rust::DOTDOTEQ),
("enum", Rust::Enum),
("await", Rust::Await),
("vis", Rust::Vis),
("while", Rust::While),
("tuple_pattern", Rust::TuplePattern),
("(", Rust::LPAREN),
("loop_expression", Rust::LoopExpression),
("self", Rust::Zelf),
(
"field_initializer_list_repeat1",
Rust::FieldInitializerListRepeat1,
),
("await_expression", Rust::AwaitExpression),
("_non_special_token_token1", Rust::NonSpecialTokenToken1),
("self_parameter", Rust::SelfParameter),
("crate", Rust::Crate),
("primitive_type", Rust::PrimitiveType),
("struct_expression", Rust::StructExpression),
("loop_label", Rust::LoopLabel),
("bracketed_type", Rust::BracketedType),
("enum_variant_list_repeat2", Rust::EnumVariantListRepeat2),
("field_initializer_list", Rust::FieldInitializerList),
("use_list_repeat1", Rust::UseListRepeat1),
("let", Rust::Let),
("|", Rust::PIPE),
("]", Rust::RBRACK),
(".", Rust::DOT),
("associated_type", Rust::AssociatedType),
("else", Rust::Else),
("&=", Rust::AMPEQ),
("constrained_type_parameter", Rust::ConstrainedTypeParameter),
("ty", Rust::Ty),
(
"ordered_field_declaration_list",
Rust::OrderedFieldDeclarationList,
),
("fragment_specifier", Rust::FragmentSpecifier),
("array_expression_repeat1", Rust::ArrayExpressionRepeat1),
("function_modifiers", Rust::FunctionModifiers),
("qualified_type", Rust::QualifiedType),
("async", Rust::Async),
("#", Rust::HASH),
("union", Rust::Union),
("extern_modifier", Rust::ExternModifier),
("macro_rules!", Rust::MacroRulesBANG),
(
"shorthand_field_initializer",
Rust::ShorthandFieldInitializer,
),
("_string_content", Rust::StringContent),
("[", Rust::LBRACK),
("continue", Rust::Continue),
("end", Rust::End),
("parameters", Rust::Parameters),
("field_pattern", Rust::FieldPattern),
("const", Rust::Const),
("struct_pattern", Rust::StructPattern),
("try_expression", Rust::TryExpression),
("inner_attribute_item", Rust::InnerAttributeItem),
("false", Rust::False),
("token_repetition", Rust::TokenRepetition),
("<=", Rust::LTEQ),
("_token_pattern", Rust::TokenPattern),
("true", Rust::True),
("visibility_modifier", Rust::VisibilityModifier),
("enum_variant_list_repeat1", Rust::EnumVariantListRepeat1),
("token_tree", Rust::TokenTree),
(":", Rust::COLON),
("string_literal", Rust::StringLiteral),
("closure_parameters_repeat1", Rust::ClosureParametersRepeat1),
("move", Rust::Move),
("for", Rust::For),
("where_clause_repeat1", Rust::WhereClauseRepeat1),
("raw_string_literal", Rust::RawStringLiteral),
("call_expression", Rust::CallExpression),
("+", Rust::PLUS),
("line_comment", Rust::LineComment),
("meta", Rust::Meta),
("_expression_statement", Rust::ExpressionStatement),
("meta_arguments", Rust::MetaArguments),
("token_tree_pattern", Rust::TokenTreePattern),
("mut_pattern", Rust::MutPattern),
("source_file", Rust::SourceFile),
("scoped_type_identifier", Rust::ScopedTypeIdentifier),
("ident", Rust::Ident),
("\'", Rust::SQUOTE),
("if_expression", Rust::IfExpression),
("ERROR", Rust::Error),
("extern_crate_declaration", Rust::ExternCrateDeclaration),
("arguments", Rust::Arguments),
("dynamic_type", Rust::DynamicType),
("$", Rust::DOLLAR),
("field_declaration", Rust::FieldDeclaration),
("struct", Rust::Struct),
("ref", Rust::Ref),
("closure_expression", Rust::ClosureExpression),
("default", Rust::Default),
("optional_type_parameter", Rust::OptionalTypeParameter),
(
"ordered_field_declaration_list_repeat1",
Rust::OrderedFieldDeclarationListRepeat1,
),
("abstract_type", Rust::AbstractType),
("empty_statement", Rust::EmptyStatement),
("use", Rust::Use),
("_literal", Rust::Literal),
("source_file_repeat1", Rust::SourceFileRepeat1),
("_type", Rust::Type),
("parameters_repeat1", Rust::ParametersRepeat1),
("-", Rust::DASH),
("_use_clause", Rust::UseClause),
("lifetime", Rust::Lifetime),
("reference_pattern", Rust::ReferencePattern),
("struct_pattern_repeat1", Rust::StructPatternRepeat1),
("loop", Rust::Loop),
("base_field_initializer", Rust::BaseFieldInitializer),
("index_expression", Rust::IndexExpression),
("const_block", Rust::ConstBlock),
("trait", Rust::Trait),
("_statement", Rust::Statement),
("==", Rust::EQEQ),
("ref_pattern", Rust::RefPattern),
("mod", Rust::Mod),
("enum_item", Rust::EnumItem),
(">", Rust::GT),
("bounded_type", Rust::BoundedType),
(">>=", Rust::GTGTEQ),
("generic_function", Rust::GenericFunction),
("removed_trait_bound", Rust::RemovedTraitBound),
("!", Rust::BANG),
("?", Rust::QMARK),
("{", Rust::LBRACE),
("meta_item", Rust::MetaItem),
("if_let_expression", Rust::IfLetExpression),
("return_expression", Rust::ReturnExpression),
(
"generic_type_with_turbofish",
Rust::GenericTypeWithTurbofish,
),
("function_type", Rust::FunctionType),
(">>", Rust::GTGT),
("..", Rust::DOTDOT),
("pub", Rust::Pub),
("=", Rust::EQ),
("|=", Rust::PIPEEQ),
("type_arguments_repeat1", Rust::TypeArgumentsRepeat1),
("%=", Rust::PERCENTEQ),
("||", Rust::PIPEPIPE),
(";", Rust::SEMI),
("float_literal", Rust::FloatLiteral),
("return", Rust::Return),
("slice_pattern", Rust::SlicePattern),
("scoped_use_list", Rust::ScopedUseList),
("_expression", Rust::Expression),
(">=", Rust::GTEQ),
("or_pattern", Rust::OrPattern),
(")", Rust::RPAREN),
("type_binding", Rust::TypeBinding),
("unit_type", Rust::UnitType),
("identifier", Rust::Identifier),
("type_item", Rust::TypeItem),
("for_expression", Rust::ForExpression),
("_literal_pattern", Rust::LiteralPattern),
("token_repetition_pattern", Rust::TokenRepetitionPattern),
("function_item", Rust::FunctionItem),
("pointer_type", Rust::PointerType),
("tt", Rust::Tt),
("unsafe_block", Rust::UnsafeBlock),
("else_clause", Rust::ElseClause),
("if", Rust::If),
("reference_type", Rust::ReferenceType),
("tuple_struct_pattern", Rust::TupleStructPattern),
("}", Rust::RBRACE),
(
"field_declaration_list_repeat1",
Rust::FieldDeclarationListRepeat1,
),
("/=", Rust::SLASHEQ),
("*=", Rust::STAREQ),
("%", Rust::PERCENT),
("super", Rust::Super),
("shorthand_field_identifier", Rust::ShorthandFieldIdentifier),
("where", Rust::Where),
("impl_item", Rust::ImplItem),
("function_signature_item", Rust::FunctionSignatureItem),
("/", Rust::SLASH),
("macro_rule", Rust::MacroRule),
("declaration_list", Rust::DeclarationList),
("dyn", Rust::Dyn),
("reference_expression", Rust::ReferenceExpression),
("closure_parameters", Rust::ClosureParameters),
("function_modifiers_repeat1", Rust::FunctionModifiersRepeat1),
("token_tree_repeat1", Rust::TokenTreeRepeat1),
("macro_definition_repeat1", Rust::MacroDefinitionRepeat1),
("parameter", Rust::Parameter),
("array_type", Rust::ArrayType),
("impl", Rust::Impl),
("_", Rust::UNDERSCORE),
("while_let_expression", Rust::WhileLetExpression),
("tuple_expression_repeat1", Rust::TupleExpressionRepeat1),
("meta_arguments_repeat1", Rust::MetaArgumentsRepeat1),
("foreign_mod_item", Rust::ForeignModItem),
("static_item", Rust::StaticItem),
("!=", Rust::BANGEQ),
("empty_type", Rust::EmptyType),
("tuple_pattern_repeat1", Rust::TuplePatternRepeat1),
("break", Rust::Break),
("+=", Rust::PLUSEQ),
("type_identifier", Rust::TypeIdentifier),
("match", Rust::Match),
("pat", Rust::Pat),
("continue_expression", Rust::ContinueExpression),
("block", Rust::Block),
("unsafe", Rust::Unsafe),
("::", Rust::COLONCOLON),
("field_initializer", Rust::FieldInitializer),
("parenthesized_expression", Rust::ParenthesizedExpression),
("match_arm", Rust::MatchArm),
("const_parameter", Rust::ConstParameter),
("generic_type", Rust::GenericType),
("<", Rust::LT),
(",", Rust::COMMA),
("macro_invocation", Rust::MacroInvocation),
("match_pattern", Rust::MatchPattern),
("unit_expression", Rust::UnitExpression),
("use_list", Rust::UseList),
("while_expression", Rust::WhileExpression),
("arguments_repeat1", Rust::ArgumentsRepeat1),
("integer_literal", Rust::IntegerLiteral),
("use_as_clause", Rust::UseAsClause),
("^", Rust::CARET),
("negative_literal", Rust::NegativeLiteral),
("type_arguments", Rust::TypeArguments),
("item", Rust::Item),
("trait_bounds", Rust::TraitBounds),
("<<", Rust::LTLT),
]),
};
impl From<&str> for Rust {
#[inline(always)]
fn from(key: &str) -> Self {
KEYS.get(key).unwrap().clone()
}
}
impl From<u16> for Rust {
#[inline(always)]
fn from(x: u16) -> Self {
num::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
}
}
impl PartialEq<u16> for Rust {
#[inline(always)]
fn eq(&self, x: &u16) -> bool {
*self == Rust::from(*x)
}
}
impl PartialEq<Rust> for u16 {
#[inline(always)]
fn eq(&self, x: &Rust) -> bool {
*x == *self
}
}