26 #define IGNORE_TOKEN(name, string, precedence)
28 #define TOKEN_LIST(T, K) \
40 T(SEMICOLON, ";", 0) \
42 T(CONDITIONAL, "?", 3) \
51 T(INIT_VAR, "=init_var", 2)
\
52 T(INIT_LET, "=init_let", 2)
\
53 T(INIT_CONST, "=init_const", 2)
\
54 T(INIT_CONST_LEGACY, "=init_const_legacy", 2)
\
56 T(ASSIGN_BIT_OR, "|=", 2) \
57 T(ASSIGN_BIT_XOR, "^=", 2) \
58 T(ASSIGN_BIT_AND, "&=", 2) \
59 T(ASSIGN_SHL, "<<=", 2) \
60 T(ASSIGN_SAR, ">>=", 2) \
61 T(ASSIGN_SHR, ">>>=", 2) \
62 T(ASSIGN_ADD, "+=", 2) \
63 T(ASSIGN_SUB, "-=", 2) \
64 T(ASSIGN_MUL, "*=", 2) \
65 T(ASSIGN_DIV, "/=", 2) \
66 T(ASSIGN_MOD, "%=", 2) \
80 T(ROR, "rotate right", 11)
\
92 T(EQ_STRICT, "===", 9) \
93 T(NE_STRICT, "!==", 9) \
98 K(INSTANCEOF, "instanceof", 10) \
106 K(DELETE, "delete", 0) \
107 K(TYPEOF, "typeof", 0) \
111 K(BREAK, "break", 0) \
113 K(CATCH, "catch", 0) \
114 K(CONTINUE, "continue", 0) \
115 K(DEBUGGER, "debugger", 0) \
116 K(DEFAULT, "default", 0) \
120 K(FINALLY, "finally", 0) \
122 K(FUNCTION, "function", 0) \
127 K(RETURN, "return", 0) \
128 K(SWITCH, "switch", 0) \
130 K(THROW, "throw", 0) \
135 K(WHILE, "while", 0) \
139 K(NULL_LITERAL, "null", 0) \
140 K(TRUE_LITERAL, "true", 0) \
141 K(FALSE_LITERAL, "false", 0) \
146 T(IDENTIFIER, NULL, 0) \
149 T(FUTURE_RESERVED_WORD, NULL, 0) \
150 T(FUTURE_STRICT_RESERVED_WORD, NULL, 0) \
151 K(CLASS, "class", 0) \
152 K(CONST, "const", 0) \
153 K(EXPORT, "export", 0) \
154 K(EXTENDS, "extends", 0) \
155 K(IMPORT, "import", 0) \
157 K(STATIC, "static", 0) \
158 K(YIELD, "yield", 0) \
159 K(SUPER, "super", 0) \
162 T(ILLEGAL, "ILLEGAL", 0) \
165 T(WHITESPACE, NULL, 0)
171 #define T(name, string, precedence) name,
191 return INIT_VAR <= tok && tok <= ASSIGN_MOD;
195 return COMMA <= op && op <= MOD;
199 return BIT_OR <= op && op <=
ROR;
203 return EQ <= op && op <=
IN;
207 return op == LT || op == LTE || op == GT || op == GTE;
211 return op ==
EQ || op == EQ_STRICT;
215 return op == NE || op == NE_STRICT;
228 case EQ_STRICT:
return NE_STRICT;
229 case NE_STRICT:
return EQ_STRICT;
245 case EQ_STRICT:
return EQ_STRICT;
246 case NE_STRICT:
return NE_STRICT;
249 case LTE:
return GTE;
250 case GTE:
return LTE;
258 return (BIT_OR <= op && op <= SHR) || op == BIT_NOT;
266 return op == INC || op == DEC;
270 return (SHL <= op) && (op <= SHR);
static bool IsInequalityOp(Value op)
static bool IsOrderedRelationalCompareOp(Value op)
static bool IsKeyword(Value tok)
static const char * Name(Value tok)
static bool IsCompareOp(Value op)
static bool IsBinaryOp(Value op)
static const char * String(Value tok)
static int Precedence(Value tok)
static const char token_type[NUM_TOKENS]
static bool IsUnaryOp(Value op)
static bool IsBitOp(Value op)
static const int8_t precedence_[NUM_TOKENS]
static bool IsCountOp(Value op)
static Value NegateCompareOp(Value op)
static bool IsShiftOp(Value op)
static bool IsEqualityOp(Value op)
static bool IsAssignmentOp(Value tok)
static const char *const string_[NUM_TOKENS]
static bool IsArithmeticCompareOp(Value op)
static Value ReverseCompareOp(Value op)
static const char *const name_[NUM_TOKENS]
static bool IsTruncatingBinaryOp(Value op)
#define DCHECK(condition)
Debugger support for the V8 JavaScript engine.
#define T(name, string, precedence)