📄 token.java
字号:
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-1999 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Roger Lawrence * Mike McCabe * Igor Bukanov * Bob Jervis * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * the GNU General Public License Version 2 or later (the "GPL"), in which * case the provisions of the GPL are applicable instead of those above. If * you wish to allow use of your version of this file only under the terms of * the GPL and not to allow others to use your version of this file under the * MPL, indicate your decision by deleting the provisions above and replacing * them with the notice and other provisions required by the GPL. If you do * not delete the provisions above, a recipient may use your version of this * file under either the MPL or the GPL. * * ***** END LICENSE BLOCK ***** */package org.mozilla.javascript;/** * This class implements the JavaScript scanner. * * It is based on the C source files jsscan.c and jsscan.h * in the jsref package. * * @see org.mozilla.javascript.Parser * * @author Mike McCabe * @author Brendan Eich */public class Token{ // debug flags public static final boolean printTrees = false; static final boolean printICode = false; static final boolean printNames = printTrees || printICode; /** * Token types. These values correspond to JSTokenType values in * jsscan.c. */ public final static 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 // 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_NEXT = 61, ENUM_ID = 62, THISFN = 63, RETURN_RESULT = 64, // to return previously stored return result ARRAYLIT = 65, // array literal OBJECTLIT = 66, // object literal GET_REF = 67, // *reference SET_REF = 68, // *reference = something DEL_REF = 69, // delete reference REF_CALL = 70, // f(args) = something or f(args)++ REF_SPECIAL = 71, // reference for special properties like __proto YIELD = 72, // JS 1.7 yield pseudo keyword // For XML support: DEFAULTNAMESPACE = 73, // default xml namespace = ESCXMLATTR = 74, ESCXMLTEXT = 75, REF_MEMBER = 76, // Reference for x.@y, x..y etc. REF_NS_MEMBER = 77, // Reference for x.ns::y, x..ns::y etc. REF_NAME = 78, // Reference for @y, @[y] etc. REF_NS_NAME = 79; // Reference for ns::y, @ns::y@[y] etc. // End of interpreter bytecodes public final static int LAST_BYTECODE_TOKEN = REF_NS_NAME, TRY = 80, SEMI = 81, // semicolon LB = 82, // left and right brackets RB = 83, LC = 84, // left and right curlies (braces) RC = 85, LP = 86, // left and right parentheses RP = 87, COMMA = 88, // comma operator ASSIGN = 89, // simple assignment (=) ASSIGN_BITOR = 90, // |= ASSIGN_BITXOR = 91, // ^= ASSIGN_BITAND = 92, // |= ASSIGN_LSH = 93, // <<= ASSIGN_RSH = 94, // >>= ASSIGN_URSH = 95, // >>>= ASSIGN_ADD = 96, // += ASSIGN_SUB = 97, // -= ASSIGN_MUL = 98, // *= ASSIGN_DIV = 99, // /= ASSIGN_MOD = 100; // %= public final static int FIRST_ASSIGN = ASSIGN, LAST_ASSIGN = ASSIGN_MOD, HOOK = 101, // conditional (?:) COLON = 102, OR = 103, // logical or (||) AND = 104, // logical and (&&) INC = 105, // increment/decrement (++ --) DEC = 106, DOT = 107, // member operator (.) FUNCTION = 108, // function keyword EXPORT = 109, // export keyword IMPORT = 110, // import keyword IF = 111, // if keyword ELSE = 112, // else keyword SWITCH = 113, // switch keyword CASE = 114, // case keyword DEFAULT = 115, // default keyword WHILE = 116, // while keyword DO = 117, // do keyword FOR = 118, // for keyword BREAK = 119, // break keyword CONTINUE = 120, // continue keyword VAR = 121, // var keyword WITH = 122, // with keyword CATCH = 123, // catch keyword FINALLY = 124, // finally keyword VOID = 125, // void keyword RESERVED = 126, // reserved keywords EMPTY = 127,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -