Interface Token
-
public interface TokenInterface that identifies a token.
-
-
Field Summary
Fields Modifier and Type Field Description static intCOMMENTToken is a comment.static intEOFToken represents end-of-file.static intERRORToken is of unknown type.static intIDENTIFIERToken is an identifier (e.g.static intLABELToken is an label identifier.static intLITERALToken is a literal (e.g.static intOPERATORToken is a operator (e.g.static intPREPROCESSORToken is a preprocessor keyword.static intREGISTERToken is a CPU register.static intRESERVEDToken is a reserved word.static intSEPARATORToken is a separator (e.g.static intWHITESPACEToken is a whitespace
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetOffset()Get 0-based starting offset of token position.java.lang.StringgetText()Get token value.intgetType()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
-
-