49 #define IGNORE_TOKEN(name, string, precedence)
51 #define TOKEN_LIST(T, K) \
63 T(SEMICOLON, ";", 0) \
65 T(CONDITIONAL, "?", 3) \
73 T(INIT_VAR, "=init_var", 2) \
74 T(INIT_LET, "=init_let", 2) \
75 T(INIT_CONST, "=init_const", 2) \
76 T(INIT_CONST_LEGACY, "=init_const_legacy", 2) \
78 T(ASSIGN_BIT_OR, "|=", 2) \
79 T(ASSIGN_BIT_XOR, "^=", 2) \
80 T(ASSIGN_BIT_AND, "&=", 2) \
81 T(ASSIGN_SHL, "<<=", 2) \
82 T(ASSIGN_SAR, ">>=", 2) \
83 T(ASSIGN_SHR, ">>>=", 2) \
84 T(ASSIGN_ADD, "+=", 2) \
85 T(ASSIGN_SUB, "-=", 2) \
86 T(ASSIGN_MUL, "*=", 2) \
87 T(ASSIGN_DIV, "/=", 2) \
88 T(ASSIGN_MOD, "%=", 2) \
102 T(ROR, "rotate right", 11) \
114 T(EQ_STRICT, "===", 9) \
115 T(NE_STRICT, "!==", 9) \
120 K(INSTANCEOF, "instanceof", 10) \
128 K(DELETE, "delete", 0) \
129 K(TYPEOF, "typeof", 0) \
133 K(BREAK, "break", 0) \
135 K(CATCH, "catch", 0) \
136 K(CONTINUE, "continue", 0) \
137 K(DEBUGGER, "debugger", 0) \
138 K(DEFAULT, "default", 0) \
142 K(FINALLY, "finally", 0) \
144 K(FUNCTION, "function", 0) \
149 K(RETURN, "return", 0) \
150 K(SWITCH, "switch", 0) \
152 K(THROW, "throw", 0) \
157 K(WHILE, "while", 0) \
161 K(NULL_LITERAL, "null", 0) \
162 K(TRUE_LITERAL, "true", 0) \
163 K(FALSE_LITERAL, "false", 0) \
168 T(IDENTIFIER, NULL, 0) \
171 T(FUTURE_RESERVED_WORD, NULL, 0) \
172 T(FUTURE_STRICT_RESERVED_WORD, NULL, 0) \
173 K(CONST, "const", 0) \
174 K(EXPORT, "export", 0) \
175 K(IMPORT, "import", 0) \
177 K(YIELD, "yield", 0) \
180 T(ILLEGAL, "ILLEGAL", 0) \
183 T(WHITESPACE, NULL, 0)
189 #define T(name, string, precedence) name,
205 return token_type[tok] ==
'K';
209 return INIT_VAR <= tok && tok <= ASSIGN_MOD;
213 return COMMA <= op && op <= MOD;
217 return BIT_OR <= op && op <=
ROR;
221 return EQ <= op && op <=
IN;
225 return op == LT || op == LTE || op == GT || op == GTE;
229 return op ==
EQ || op == EQ_STRICT;
233 return op == NE || op == NE_STRICT;
246 case EQ_STRICT:
return NE_STRICT;
247 case NE_STRICT:
return EQ_STRICT;
263 case EQ_STRICT:
return EQ_STRICT;
264 case NE_STRICT:
return NE_STRICT;
267 case LTE:
return GTE;
268 case GTE:
return LTE;
276 return (BIT_OR <= op && op <= SHR) || op == BIT_NOT;
284 return op == INC || op == DEC;
288 return (SHL <= op) && (op <= SHR);
303 return precedence_[tok];
315 #endif // V8_TOKEN_H_
static bool IsTruncatingBinaryOp(Value op)
static const char * Name(Value tok)
static int Precedence(Value tok)
static bool IsCompareOp(Value op)
static bool IsUnaryOp(Value op)
static bool IsArithmeticCompareOp(Value op)
#define ASSERT(condition)
static bool IsInequalityOp(Value op)
static Value ReverseCompareOp(Value op)
static bool IsShiftOp(Value op)
static bool IsBitOp(Value op)
static const char * String(Value tok)
static bool IsAssignmentOp(Value tok)
static Value NegateCompareOp(Value op)
static bool IsKeyword(Value tok)
static bool IsEqualityOp(Value op)
static bool IsBinaryOp(Value op)
#define T(name, string, precedence)
static bool IsCountOp(Value op)
static bool IsOrderedRelationalCompareOp(Value op)