📄 token.h.svn-base
字号:
K(NEW, "new", 0) \ K(RETURN, "return", 0) \ K(SWITCH, "switch", 0) \ K(THIS, "this", 0) \ K(THROW, "throw", 0) \ K(TRY, "try", 0) \ /* TYPEOF */ \ K(VAR, "var", 0) \ /* VOID */ \ K(WHILE, "while", 0) \ K(WITH, "with", 0) \ \ /* Future reserved words (ECMA-262, section 7.5.3, page 14). */ \ F(ABSTRACT, "abstract", 0) \ F(BOOLEAN, "boolean", 0) \ F(BYTE, "byte", 0) \ F(CHAR, "char", 0) \ F(CLASS, "class", 0) \ K(CONST, "const", 0) \ F(DOUBLE, "double", 0) \ F(ENUM, "enum", 0) \ F(EXPORT, "export", 0) \ F(EXTENDS, "extends", 0) \ F(FINAL, "final", 0) \ F(FLOAT, "float", 0) \ F(GOTO, "goto", 0) \ F(IMPLEMENTS, "implements", 0) \ F(IMPORT, "import", 0) \ F(INT, "int", 0) \ F(INTERFACE, "interface", 0) \ F(LONG, "long", 0) \ K(NATIVE, "native", 0) \ F(PACKAGE, "package", 0) \ F(PRIVATE, "private", 0) \ F(PROTECTED, "protected", 0) \ F(PUBLIC, "public", 0) \ F(SHORT, "short", 0) \ F(STATIC, "static", 0) \ F(SUPER, "super", 0) \ F(SYNCHRONIZED, "synchronized", 0) \ F(THROWS, "throws", 0) \ F(TRANSIENT, "transient", 0) \ F(VOLATILE, "volatile", 0) \ \ /* Literals (ECMA-262, section 7.8, page 16). */ \ K(NULL_LITERAL, "null", 0) \ K(TRUE_LITERAL, "true", 0) \ K(FALSE_LITERAL, "false", 0) \ T(NUMBER, NULL, 0) \ T(STRING, NULL, 0) \ \ /* Identifiers (not keywords or future reserved words). */ \ T(IDENTIFIER, NULL, 0) \ \ /* Illegal token - not able to scan. */ \ T(ILLEGAL, "ILLEGAL", 0) \ \ /* Scanner-internal use only. */ \ T(COMMENT, NULL, 0)class Token { public: // All token values.#define T(name, string, precedence) name, enum Value { TOKEN_LIST(T, T, IGNORE_TOKEN) NUM_TOKENS };#undef T#ifdef DEBUG // Returns a string corresponding to the C++ token name // (e.g. "LT" for the token LT). static const char* Name(Value tok) { ASSERT(0 <= tok && tok < NUM_TOKENS); return name_[tok]; }#endif // Predicates static bool IsAssignmentOp(Value tok) { return INIT_VAR <= tok && tok <= ASSIGN_MOD; } static bool IsBinaryOp(Value op) { return COMMA <= op && op <= MOD; } static bool IsCompareOp(Value op) { return EQ <= op && op <= IN; } static bool IsBitOp(Value op) { return (BIT_OR <= op && op <= SHR) || op == BIT_NOT; } static bool IsUnaryOp(Value op) { return (NOT <= op && op <= VOID) || op == ADD || op == SUB; } static bool IsCountOp(Value op) { return op == INC || op == DEC; } // Returns a string corresponding to the JS token string // (.e., "<" for the token LT) or NULL if the token doesn't // have a (unique) string (e.g. an IDENTIFIER). static const char* String(Value tok) { ASSERT(0 <= tok && tok < NUM_TOKENS); return string_[tok]; } // Returns the precedence > 0 for binary and compare // operators; returns 0 otherwise. static int Precedence(Value tok) { ASSERT(0 <= tok && tok < NUM_TOKENS); return precedence_[tok]; } // Returns the keyword value if str is a keyword; // returns IDENTIFIER otherwise. The class must // have been initialized. static Value Lookup(const char* str); // Must be called once to initialize the class. // Multiple calls are ignored. static void Initialize(); private:#ifdef DEBUG static const char* name_[NUM_TOKENS];#endif static const char* string_[NUM_TOKENS]; static int8_t precedence_[NUM_TOKENS];};} } // namespace v8::internal#endif // V8_TOKEN_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -