use num_derive::FromPrimitive;
#[derive(Clone, Debug, PartialEq, Eq, FromPrimitive)]
pub enum Mozjs {
End = 0,
Identifier = 1,
HashBangLine = 2,
Export = 3,
STAR = 4,
Default = 5,
As = 6,
LBRACE = 7,
COMMA = 8,
RBRACE = 9,
Import2 = 10,
From = 11,
With = 12,
Var = 13,
Let = 14,
Const = 15,
Else = 16,
If = 17,
Switch = 18,
For = 19,
LPAREN = 20,
SEMI = 21,
RPAREN = 22,
Await = 23,
In = 24,
Of = 25,
While = 26,
Do = 27,
Try = 28,
Break = 29,
Continue = 30,
Debugger = 31,
Return = 32,
Throw = 33,
COLON = 34,
Case = 35,
Catch = 36,
Finally = 37,
Yield = 38,
EQ = 39,
LBRACK = 40,
RBRACK = 41,
HtmlCharacterReference = 42,
LT = 43,
GT = 44,
Identifier2 = 45,
DOT = 46,
LTSLASH = 47,
SLASHGT = 48,
DQUOTE = 49,
SQUOTE = 50,
StringFragment = 51,
StringFragment2 = 52,
Class2 = 53,
Extends = 54,
Async = 55,
Function = 56,
EQGT = 57,
OptionalChain = 58,
New = 59,
PLUSEQ = 60,
DASHEQ = 61,
STAREQ = 62,
SLASHEQ = 63,
PERCENTEQ = 64,
CARETEQ = 65,
AMPEQ = 66,
PIPEEQ = 67,
GTGTEQ = 68,
GTGTGTEQ = 69,
LTLTEQ = 70,
STARSTAREQ = 71,
AMPAMPEQ = 72,
PIPEPIPEEQ = 73,
QMARKQMARKEQ = 74,
DOTDOTDOT = 75,
AMPAMP = 76,
PIPEPIPE = 77,
GTGT = 78,
GTGTGT = 79,
LTLT = 80,
AMP = 81,
CARET = 82,
PIPE = 83,
PLUS = 84,
DASH = 85,
SLASH = 86,
PERCENT = 87,
STARSTAR = 88,
LTEQ = 89,
EQEQ = 90,
EQEQEQ = 91,
BANGEQ = 92,
BANGEQEQ = 93,
GTEQ = 94,
QMARKQMARK = 95,
Instanceof = 96,
BANG = 97,
TILDE = 98,
Typeof = 99,
Void = 100,
Delete = 101,
PLUSPLUS = 102,
DASHDASH = 103,
StringFragment3 = 104,
StringFragment4 = 105,
EscapeSequence = 106,
Comment = 107,
BQUOTE = 108,
DOLLARLBRACE = 109,
SLASH2 = 110,
RegexPattern = 111,
RegexFlags = 112,
Number = 113,
PrivatePropertyIdentifier = 114,
Target = 115,
Meta = 116,
This = 117,
Super = 118,
True = 119,
False = 120,
Null = 121,
Undefined = 122,
AT = 123,
Static = 124,
Staticget = 125,
Get = 126,
Set = 127,
Preproc = 128,
AutomaticSemicolon = 129,
StringFragment5 = 130,
QMARK = 131,
HtmlComment = 132,
JsxText = 133,
Program = 134,
ExportStatement = 135,
NamespaceExport = 136,
ExportClause = 137,
ExportSpecifier = 138,
ModuleExportName = 139,
Declaration = 140,
Import = 141,
ImportStatement = 142,
ImportClause = 143,
FromClause = 144,
NamespaceImport = 145,
NamedImports = 146,
ImportSpecifier = 147,
ImportAttribute = 148,
Statement = 149,
ExpressionStatement = 150,
VariableDeclaration = 151,
LexicalDeclaration = 152,
VariableDeclarator = 153,
StatementBlock = 154,
ElseClause = 155,
IfStatement = 156,
SwitchStatement = 157,
ForStatement = 158,
ForInStatement = 159,
ForHeader = 160,
WhileStatement = 161,
DoStatement = 162,
TryStatement = 163,
WithStatement = 164,
BreakStatement = 165,
ContinueStatement = 166,
DebuggerStatement = 167,
ReturnStatement = 168,
ThrowStatement = 169,
EmptyStatement = 170,
LabeledStatement = 171,
SwitchBody = 172,
SwitchCase = 173,
SwitchDefault = 174,
CatchClause = 175,
FinallyClause = 176,
ParenthesizedExpression = 177,
Expression = 178,
PrimaryExpression = 179,
YieldExpression = 180,
Object = 181,
ObjectPattern = 182,
AssignmentPattern = 183,
ObjectAssignmentPattern = 184,
Array = 185,
ArrayPattern = 186,
JsxElement = 187,
JsxExpression = 188,
JsxOpeningElement = 189,
MemberExpression = 190,
JsxNamespaceName = 191,
JsxClosingElement = 192,
JsxSelfClosingElement = 193,
JsxAttribute = 194,
String = 195,
Class = 196,
ClassDeclaration = 197,
ClassHeritage = 198,
FunctionExpression = 199,
FunctionDeclaration = 200,
GeneratorFunction = 201,
GeneratorFunctionDeclaration = 202,
ArrowFunction = 203,
CallExpression = 204,
NewExpression = 205,
AwaitExpression = 206,
MemberExpression2 = 207,
SubscriptExpression = 208,
AssignmentExpression = 209,
AugmentedAssignmentLhs = 210,
AugmentedAssignmentExpression = 211,
Initializer = 212,
DestructuringPattern = 213,
SpreadElement = 214,
TernaryExpression = 215,
BinaryExpression = 216,
UnaryExpression = 217,
UpdateExpression = 218,
SequenceExpression = 219,
String2 = 220,
TemplateString = 221,
TemplateSubstitution = 222,
Regex = 223,
MetaProperty = 224,
Arguments = 225,
Decorator = 226,
MemberExpression3 = 227,
CallExpression2 = 228,
ClassBody = 229,
FieldDefinition = 230,
FormalParameters = 231,
ClassStaticBlock = 232,
Pattern = 233,
RestPattern = 234,
MethodDefinition = 235,
Pair = 236,
PairPattern = 237,
PropertyName = 238,
ComputedPropertyName = 239,
ProgramRepeat1 = 240,
ExportStatementRepeat1 = 241,
ExportClauseRepeat1 = 242,
NamedImportsRepeat1 = 243,
VariableDeclarationRepeat1 = 244,
SwitchBodyRepeat1 = 245,
ObjectRepeat1 = 246,
ObjectPatternRepeat1 = 247,
ArrayRepeat1 = 248,
ArrayPatternRepeat1 = 249,
JsxElementRepeat1 = 250,
JsxOpeningElementRepeat1 = 251,
JsxStringRepeat1 = 252,
JsxStringRepeat2 = 253,
SequenceExpressionRepeat1 = 254,
StringRepeat1 = 255,
StringRepeat2 = 256,
TemplateStringRepeat1 = 257,
ClassBodyRepeat1 = 258,
FormalParametersRepeat1 = 259,
PropertyIdentifier = 260,
ShorthandPropertyIdentifier = 261,
ShorthandPropertyIdentifierPattern = 262,
StatementIdentifier = 263,
Error = 264,
}
impl From<Mozjs> for &'static str {
#[inline(always)]
fn from(tok: Mozjs) -> Self {
match tok {
Mozjs::End => "end",
Mozjs::Identifier => "identifier",
Mozjs::HashBangLine => "hash_bang_line",
Mozjs::Export => "export",
Mozjs::STAR => "*",
Mozjs::Default => "default",
Mozjs::As => "as",
Mozjs::LBRACE => "{",
Mozjs::COMMA => ",",
Mozjs::RBRACE => "}",
Mozjs::Import2 => "import",
Mozjs::From => "from",
Mozjs::With => "with",
Mozjs::Var => "var",
Mozjs::Let => "let",
Mozjs::Const => "const",
Mozjs::Else => "else",
Mozjs::If => "if",
Mozjs::Switch => "switch",
Mozjs::For => "for",
Mozjs::LPAREN => "(",
Mozjs::SEMI => ";",
Mozjs::RPAREN => ")",
Mozjs::Await => "await",
Mozjs::In => "in",
Mozjs::Of => "of",
Mozjs::While => "while",
Mozjs::Do => "do",
Mozjs::Try => "try",
Mozjs::Break => "break",
Mozjs::Continue => "continue",
Mozjs::Debugger => "debugger",
Mozjs::Return => "return",
Mozjs::Throw => "throw",
Mozjs::COLON => ":",
Mozjs::Case => "case",
Mozjs::Catch => "catch",
Mozjs::Finally => "finally",
Mozjs::Yield => "yield",
Mozjs::EQ => "=",
Mozjs::LBRACK => "[",
Mozjs::RBRACK => "]",
Mozjs::HtmlCharacterReference => "html_character_reference",
Mozjs::LT => "<",
Mozjs::GT => ">",
Mozjs::Identifier2 => "identifier",
Mozjs::DOT => ".",
Mozjs::LTSLASH => "</",
Mozjs::SLASHGT => "/>",
Mozjs::DQUOTE => "\"",
Mozjs::SQUOTE => "'",
Mozjs::StringFragment => "string_fragment",
Mozjs::StringFragment2 => "string_fragment",
Mozjs::Class2 => "class",
Mozjs::Extends => "extends",
Mozjs::Async => "async",
Mozjs::Function => "function",
Mozjs::EQGT => "=>",
Mozjs::OptionalChain => "optional_chain",
Mozjs::New => "new",
Mozjs::PLUSEQ => "+=",
Mozjs::DASHEQ => "-=",
Mozjs::STAREQ => "*=",
Mozjs::SLASHEQ => "/=",
Mozjs::PERCENTEQ => "%=",
Mozjs::CARETEQ => "^=",
Mozjs::AMPEQ => "&=",
Mozjs::PIPEEQ => "|=",
Mozjs::GTGTEQ => ">>=",
Mozjs::GTGTGTEQ => ">>>=",
Mozjs::LTLTEQ => "<<=",
Mozjs::STARSTAREQ => "**=",
Mozjs::AMPAMPEQ => "&&=",
Mozjs::PIPEPIPEEQ => "||=",
Mozjs::QMARKQMARKEQ => "??=",
Mozjs::DOTDOTDOT => "...",
Mozjs::AMPAMP => "&&",
Mozjs::PIPEPIPE => "||",
Mozjs::GTGT => ">>",
Mozjs::GTGTGT => ">>>",
Mozjs::LTLT => "<<",
Mozjs::AMP => "&",
Mozjs::CARET => "^",
Mozjs::PIPE => "|",
Mozjs::PLUS => "+",
Mozjs::DASH => "-",
Mozjs::SLASH => "/",
Mozjs::PERCENT => "%",
Mozjs::STARSTAR => "**",
Mozjs::LTEQ => "<=",
Mozjs::EQEQ => "==",
Mozjs::EQEQEQ => "===",
Mozjs::BANGEQ => "!=",
Mozjs::BANGEQEQ => "!==",
Mozjs::GTEQ => ">=",
Mozjs::QMARKQMARK => "??",
Mozjs::Instanceof => "instanceof",
Mozjs::BANG => "!",
Mozjs::TILDE => "~",
Mozjs::Typeof => "typeof",
Mozjs::Void => "void",
Mozjs::Delete => "delete",
Mozjs::PLUSPLUS => "++",
Mozjs::DASHDASH => "--",
Mozjs::StringFragment3 => "string_fragment",
Mozjs::StringFragment4 => "string_fragment",
Mozjs::EscapeSequence => "escape_sequence",
Mozjs::Comment => "comment",
Mozjs::BQUOTE => "`",
Mozjs::DOLLARLBRACE => "${",
Mozjs::SLASH2 => "/",
Mozjs::RegexPattern => "regex_pattern",
Mozjs::RegexFlags => "regex_flags",
Mozjs::Number => "number",
Mozjs::PrivatePropertyIdentifier => "private_property_identifier",
Mozjs::Target => "target",
Mozjs::Meta => "meta",
Mozjs::This => "this",
Mozjs::Super => "super",
Mozjs::True => "true",
Mozjs::False => "false",
Mozjs::Null => "null",
Mozjs::Undefined => "undefined",
Mozjs::AT => "@",
Mozjs::Static => "static",
Mozjs::Staticget => "static get",
Mozjs::Get => "get",
Mozjs::Set => "set",
Mozjs::Preproc => "preproc",
Mozjs::AutomaticSemicolon => "_automatic_semicolon",
Mozjs::StringFragment5 => "string_fragment",
Mozjs::QMARK => "?",
Mozjs::HtmlComment => "html_comment",
Mozjs::JsxText => "jsx_text",
Mozjs::Program => "program",
Mozjs::ExportStatement => "export_statement",
Mozjs::NamespaceExport => "namespace_export",
Mozjs::ExportClause => "export_clause",
Mozjs::ExportSpecifier => "export_specifier",
Mozjs::ModuleExportName => "_module_export_name",
Mozjs::Declaration => "declaration",
Mozjs::Import => "import",
Mozjs::ImportStatement => "import_statement",
Mozjs::ImportClause => "import_clause",
Mozjs::FromClause => "_from_clause",
Mozjs::NamespaceImport => "namespace_import",
Mozjs::NamedImports => "named_imports",
Mozjs::ImportSpecifier => "import_specifier",
Mozjs::ImportAttribute => "import_attribute",
Mozjs::Statement => "statement",
Mozjs::ExpressionStatement => "expression_statement",
Mozjs::VariableDeclaration => "variable_declaration",
Mozjs::LexicalDeclaration => "lexical_declaration",
Mozjs::VariableDeclarator => "variable_declarator",
Mozjs::StatementBlock => "statement_block",
Mozjs::ElseClause => "else_clause",
Mozjs::IfStatement => "if_statement",
Mozjs::SwitchStatement => "switch_statement",
Mozjs::ForStatement => "for_statement",
Mozjs::ForInStatement => "for_in_statement",
Mozjs::ForHeader => "_for_header",
Mozjs::WhileStatement => "while_statement",
Mozjs::DoStatement => "do_statement",
Mozjs::TryStatement => "try_statement",
Mozjs::WithStatement => "with_statement",
Mozjs::BreakStatement => "break_statement",
Mozjs::ContinueStatement => "continue_statement",
Mozjs::DebuggerStatement => "debugger_statement",
Mozjs::ReturnStatement => "return_statement",
Mozjs::ThrowStatement => "throw_statement",
Mozjs::EmptyStatement => "empty_statement",
Mozjs::LabeledStatement => "labeled_statement",
Mozjs::SwitchBody => "switch_body",
Mozjs::SwitchCase => "switch_case",
Mozjs::SwitchDefault => "switch_default",
Mozjs::CatchClause => "catch_clause",
Mozjs::FinallyClause => "finally_clause",
Mozjs::ParenthesizedExpression => "parenthesized_expression",
Mozjs::Expression => "expression",
Mozjs::PrimaryExpression => "primary_expression",
Mozjs::YieldExpression => "yield_expression",
Mozjs::Object => "object",
Mozjs::ObjectPattern => "object_pattern",
Mozjs::AssignmentPattern => "assignment_pattern",
Mozjs::ObjectAssignmentPattern => "object_assignment_pattern",
Mozjs::Array => "array",
Mozjs::ArrayPattern => "array_pattern",
Mozjs::JsxElement => "jsx_element",
Mozjs::JsxExpression => "jsx_expression",
Mozjs::JsxOpeningElement => "jsx_opening_element",
Mozjs::MemberExpression => "member_expression",
Mozjs::JsxNamespaceName => "jsx_namespace_name",
Mozjs::JsxClosingElement => "jsx_closing_element",
Mozjs::JsxSelfClosingElement => "jsx_self_closing_element",
Mozjs::JsxAttribute => "jsx_attribute",
Mozjs::String => "string",
Mozjs::Class => "class",
Mozjs::ClassDeclaration => "class_declaration",
Mozjs::ClassHeritage => "class_heritage",
Mozjs::FunctionExpression => "function_expression",
Mozjs::FunctionDeclaration => "function_declaration",
Mozjs::GeneratorFunction => "generator_function",
Mozjs::GeneratorFunctionDeclaration => "generator_function_declaration",
Mozjs::ArrowFunction => "arrow_function",
Mozjs::CallExpression => "call_expression",
Mozjs::NewExpression => "new_expression",
Mozjs::AwaitExpression => "await_expression",
Mozjs::MemberExpression2 => "member_expression",
Mozjs::SubscriptExpression => "subscript_expression",
Mozjs::AssignmentExpression => "assignment_expression",
Mozjs::AugmentedAssignmentLhs => "_augmented_assignment_lhs",
Mozjs::AugmentedAssignmentExpression => "augmented_assignment_expression",
Mozjs::Initializer => "_initializer",
Mozjs::DestructuringPattern => "_destructuring_pattern",
Mozjs::SpreadElement => "spread_element",
Mozjs::TernaryExpression => "ternary_expression",
Mozjs::BinaryExpression => "binary_expression",
Mozjs::UnaryExpression => "unary_expression",
Mozjs::UpdateExpression => "update_expression",
Mozjs::SequenceExpression => "sequence_expression",
Mozjs::String2 => "string",
Mozjs::TemplateString => "template_string",
Mozjs::TemplateSubstitution => "template_substitution",
Mozjs::Regex => "regex",
Mozjs::MetaProperty => "meta_property",
Mozjs::Arguments => "arguments",
Mozjs::Decorator => "decorator",
Mozjs::MemberExpression3 => "member_expression",
Mozjs::CallExpression2 => "call_expression",
Mozjs::ClassBody => "class_body",
Mozjs::FieldDefinition => "field_definition",
Mozjs::FormalParameters => "formal_parameters",
Mozjs::ClassStaticBlock => "class_static_block",
Mozjs::Pattern => "pattern",
Mozjs::RestPattern => "rest_pattern",
Mozjs::MethodDefinition => "method_definition",
Mozjs::Pair => "pair",
Mozjs::PairPattern => "pair_pattern",
Mozjs::PropertyName => "_property_name",
Mozjs::ComputedPropertyName => "computed_property_name",
Mozjs::ProgramRepeat1 => "program_repeat1",
Mozjs::ExportStatementRepeat1 => "export_statement_repeat1",
Mozjs::ExportClauseRepeat1 => "export_clause_repeat1",
Mozjs::NamedImportsRepeat1 => "named_imports_repeat1",
Mozjs::VariableDeclarationRepeat1 => "variable_declaration_repeat1",
Mozjs::SwitchBodyRepeat1 => "switch_body_repeat1",
Mozjs::ObjectRepeat1 => "object_repeat1",
Mozjs::ObjectPatternRepeat1 => "object_pattern_repeat1",
Mozjs::ArrayRepeat1 => "array_repeat1",
Mozjs::ArrayPatternRepeat1 => "array_pattern_repeat1",
Mozjs::JsxElementRepeat1 => "jsx_element_repeat1",
Mozjs::JsxOpeningElementRepeat1 => "jsx_opening_element_repeat1",
Mozjs::JsxStringRepeat1 => "_jsx_string_repeat1",
Mozjs::JsxStringRepeat2 => "_jsx_string_repeat2",
Mozjs::SequenceExpressionRepeat1 => "sequence_expression_repeat1",
Mozjs::StringRepeat1 => "string_repeat1",
Mozjs::StringRepeat2 => "string_repeat2",
Mozjs::TemplateStringRepeat1 => "template_string_repeat1",
Mozjs::ClassBodyRepeat1 => "class_body_repeat1",
Mozjs::FormalParametersRepeat1 => "formal_parameters_repeat1",
Mozjs::PropertyIdentifier => "property_identifier",
Mozjs::ShorthandPropertyIdentifier => "shorthand_property_identifier",
Mozjs::ShorthandPropertyIdentifierPattern => "shorthand_property_identifier_pattern",
Mozjs::StatementIdentifier => "statement_identifier",
Mozjs::Error => "ERROR",
}
}
}
impl From<u16> for Mozjs {
#[inline(always)]
fn from(x: u16) -> Self {
num::FromPrimitive::from_u16(x).unwrap_or(Self::Error)
}
}
impl PartialEq<u16> for Mozjs {
#[inline(always)]
fn eq(&self, x: &u16) -> bool {
*self == Into::<Self>::into(*x)
}
}
impl PartialEq<Mozjs> for u16 {
#[inline(always)]
fn eq(&self, x: &Mozjs) -> bool {
*x == *self
}
}