|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--parser.ExpressionParser.Default.Node | +--parser.ExpressionParser.Default.Token
Provides a simple implementation of ExpressionParser.Token
.
Constructor Summary | |
ExpressionParser.Default.Token(int symbolID,
String image)
|
|
ExpressionParser.Default.Token(int symbolID,
String image,
String sourceName,
int index,
int line,
int column)
Constructs a token. |
Method Summary | |
int |
getColumn()
Returns the one-based column number in the source where this token begins. |
String |
getImage()
Returns the string this token corresponds to. |
int |
getIndex()
Returns the zero-based index number in the source where this token begins. |
int |
getLine()
Returns the one-based line number in the source where this token begins. |
String |
getSourceName()
Returns the source name this token coressponds to. |
int |
getSymbolID()
Returns the kind of this token. |
String |
toString()
Returns the image and the parenthesized position of this token if supported. |
Methods inherited from class parser.ExpressionParser.Default.Node |
accept, getChildNodes, getParentNode, replaceChild, replaceSubtree, setParentNode |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface parser.ExpressionParser.Node |
accept, getChildNodes, getParentNode, setParentNode |
Constructor Detail |
public ExpressionParser.Default.Token(int symbolID, String image)
public ExpressionParser.Default.Token(int symbolID, String image, String sourceName, int index, int line, int column)
symbolID
- the symbol ID of the token, returned by getSymbolID
.image
- the image string, returned by getImage
.sourceName
- the source name returned by getSourceName
, or null if not supported.index
- the index returned by getIndex
, or -1 if not supported.line
- the line number returned by getLine
, or -1 if not supported.column
- the column number returned by getColumn
, or -1 if not supported.Method Detail |
public int getSymbolID()
ExpressionParser.Token
this
token.
The result value should be one of the followings:
value | described token |
---|---|
EOF_TOKEN |
<EOF> |
TOKEN_WHITE_SPACES |
WHITE_SPACES |
TOKEN_TRADITIONAL_COMMENT |
TRADITIONAL_COMMENT |
TOKEN_END_OF_LINE_COMMENT |
END_OF_LINE_COMMENT |
TOKEN_INTEGER |
INTEGER |
5 |
"(" |
6 |
")" |
7 |
"*" |
8 |
"+" |
9 |
"-" |
10 |
"/" |
getSymbolID
in interface ExpressionParser.Token
this
token.public String getImage()
ExpressionParser.Token
this
token corresponds to.
getImage
in interface ExpressionParser.Token
this
token corresponds to.public String getSourceName() throws UnsupportedOperationException
ExpressionParser.Token
this
token coressponds to.
getSourceName
in interface ExpressionParser.Token
this
token coressponds to. E.g. the canonical name of the file.
UnsupportedOperationException
- if the method is not suported.public int getIndex() throws UnsupportedOperationException
ExpressionParser.Token
this
token begins.
getIndex
in interface ExpressionParser.Token
this
token begins.
UnsupportedOperationException
- if the method is not suported.public int getLine() throws UnsupportedOperationException
ExpressionParser.Token
this
token begins.
getLine
in interface ExpressionParser.Token
this
token begins.
UnsupportedOperationException
- if the method is not suported.public int getColumn() throws UnsupportedOperationException
ExpressionParser.Token
this
token begins.
getColumn
in interface ExpressionParser.Token
this
token begins.
UnsupportedOperationException
- if the method is not suported.public String toString()
ExpressionParser.Token
this
token if supported.
E.g. "'identifier' (line 2, column 3)"
or "'identifier'"
.
toString
in interface ExpressionParser.Token
toString
in class ExpressionParser.Default.Node
this
token.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |