#[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,
}
impl From<Python> for &'static str {
#[inline(always)]
fn from(tok: Python) -> Self {
match tok {
Python::End => "end",
Python::Identifier => "identifier",
Python::Import => "import",
Python::DOT => ".",
Python::From => "from",
Python::Future => "__future__",
Python::LPAREN => "(",
Python::RPAREN => ")",
Python::COMMA => ",",
Python::As => "as",
Python::STAR => "*",
Python::Print => "print",
Python::GTGT => ">>",
Python::Assert => "assert",
Python::COLONEQ => ":=",
Python::Return => "return",
Python::Del => "del",
Python::Raise => "raise",
Python::Pass => "pass",
Python::Break => "break",
Python::Continue => "continue",
Python::If => "if",
Python::COLON => ":",
Python::Elif => "elif",
Python::Else => "else",
Python::Async => "async",
Python::For => "for",
Python::In => "in",
Python::While => "while",
Python::Try => "try",
Python::Except => "except",
Python::Finally => "finally",
Python::With => "with",
Python::Def => "def",
Python::DASHGT => "->",
Python::STARSTAR => "**",
Python::Global => "global",
Python::Nonlocal => "nonlocal",
Python::Exec => "exec",
Python::Class => "class",
Python::AT => "@",
Python::LBRACK => "[",
Python::RBRACK => "]",
Python::EQ => "=",
Python::Not => "not",
Python::And => "and",
Python::Or => "or",
Python::PLUS => "+",
Python::DASH => "-",
Python::SLASH => "/",
Python::PERCENT => "%",
Python::SLASHSLASH => "//",
Python::PIPE => "|",
Python::AMP => "&",
Python::CARET => "^",
Python::LTLT => "<<",
Python::TILDE => "~",
Python::LT => "<",
Python::LTEQ => "<=",
Python::EQEQ => "==",
Python::BANGEQ => "!=",
Python::GTEQ => ">=",
Python::GT => ">",
Python::LTGT => "<>",
Python::Is => "is",
Python::Lambda3 => "lambda",
Python::PLUSEQ => "+=",
Python::DASHEQ => "-=",
Python::STAREQ => "*=",
Python::SLASHEQ => "/=",
Python::ATEQ => "@=",
Python::SLASHSLASHEQ => "//=",
Python::PERCENTEQ => "%=",
Python::STARSTAREQ => "**=",
Python::GTGTEQ => ">>=",
Python::LTLTEQ => "<<=",
Python::AMPEQ => "&=",
Python::CARETEQ => "^=",
Python::PIPEEQ => "|=",
Python::Yield2 => "yield",
Python::Ellipsis => "ellipsis",
Python::LBRACE => "{",
Python::RBRACE => "}",
Python::EscapeSequence => "escape_sequence",
Python::NotEscapeSequence => "_not_escape_sequence",
Python::FormatSpecifierToken1 => "format_specifier_token1",
Python::TypeConversion => "type_conversion",
Python::Integer => "integer",
Python::Float => "float",
Python::Await2 => "await",
Python::True => "true",
Python::False => "false",
Python::None => "none",
Python::Comment => "comment",
Python::Semicolon => "_semicolon",
Python::Newline => "_newline",
Python::Indent => "_indent",
Python::Dedent => "_dedent",
Python::DQUOTE => "\"",
Python::StringContent => "_string_content",
Python::DQUOTE2 => "\"",
Python::Module => "module",
Python::Statement => "_statement",
Python::SimpleStatements => "_simple_statements",
Python::ImportStatement => "import_statement",
Python::ImportPrefix => "import_prefix",
Python::RelativeImport => "relative_import",
Python::FutureImportStatement => "future_import_statement",
Python::ImportFromStatement => "import_from_statement",
Python::ImportList => "_import_list",
Python::AliasedImport => "aliased_import",
Python::WildcardImport => "wildcard_import",
Python::PrintStatement => "print_statement",
Python::Chevron => "chevron",
Python::AssertStatement => "assert_statement",
Python::ExpressionStatement => "expression_statement",
Python::NamedExpression => "named_expression",
Python::ReturnStatement => "return_statement",
Python::DeleteStatement => "delete_statement",
Python::RaiseStatement => "raise_statement",
Python::PassStatement => "pass_statement",
Python::BreakStatement => "break_statement",
Python::ContinueStatement => "continue_statement",
Python::IfStatement => "if_statement",
Python::ElifClause => "elif_clause",
Python::ElseClause => "else_clause",
Python::ForStatement => "for_statement",
Python::WhileStatement => "while_statement",
Python::TryStatement => "try_statement",
Python::ExceptClause => "except_clause",
Python::FinallyClause => "finally_clause",
Python::WithStatement => "with_statement",
Python::WithClause => "with_clause",
Python::WithItem => "with_item",
Python::FunctionDefinition => "function_definition",
Python::Parameters => "parameters",
Python::LambdaParameters => "lambda_parameters",
Python::ListSplat => "list_splat",
Python::DictionarySplat => "dictionary_splat",
Python::GlobalStatement => "global_statement",
Python::NonlocalStatement => "nonlocal_statement",
Python::ExecStatement => "exec_statement",
Python::ClassDefinition => "class_definition",
Python::ParenthesizedListSplat => "parenthesized_list_splat",
Python::ArgumentList => "argument_list",
Python::DecoratedDefinition => "decorated_definition",
Python::Decorator => "decorator",
Python::Block => "block",
Python::ExpressionList => "expression_list",
Python::DottedName => "dotted_name",
Python::Parameters2 => "_parameters",
Python::Patterns => "_patterns",
Python::Parameter => "parameter",
Python::Pattern => "pattern",
Python::TuplePattern => "tuple_pattern",
Python::ListPattern => "list_pattern",
Python::DefaultParameter => "default_parameter",
Python::TypedDefaultParameter => "typed_default_parameter",
Python::ListSplatPattern => "list_splat_pattern",
Python::DictionarySplatPattern => "dictionary_splat_pattern",
Python::ExpressionWithinForInClause => "_expression_within_for_in_clause",
Python::Expression => "expression",
Python::PrimaryExpression => "primary_expression",
Python::NotOperator => "not_operator",
Python::BooleanOperator => "boolean_operator",
Python::BinaryOperator => "binary_operator",
Python::UnaryOperator => "unary_operator",
Python::ComparisonOperator => "comparison_operator",
Python::Lambda => "lambda",
Python::Lambda2 => "lambda",
Python::Assignment => "assignment",
Python::AugmentedAssignment => "augmented_assignment",
Python::PatternList => "pattern_list",
Python::RightHandSide => "_right_hand_side",
Python::Yield => "yield",
Python::Attribute => "attribute",
Python::Subscript => "subscript",
Python::Slice => "slice",
Python::Call => "call",
Python::TypedParameter => "typed_parameter",
Python::Type => "type",
Python::KeywordArgument => "keyword_argument",
Python::List => "list",
Python::Set => "set",
Python::Tuple => "tuple",
Python::Dictionary => "dictionary",
Python::Pair => "pair",
Python::ListComprehension => "list_comprehension",
Python::DictionaryComprehension => "dictionary_comprehension",
Python::SetComprehension => "set_comprehension",
Python::GeneratorExpression => "generator_expression",
Python::ComprehensionClauses => "_comprehension_clauses",
Python::ParenthesizedExpression => "parenthesized_expression",
Python::CollectionElements => "_collection_elements",
Python::ForInClause => "for_in_clause",
Python::IfClause => "if_clause",
Python::ConditionalExpression => "conditional_expression",
Python::ConcatenatedString => "concatenated_string",
Python::String => "string",
Python::Interpolation => "interpolation",
Python::FormatSpecifier => "format_specifier",
Python::FormatExpression => "format_expression",
Python::Await => "await",
Python::ModuleRepeat1 => "module_repeat1",
Python::SimpleStatementsRepeat1 => "_simple_statements_repeat1",
Python::ImportPrefixRepeat1 => "import_prefix_repeat1",
Python::ImportListRepeat1 => "_import_list_repeat1",
Python::PrintStatementRepeat1 => "print_statement_repeat1",
Python::AssertStatementRepeat1 => "assert_statement_repeat1",
Python::IfStatementRepeat1 => "if_statement_repeat1",
Python::TryStatementRepeat1 => "try_statement_repeat1",
Python::WithClauseRepeat1 => "with_clause_repeat1",
Python::GlobalStatementRepeat1 => "global_statement_repeat1",
Python::ArgumentListRepeat1 => "argument_list_repeat1",
Python::DecoratedDefinitionRepeat1 => "decorated_definition_repeat1",
Python::DottedNameRepeat1 => "dotted_name_repeat1",
Python::ParametersRepeat1 => "_parameters_repeat1",
Python::PatternsRepeat1 => "_patterns_repeat1",
Python::ComparisonOperatorRepeat1 => "comparison_operator_repeat1",
Python::SubscriptRepeat1 => "subscript_repeat1",
Python::DictionaryRepeat1 => "dictionary_repeat1",
Python::ComprehensionClausesRepeat1 => "_comprehension_clauses_repeat1",
Python::CollectionElementsRepeat1 => "_collection_elements_repeat1",
Python::ForInClauseRepeat1 => "for_in_clause_repeat1",
Python::ConcatenatedStringRepeat1 => "concatenated_string_repeat1",
Python::StringRepeat1 => "string_repeat1",
Python::FormatSpecifierRepeat1 => "format_specifier_repeat1",
Python::Error => "ERROR",
}
}
}
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
}
}