Package org.mozilla.javascript
Class Token
java.lang.Object
org.mozilla.javascript.Token
This class implements the JavaScript scanner.
It is based on the C source files jsscan.c and jsscan.h in the jsref package.
- Author:
- Mike McCabe, Brendan Eich
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Token types.static final int
static final int
static final int
Token types.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
static final int
static final int
Token types.static final int
static final int
static final int
Token types.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
static final int
static final int
static final int
Token types.static final int
static final int
static final int
Token types.static final int
Token types.static final int
static final int
static final int
Token types.static final int
static final int
static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
static final int
static final int
Token types.static final int
Token types.static final int
static final int
Token types.static final int
static final int
Token types.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Token types.static final int
Token types.static final int
static final int
static final int
static final int
Token types.static final int
static final int
static final int
Token types.static final int
Token types.static final int
static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
static final int
Token types.static final int
Token types.static final int
static final int
Token types.static final boolean
static final int
static final int
static final int
static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
static final int
Token types.static final int
Token types.static final int
Token types.static final int
static final int
Token types.static final int
static final int
static final int
static final int
Token types.static final int
static final int
static final int
static final int
Token types.static final int
static final int
Token types.static final int
Token types.static final int
static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
Token types.static final int
static final int
static final int
static final int
static final int
static final int
static final int
Token types.static final int
Token types.static final int
Token types.static final int
static final int
static final int
Token types.static final int
static final int
Token types.static final int
static final int
Token types.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Token types.static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isValidToken
(int code) Return true if the passed code is a valid Token constant.static String
keywordToName
(int token) Convert a keyword token to a name string for use with theContext.FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER
feature.static String
name
(int token) Returns a name for the token.static String
typeToName
(int token) Always returns a human-readable string for the token name.
-
Field Details
-
printTrees
public static final boolean printTrees- See Also:
-
ERROR
public static final int ERRORToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
FIRST_TOKEN
public static final int FIRST_TOKENToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
EOF
public static final int EOFToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
EOL
public static final int EOLToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
FIRST_BYTECODE_TOKEN
public static final int FIRST_BYTECODE_TOKENToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
ENTERWITH
public static final int ENTERWITHToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
LEAVEWITH
public static final int LEAVEWITHToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
RETURN
public static final int RETURNToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
GOTO
public static final int GOTOToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
IFEQ
public static final int IFEQToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
IFNE
public static final int IFNEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
SETNAME
public static final int SETNAMEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
BITOR
public static final int BITORToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
BITXOR
public static final int BITXORToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
BITAND
public static final int BITANDToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
EQ
public static final int EQToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
NE
public static final int NEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
LT
public static final int LTToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
LE
public static final int LEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
GT
public static final int GTToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
GE
public static final int GEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
LSH
public static final int LSHToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
RSH
public static final int RSHToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
URSH
public static final int URSHToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
ADD
public static final int ADDToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
SUB
public static final int SUBToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
MUL
public static final int MULToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
DIV
public static final int DIVToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
MOD
public static final int MODToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
NOT
public static final int NOTToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
BITNOT
public static final int BITNOTToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
POS
public static final int POSToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
NEG
public static final int NEGToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
NEW
public static final int NEWToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
DELPROP
public static final int DELPROPToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
TYPEOF
public static final int TYPEOFToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
GETPROP
public static final int GETPROPToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
GETPROPNOWARN
public static final int GETPROPNOWARNToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
SETPROP
public static final int SETPROPToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
GETELEM
public static final int GETELEMToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
SETELEM
public static final int SETELEMToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
CALL
public static final int CALLToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
NAME
public static final int NAMEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
NUMBER
public static final int NUMBERToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
STRING
public static final int STRINGToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
NULL
public static final int NULLToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
THIS
public static final int THISToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
FALSE
public static final int FALSEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
TRUE
public static final int TRUEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
SHEQ
public static final int SHEQToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
SHNE
public static final int SHNEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
REGEXP
public static final int REGEXPToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
BINDNAME
public static final int BINDNAMEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
THROW
public static final int THROWToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
RETHROW
public static final int RETHROWToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
IN
public static final int INToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
INSTANCEOF
public static final int INSTANCEOFToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
LOCAL_LOAD
public static final int LOCAL_LOADToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
GETVAR
public static final int GETVARToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
SETVAR
public static final int SETVARToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
CATCH_SCOPE
public static final int CATCH_SCOPEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
ENUM_INIT_KEYS
public static final int ENUM_INIT_KEYSToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
ENUM_INIT_VALUES
public static final int ENUM_INIT_VALUESToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
ENUM_INIT_ARRAY
public static final int ENUM_INIT_ARRAYToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
ENUM_INIT_VALUES_IN_ORDER
public static final int ENUM_INIT_VALUES_IN_ORDERToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
ENUM_NEXT
public static final int ENUM_NEXTToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
ENUM_ID
public static final int ENUM_IDToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
THISFN
public static final int THISFNToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
RETURN_RESULT
public static final int RETURN_RESULTToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
ARRAYLIT
public static final int ARRAYLITToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
OBJECTLIT
public static final int OBJECTLITToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
GET_REF
public static final int GET_REFToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
SET_REF
public static final int SET_REFToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
DEL_REF
public static final int DEL_REFToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
REF_CALL
public static final int REF_CALLToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
REF_SPECIAL
public static final int REF_SPECIALToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
YIELD
public static final int YIELDToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
STRICT_SETNAME
public static final int STRICT_SETNAMEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
EXP
public static final int EXPToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
DEFAULTNAMESPACE
public static final int DEFAULTNAMESPACEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
ESCXMLATTR
public static final int ESCXMLATTRToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
ESCXMLTEXT
public static final int ESCXMLTEXTToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
REF_MEMBER
public static final int REF_MEMBERToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
REF_NS_MEMBER
public static final int REF_NS_MEMBERToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
REF_NAME
public static final int REF_NAMEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
REF_NS_NAME
public static final int REF_NS_NAMEToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
BIGINT
public static final int BIGINTToken types. These values correspond to JSTokenType values in jsscan.c.- See Also:
-
LAST_BYTECODE_TOKEN
public static final int LAST_BYTECODE_TOKEN- See Also:
-
TRY
public static final int TRY- See Also:
-
SEMI
public static final int SEMI- See Also:
-
LB
public static final int LB- See Also:
-
RB
public static final int RB- See Also:
-
LC
public static final int LC- See Also:
-
RC
public static final int RC- See Also:
-
LP
public static final int LP- See Also:
-
RP
public static final int RP- See Also:
-
COMMA
public static final int COMMA- See Also:
-
ASSIGN
public static final int ASSIGN- See Also:
-
ASSIGN_BITOR
public static final int ASSIGN_BITOR- See Also:
-
ASSIGN_LOGICAL_OR
public static final int ASSIGN_LOGICAL_OR- See Also:
-
ASSIGN_BITXOR
public static final int ASSIGN_BITXOR- See Also:
-
ASSIGN_BITAND
public static final int ASSIGN_BITAND- See Also:
-
ASSIGN_LOGICAL_AND
public static final int ASSIGN_LOGICAL_AND- See Also:
-
ASSIGN_LSH
public static final int ASSIGN_LSH- See Also:
-
ASSIGN_RSH
public static final int ASSIGN_RSH- See Also:
-
ASSIGN_URSH
public static final int ASSIGN_URSH- See Also:
-
ASSIGN_ADD
public static final int ASSIGN_ADD- See Also:
-
ASSIGN_SUB
public static final int ASSIGN_SUB- See Also:
-
ASSIGN_MUL
public static final int ASSIGN_MUL- See Also:
-
ASSIGN_DIV
public static final int ASSIGN_DIV- See Also:
-
ASSIGN_MOD
public static final int ASSIGN_MOD- See Also:
-
ASSIGN_EXP
public static final int ASSIGN_EXP- See Also:
-
ASSIGN_NULLISH
public static final int ASSIGN_NULLISH- See Also:
-
FIRST_ASSIGN
public static final int FIRST_ASSIGN- See Also:
-
LAST_ASSIGN
public static final int LAST_ASSIGN- See Also:
-
HOOK
public static final int HOOK- See Also:
-
COLON
public static final int COLON- See Also:
-
OR
public static final int OR- See Also:
-
AND
public static final int AND- See Also:
-
INC
public static final int INC- See Also:
-
DEC
public static final int DEC- See Also:
-
DOT
public static final int DOT- See Also:
-
FUNCTION
public static final int FUNCTION- See Also:
-
EXPORT
public static final int EXPORT- See Also:
-
IMPORT
public static final int IMPORT- See Also:
-
IF
public static final int IF- See Also:
-
ELSE
public static final int ELSE- See Also:
-
SWITCH
public static final int SWITCH- See Also:
-
CASE
public static final int CASE- See Also:
-
DEFAULT
public static final int DEFAULT- See Also:
-
WHILE
public static final int WHILE- See Also:
-
DO
public static final int DO- See Also:
-
FOR
public static final int FOR- See Also:
-
BREAK
public static final int BREAK- See Also:
-
CONTINUE
public static final int CONTINUE- See Also:
-
VAR
public static final int VAR- See Also:
-
WITH
public static final int WITH- See Also:
-
CATCH
public static final int CATCH- See Also:
-
FINALLY
public static final int FINALLY- See Also:
-
VOID
public static final int VOID- See Also:
-
RESERVED
public static final int RESERVED- See Also:
-
EMPTY
public static final int EMPTY- See Also:
-
COMPUTED_PROPERTY
public static final int COMPUTED_PROPERTY- See Also:
-
BLOCK
public static final int BLOCK- See Also:
-
LABEL
public static final int LABEL- See Also:
-
TARGET
public static final int TARGET- See Also:
-
LOOP
public static final int LOOP- See Also:
-
EXPR_VOID
public static final int EXPR_VOID- See Also:
-
EXPR_RESULT
public static final int EXPR_RESULT- See Also:
-
JSR
public static final int JSR- See Also:
-
SCRIPT
public static final int SCRIPT- See Also:
-
TYPEOFNAME
public static final int TYPEOFNAME- See Also:
-
USE_STACK
public static final int USE_STACK- See Also:
-
SETPROP_OP
public static final int SETPROP_OP- See Also:
-
SETELEM_OP
public static final int SETELEM_OP- See Also:
-
LOCAL_BLOCK
public static final int LOCAL_BLOCK- See Also:
-
SET_REF_OP
public static final int SET_REF_OP- See Also:
-
DOTDOT
public static final int DOTDOT- See Also:
-
COLONCOLON
public static final int COLONCOLON- See Also:
-
XML
public static final int XML- See Also:
-
DOTQUERY
public static final int DOTQUERY- See Also:
-
XMLATTR
public static final int XMLATTR- See Also:
-
XMLEND
public static final int XMLEND- See Also:
-
TO_OBJECT
public static final int TO_OBJECT- See Also:
-
TO_DOUBLE
public static final int TO_DOUBLE- See Also:
-
GET
public static final int GET- See Also:
-
SET
public static final int SET- See Also:
-
LET
public static final int LET- See Also:
-
CONST
public static final int CONST- See Also:
-
SETCONST
public static final int SETCONST- See Also:
-
SETCONSTVAR
public static final int SETCONSTVAR- See Also:
-
ARRAYCOMP
public static final int ARRAYCOMP- See Also:
-
LETEXPR
public static final int LETEXPR- See Also:
-
WITHEXPR
public static final int WITHEXPR- See Also:
-
DEBUGGER
public static final int DEBUGGER- See Also:
-
COMMENT
public static final int COMMENT- See Also:
-
GENEXPR
public static final int GENEXPR- See Also:
-
METHOD
public static final int METHOD- See Also:
-
ARROW
public static final int ARROW- See Also:
-
YIELD_STAR
public static final int YIELD_STAR- See Also:
-
TEMPLATE_LITERAL
public static final int TEMPLATE_LITERAL- See Also:
-
TEMPLATE_CHARS
public static final int TEMPLATE_CHARS- See Also:
-
TEMPLATE_LITERAL_SUBST
public static final int TEMPLATE_LITERAL_SUBST- See Also:
-
TAGGED_TEMPLATE_LITERAL
public static final int TAGGED_TEMPLATE_LITERAL- See Also:
-
DOTDOTDOT
public static final int DOTDOTDOT- See Also:
-
NULLISH_COALESCING
public static final int NULLISH_COALESCING- See Also:
-
QUESTION_DOT
public static final int QUESTION_DOT- See Also:
-
LAST_TOKEN
public static final int LAST_TOKEN- See Also:
-
-
Constructor Details
-
Token
public Token()
-
-
Method Details
-
name
Returns a name for the token. If Rhino is compiled with certain hardcoded debugging flags in this file, it calls#typeToName
; otherwise it returns a string whose value is the token number. -
typeToName
Always returns a human-readable string for the token name. For instance,FINALLY
has the name "FINALLY".- Parameters:
token
- the token code- Returns:
- the actual name for the token code
-
keywordToName
Convert a keyword token to a name string for use with theContext.FEATURE_RESERVED_KEYWORD_AS_IDENTIFIER
feature.- Parameters:
token
- A token- Returns:
- the corresponding name string
-
isValidToken
public static boolean isValidToken(int code) Return true if the passed code is a valid Token constant.- Parameters:
code
- a potential token code- Returns:
- true if it's a known token
-