|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A token, which is a fragment of a parsed text.
A token is a fragment of a parsed text (a source). Tokens are usually constructed by TopLevelClass.LexicalAnalyzers. This class introduces the methods that represent what is the source of the token and where the token is placed in the source (getSourceName(), getIndex(), getLine(), getColumn()), however, the strict specification of the returned value is defined by the generator of the token, e.g., LexicalAnalyzers. Also, these methods may be unsuported and may throw UnsupportedOperationException.
| Method Summary | |
int |
getColumn()
Returns the one-based column number in the source where this token begins. |
java.lang.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. |
java.lang.String |
getOriginalImage()
Returns the string this token corresponds to.
|
java.lang.String |
getSourceName()
Returns the source name this token coressponds to. |
int |
getSymbolID()
Returns the kind of this token.
|
boolean |
isWhite()
Returnds true if this is a white token.
|
java.lang.String |
toString()
Returns the image and the position of this token if supported.
|
| Methods inherited from interface TopLevelClass.Node |
getChildNodes |
| Method Detail |
public int getSymbolID()
this token.
The result value should be one of the followings:
| value | described token |
|---|---|
TopLevelClass.EOF_TOKEN |
<EOF> |
TopLevelClass.TOKEN_TERMINAL |
TERMINAL |
| others | an instance of a terminal defined by STRING |
this token.public boolean isWhite()
true if this is a white token.
true if this is a while token.public java.lang.String getImage()
this token corresponds to.
If the string contains some meta notation like Unicode escapes, the returned value is the represented string (e.g., A) rather than the representation (e.g., A). If not, the returned value is the same as getOriginalImage().
this token corresponds to.getOriginalImage()public java.lang.String getOriginalImage()
this token corresponds to.
If the string contains some meta notation like Unicode escapes, the returned value is the representation (e.g., A) rather than the represented string (e.g., A). If not, the returned value is the same as getImage().
this token corresponds to.getImage()
public java.lang.String getSourceName()
throws java.lang.UnsupportedOperationException
this token coressponds to.
this token coressponds to.
java.lang.UnsupportedOperationException - if the method is not suported.
public int getIndex()
throws java.lang.UnsupportedOperationException
this token begins.
this token begins.
java.lang.UnsupportedOperationException - if the method is not suported.
public int getLine()
throws java.lang.UnsupportedOperationException
this token begins.
this token begins.
java.lang.UnsupportedOperationException - if the method is not suported.
public int getColumn()
throws java.lang.UnsupportedOperationException
this token begins.
this token begins.
java.lang.UnsupportedOperationException - if the method is not suported.public java.lang.String toString()
this token if supported.
For instance, `identifier' (line 2, column 3) or `identifier'.
The format is not specified strictly.
this token.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||