public class ASToken extends TokenBase implements IASToken, ASTokenTypes
IASToken.ASTokenKind
Modifier and Type | Field and Description |
---|---|
static int |
UNKNOWN_OPEN_BLOCK_TOKEN_TYPE
Unknown open block token type.
|
badToken, EOF_TYPE, INVALID_TYPE, MIN_USER_TYPE, NULL_TREE_LOOKAHEAD, SKIP, type
UNKNOWN
EOF, HIDDEN_TOKEN_BUILTIN_NS, HIDDEN_TOKEN_COMMENT, HIDDEN_TOKEN_E4X, HIDDEN_TOKEN_MULTI_LINE_COMMENT, HIDDEN_TOKEN_SINGLE_LINE_COMMENT, HIDDEN_TOKEN_STAR_ASSIGNMENT, NULL_TREE_LOOKAHEAD, TOKEN_ASDOC_COMMENT, TOKEN_ASDOC_TAG, TOKEN_ASDOC_TEXT, TOKEN_ATTRIBUTE, TOKEN_BLOCK_CLOSE, TOKEN_BLOCK_OPEN, TOKEN_COLON, TOKEN_COMMA, TOKEN_DIRECTIVE_DEFAULT_XML, TOKEN_E4X_BINDING_CLOSE, TOKEN_E4X_BINDING_OPEN, TOKEN_E4X_CDATA, TOKEN_E4X_CLOSE_TAG_START, TOKEN_E4X_COMMENT, TOKEN_E4X_DECIMAL_ENTITY, TOKEN_E4X_DOTTED_NAME_PART, TOKEN_E4X_EMPTY_TAG_END, TOKEN_E4X_ENTITY, TOKEN_E4X_EQUALS, TOKEN_E4X_HEX_ENTITY, TOKEN_E4X_NAME, TOKEN_E4X_NAME_DOT, TOKEN_E4X_OPEN_TAG_START, TOKEN_E4X_PROCESSING_INSTRUCTION, TOKEN_E4X_STRING, TOKEN_E4X_TAG_END, TOKEN_E4X_TEXT, TOKEN_E4X_WHITESPACE, TOKEN_E4X_XMLLIST_CLOSE, TOKEN_E4X_XMLNS, TOKEN_ELLIPSIS, TOKEN_IDENTIFIER, TOKEN_KEYWORD_AS, TOKEN_KEYWORD_BREAK, TOKEN_KEYWORD_CASE, TOKEN_KEYWORD_CATCH, TOKEN_KEYWORD_CLASS, TOKEN_KEYWORD_CONST, TOKEN_KEYWORD_CONTINUE, TOKEN_KEYWORD_DEFAULT, TOKEN_KEYWORD_DELETE, TOKEN_KEYWORD_DO, TOKEN_KEYWORD_ELSE, TOKEN_KEYWORD_FALSE, TOKEN_KEYWORD_FINALLY, TOKEN_KEYWORD_FOR, TOKEN_KEYWORD_FUNCTION, TOKEN_KEYWORD_IF, TOKEN_KEYWORD_IMPORT, TOKEN_KEYWORD_IN, TOKEN_KEYWORD_INCLUDE, TOKEN_KEYWORD_INSTANCEOF, TOKEN_KEYWORD_INTERFACE, TOKEN_KEYWORD_IS, TOKEN_KEYWORD_NEW, TOKEN_KEYWORD_NULL, TOKEN_KEYWORD_PACKAGE, TOKEN_KEYWORD_RETURN, TOKEN_KEYWORD_SUPER, TOKEN_KEYWORD_SWITCH, TOKEN_KEYWORD_THIS, TOKEN_KEYWORD_THROW, TOKEN_KEYWORD_TRUE, TOKEN_KEYWORD_TRY, TOKEN_KEYWORD_TYPEOF, TOKEN_KEYWORD_USE, TOKEN_KEYWORD_VAR, TOKEN_KEYWORD_VOID, TOKEN_KEYWORD_WHILE, TOKEN_KEYWORD_WITH, TOKEN_LITERAL_HEX_NUMBER, TOKEN_LITERAL_NUMBER, TOKEN_LITERAL_REGEXP, TOKEN_LITERAL_STRING, TOKEN_LITERAL_XMLLIST, TOKEN_MODIFIER_DYNAMIC, TOKEN_MODIFIER_FINAL, TOKEN_MODIFIER_NATIVE, TOKEN_MODIFIER_OVERRIDE, TOKEN_MODIFIER_STATIC, TOKEN_MODIFIER_VIRTUAL, TOKEN_NAMESPACE_ANNOTATION, TOKEN_NAMESPACE_NAME, TOKEN_OPERATOR_ASSIGNMENT, TOKEN_OPERATOR_ATSIGN, TOKEN_OPERATOR_BITWISE_AND, TOKEN_OPERATOR_BITWISE_AND_ASSIGNMENT, TOKEN_OPERATOR_BITWISE_LEFT_SHIFT, TOKEN_OPERATOR_BITWISE_LEFT_SHIFT_ASSIGNMENT, TOKEN_OPERATOR_BITWISE_NOT, TOKEN_OPERATOR_BITWISE_OR, TOKEN_OPERATOR_BITWISE_OR_ASSIGNMENT, TOKEN_OPERATOR_BITWISE_RIGHT_SHIFT, TOKEN_OPERATOR_BITWISE_RIGHT_SHIFT_ASSIGNMENT, TOKEN_OPERATOR_BITWISE_UNSIGNED_RIGHT_SHIFT, TOKEN_OPERATOR_BITWISE_UNSIGNED_RIGHT_SHIFT_ASSIGNMENT, TOKEN_OPERATOR_BITWISE_XOR, TOKEN_OPERATOR_BITWISE_XOR_ASSIGNMENT, TOKEN_OPERATOR_DECREMENT, TOKEN_OPERATOR_DESCENDANT_ACCESS, TOKEN_OPERATOR_DIVISION, TOKEN_OPERATOR_DIVISION_ASSIGNMENT, TOKEN_OPERATOR_EQUAL, TOKEN_OPERATOR_GREATER_THAN, TOKEN_OPERATOR_GREATER_THAN_EQUALS, TOKEN_OPERATOR_INCREMENT, TOKEN_OPERATOR_LESS_THAN, TOKEN_OPERATOR_LESS_THAN_EQUALS, TOKEN_OPERATOR_LOGICAL_AND, TOKEN_OPERATOR_LOGICAL_AND_ASSIGNMENT, TOKEN_OPERATOR_LOGICAL_NOT, TOKEN_OPERATOR_LOGICAL_OR, TOKEN_OPERATOR_LOGICAL_OR_ASSIGNMENT, TOKEN_OPERATOR_MEMBER_ACCESS, TOKEN_OPERATOR_MINUS, TOKEN_OPERATOR_MINUS_ASSIGNMENT, TOKEN_OPERATOR_MODULO, TOKEN_OPERATOR_MODULO_ASSIGNMENT, TOKEN_OPERATOR_MULTIPLICATION_ASSIGNMENT, TOKEN_OPERATOR_NOT_EQUAL, TOKEN_OPERATOR_NS_QUALIFIER, TOKEN_OPERATOR_PLUS, TOKEN_OPERATOR_PLUS_ASSIGNMENT, TOKEN_OPERATOR_STAR, TOKEN_OPERATOR_STRICT_EQUAL, TOKEN_OPERATOR_STRICT_NOT_EQUAL, TOKEN_OPERATOR_TERNARY, TOKEN_PAREN_CLOSE, TOKEN_PAREN_OPEN, TOKEN_RESERVED_WORD_CONFIG, TOKEN_RESERVED_WORD_EACH, TOKEN_RESERVED_WORD_EXTENDS, TOKEN_RESERVED_WORD_GET, TOKEN_RESERVED_WORD_GOTO, TOKEN_RESERVED_WORD_IMPLEMENTS, TOKEN_RESERVED_WORD_NAMESPACE, TOKEN_RESERVED_WORD_SET, TOKEN_SEMICOLON, TOKEN_SQUARE_CLOSE, TOKEN_SQUARE_OPEN, TOKEN_TYPED_COLLECTION_CLOSE, TOKEN_TYPED_COLLECTION_OPEN, TOKEN_TYPED_LITERAL_CLOSE, TOKEN_TYPED_LITERAL_OPEN, TOKEN_VOID_0
Constructor and Description |
---|
ASToken(ASToken other)
Copy constructor
|
ASToken(int tokenType,
int start,
int end,
int line,
int column,
CharSequence tokenText)
Builds a new
ASToken |
Modifier and Type | Method and Description |
---|---|
boolean |
canCauseContainmentProblems()
Determine whether or not this token is capable of causing a containment
problem.
|
boolean |
canExistInMetadata() |
static boolean |
canExistInMetadata(int tokenType) |
boolean |
canFollowMetadata() |
static boolean |
canFollowMetadata(int tokenType) |
boolean |
canFollowUserNamespace() |
static boolean |
canFollowUserNamespaceAnnotation(int tokenType) |
boolean |
canPreceedAnonymousFunction() |
boolean |
canPreceedE4X() |
static boolean |
canPreceedE4X(int tokenType) |
static boolean |
canPreceedRegex(int tokenType)
Check if regular-expression literal can follow a token of given type.
|
boolean |
canPreceedSignedOperator()
Returns true if the token can come before the operators
+ or
- |
static boolean |
canPreceedSignedOperator(int tokenType)
Returns true if the token type can come before the operators
+ or - |
ICMToken |
changeType(int type)
Changes the type of the token, and returns a new copy with the desired type.
|
ASToken |
clone() |
int |
getBalancingToken()
If this is an open token, get the matching close token.
|
static int |
getBalancingToken(int tokenType)
If this is an open token, get the matching close token.
|
int |
getOpenBlockTokenType() |
static int |
getOpenBlockTokenType(int tokenType) |
IASToken.ASTokenKind |
getTokenKind()
Returns the kind of token that we represent.
|
protected String |
getTypeString()
Get the display string for the token type
|
boolean |
isCloseBlockToken()
Is this a close block token
|
static boolean |
isCloseBlockToken(int tokenType)
Is this a close token
|
boolean |
isCloseToken()
Is this a close token (e.g. ")", "}", "]")
|
static boolean |
isCloseToken(int tokenType)
Is this a close token (e.g. ")", "}", "]")
|
boolean |
isContextualReservedWord()
Check if the token is a contextual reserved word.
|
static boolean |
isDefinitionKeyword(int type) |
boolean |
isE4X() |
static boolean |
isE4X(int type) |
boolean |
isKeyword()
Returns whether this token represents an ActionScript keyword.
|
boolean |
isKeywordOrContextualReservedWord()
Check if the token is either a "keyword" or a "contextual reserved word".
|
boolean |
isLiteral() |
boolean |
isModifier() |
static boolean |
isModifier(int type) |
boolean |
isMultiLineComment() |
boolean |
isOpenBlockToken()
Is this an open block token
|
static boolean |
isOpenBlockToken(int tokenType) |
boolean |
isOpenToken()
Is this an open token (e.g. "(", "{", "[")
|
static boolean |
isOpenToken(int tokenType)
Is this an open token (e.g. "(", "{", "[")
|
boolean |
isOperator() |
boolean |
isStatementKeyword() |
static boolean |
isStatementKeyword(int type) |
static IASToken.ASTokenKind |
typeToKind(int type)
Get
IASToken.ASTokenKind from a given token type. |
adjustLocation, adjustOffsets, getAbsoluteEnd, getAbsoluteStart, getCharSequence, getColumn, getEnd, getEndColumn, getEndLine, getLine, getLocalEnd, getLocalStart, getSourcePath, getStart, getText, isImplicit, isLocked, lock, matchesLine, reuse, setColumn, setEnd, setEndColumn, setEndLine, setLine, setLocation, setSourcePath, setStart, setText, setText, storeLocalOffset, toDumpString, toString, truncate, verify
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getColumn, getEnd, getLine, getSourcePath, getStart, getText, getType, isImplicit
getAbsoluteEnd, getAbsoluteStart, getColumn, getEnd, getEndColumn, getEndLine, getLine, getSourcePath, getStart
public static final int UNKNOWN_OPEN_BLOCK_TOKEN_TYPE
getOpenBlockTokenType()
,
Constant Field Valuespublic ASToken(int tokenType, int start, int end, int line, int column, CharSequence tokenText)
ASToken
tokenType
- type of tokenstart
- start of tokenend
- end of tokenline
- line of tokentokenText
- token type from ASTokenTypespublic ASToken(ASToken other)
other
- the ASToken to copypublic ICMToken changeType(int type)
ICMToken
changeType
in interface ICMToken
type
- the type of token to createICMToken
that is a copy of the original, with a different typepublic static final boolean isOpenToken(int tokenType)
tokenType
- type of the tokenpublic static final int getOpenBlockTokenType(int tokenType)
public final int getOpenBlockTokenType()
public final boolean isOpenBlockToken()
public static final boolean isOpenBlockToken(int tokenType)
public final boolean isOpenToken()
public static final boolean isCloseToken(int tokenType)
tokenType
- type of the tokenpublic final boolean isCloseBlockToken()
public static final boolean isCloseBlockToken(int tokenType)
tokenType
- type of the tokenpublic final boolean isCloseToken()
public static final int getBalancingToken(int tokenType)
tokenType
- type of the tokenpublic final int getBalancingToken()
public final boolean canCauseContainmentProblems()
public final boolean isOperator()
public final boolean isE4X()
public static final boolean isE4X(int type)
public final boolean isLiteral()
public static final boolean isDefinitionKeyword(int type)
public static boolean isModifier(int type)
public final boolean isModifier()
public static final boolean isStatementKeyword(int type)
public final boolean isStatementKeyword()
public final boolean isContextualReservedWord()
public final boolean isKeyword()
For missing "private", "protected", "public", "internal", see https://bugs.adobe.com/jira/browse/ASLSPEC-8
public final boolean isKeywordOrContextualReservedWord()
public static final boolean canExistInMetadata(int tokenType)
public final boolean canExistInMetadata()
public static final boolean canFollowMetadata(int tokenType)
public final boolean canFollowMetadata()
public static final boolean canFollowUserNamespaceAnnotation(int tokenType)
public final boolean canFollowUserNamespace()
public final boolean canPreceedAnonymousFunction()
public static final boolean canPreceedSignedOperator(int tokenType)
+
or -
tokenType
- the token type to checkpublic final boolean canPreceedSignedOperator()
+
or
-
public final boolean canPreceedE4X()
public static final boolean canPreceedE4X(int tokenType)
public static final boolean canPreceedRegex(int tokenType)
tokenType
- Token typeASTokenTypes.TOKEN_LITERAL_REGEXP
can follow the
given token type.protected String getTypeString()
getTypeString
in class TokenBase
public IASToken.ASTokenKind getTokenKind()
IASToken
getTokenKind
in interface IASToken
public static IASToken.ASTokenKind typeToKind(int type)
IASToken.ASTokenKind
from a given token type.type
- AS token type.public final boolean isMultiLineComment()
isMultiLineComment
in interface IASToken
ASTokenTypes.TOKEN_ASDOC_COMMENT
and
ASTokenTypes.HIDDEN_TOKEN_MULTI_LINE_COMMENT
.Copyright © 2016 The Apache Software Foundation. All rights reserved.