#[derive(Clone, Debug, PartialEq, FromPrimitive)]
pub enum Python {
End = 0,
Identifier = 1,
Import = 2,
DOT = 3,
From = 4,
Future = 5,
LPAREN = 6,
RPAREN = 7,
COMMA = 8,
As = 9,
STAR = 10,
Print = 11,
GTGT = 12,
Assert = 13,
COLONEQ = 14,
Return = 15,
Del = 16,
Raise = 17,
Pass = 18,
Break = 19,
Continue = 20,
If = 21,
COLON = 22,
Elif = 23,
Else = 24,
Async = 25,
For = 26,
In = 27,
While = 28,
Try = 29,
Except = 30,
Finally = 31,
With = 32,
Def = 33,
DASHGT = 34,
STARSTAR = 35,
Global = 36,
Nonlocal = 37,
Exec = 38,
Class = 39,
AT = 40,
LBRACK = 41,
RBRACK = 42,
EQ = 43,
Not = 44,
And = 45,
Or = 46,
PLUS = 47,
DASH = 48,
SLASH = 49,
PERCENT = 50,
SLASHSLASH = 51,
PIPE = 52,
AMP = 53,
CARET = 54,
LTLT = 55,
TILDE = 56,
LT = 57,
LTEQ = 58,
EQEQ = 59,
BANGEQ = 60,
GTEQ = 61,
GT = 62,
LTGT = 63,
Is = 64,
Lambda3 = 65,
PLUSEQ = 66,
DASHEQ = 67,
STAREQ = 68,
SLASHEQ = 69,
ATEQ = 70,
SLASHSLASHEQ = 71,
PERCENTEQ = 72,
STARSTAREQ = 73,
GTGTEQ = 74,
LTLTEQ = 75,
AMPEQ = 76,
CARETEQ = 77,
PIPEEQ = 78,
Yield2 = 79,
Ellipsis = 80,
LBRACE = 81,
RBRACE = 82,
EscapeSequence = 83,
NotEscapeSequence = 84,
FormatSpecifierToken1 = 85,
TypeConversion = 86,
Integer = 87,
Float = 88,
Await2 = 89,
True = 90,
False = 91,
None = 92,
Comment = 93,
Semicolon = 94,
Newline = 95,
Indent = 96,
Dedent = 97,
DQUOTE = 98,
StringContent = 99,
DQUOTE2 = 100,
Module = 101,
Statement = 102,
SimpleStatements = 103,
ImportStatement = 104,
ImportPrefix = 105,
RelativeImport = 106,
FutureImportStatement = 107,
ImportFromStatement = 108,
ImportList = 109,
AliasedImport = 110,
WildcardImport = 111,
PrintStatement = 112,
Chevron = 113,
AssertStatement = 114,
ExpressionStatement = 115,
NamedExpression = 116,
ReturnStatement = 117,
DeleteStatement = 118,
RaiseStatement = 119,
PassStatement = 120,
BreakStatement = 121,
ContinueStatement = 122,
IfStatement = 123,
ElifClause = 124,
ElseClause = 125,
ForStatement = 126,
WhileStatement = 127,
TryStatement = 128,
ExceptClause = 129,
FinallyClause = 130,
WithStatement = 131,
WithClause = 132,
WithItem = 133,
FunctionDefinition = 134,
Parameters = 135,
LambdaParameters = 136,
ListSplat = 137,
DictionarySplat = 138,
GlobalStatement = 139,
NonlocalStatement = 140,
ExecStatement = 141,
ClassDefinition = 142,
ParenthesizedListSplat = 143,
ArgumentList = 144,
DecoratedDefinition = 145,
Decorator = 146,
Block = 147,
ExpressionList = 148,
DottedName = 149,
Parameters2 = 150,
Patterns = 151,
Parameter = 152,
Pattern = 153,
TuplePattern = 154,
ListPattern = 155,
DefaultParameter = 156,
TypedDefaultParameter = 157,
ListSplatPattern = 158,
DictionarySplatPattern = 159,
ExpressionWithinForInClause = 160,
Expression = 161,
PrimaryExpression = 162,
NotOperator = 163,
BooleanOperator = 164,
BinaryOperator = 165,
UnaryOperator = 166,
ComparisonOperator = 167,
Lambda = 168,
Lambda2 = 169,
Assignment = 170,
AugmentedAssignment = 171,
PatternList = 172,
RightHandSide = 173,
Yield = 174,
Attribute = 175,
Subscript = 176,
Slice = 177,
Call = 178,
TypedParameter = 179,
Type = 180,
KeywordArgument = 181,
List = 182,
Set = 183,
Tuple = 184,
Dictionary = 185,
Pair = 186,
ListComprehension = 187,
DictionaryComprehension = 188,
SetComprehension = 189,
GeneratorExpression = 190,
ComprehensionClauses = 191,
ParenthesizedExpression = 192,
CollectionElements = 193,
ForInClause = 194,
IfClause = 195,
ConditionalExpression = 196,
ConcatenatedString = 197,
String = 198,
Interpolation = 199,
FormatSpecifier = 200,
FormatExpression = 201,
Await = 202,
ModuleRepeat1 = 203,
SimpleStatementsRepeat1 = 204,
ImportPrefixRepeat1 = 205,
ImportListRepeat1 = 206,
PrintStatementRepeat1 = 207,
AssertStatementRepeat1 = 208,
IfStatementRepeat1 = 209,
TryStatementRepeat1 = 210,
WithClauseRepeat1 = 211,
GlobalStatementRepeat1 = 212,
ArgumentListRepeat1 = 213,
DecoratedDefinitionRepeat1 = 214,
DottedNameRepeat1 = 215,
ParametersRepeat1 = 216,
PatternsRepeat1 = 217,
ComparisonOperatorRepeat1 = 218,
SubscriptRepeat1 = 219,
DictionaryRepeat1 = 220,
ComprehensionClausesRepeat1 = 221,
CollectionElementsRepeat1 = 222,
ForInClauseRepeat1 = 223,
ConcatenatedStringRepeat1 = 224,
StringRepeat1 = 225,
FormatSpecifierRepeat1 = 226,
Error = 227,
}
#[allow(clippy::unreadable_literal)]
static KEYS: phf::Map<&'static str, Python> = ::phf::Map {
key: 3213172566270843353,
disps: ::phf::Slice::Static(&[
(0, 0),
(2, 103),
(0, 0),
(6, 32),
(0, 46),
(0, 93),
(0, 1),
(0, 7),
(0, 3),
(1, 39),
(0, 47),
(0, 197),
(0, 9),
(0, 10),
(0, 58),
(0, 23),
(0, 195),
(0, 60),
(2, 221),
(0, 41),
(0, 2),
(2, 18),
(0, 0),
(2, 85),
(1, 16),
(9, 18),
(0, 74),
(1, 3),
(0, 204),
(15, 128),
(5, 52),
(15, 199),
(8, 141),
(0, 42),
(0, 204),
(0, 135),
(3, 84),
(0, 8),
(20, 41),
(13, 60),
(25, 122),
(4, 79),
(14, 155),
(0, 204),
(0, 0),
]),
entries: ::phf::Slice::Static(&[
("concatenated_string", Python::ConcatenatedString),
("chevron", Python::Chevron),
("list_splat", Python::ListSplat),
("exec_statement", Python::ExecStatement),
("lambda", Python::Lambda),
("nonlocal", Python::Nonlocal),
("<<", Python::LTLT),
("argument_list_repeat1", Python::ArgumentListRepeat1),
("set_comprehension", Python::SetComprehension),
("import_prefix", Python::ImportPrefix),
("*=", Python::STAREQ),
("\\\"", Python::DQUOTE),
("break_statement", Python::BreakStatement),
("future_import_statement", Python::FutureImportStatement),
("attribute", Python::Attribute),
("false", Python::False),
(")", Python::RPAREN),
("type_conversion", Python::TypeConversion),
("if", Python::If),
("ERROR", Python::Error),
("continue", Python::Continue),
(
"_collection_elements_repeat1",
Python::CollectionElementsRepeat1,
),
("pass", Python::Pass),
("for_in_clause", Python::ForInClause),
("while_statement", Python::WhileStatement),
("import_prefix_repeat1", Python::ImportPrefixRepeat1),
("_collection_elements", Python::CollectionElements),
("~", Python::TILDE),
("global", Python::Global),
("set", Python::Set),
("primary_expression", Python::PrimaryExpression),
("slice", Python::Slice),
("parenthesized_list_splat", Python::ParenthesizedListSplat),
("module_repeat1", Python::ModuleRepeat1),
("delete_statement", Python::DeleteStatement),
("-", Python::DASH),
("else_clause", Python::ElseClause),
("lambda_parameters", Python::LambdaParameters),
("typed_default_parameter", Python::TypedDefaultParameter),
("break", Python::Break),
("escape_sequence", Python::EscapeSequence),
("tuple_pattern", Python::TuplePattern),
("del", Python::Del),
(",", Python::COMMA),
("block", Python::Block),
("_right_hand_side", Python::RightHandSide),
("_string_content", Python::StringContent),
("raise", Python::Raise),
("relative_import", Python::RelativeImport),
("except_clause", Python::ExceptClause),
("dictionary_repeat1", Python::DictionaryRepeat1),
("|=", Python::PIPEEQ),
("argument_list", Python::ArgumentList),
("finally", Python::Finally),
("expression_statement", Python::ExpressionStatement),
("dictionary_splat", Python::DictionarySplat),
("try_statement", Python::TryStatement),
("class_definition", Python::ClassDefinition),
("unary_operator", Python::UnaryOperator),
("global_statement", Python::GlobalStatement),
("_import_list_repeat1", Python::ImportListRepeat1),
("expression", Python::Expression),
("-=", Python::DASHEQ),
("dictionary_splat_pattern", Python::DictionarySplatPattern),
("}", Python::RBRACE),
("integer", Python::Integer),
("@=", Python::ATEQ),
("|", Python::PIPE),
(":", Python::COLON),
("module", Python::Module),
("&=", Python::AMPEQ),
("format_specifier_repeat1", Python::FormatSpecifierRepeat1),
("else", Python::Else),
("elif", Python::Elif),
("print", Python::Print),
(">=", Python::GTEQ),
("_statement", Python::Statement),
("&", Python::AMP),
("%", Python::PERCENT),
("pattern_list", Python::PatternList),
("identifier", Python::Identifier),
("/", Python::SLASH),
("for", Python::For),
(
"decorated_definition_repeat1",
Python::DecoratedDefinitionRepeat1,
),
("pass_statement", Python::PassStatement),
("/=", Python::SLASHEQ),
("->", Python::DASHGT),
("]", Python::RBRACK),
("string_repeat1", Python::StringRepeat1),
("for_in_clause_repeat1", Python::ForInClauseRepeat1),
("except", Python::Except),
("^=", Python::CARETEQ),
("boolean_operator", Python::BooleanOperator),
("list_pattern", Python::ListPattern),
("not", Python::Not),
("<<=", Python::LTLTEQ),
("[", Python::LBRACK),
("class", Python::Class),
("_semicolon", Python::Semicolon),
("async", Python::Async),
("type", Python::Type),
("<=", Python::LTEQ),
("print_statement_repeat1", Python::PrintStatementRepeat1),
(
"concatenated_string_repeat1",
Python::ConcatenatedStringRepeat1,
),
("binary_operator", Python::BinaryOperator),
("subscript_repeat1", Python::SubscriptRepeat1),
("_not_escape_sequence", Python::NotEscapeSequence),
("elif_clause", Python::ElifClause),
("pair", Python::Pair),
("with_clause", Python::WithClause),
("%=", Python::PERCENTEQ),
("format_specifier_token1", Python::FormatSpecifierToken1),
("if_statement_repeat1", Python::IfStatementRepeat1),
("return", Python::Return),
(
"_expression_within_for_in_clause",
Python::ExpressionWithinForInClause,
),
("function_definition", Python::FunctionDefinition),
("import_statement", Python::ImportStatement),
("true", Python::True),
("_simple_statements", Python::SimpleStatements),
("parameter", Python::Parameter),
("list_splat_pattern", Python::ListSplatPattern),
("dotted_name_repeat1", Python::DottedNameRepeat1),
("global_statement_repeat1", Python::GlobalStatementRepeat1),
("and", Python::And),
("!=", Python::BANGEQ),
("assignment", Python::Assignment),
("decorated_definition", Python::DecoratedDefinition),
("comparison_operator", Python::ComparisonOperator),
("try", Python::Try),
("none", Python::None),
("while", Python::While),
("dictionary_comprehension", Python::DictionaryComprehension),
("import", Python::Import),
("conditional_expression", Python::ConditionalExpression),
("with", Python::With),
("if_clause", Python::IfClause),
("parameters", Python::Parameters),
("typed_parameter", Python::TypedParameter),
(">", Python::GT),
("print_statement", Python::PrintStatement),
(":=", Python::COLONEQ),
("return_statement", Python::ReturnStatement),
("for_statement", Python::ForStatement),
("default_parameter", Python::DefaultParameter),
("assert_statement_repeat1", Python::AssertStatementRepeat1),
("as", Python::As),
("not_operator", Python::NotOperator),
("_import_list", Python::ImportList),
("finally_clause", Python::FinallyClause),
("string", Python::String),
(
"_comprehension_clauses_repeat1",
Python::ComprehensionClausesRepeat1,
),
("continue_statement", Python::ContinueStatement),
("with_item", Python::WithItem),
("or", Python::Or),
("named_expression", Python::NamedExpression),
("float", Python::Float),
("dictionary", Python::Dictionary),
("with_clause_repeat1", Python::WithClauseRepeat1),
("generator_expression", Python::GeneratorExpression),
("==", Python::EQEQ),
("keyword_argument", Python::KeywordArgument),
("import_from_statement", Python::ImportFromStatement),
("if_statement", Python::IfStatement),
("call", Python::Call),
("(", Python::LPAREN),
("yield", Python::Yield),
("list_comprehension", Python::ListComprehension),
("from", Python::From),
("dotted_name", Python::DottedName),
("_parameters_repeat1", Python::ParametersRepeat1),
("__future__", Python::Future),
("^", Python::CARET),
("list", Python::List),
("//", Python::SLASHSLASH),
("augmented_assignment", Python::AugmentedAssignment),
("comment", Python::Comment),
("**=", Python::STARSTAREQ),
("def", Python::Def),
("{", Python::LBRACE),
("pattern", Python::Pattern),
("=", Python::EQ),
("*", Python::STAR),
("_patterns_repeat1", Python::PatternsRepeat1),
("+=", Python::PLUSEQ),
("decorator", Python::Decorator),
("_comprehension_clauses", Python::ComprehensionClauses),
("**", Python::STARSTAR),
("format_specifier", Python::FormatSpecifier),
("aliased_import", Python::AliasedImport),
("expression_list", Python::ExpressionList),
("raise_statement", Python::RaiseStatement),
("with_statement", Python::WithStatement),
("subscript", Python::Subscript),
("ellipsis", Python::Ellipsis),
("_newline", Python::Newline),
("await", Python::Await),
("@", Python::AT),
("try_statement_repeat1", Python::TryStatementRepeat1),
("assert_statement", Python::AssertStatement),
("format_expression", Python::FormatExpression),
("<", Python::LT),
("_indent", Python::Indent),
("//=", Python::SLASHSLASHEQ),
("tuple", Python::Tuple),
(
"comparison_operator_repeat1",
Python::ComparisonOperatorRepeat1,
),
("parenthesized_expression", Python::ParenthesizedExpression),
("_dedent", Python::Dedent),
(">>", Python::GTGT),
("nonlocal_statement", Python::NonlocalStatement),
("assert", Python::Assert),
("exec", Python::Exec),
("<>", Python::LTGT),
(
"_simple_statements_repeat1",
Python::SimpleStatementsRepeat1,
),
("in", Python::In),
(">>=", Python::GTGTEQ),
(".", Python::DOT),
("_patterns", Python::Patterns),
("is", Python::Is),
("wildcard_import", Python::WildcardImport),
("end", Python::End),
("interpolation", Python::Interpolation),
("+", Python::PLUS),
]),
};
impl From<&str> for Python {
#[inline(always)]
fn from(key: &str) -> Self {
KEYS.get(key).unwrap().clone()
}
}
impl From<u16> for Python {
#[inline(always)]
fn from(x: u16) -> Self {
num::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
}
}
impl PartialEq<u16> for Python {
#[inline(always)]
fn eq(&self, x: &u16) -> bool {
*self == Python::from(*x)
}
}
impl PartialEq<Python> for u16 {
#[inline(always)]
fn eq(&self, x: &Python) -> bool {
*x == *self
}
}