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_HARMONY, "=init_const_harmony", 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) \
113 T(EQ_STRICT, "===", 9) \
114 T(NE_STRICT, "!==", 9) \
119 K(INSTANCEOF, "instanceof", 10) \
127 K(DELETE, "delete", 0) \
128 K(TYPEOF, "typeof", 0) \
132 K(BREAK, "break", 0) \
134 K(CATCH, "catch", 0) \
135 K(CONTINUE, "continue", 0) \
136 K(DEBUGGER, "debugger", 0) \
137 K(DEFAULT, "default", 0) \
141 K(FINALLY, "finally", 0) \
143 K(FUNCTION, "function", 0) \
148 K(RETURN, "return", 0) \
149 K(SWITCH, "switch", 0) \
151 K(THROW, "throw", 0) \
156 K(WHILE, "while", 0) \
160 K(NULL_LITERAL, "null", 0) \
161 K(TRUE_LITERAL, "true", 0) \
162 K(FALSE_LITERAL, "false", 0) \
167 T(IDENTIFIER, NULL, 0) \
170 T(FUTURE_RESERVED_WORD, NULL, 0) \
171 T(FUTURE_STRICT_RESERVED_WORD, NULL, 0) \
172 K(CONST, "const", 0) \
173 K(EXPORT, "export", 0) \
174 K(IMPORT, "import", 0) \
178 T(ILLEGAL, "ILLEGAL", 0) \
181 T(WHITESPACE, NULL, 0)
187 #define T(name, string, precedence) name,
203 return token_type[tok] ==
'K';
207 return INIT_VAR <= tok && tok <= ASSIGN_MOD;
211 return COMMA <= op && op <= MOD;
215 return EQ <= op && op <=
IN;
219 return op == LT || op == LTE || op == GT || op == GTE;
223 return op ==
EQ || op == EQ_STRICT;
231 case EQ_STRICT:
return NE_STRICT;
246 case EQ_STRICT:
return NE_STRICT;
249 case LTE:
return GTE;
250 case GTE:
return LTE;
257 return (BIT_OR <= op && op <= SHR) || op == BIT_NOT;
261 return (NOT <= op && op <=
VOID) || op ==
ADD || op ==
SUB;
265 return op == INC || op == DEC;
269 return (SHL <= op) && (op <= SHR);
284 return precedence_[tok];
296 #endif // V8_TOKEN_H_
static const char * Name(Value tok)
static int Precedence(Value tok)
static bool IsCompareOp(Value op)
static bool IsUnaryOp(Value op)
#define ASSERT(condition)
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 Value InvertCompareOp(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)