From 38975f9088762a3392d186f48f26fb0f85b667ba Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Tue, 24 Sep 2024 14:26:52 +0200 Subject: [PATCH] Compute Token and Icode constants --- .../java/org/mozilla/javascript/Icode.java | 152 ++++---- .../java/org/mozilla/javascript/Token.java | 363 +++++++++--------- 2 files changed, 258 insertions(+), 257 deletions(-) diff --git a/rhino/src/main/java/org/mozilla/javascript/Icode.java b/rhino/src/main/java/org/mozilla/javascript/Icode.java index 046cb02367..cf10b46032 100644 --- a/rhino/src/main/java/org/mozilla/javascript/Icode.java +++ b/rhino/src/main/java/org/mozilla/javascript/Icode.java @@ -15,136 +15,136 @@ abstract class Icode { Icode_DELNAME = 0, // Stack: ... value1 -> ... value1 value1 - Icode_DUP = -1, + Icode_DUP = Icode_DELNAME - 1, // Stack: ... value2 value1 -> ... value2 value1 value2 value1 - Icode_DUP2 = -2, + Icode_DUP2 = Icode_DUP - 1, // Stack: ... value1 -> ... - Icode_POP = -4, + Icode_POP = Icode_DUP2 - 1, // Store stack top into return register and then pop it - Icode_POP_RESULT = -5, + Icode_POP_RESULT = Icode_POP - 1, // To jump conditionally and pop additional stack value - Icode_IFEQ_POP = -6, + Icode_IFEQ_POP = Icode_POP_RESULT - 1, // various types of ++/-- - Icode_VAR_INC_DEC = -7, - Icode_NAME_INC_DEC = -8, - Icode_PROP_INC_DEC = -9, - Icode_ELEM_INC_DEC = -10, - Icode_REF_INC_DEC = -11, + Icode_VAR_INC_DEC = Icode_IFEQ_POP - 1, + Icode_NAME_INC_DEC = Icode_VAR_INC_DEC - 1, + Icode_PROP_INC_DEC = Icode_NAME_INC_DEC - 1, + Icode_ELEM_INC_DEC = Icode_PROP_INC_DEC - 1, + Icode_REF_INC_DEC = Icode_ELEM_INC_DEC - 1, // load/save scope from/to local - Icode_SCOPE_LOAD = -12, - Icode_SCOPE_SAVE = -13, - Icode_TYPEOFNAME = -14, + Icode_SCOPE_LOAD = Icode_REF_INC_DEC - 1, + Icode_SCOPE_SAVE = Icode_SCOPE_LOAD - 1, + Icode_TYPEOFNAME = Icode_SCOPE_SAVE - 1, // helper for function calls - Icode_NAME_AND_THIS = -15, - Icode_PROP_AND_THIS = -16, - Icode_ELEM_AND_THIS = -17, - Icode_VALUE_AND_THIS = -18, + Icode_NAME_AND_THIS = Icode_TYPEOFNAME - 1, + Icode_PROP_AND_THIS = Icode_NAME_AND_THIS - 1, + Icode_ELEM_AND_THIS = Icode_PROP_AND_THIS - 1, + Icode_VALUE_AND_THIS = Icode_ELEM_AND_THIS - 1, // Create closure object for nested functions - Icode_CLOSURE_EXPR = -19, - Icode_CLOSURE_STMT = -20, + Icode_CLOSURE_EXPR = Icode_VALUE_AND_THIS - 1, + Icode_CLOSURE_STMT = Icode_CLOSURE_EXPR - 1, // Special calls - Icode_CALLSPECIAL = -21, + Icode_CALLSPECIAL = Icode_CLOSURE_STMT - 1, // To return undefined value - Icode_RETUNDEF = -22, + Icode_RETUNDEF = Icode_CALLSPECIAL - 1, // Exception handling implementation - Icode_GOSUB = -23, - Icode_STARTSUB = -24, - Icode_RETSUB = -25, + Icode_GOSUB = Icode_RETUNDEF - 1, + Icode_STARTSUB = Icode_GOSUB - 1, + Icode_RETSUB = Icode_STARTSUB - 1, // To indicating a line number change in icodes. - Icode_LINE = -26, + Icode_LINE = Icode_RETSUB - 1, // To store shorts and ints inline - Icode_SHORTNUMBER = -27, - Icode_INTNUMBER = -28, + Icode_SHORTNUMBER = Icode_LINE - 1, + Icode_INTNUMBER = Icode_SHORTNUMBER - 1, // To create and populate array to hold values for [] and {} literals - Icode_LITERAL_NEW = -29, - Icode_LITERAL_SET = -30, + Icode_LITERAL_NEW = Icode_INTNUMBER - 1, + Icode_LITERAL_SET = Icode_LITERAL_NEW - 1, // Array literal with skipped index like [1,,2] - Icode_SPARE_ARRAYLIT = -31, + Icode_SPARE_ARRAYLIT = Icode_LITERAL_SET - 1, // Load index register to prepare for the following index operation - Icode_REG_IND_C0 = -32, - Icode_REG_IND_C1 = -33, - Icode_REG_IND_C2 = -34, - Icode_REG_IND_C3 = -35, - Icode_REG_IND_C4 = -36, - Icode_REG_IND_C5 = -37, - Icode_REG_IND1 = -38, - Icode_REG_IND2 = -39, - Icode_REG_IND4 = -40, + Icode_REG_IND_C0 = Icode_SPARE_ARRAYLIT - 1, + Icode_REG_IND_C1 = Icode_REG_IND_C0 - 1, + Icode_REG_IND_C2 = Icode_REG_IND_C1 - 1, + Icode_REG_IND_C3 = Icode_REG_IND_C2 - 1, + Icode_REG_IND_C4 = Icode_REG_IND_C3 - 1, + Icode_REG_IND_C5 = Icode_REG_IND_C4 - 1, + Icode_REG_IND1 = Icode_REG_IND_C5 - 1, + Icode_REG_IND2 = Icode_REG_IND1 - 1, + Icode_REG_IND4 = Icode_REG_IND2 - 1, // Load string register to prepare for the following string operation - Icode_REG_STR_C0 = -41, - Icode_REG_STR_C1 = -42, - Icode_REG_STR_C2 = -43, - Icode_REG_STR_C3 = -44, - Icode_REG_STR1 = -45, - Icode_REG_STR2 = -46, - Icode_REG_STR4 = -47, + Icode_REG_STR_C0 = Icode_REG_IND4 - 1, + Icode_REG_STR_C1 = Icode_REG_STR_C0 - 1, + Icode_REG_STR_C2 = Icode_REG_STR_C1 - 1, + Icode_REG_STR_C3 = Icode_REG_STR_C2 - 1, + Icode_REG_STR1 = Icode_REG_STR_C3 - 1, + Icode_REG_STR2 = Icode_REG_STR1 - 1, + Icode_REG_STR4 = Icode_REG_STR2 - 1, // Version of getvar/setvar that read var index directly from bytecode - Icode_GETVAR1 = -48, - Icode_SETVAR1 = -49, + Icode_GETVAR1 = Icode_REG_STR4 - 1, + Icode_SETVAR1 = Icode_GETVAR1 - 1, // Load undefined - Icode_UNDEF = -50, - Icode_ZERO = -51, - Icode_ONE = -52, + Icode_UNDEF = Icode_SETVAR1 - 1, + Icode_ZERO = Icode_UNDEF - 1, + Icode_ONE = Icode_ZERO - 1, // entrance and exit from .() - Icode_ENTERDQ = -53, - Icode_LEAVEDQ = -54, - Icode_TAIL_CALL = -55, + Icode_ENTERDQ = Icode_ONE - 1, + Icode_LEAVEDQ = Icode_ENTERDQ - 1, + Icode_TAIL_CALL = Icode_LEAVEDQ - 1, // Clear local to allow GC its context - Icode_LOCAL_CLEAR = -56, + Icode_LOCAL_CLEAR = Icode_TAIL_CALL - 1, // Literal get/set - Icode_LITERAL_GETTER = -57, - Icode_LITERAL_SETTER = -58, + Icode_LITERAL_GETTER = Icode_LOCAL_CLEAR - 1, + Icode_LITERAL_SETTER = Icode_LITERAL_GETTER - 1, // const - Icode_SETCONST = -59, - Icode_SETCONSTVAR = -60, - Icode_SETCONSTVAR1 = -61, + Icode_SETCONST = Icode_LITERAL_SETTER - 1, + Icode_SETCONSTVAR = Icode_SETCONST - 1, + Icode_SETCONSTVAR1 = Icode_SETCONSTVAR - 1, // Generator opcodes (along with Token.YIELD) - Icode_GENERATOR = -62, - Icode_GENERATOR_END = -63, - Icode_DEBUGGER = -64, - Icode_GENERATOR_RETURN = -65, - Icode_YIELD_STAR = -66, + Icode_GENERATOR = Icode_SETCONSTVAR1 - 1, + Icode_GENERATOR_END = Icode_GENERATOR - 1, + Icode_DEBUGGER = Icode_GENERATOR_END - 1, + Icode_GENERATOR_RETURN = Icode_DEBUGGER - 1, + Icode_YIELD_STAR = Icode_GENERATOR_RETURN - 1, // Load BigInt register to prepare for the following BigInt operation - Icode_REG_BIGINT_C0 = -67, - Icode_REG_BIGINT_C1 = -68, - Icode_REG_BIGINT_C2 = -69, - Icode_REG_BIGINT_C3 = -70, - Icode_REG_BIGINT1 = -71, - Icode_REG_BIGINT2 = -72, - Icode_REG_BIGINT4 = -73, + Icode_REG_BIGINT_C0 = Icode_YIELD_STAR - 1, + Icode_REG_BIGINT_C1 = Icode_REG_BIGINT_C0 - 1, + Icode_REG_BIGINT_C2 = Icode_REG_BIGINT_C1 - 1, + Icode_REG_BIGINT_C3 = Icode_REG_BIGINT_C2 - 1, + Icode_REG_BIGINT1 = Icode_REG_BIGINT_C3 - 1, + Icode_REG_BIGINT2 = Icode_REG_BIGINT1 - 1, + Icode_REG_BIGINT4 = Icode_REG_BIGINT2 - 1, // Call to GetTemplateLiteralCallSite - Icode_TEMPLATE_LITERAL_CALLSITE = -74, - Icode_LITERAL_KEYS = -75, - Icode_LITERAL_KEY_SET = -76, + Icode_TEMPLATE_LITERAL_CALLSITE = Icode_REG_BIGINT4 - 1, + Icode_LITERAL_KEYS = Icode_TEMPLATE_LITERAL_CALLSITE - 1, + Icode_LITERAL_KEY_SET = Icode_LITERAL_KEYS - 1, // Last icode - MIN_ICODE = -76; + MIN_ICODE = Icode_LITERAL_KEY_SET; static String bytecodeName(int bytecode) { if (!validBytecode(bytecode)) { diff --git a/rhino/src/main/java/org/mozilla/javascript/Token.java b/rhino/src/main/java/org/mozilla/javascript/Token.java index b8ed54fb0f..daf8139cc0 100644 --- a/rhino/src/main/java/org/mozilla/javascript/Token.java +++ b/rhino/src/main/java/org/mozilla/javascript/Token.java @@ -32,205 +32,206 @@ public static enum CommentType { public static final int // start enum ERROR = -1, // well-known as the only code < EOF - EOF = 0, // end of file token - (not EOF_CHAR) - EOL = 1, // end of line + EOF = ERROR + 1, // end of file token - (not EOF_CHAR) + EOL = EOF + 1, // end of line // Interpreter reuses the following as bytecodes - FIRST_BYTECODE_TOKEN = 2, - ENTERWITH = 2, - LEAVEWITH = 3, - RETURN = 4, - GOTO = 5, - IFEQ = 6, - IFNE = 7, - SETNAME = 8, - BITOR = 9, - BITXOR = 10, - BITAND = 11, - EQ = 12, - NE = 13, - LT = 14, - LE = 15, - GT = 16, - GE = 17, - LSH = 18, - RSH = 19, - URSH = 20, - ADD = 21, - SUB = 22, - MUL = 23, - DIV = 24, - MOD = 25, - NOT = 26, - BITNOT = 27, - POS = 28, - NEG = 29, - NEW = 30, - DELPROP = 31, - TYPEOF = 32, - GETPROP = 33, - GETPROPNOWARN = 34, - SETPROP = 35, - GETELEM = 36, - SETELEM = 37, - CALL = 38, - NAME = 39, - NUMBER = 40, - STRING = 41, - NULL = 42, - THIS = 43, - FALSE = 44, - TRUE = 45, - SHEQ = 46, // shallow equality (===) - SHNE = 47, // shallow inequality (!==) - REGEXP = 48, - BINDNAME = 49, - THROW = 50, - RETHROW = 51, // rethrow caught exception: catch (e if ) use it - IN = 52, - INSTANCEOF = 53, - LOCAL_LOAD = 54, - GETVAR = 55, - SETVAR = 56, - CATCH_SCOPE = 57, - ENUM_INIT_KEYS = 58, - ENUM_INIT_VALUES = 59, - ENUM_INIT_ARRAY = 60, - ENUM_INIT_VALUES_IN_ORDER = 61, - ENUM_NEXT = 62, - ENUM_ID = 63, - THISFN = 64, - RETURN_RESULT = 65, // to return previously stored return result - ARRAYLIT = 66, // array literal - OBJECTLIT = 67, // object literal - GET_REF = 68, // *reference - SET_REF = 69, // *reference = something - DEL_REF = 70, // delete reference - REF_CALL = 71, // f(args) = something or f(args)++ - REF_SPECIAL = 72, // reference for special properties like __proto - YIELD = 73, // JS 1.7 yield pseudo keyword - STRICT_SETNAME = 74, - EXP = 75, // Exponentiation Operator + FIRST_BYTECODE_TOKEN = EOL + 1, + ENTERWITH = FIRST_BYTECODE_TOKEN, + LEAVEWITH = ENTERWITH + 1, + RETURN = LEAVEWITH + 1, + GOTO = RETURN + 1, + IFEQ = GOTO + 1, + IFNE = IFEQ + 1, + SETNAME = IFNE + 1, + BITOR = SETNAME + 1, + BITXOR = BITOR + 1, + BITAND = BITXOR + 1, + EQ = BITAND + 1, + NE = EQ + 1, + LT = NE + 1, + LE = LT + 1, + GT = LE + 1, + GE = GT + 1, + LSH = GE + 1, + RSH = LSH + 1, + URSH = RSH + 1, + ADD = URSH + 1, + SUB = ADD + 1, + MUL = SUB + 1, + DIV = MUL + 1, + MOD = DIV + 1, + NOT = MOD + 1, + BITNOT = NOT + 1, + POS = BITNOT + 1, + NEG = POS + 1, + NEW = NEG + 1, + DELPROP = NEW + 1, + TYPEOF = DELPROP + 1, + GETPROP = TYPEOF + 1, + GETPROPNOWARN = GETPROP + 1, + SETPROP = GETPROPNOWARN + 1, + GETELEM = SETPROP + 1, + SETELEM = GETELEM + 1, + CALL = SETELEM + 1, + NAME = CALL + 1, + NUMBER = NAME + 1, + STRING = NUMBER + 1, + NULL = STRING + 1, + THIS = NULL + 1, + FALSE = THIS + 1, + TRUE = FALSE + 1, + SHEQ = TRUE + 1, // shallow equality (===) + SHNE = SHEQ + 1, // shallow inequality (!==) + REGEXP = SHNE + 1, + BINDNAME = REGEXP + 1, + THROW = BINDNAME + 1, + RETHROW = THROW + 1, // rethrow caught exception: catch (e if ) use it + IN = RETHROW + 1, + INSTANCEOF = IN + 1, + LOCAL_LOAD = INSTANCEOF + 1, + GETVAR = LOCAL_LOAD + 1, + SETVAR = GETVAR + 1, + CATCH_SCOPE = SETVAR + 1, + ENUM_INIT_KEYS = CATCH_SCOPE + 1, + ENUM_INIT_VALUES = ENUM_INIT_KEYS + 1, + ENUM_INIT_ARRAY = ENUM_INIT_VALUES + 1, + ENUM_INIT_VALUES_IN_ORDER = ENUM_INIT_ARRAY + 1, + ENUM_NEXT = ENUM_INIT_VALUES_IN_ORDER + 1, + ENUM_ID = ENUM_NEXT + 1, + THISFN = ENUM_ID + 1, + RETURN_RESULT = THISFN + 1, // to return previously stored return result + ARRAYLIT = RETURN_RESULT + 1, // array literal + OBJECTLIT = ARRAYLIT + 1, // object literal + GET_REF = OBJECTLIT + 1, // *reference + SET_REF = GET_REF + 1, // *reference = something + DEL_REF = SET_REF + 1, // delete reference + REF_CALL = DEL_REF + 1, // f(args) = something or f(args)++ + REF_SPECIAL = REF_CALL + 1, // reference for special properties like __proto + YIELD = REF_SPECIAL + 1, // JS 1.7 yield pseudo keyword + STRICT_SETNAME = YIELD + 1, + EXP = STRICT_SETNAME + 1, // Exponentiation Operator // For XML support: - DEFAULTNAMESPACE = 76, // default xml namespace = - ESCXMLATTR = 77, - ESCXMLTEXT = 78, - REF_MEMBER = 79, // Reference for x.@y, x..y etc. - REF_NS_MEMBER = 80, // Reference for x.ns::y, x..ns::y etc. - REF_NAME = 81, // Reference for @y, @[y] etc. - REF_NS_NAME = 82, // Reference for ns::y, @ns::y@[y] etc. - BIGINT = 83; // ES2020 BigInt + DEFAULTNAMESPACE = EXP + 1, // default xml namespace = + ESCXMLATTR = DEFAULTNAMESPACE + 1, + ESCXMLTEXT = ESCXMLATTR + 1, + REF_MEMBER = ESCXMLTEXT + 1, // Reference for x.@y, x..y etc. + REF_NS_MEMBER = REF_MEMBER + 1, // Reference for x.ns::y, x..ns::y etc. + REF_NAME = REF_NS_MEMBER + 1, // Reference for @y, @[y] etc. + REF_NS_NAME = REF_NAME + 1, // Reference for ns::y, @ns::y@[y] etc. + BIGINT = REF_NS_NAME + 1; // ES2020 BigInt // End of interpreter bytecodes public static final int LAST_BYTECODE_TOKEN = BIGINT, - TRY = 84, - SEMI = 85, // semicolon - LB = 86, // left and right brackets - RB = 87, - LC = 88, // left and right curlies (braces) - RC = 89, - LP = 90, // left and right parentheses - RP = 91, - COMMA = 92, // comma operator - ASSIGN = 93, // simple assignment (=) - ASSIGN_BITOR = 94, // |= - ASSIGN_LOGICAL_OR = 95, // ||= - ASSIGN_BITXOR = 96, // ^= - ASSIGN_BITAND = 97, // |= - ASSIGN_LOGICAL_AND = 98, // &&= - ASSIGN_LSH = 99, // <<= - ASSIGN_RSH = 100, // >>= - ASSIGN_URSH = 101, // >>>= - ASSIGN_ADD = 102, // += - ASSIGN_SUB = 103, // -= - ASSIGN_MUL = 104, // *= - ASSIGN_DIV = 105, // /= - ASSIGN_MOD = 106, // %= - ASSIGN_EXP = 107; // **= + TRY = LAST_BYTECODE_TOKEN + 1, + SEMI = TRY + 1, // semicolon + LB = SEMI + 1, // left and right brackets + RB = LB + 1, + LC = RB + 1, // left and right curlies (braces) + RC = LC + 1, + LP = RC + 1, // left and right parentheses + RP = LP + 1, + COMMA = RP + 1, // comma operator + ASSIGN = COMMA + 1, // simple assignment (=) + ASSIGN_BITOR = ASSIGN + 1, // |= + ASSIGN_LOGICAL_OR = ASSIGN_BITOR + 1, // ||= + ASSIGN_BITXOR = ASSIGN_LOGICAL_OR + 1, // ^= + ASSIGN_BITAND = ASSIGN_BITXOR + 1, // |= + ASSIGN_LOGICAL_AND = ASSIGN_BITAND + 1, // &&= + ASSIGN_LSH = ASSIGN_LOGICAL_AND + 1, // <<= + ASSIGN_RSH = ASSIGN_LSH + 1, // >>= + ASSIGN_URSH = ASSIGN_RSH + 1, // >>>= + ASSIGN_ADD = ASSIGN_URSH + 1, // += + ASSIGN_SUB = ASSIGN_ADD + 1, // -= + ASSIGN_MUL = ASSIGN_SUB + 1, // *= + ASSIGN_DIV = ASSIGN_MUL + 1, // /= + ASSIGN_MOD = ASSIGN_DIV + 1, // %= + ASSIGN_EXP = ASSIGN_MOD + 1; // **= public static final int FIRST_ASSIGN = ASSIGN, LAST_ASSIGN = ASSIGN_EXP, - HOOK = 108, // conditional (?:) - COLON = 109, - OR = 110, // logical or (||) - AND = 111, // logical and (&&) - INC = 112, // increment/decrement (++ --) - DEC = 113, - DOT = 114, // member operator (.) - FUNCTION = 115, // function keyword - EXPORT = 116, // export keyword - IMPORT = 117, // import keyword - IF = 118, // if keyword - ELSE = 119, // else keyword - SWITCH = 120, // switch keyword - CASE = 121, // case keyword - DEFAULT = 122, // default keyword - WHILE = 123, // while keyword - DO = 124, // do keyword - FOR = 125, // for keyword - BREAK = 126, // break keyword - CONTINUE = 127, // continue keyword - VAR = 128, // var keyword - WITH = 129, // with keyword - CATCH = 130, // catch keyword - FINALLY = 131, // finally keyword - VOID = 132, // void keyword - RESERVED = 133, // reserved keywords - EMPTY = 134, - COMPUTED_PROPERTY = 135, // computed property in object initializer [x] + HOOK = LAST_ASSIGN + 1, // conditional (?:) + COLON = HOOK + 1, + OR = COLON + 1, // logical or (||) + AND = OR + 1, // logical and (&&) + INC = AND + 1, // increment/decrement (++ --) + DEC = INC + 1, + DOT = DEC + 1, // member operator (.) + FUNCTION = DOT + 1, // function keyword + EXPORT = FUNCTION + 1, // export keyword + IMPORT = EXPORT + 1, // import keyword + IF = IMPORT + 1, // if keyword + ELSE = IF + 1, // else keyword + SWITCH = ELSE + 1, // switch keyword + CASE = SWITCH + 1, // case keyword + DEFAULT = CASE + 1, // default keyword + WHILE = DEFAULT + 1, // while keyword + DO = WHILE + 1, // do keyword + FOR = DO + 1, // for keyword + BREAK = FOR + 1, // break keyword + CONTINUE = BREAK + 1, // continue keyword + VAR = CONTINUE + 1, // var keyword + WITH = VAR + 1, // with keyword + CATCH = WITH + 1, // catch keyword + FINALLY = CATCH + 1, // finally keyword + VOID = FINALLY + 1, // void keyword + RESERVED = VOID + 1, // reserved keywords + EMPTY = RESERVED + 1, + COMPUTED_PROPERTY = EMPTY + 1, // computed property in object initializer [x] /* types used for the parse tree - these never get returned * by the scanner. */ - BLOCK = 136, // statement block - LABEL = 137, // label - TARGET = 138, - LOOP = 139, - EXPR_VOID = 140, // expression statement in functions - EXPR_RESULT = 141, // expression statement in scripts - JSR = 142, - SCRIPT = 143, // top-level node for entire script - TYPEOFNAME = 144, // for typeof(simple-name) - USE_STACK = 145, - SETPROP_OP = 146, // x.y op= something - SETELEM_OP = 147, // x[y] op= something - LOCAL_BLOCK = 148, - SET_REF_OP = 149, // *reference op= something + BLOCK = COMPUTED_PROPERTY + 1, // statement block + LABEL = BLOCK + 1, // label + TARGET = LABEL + 1, + LOOP = TARGET + 1, + EXPR_VOID = LOOP + 1, // expression statement in functions + EXPR_RESULT = EXPR_VOID + 1, // expression statement in scripts + JSR = EXPR_RESULT + 1, + SCRIPT = JSR + 1, // top-level node for entire script + TYPEOFNAME = SCRIPT + 1, // for typeof(simple-name) + USE_STACK = TYPEOFNAME + 1, + SETPROP_OP = USE_STACK + 1, // x.y op= something + SETELEM_OP = SETPROP_OP + 1, // x[y] op= something + LOCAL_BLOCK = SETELEM_OP + 1, + SET_REF_OP = LOCAL_BLOCK + 1, // *reference op= something // For XML support: - DOTDOT = 150, // member operator (..) - COLONCOLON = 151, // namespace::name - XML = 152, // XML type - DOTQUERY = 153, // .() -- e.g., x.emps.emp.(name == "terry") - XMLATTR = 154, // @ - XMLEND = 155, + DOTDOT = SET_REF_OP + 1, // member operator (..) + COLONCOLON = DOTDOT + 1, // namespace::name + XML = COLONCOLON + 1, // XML type + DOTQUERY = XML + 1, // .() -- e.g., x.emps.emp.(name == "terry") + XMLATTR = DOTQUERY + 1, // @ + XMLEND = XMLATTR + 1, // Optimizer-only-tokens - TO_OBJECT = 156, - TO_DOUBLE = 157, - GET = 158, // JS 1.5 get pseudo keyword - SET = 159, // JS 1.5 set pseudo keyword - LET = 160, // JS 1.7 let pseudo keyword - CONST = 161, - SETCONST = 162, - SETCONSTVAR = 163, - ARRAYCOMP = 164, // array comprehension - LETEXPR = 165, - WITHEXPR = 166, - DEBUGGER = 167, - COMMENT = 168, - GENEXPR = 169, - METHOD = 170, // ES6 MethodDefinition - ARROW = 171, // ES6 ArrowFunction - YIELD_STAR = 172, // ES6 "yield *", a specialization of yield - TEMPLATE_LITERAL = 173, // template literal - TEMPLATE_CHARS = 174, // template literal - literal section - TEMPLATE_LITERAL_SUBST = 175, // template literal - substitution - TAGGED_TEMPLATE_LITERAL = 176, // template literal - tagged/handler - DOTDOTDOT = 177, // spread/rest ... - NULLISH_COALESCING = 178, // nullish coalescing (??) - LAST_TOKEN = 178; + TO_OBJECT = XMLEND + 1, + TO_DOUBLE = TO_OBJECT + 1, + GET = TO_DOUBLE + 1, // JS 1.5 get pseudo keyword + SET = GET + 1, // JS 1.5 set pseudo keyword + LET = SET + 1, // JS 1.7 let pseudo keyword + CONST = LET + 1, + SETCONST = CONST + 1, + SETCONSTVAR = SETCONST + 1, + ARRAYCOMP = SETCONSTVAR + 1, // array comprehension + LETEXPR = ARRAYCOMP + 1, + WITHEXPR = LETEXPR + 1, + DEBUGGER = WITHEXPR + 1, + COMMENT = DEBUGGER + 1, + GENEXPR = COMMENT + 1, + METHOD = GENEXPR + 1, // ES6 MethodDefinition + ARROW = METHOD + 1, // ES6 ArrowFunction + YIELD_STAR = ARROW + 1, // ES6 "yield *", a specialization of yield + TEMPLATE_LITERAL = YIELD_STAR + 1, // template literal + TEMPLATE_CHARS = TEMPLATE_LITERAL + 1, // template literal - literal section + TEMPLATE_LITERAL_SUBST = TEMPLATE_CHARS + 1, // template literal - substitution + TAGGED_TEMPLATE_LITERAL = + TEMPLATE_LITERAL_SUBST + 1, // template literal - tagged/handler + DOTDOTDOT = TAGGED_TEMPLATE_LITERAL + 1, // spread/rest ... + NULLISH_COALESCING = DOTDOTDOT + 1, // nullish coalescing (??) + LAST_TOKEN = NULLISH_COALESCING; /** * Returns a name for the token. If Rhino is compiled with certain hardcoded debugging flags in