#[derive(Clone, Debug, PartialEq, FromPrimitive)]
pub enum Mozjs {
End = 0,
Identifier = 1,
HashBangLine = 2,
Export = 3,
STAR = 4,
Default = 5,
LBRACE = 6,
COMMA = 7,
RBRACE = 8,
As = 9,
Import2 = 10,
From = 11,
Var = 12,
Let = 13,
Const = 14,
Else = 15,
If = 16,
Switch = 17,
For = 18,
LPAREN = 19,
RPAREN = 20,
Await = 21,
In = 22,
Of = 23,
While = 24,
Do = 25,
Try = 26,
With = 27,
Break = 28,
Continue = 29,
Debugger = 30,
Return = 31,
Throw = 32,
SEMI = 33,
COLON = 34,
Case = 35,
Catch = 36,
Finally = 37,
Yield = 38,
EQ = 39,
LBRACK = 40,
RBRACK = 41,
LT = 42,
GT = 43,
SLASH = 44,
JsxText = 45,
Identifier2 = 46,
DOT = 47,
Class2 = 48,
Extends = 49,
Async = 50,
Function2 = 51,
EQGT = 52,
QMARKDOT = 53,
New = 54,
PLUSEQ = 55,
DASHEQ = 56,
STAREQ = 57,
SLASHEQ = 58,
PERCENTEQ = 59,
CARETEQ = 60,
AMPEQ = 61,
PIPEEQ = 62,
GTGTEQ = 63,
GTGTGTEQ = 64,
LTLTEQ = 65,
STARSTAREQ = 66,
AMPAMPEQ = 67,
PIPEPIPEEQ = 68,
QMARKQMARKEQ = 69,
DOTDOTDOT = 70,
QMARK = 71,
AMPAMP = 72,
PIPEPIPE = 73,
GTGT = 74,
GTGTGT = 75,
LTLT = 76,
AMP = 77,
CARET = 78,
PIPE = 79,
PLUS = 80,
DASH = 81,
PERCENT = 82,
STARSTAR = 83,
LTEQ = 84,
EQEQ = 85,
EQEQEQ = 86,
BANGEQ = 87,
BANGEQEQ = 88,
GTEQ = 89,
QMARKQMARK = 90,
Instanceof = 91,
BANG = 92,
TILDE = 93,
Typeof = 94,
Void = 95,
Delete = 96,
PLUSPLUS = 97,
DASHDASH = 98,
DQUOTE = 99,
StringToken1 = 100,
SQUOTE = 101,
StringToken2 = 102,
EscapeSequence = 103,
Comment = 104,
BQUOTE = 105,
DOLLARLBRACE = 106,
SLASH2 = 107,
RegexPattern = 108,
RegexFlags = 109,
Number = 110,
Target = 111,
This = 112,
Super = 113,
True = 114,
False = 115,
Null = 116,
Undefined = 117,
AT = 118,
Static = 119,
Get = 120,
Set = 121,
Preproc = 122,
AutomaticSemicolon = 123,
TemplateChars = 124,
Program = 125,
ExportStatement = 126,
ExportClause = 127,
ExportSpecifier = 128,
Declaration = 129,
Import = 130,
ImportStatement = 131,
ImportClause = 132,
FromClause = 133,
NamespaceImport = 134,
NamedImports = 135,
ExpressionStatement = 136,
VariableDeclaration = 137,
LexicalDeclaration = 138,
VariableDeclarator = 139,
StatementBlock = 140,
ElseClause = 141,
IfStatement = 142,
SwitchStatement = 143,
ForStatement = 144,
ForInStatement = 145,
ForHeader = 146,
WhileStatement = 147,
DoStatement = 148,
TryStatement = 149,
WithStatement = 150,
BreakStatement = 151,
ContinueStatement = 152,
DebuggerStatement = 153,
ReturnStatement = 154,
ThrowStatement = 155,
EmptyStatement = 156,
LabeledStatement = 157,
SwitchBody = 158,
SwitchCase = 159,
SwitchDefault = 160,
CatchClause = 161,
FinallyClause = 162,
ParenthesizedExpression = 163,
Expression = 164,
PrimaryExpression = 165,
YieldExpression = 166,
Object = 167,
ObjectPattern = 168,
AssignmentPattern = 169,
ObjectAssignmentPattern = 170,
Array = 171,
ArrayPattern = 172,
JsxElement = 173,
JsxFragment = 174,
JsxExpression = 175,
JsxOpeningElement = 176,
NestedIdentifier = 177,
JsxNamespaceName = 178,
JsxClosingElement = 179,
JsxSelfClosingElement = 180,
JsxAttribute = 181,
Class = 182,
ClassDeclaration = 183,
ClassHeritage = 184,
Function = 185,
FunctionDeclaration = 186,
GeneratorFunction = 187,
GeneratorFunctionDeclaration = 188,
ArrowFunction = 189,
CallExpression = 190,
NewExpression = 191,
AwaitExpression = 192,
MemberExpression = 193,
SubscriptExpression = 194,
AssignmentExpression = 195,
AugmentedAssignmentLhs = 196,
AugmentedAssignmentExpression = 197,
Initializer = 198,
DestructuringPattern = 199,
SpreadElement = 200,
TernaryExpression = 201,
BinaryExpression = 202,
UnaryExpression = 203,
UpdateExpression = 204,
SequenceExpression = 205,
String = 206,
TemplateString = 207,
TemplateSubstitution = 208,
Regex = 209,
MetaProperty = 210,
Arguments = 211,
Decorator = 212,
MemberExpression2 = 213,
CallExpression2 = 214,
ClassBody = 215,
PublicFieldDefinition = 216,
FormalParameters = 217,
Pattern = 218,
RestPattern = 219,
MethodDefinition = 220,
Pair = 221,
PairPattern = 222,
PropertyName = 223,
ComputedPropertyName = 224,
ProgramRepeat1 = 225,
ExportStatementRepeat1 = 226,
ExportClauseRepeat1 = 227,
NamedImportsRepeat1 = 228,
VariableDeclarationRepeat1 = 229,
SwitchBodyRepeat1 = 230,
ObjectRepeat1 = 231,
ObjectPatternRepeat1 = 232,
ArrayRepeat1 = 233,
ArrayPatternRepeat1 = 234,
JsxElementRepeat1 = 235,
JsxOpeningElementRepeat1 = 236,
StringRepeat1 = 237,
StringRepeat2 = 238,
TemplateStringRepeat1 = 239,
ClassBodyRepeat1 = 240,
FormalParametersRepeat1 = 241,
ImportSpecifier = 242,
PropertyIdentifier = 243,
ShorthandPropertyIdentifier = 244,
ShorthandPropertyIdentifierPattern = 245,
StatementIdentifier = 246,
Error = 247,
}
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::LBRACE => "{",
Mozjs::COMMA => ",",
Mozjs::RBRACE => "}",
Mozjs::As => "as",
Mozjs::Import2 => "import",
Mozjs::From => "from",
Mozjs::Var => "var",
Mozjs::Let => "let",
Mozjs::Const => "const",
Mozjs::Else => "else",
Mozjs::If => "if",
Mozjs::Switch => "switch",
Mozjs::For => "for",
Mozjs::LPAREN => "(",
Mozjs::RPAREN => ")",
Mozjs::Await => "await",
Mozjs::In => "in",
Mozjs::Of => "of",
Mozjs::While => "while",
Mozjs::Do => "do",
Mozjs::Try => "try",
Mozjs::With => "with",
Mozjs::Break => "break",
Mozjs::Continue => "continue",
Mozjs::Debugger => "debugger",
Mozjs::Return => "return",
Mozjs::Throw => "throw",
Mozjs::SEMI => ";",
Mozjs::COLON => ":",
Mozjs::Case => "case",
Mozjs::Catch => "catch",
Mozjs::Finally => "finally",
Mozjs::Yield => "yield",
Mozjs::EQ => "=",
Mozjs::LBRACK => "[",
Mozjs::RBRACK => "]",
Mozjs::LT => "<",
Mozjs::GT => ">",
Mozjs::SLASH => "/",
Mozjs::JsxText => "jsx_text",
Mozjs::Identifier2 => "identifier",
Mozjs::DOT => ".",
Mozjs::Class2 => "class",
Mozjs::Extends => "extends",
Mozjs::Async => "async",
Mozjs::Function2 => "function",
Mozjs::EQGT => "=>",
Mozjs::QMARKDOT => "?.",
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::QMARK => "?",
Mozjs::AMPAMP => "&&",
Mozjs::PIPEPIPE => "||",
Mozjs::GTGT => ">>",
Mozjs::GTGTGT => ">>>",
Mozjs::LTLT => "<<",
Mozjs::AMP => "&",
Mozjs::CARET => "^",
Mozjs::PIPE => "|",
Mozjs::PLUS => "+",
Mozjs::DASH => "-",
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::DQUOTE => "\"",
Mozjs::StringToken1 => "string_token1",
Mozjs::SQUOTE => "'",
Mozjs::StringToken2 => "string_token2",
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::Target => "target",
Mozjs::This => "this",
Mozjs::Super => "super",
Mozjs::True => "true",
Mozjs::False => "false",
Mozjs::Null => "null",
Mozjs::Undefined => "undefined",
Mozjs::AT => "@",
Mozjs::Static => "static",
Mozjs::Get => "get",
Mozjs::Set => "set",
Mozjs::Preproc => "preproc",
Mozjs::AutomaticSemicolon => "_automatic_semicolon",
Mozjs::TemplateChars => "_template_chars",
Mozjs::Program => "program",
Mozjs::ExportStatement => "export_statement",
Mozjs::ExportClause => "export_clause",
Mozjs::ExportSpecifier => "export_specifier",
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::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::JsxFragment => "jsx_fragment",
Mozjs::JsxExpression => "jsx_expression",
Mozjs::JsxOpeningElement => "jsx_opening_element",
Mozjs::NestedIdentifier => "nested_identifier",
Mozjs::JsxNamespaceName => "jsx_namespace_name",
Mozjs::JsxClosingElement => "jsx_closing_element",
Mozjs::JsxSelfClosingElement => "jsx_self_closing_element",
Mozjs::JsxAttribute => "jsx_attribute",
Mozjs::Class => "class",
Mozjs::ClassDeclaration => "class_declaration",
Mozjs::ClassHeritage => "class_heritage",
Mozjs::Function => "function",
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::MemberExpression => "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::String => "string",
Mozjs::TemplateString => "template_string",
Mozjs::TemplateSubstitution => "template_substitution",
Mozjs::Regex => "regex",
Mozjs::MetaProperty => "meta_property",
Mozjs::Arguments => "arguments",
Mozjs::Decorator => "decorator",
Mozjs::MemberExpression2 => "member_expression",
Mozjs::CallExpression2 => "call_expression",
Mozjs::ClassBody => "class_body",
Mozjs::PublicFieldDefinition => "public_field_definition",
Mozjs::FormalParameters => "formal_parameters",
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::StringRepeat1 => "string_repeat1",
Mozjs::StringRepeat2 => "string_repeat2",
Mozjs::TemplateStringRepeat1 => "template_string_repeat1",
Mozjs::ClassBodyRepeat1 => "class_body_repeat1",
Mozjs::FormalParametersRepeat1 => "formal_parameters_repeat1",
Mozjs::ImportSpecifier => "import_specifier",
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 == Mozjs::from(*x)
}
}
impl PartialEq<Mozjs> for u16 {
#[inline(always)]
fn eq(&self, x: &Mozjs) -> bool {
*x == *self
}
}