#[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,
}
#[allow(clippy::unreadable_literal)]
static KEYS: phf::Map<&'static str, Mozjs> = ::phf::Map {
key: 3213172566270843353,
disps: ::phf::Slice::Static(&[
(5, 82),
(1, 172),
(1, 132),
(1, 51),
(0, 115),
(0, 53),
(0, 1),
(0, 6),
(0, 36),
(0, 224),
(1, 0),
(0, 57),
(0, 13),
(0, 11),
(1, 2),
(2, 5),
(0, 4),
(2, 0),
(0, 195),
(1, 47),
(0, 6),
(0, 0),
(0, 23),
(11, 45),
(0, 5),
(0, 15),
(0, 56),
(28, 84),
(0, 2),
(9, 161),
(1, 18),
(0, 79),
(60, 226),
(4, 212),
(0, 10),
(2, 181),
(0, 4),
(1, 41),
(0, 16),
(0, 38),
(0, 24),
(36, 8),
(0, 0),
(0, 36),
(2, 24),
(0, 0),
(0, 39),
(1, 11),
(1, 204),
]),
entries: ::phf::Slice::Static(&[
(
"shorthand_property_identifier",
Mozjs::ShorthandPropertyIdentifier,
),
("+", Mozjs::PLUS),
("string_repeat1", Mozjs::StringRepeat1),
(
"generator_function_declaration",
Mozjs::GeneratorFunctionDeclaration,
),
("expression_statement", Mozjs::ExpressionStatement),
("jsx_expression", Mozjs::JsxExpression),
("...", Mozjs::DOTDOTDOT),
("escape_sequence", Mozjs::EscapeSequence),
("]", Mozjs::RBRACK),
("export_statement_repeat1", Mozjs::ExportStatementRepeat1),
("string_token2", Mozjs::StringToken2),
("undefined", Mozjs::Undefined),
("template_string_repeat1", Mozjs::TemplateStringRepeat1),
("named_imports_repeat1", Mozjs::NamedImportsRepeat1),
("return_statement", Mozjs::ReturnStatement),
("if", Mozjs::If),
("typeof", Mozjs::Typeof),
("from", Mozjs::From),
("declaration", Mozjs::Declaration),
("named_imports", Mozjs::NamedImports),
("-=", Mozjs::DASHEQ),
("throw_statement", Mozjs::ThrowStatement),
("meta_property", Mozjs::MetaProperty),
("export", Mozjs::Export),
(">>>", Mozjs::GTGTGT),
(">", Mozjs::GT),
("import_clause", Mozjs::ImportClause),
("array_pattern_repeat1", Mozjs::ArrayPatternRepeat1),
("var", Mozjs::Var),
("binary_expression", Mozjs::BinaryExpression),
("string", Mozjs::String),
("ternary_expression", Mozjs::TernaryExpression),
(
"shorthand_property_identifier_pattern",
Mozjs::ShorthandPropertyIdentifierPattern,
),
("=>", Mozjs::EQGT),
("**", Mozjs::STARSTAR),
("|", Mozjs::PIPE),
("for_statement", Mozjs::ForStatement),
("throw", Mozjs::Throw),
(
"augmented_assignment_expression",
Mozjs::AugmentedAssignmentExpression,
),
("void", Mozjs::Void),
("public_field_definition", Mozjs::PublicFieldDefinition),
("for", Mozjs::For),
("preproc", Mozjs::Preproc),
("[", Mozjs::LBRACK),
("unary_expression", Mozjs::UnaryExpression),
("pair_pattern", Mozjs::PairPattern),
(".", Mozjs::DOT),
("_property_name", Mozjs::PropertyName),
("parenthesized_expression", Mozjs::ParenthesizedExpression),
("array_repeat1", Mozjs::ArrayRepeat1),
("switch_body_repeat1", Mozjs::SwitchBodyRepeat1),
("array_pattern", Mozjs::ArrayPattern),
("number", Mozjs::Number),
("class_heritage", Mozjs::ClassHeritage),
("labeled_statement", Mozjs::LabeledStatement),
("||", Mozjs::PIPEPIPE),
("regex", Mozjs::Regex),
("~", Mozjs::TILDE),
(
"jsx_opening_element_repeat1",
Mozjs::JsxOpeningElementRepeat1,
),
("import_specifier", Mozjs::ImportSpecifier),
("this", Mozjs::This),
("switch", Mozjs::Switch),
("^=", Mozjs::CARETEQ),
("empty_statement", Mozjs::EmptyStatement),
("array", Mozjs::Array),
("continue_statement", Mozjs::ContinueStatement),
("<<", Mozjs::LTLT),
("!=", Mozjs::BANGEQ),
("`", Mozjs::BQUOTE),
("<<=", Mozjs::LTLTEQ),
("=", Mozjs::EQ),
(">>=", Mozjs::GTGTEQ),
("assignment_pattern", Mozjs::AssignmentPattern),
("==", Mozjs::EQEQ),
("debugger", Mozjs::Debugger),
("generator_function", Mozjs::GeneratorFunction),
("in", Mozjs::In),
("static", Mozjs::Static),
("^", Mozjs::CARET),
("%=", Mozjs::PERCENTEQ),
("for_in_statement", Mozjs::ForInStatement),
("finally", Mozjs::Finally),
("else", Mozjs::Else),
("jsx_attribute", Mozjs::JsxAttribute),
("catch", Mozjs::Catch),
("_for_header", Mozjs::ForHeader),
("object_pattern", Mozjs::ObjectPattern),
("null", Mozjs::Null),
("string_token1", Mozjs::StringToken1),
("break_statement", Mozjs::BreakStatement),
("instanceof", Mozjs::Instanceof),
("regex_flags", Mozjs::RegexFlags),
("finally_clause", Mozjs::FinallyClause),
("!==", Mozjs::BANGEQEQ),
("*", Mozjs::STAR),
("export_specifier", Mozjs::ExportSpecifier),
("nested_identifier", Mozjs::NestedIdentifier),
("jsx_fragment", Mozjs::JsxFragment),
("break", Mozjs::Break),
("class_body_repeat1", Mozjs::ClassBodyRepeat1),
("method_definition", Mozjs::MethodDefinition),
("jsx_text", Mozjs::JsxText),
("|=", Mozjs::PIPEEQ),
("member_expression", Mozjs::MemberExpression),
("extends", Mozjs::Extends),
("continue", Mozjs::Continue),
("jsx_opening_element", Mozjs::JsxOpeningElement),
("export_clause_repeat1", Mozjs::ExportClauseRepeat1),
("lexical_declaration", Mozjs::LexicalDeclaration),
("await", Mozjs::Await),
("}", Mozjs::RBRACE),
("${", Mozjs::DOLLARLBRACE),
("<", Mozjs::LT),
("jsx_self_closing_element", Mozjs::JsxSelfClosingElement),
("async", Mozjs::Async),
("update_expression", Mozjs::UpdateExpression),
("sequence_expression", Mozjs::SequenceExpression),
("jsx_closing_element", Mozjs::JsxClosingElement),
("&", Mozjs::AMP),
("formal_parameters", Mozjs::FormalParameters),
("program", Mozjs::Program),
("decorator", Mozjs::Decorator),
("function", Mozjs::Function),
("import", Mozjs::Import),
("function_declaration", Mozjs::FunctionDeclaration),
("catch_clause", Mozjs::CatchClause),
("regex_pattern", Mozjs::RegexPattern),
("_initializer", Mozjs::Initializer),
("as", Mozjs::As),
("template_substitution", Mozjs::TemplateSubstitution),
("computed_property_name", Mozjs::ComputedPropertyName),
("variable_declaration", Mozjs::VariableDeclaration),
("/=", Mozjs::SLASHEQ),
("yield", Mozjs::Yield),
("&&", Mozjs::AMPAMP),
("new", Mozjs::New),
("object", Mozjs::Object),
("--", Mozjs::DASHDASH),
("property_identifier", Mozjs::PropertyIdentifier),
("default", Mozjs::Default),
("?.", Mozjs::QMARKDOT),
("expression", Mozjs::Expression),
("??=", Mozjs::QMARKQMARKEQ),
("string_repeat2", Mozjs::StringRepeat2),
("return", Mozjs::Return),
("while", Mozjs::While),
("===", Mozjs::EQEQEQ),
(">>", Mozjs::GTGT),
("_augmented_assignment_lhs", Mozjs::AugmentedAssignmentLhs),
("with_statement", Mozjs::WithStatement),
("of", Mozjs::Of),
("&=", Mozjs::AMPEQ),
("_destructuring_pattern", Mozjs::DestructuringPattern),
("&&=", Mozjs::AMPAMPEQ),
("-", Mozjs::DASH),
("_from_clause", Mozjs::FromClause),
("*=", Mozjs::STAREQ),
("const", Mozjs::Const),
("comment", Mozjs::Comment),
("identifier", Mozjs::Identifier),
(":", Mozjs::COLON),
("let", Mozjs::Let),
(">=", Mozjs::GTEQ),
("switch_case", Mozjs::SwitchCase),
("switch_statement", Mozjs::SwitchStatement),
("jsx_namespace_name", Mozjs::JsxNamespaceName),
(",", Mozjs::COMMA),
(")", Mozjs::RPAREN),
("with", Mozjs::With),
("\'", Mozjs::SQUOTE),
("false", Mozjs::False),
("variable_declarator", Mozjs::VariableDeclarator),
("ERROR", Mozjs::Error),
(
"variable_declaration_repeat1",
Mozjs::VariableDeclarationRepeat1,
),
("primary_expression", Mozjs::PrimaryExpression),
("@", Mozjs::AT),
("pair", Mozjs::Pair),
("await_expression", Mozjs::AwaitExpression),
("jsx_element_repeat1", Mozjs::JsxElementRepeat1),
("true", Mozjs::True),
("switch_body", Mozjs::SwitchBody),
("yield_expression", Mozjs::YieldExpression),
(">>>=", Mozjs::GTGTGTEQ),
("while_statement", Mozjs::WhileStatement),
("set", Mozjs::Set),
("<=", Mozjs::LTEQ),
("switch_default", Mozjs::SwitchDefault),
("statement_identifier", Mozjs::StatementIdentifier),
("export_statement", Mozjs::ExportStatement),
("_template_chars", Mozjs::TemplateChars),
("pattern", Mozjs::Pattern),
("try", Mozjs::Try),
("export_clause", Mozjs::ExportClause),
("arrow_function", Mozjs::ArrowFunction),
("get", Mozjs::Get),
("class_body", Mozjs::ClassBody),
("??", Mozjs::QMARKQMARK),
("jsx_element", Mozjs::JsxElement),
("debugger_statement", Mozjs::DebuggerStatement),
("else_clause", Mozjs::ElseClause),
("case", Mozjs::Case),
("**=", Mozjs::STARSTAREQ),
("subscript_expression", Mozjs::SubscriptExpression),
("object_assignment_pattern", Mozjs::ObjectAssignmentPattern),
("import_statement", Mozjs::ImportStatement),
("\\\"", Mozjs::DQUOTE),
("super", Mozjs::Super),
("new_expression", Mozjs::NewExpression),
("hash_bang_line", Mozjs::HashBangLine),
("_automatic_semicolon", Mozjs::AutomaticSemicolon),
("try_statement", Mozjs::TryStatement),
("namespace_import", Mozjs::NamespaceImport),
("object_repeat1", Mozjs::ObjectRepeat1),
("assignment_expression", Mozjs::AssignmentExpression),
("||=", Mozjs::PIPEPIPEEQ),
("template_string", Mozjs::TemplateString),
("statement_block", Mozjs::StatementBlock),
("do", Mozjs::Do),
("%", Mozjs::PERCENT),
("?", Mozjs::QMARK),
("if_statement", Mozjs::IfStatement),
("/", Mozjs::SLASH),
("delete", Mozjs::Delete),
("!", Mozjs::BANG),
("++", Mozjs::PLUSPLUS),
("formal_parameters_repeat1", Mozjs::FormalParametersRepeat1),
("arguments", Mozjs::Arguments),
("do_statement", Mozjs::DoStatement),
("class", Mozjs::Class),
("spread_element", Mozjs::SpreadElement),
("+=", Mozjs::PLUSEQ),
("target", Mozjs::Target),
("class_declaration", Mozjs::ClassDeclaration),
("program_repeat1", Mozjs::ProgramRepeat1),
("(", Mozjs::LPAREN),
("call_expression", Mozjs::CallExpression),
("end", Mozjs::End),
("rest_pattern", Mozjs::RestPattern),
("{", Mozjs::LBRACE),
("object_pattern_repeat1", Mozjs::ObjectPatternRepeat1),
(";", Mozjs::SEMI),
]),
};
impl From<&str> for Mozjs {
#[inline(always)]
fn from(key: &str) -> Self {
KEYS.get(key).unwrap().clone()
}
}
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
}
}