public class ClassicToken extends Object implements Token
| Modifier and Type | Field and Description |
|---|---|
protected int |
channel |
protected int |
charPositionInLine |
protected int |
index
What token number is this from 0..n-1 tokens
|
protected int |
line |
protected String |
text |
protected int |
type |
DEFAULT_CHANNEL, DOWN, EOF, EOR_TOKEN_TYPE, HIDDEN_CHANNEL, INVALID_TOKEN, INVALID_TOKEN_TYPE, MIN_TOKEN_TYPE, SKIP_TOKEN, UP| Constructor and Description |
|---|
ClassicToken(int type) |
ClassicToken(int type,
String text) |
ClassicToken(int type,
String text,
int channel) |
ClassicToken(Token oldToken) |
| 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 charPositionInLine) |
void |
setInputStream(CharStream input) |
void |
setLine(int line) |
void |
setText(String text) |
void |
setTokenIndex(int index) |
void |
setType(int type) |
String |
toString() |
protected String text
protected int type
protected int line
protected int charPositionInLine
protected int channel
protected int index
public ClassicToken(int type)
public ClassicToken(Token oldToken)
public ClassicToken(int type,
String text)
public ClassicToken(int type,
String text,
int channel)
public int getLine()
Tokenpublic int getCharPositionInLine()
TokengetCharPositionInLine in interface Tokenpublic void setCharPositionInLine(int charPositionInLine)
setCharPositionInLine in interface Tokenpublic int getChannel()
getChannel in interface Tokenpublic void setChannel(int channel)
setChannel in interface Tokenpublic int getTokenIndex()
TokengetTokenIndex in interface Tokenpublic void setTokenIndex(int index)
setTokenIndex in interface Tokenpublic CharStream getInputStream()
TokengetInputStream in interface Tokenpublic void setInputStream(CharStream input)
setInputStream in interface TokenCopyright © 1992-2013 ANTLR. All Rights Reserved.