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 |
EOF |
static int |
EPSILON
During lookahead operations, this "token" signifies we hit rule end ATN state
and did not follow it despite needing to.
|
static int |
HIDDEN_CHANNEL
Anything on different channel than DEFAULT_CHANNEL is not parsed
by parser.
|
static int |
INVALID_TYPE |
static int |
MIN_USER_TOKEN_TYPE |
Modifier and Type | Method and Description |
---|---|
int |
getChannel()
Return the channel this token.
|
int |
getCharPositionInLine()
The index of the first character of this token relative to the
beginning of the line at which it occurs, 0..n-1
|
CharStream |
getInputStream()
Gets the
CharStream from which this token was derived. |
int |
getLine()
The line number on which the 1st character of this token was matched,
line=1..n
|
int |
getStartIndex()
The starting character index of the token
This method is optional; return -1 if not implemented.
|
int |
getStopIndex()
The last character index of the token.
|
String |
getText()
Get the text of the token.
|
int |
getTokenIndex()
An index from 0..n-1 of the token object in the input stream.
|
TokenSource |
getTokenSource()
Gets the
TokenSource which created this token. |
int |
getType()
Get the token type of the token
|
static final int INVALID_TYPE
static final int EPSILON
static final int MIN_USER_TOKEN_TYPE
static final int EOF
static final int DEFAULT_CHANNEL
static final int HIDDEN_CHANNEL
String getText()
int getType()
int getLine()
int getCharPositionInLine()
int getChannel()
int getTokenIndex()
int getStartIndex()
int getStopIndex()
TokenSource getTokenSource()
TokenSource
which created this token.CharStream getInputStream()
CharStream
from which this token was derived.Copyright © 1992–2014 ANTLR. All rights reserved.