Interface Token
-
public interface Token
Interface that identifies a token.
-
-
Field Summary
Fields Modifier and Type Field Description static int
COMMENT
Token is a comment.static int
EOF
Token represents end-of-file.static int
ERROR
Token is of unknown type.static int
IDENTIFIER
Token is an identifier (e.g.static int
LABEL
Token is an label identifier.static int
LITERAL
Token is a literal (e.g.static int
OPERATOR
Token is a operator (e.g.static int
PREPROCESSOR
Token is a preprocessor keyword.static int
REGISTER
Token is a CPU register.static int
RESERVED
Token is a reserved word.static int
SEPARATOR
Token is a separator (e.g.static int
WHITESPACE
Token is a whitespace
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getOffset()
Get 0-based starting offset of token position.java.lang.String
getText()
Get token value.int
getType()
Get token type.
-
-
-
Field Detail
-
RESERVED
static final int RESERVED
Token is a reserved word.- See Also:
- Constant Field Values
-
PREPROCESSOR
static final int PREPROCESSOR
Token is a preprocessor keyword.- See Also:
- Constant Field Values
-
REGISTER
static final int REGISTER
Token is a CPU register.- See Also:
- Constant Field Values
-
SEPARATOR
static final int SEPARATOR
Token is a separator (e.g. ' ', tab, '\n', ...).- See Also:
- Constant Field Values
-
OPERATOR
static final int OPERATOR
Token is a operator (e.g. +, -, *, /, ...).- See Also:
- Constant Field Values
-
COMMENT
static final int COMMENT
Token is a comment. Most assemblers used semicolon (";") as start of a comment.- See Also:
- Constant Field Values
-
LITERAL
static final int LITERAL
Token is a literal (e.g. number, string, char, ...).- See Also:
- Constant Field Values
-
IDENTIFIER
static final int IDENTIFIER
Token is an identifier (e.g. name of variable, name of macro...).- See Also:
- Constant Field Values
-
LABEL
static final int LABEL
Token is an label identifier.- See Also:
- Constant Field Values
-
WHITESPACE
static final int WHITESPACE
Token is a whitespace- See Also:
- Constant Field Values
-
ERROR
static final int ERROR
Token is of unknown type.- See Also:
- Constant Field Values
-
EOF
static final int EOF
Token represents end-of-file. This token should be the last found token.- See Also:
- Constant Field Values
-
-
Method Detail
-
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 of token position.- Returns:
- starting offset of the token in the source code
-
getText
java.lang.String getText()
Get token value.- Returns:
- token value
-
-