|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.antlr.runtime.ClassicToken
public class ClassicToken
A Token object like we'd use in ANTLR 2.x; has an actual string created and associated with this object. These objects are needed for imaginary tree nodes that have payload objects. We need to create a Token object that has a string; the tree node will point at this token. CommonToken has indexes into a char stream and hence cannot be used to introduce new strings.
| Field Summary | |
|---|---|
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
|
| Fields inherited from interface org.antlr.runtime.Token |
|---|
DEFAULT_CHANNEL, DOWN, EOF, EOF_TOKEN, EOR_TOKEN_TYPE, HIDDEN_CHANNEL, INVALID_TOKEN, INVALID_TOKEN_TYPE, MIN_TOKEN_TYPE, SKIP_TOKEN, UP |
| Constructor Summary | |
|---|---|
ClassicToken(int type)
|
|
ClassicToken(int type,
String text)
|
|
ClassicToken(int type,
String text,
int channel)
|
|
ClassicToken(Token oldToken)
|
|
| Method Summary | |
|---|---|
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()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String text
protected int type
protected int line
protected int charPositionInLine
protected int channel
protected int index
| Constructor Detail |
|---|
public ClassicToken(int type)
public ClassicToken(Token oldToken)
public ClassicToken(int type,
String text)
public ClassicToken(int type,
String text,
int channel)
| Method Detail |
|---|
public int getType()
getType in interface Tokenpublic void setLine(int line)
setLine in interface Tokenpublic String getText()
Token
getText in interface Tokenpublic void setText(String text)
setText in interface Tokenpublic int getLine()
Token
getLine in interface Tokenpublic int getCharPositionInLine()
Token
getCharPositionInLine 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 void setType(int type)
setType in interface Tokenpublic int getTokenIndex()
Token
getTokenIndex in interface Tokenpublic void setTokenIndex(int index)
setTokenIndex in interface Tokenpublic CharStream getInputStream()
Token
getInputStream in interface Tokenpublic void setInputStream(CharStream input)
setInputStream in interface Tokenpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||