public interface Token
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CHANNEL
All tokens go to the parser (unless skip() is called in that rule)
on a particular "channel".
|
static int |
DOWN
imaginary tree navigation type; traverse "get child" link
|
static int |
EOF |
static Token |
EOF_TOKEN |
static int |
EOR_TOKEN_TYPE |
static int |
HIDDEN_CHANNEL
Anything on different channel than DEFAULT_CHANNEL is not parsed
by parser.
|
static Token |
INVALID_TOKEN |
static int |
INVALID_TOKEN_TYPE |
static int |
MIN_TOKEN_TYPE |
static Token |
SKIP_TOKEN
In an action, a lexer rule can set token to this SKIP_TOKEN and ANTLR
will avoid creating a token for this symbol and try to fetch another.
|
static int |
UP
imaginary tree navigation type; finish with a child list
|
Modifier and Type | Method and Description |
---|---|
int |
getChannel() |
int |
getCharPositionInLine()
The index of the first character relative to the beginning of the line 0..n-1
|
CharStream |
getInputStream()
From what character stream was this token created? You don't have to
implement but it's nice to know where a Token comes from if you have
include files etc...
|
int |
getLine()
The line number on which this token was matched; line=1..n
|
String |
getText()
Get the text of the token
|
int |
getTokenIndex()
An index from 0..n-1 of the token object in the input stream.
|
int |
getType() |
void |
setChannel(int channel) |
void |
setCharPositionInLine(int pos) |
void |
setInputStream(CharStream input) |
void |
setLine(int line) |
void |
setText(String text) |
void |
setTokenIndex(int index) |
void |
setType(int ttype) |
static final int EOR_TOKEN_TYPE
static final int DOWN
static final int UP
static final int MIN_TOKEN_TYPE
static final int EOF
static final Token EOF_TOKEN
static final int INVALID_TOKEN_TYPE
static final Token INVALID_TOKEN
static final Token SKIP_TOKEN
static final int DEFAULT_CHANNEL
static final int HIDDEN_CHANNEL
String getText()
void setText(String text)
int getType()
void setType(int ttype)
int getLine()
void setLine(int line)
int getCharPositionInLine()
void setCharPositionInLine(int pos)
int getChannel()
void setChannel(int channel)
int getTokenIndex()
void setTokenIndex(int index)
CharStream getInputStream()
void setInputStream(CharStream input)
Copyright © 2020. All rights reserved.