Interface Token
- All Known Implementing Classes:
AntlrLexicalAnalyzer.EmuToken, SourceToken
public interface Token
Interface that identifies a token.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intOpening and closing tokens of a foldable source block.static final intToken is a comment.static final intToken represents end-of-file.static final intToken is of unknown type.static final intToken is an identifier (e.g.static final intA token naming another source file.static final intToken is an label identifier.static final intToken is a literal (e.g.static final intToken is a operator (e.g.static final intToken is a preprocessor keyword.static final intToken is a CPU register.static final intToken is a reserved word.static final intToken is a separator (e.g.static final intA symbol declaration identified by source analysis.static final intToken is a whitespace -
Method Summary
Modifier and TypeMethodDescriptionintGet 0-based starting offset in UTF-16 code units (Java String indices).default StringReferenced source file path, or null when the token is not an include path.default StringSymbol spelling, excluding punctuation, or null when this token has no symbol metadata.getText()Get token value.intgetType()Get token type.
-
Field Details
-
RESERVED
static final int RESERVEDToken is a reserved word.- See Also:
-
PREPROCESSOR
static final int PREPROCESSORToken is a preprocessor keyword.- See Also:
-
REGISTER
static final int REGISTERToken is a CPU register.- See Also:
-
SEPARATOR
static final int SEPARATORToken is a separator (e.g. ' ', tab, '\n', ...).- See Also:
-
OPERATOR
static final int OPERATORToken is a operator (e.g. +, -, *, /, ...).- See Also:
-
COMMENT
static final int COMMENTToken is a comment. Most assemblers used semicolon (";") as start of a comment.- See Also:
-
LITERAL
static final int LITERALToken is a literal (e.g. number, string, char, ...).- See Also:
-
IDENTIFIER
static final int IDENTIFIERToken is an identifier (e.g. name of variable, name of macro...).- See Also:
-
LABEL
static final int LABELToken is an label identifier.- See Also:
-
BLOCK_START
static final int BLOCK_STARTOpening and closing tokens of a foldable source block.- See Also:
-
BLOCK_END
static final int BLOCK_END- See Also:
-
SYMBOL_DEFINITION
static final int SYMBOL_DEFINITIONA symbol declaration identified by source analysis.- See Also:
-
INCLUDE_PATH
static final int INCLUDE_PATHA token naming another source file.- See Also:
-
WHITESPACE
static final int WHITESPACEToken is a whitespace- See Also:
-
ERROR
static final int ERRORToken is of unknown type.- See Also:
-
EOF
static final int EOFToken represents end-of-file. This token should be the last found token.- See Also:
-
-
Method Details
-
getReferencedFile
Referenced source file path, or null when the token is not an include path. -
getSymbolName
Symbol spelling, excluding punctuation, or null when this token has no symbol metadata. -
getType
int getType()Get token type.The token type mus be one of the pre-defined constants located inside this interface (e.g.
RESERVED,PREPROCESSOR, etc.).- Returns:
- type of the token
-
getOffset
int getOffset()Get 0-based starting offset in UTF-16 code units (Java String indices).- Returns:
- starting offset of the token in the source code
-
getText
-