|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTopLevelClass.Default.Node
TopLevelClass.Default.Token
Provides a simple implementation of TopLevelClass.Token
.
Constructor Summary | |
TopLevelClass.Default.Token(int symbolID,
java.lang.String image)
Constructs a token. |
|
TopLevelClass.Default.Token(int symbolID,
java.lang.String image,
java.lang.String originalImage,
java.lang.String sourceName,
int index,
int line,
int column)
Constructs a token. |
|
TopLevelClass.Default.Token(int symbolID,
java.lang.String image,
java.lang.String originalImage,
TopLevelClass.Token token)
Constructs a token. |
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 class TopLevelClass.Default.Node |
getChildNodes, replaceChild |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface TopLevelClass.Node |
getChildNodes |
Constructor Detail |
public TopLevelClass.Default.Token(int symbolID,
java.lang.String image)
symbolID
- the symbol ID of the token, returned by getSymbolID
.image
- the image string, returned by getImage
and getOriginalImage
.
public TopLevelClass.Default.Token(int symbolID,
java.lang.String image,
java.lang.String originalImage,
java.lang.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
.originalImage
- the image string, returned by getOriginalImage
.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.public TopLevelClass.Default.Token(int symbolID, java.lang.String image, java.lang.String originalImage, TopLevelClass.Token token)
symbolID
- the symbol ID of the token, returned by getSymbolID
.image
- the image string, returned by getImage
.originalImage
- the image string, returned by getOriginalImage
.token
- a token that gives the returned value of getSourceName
, getIndex
, getLine
and getColumn
.Method Detail |
public int getSymbolID()
TopLevelClass.Token
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 |
getSymbolID
in interface TopLevelClass.Token
this
token.public boolean isWhite()
TopLevelClass.Token
true
if this
is a white token.
isWhite
in interface TopLevelClass.Token
true
if this
is a while token.public java.lang.String getImage()
TopLevelClass.Token
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 TopLevelClass.Token.getOriginalImage()
.
getImage
in interface TopLevelClass.Token
this
token corresponds to.TopLevelClass.Token.getOriginalImage()
public java.lang.String getOriginalImage()
TopLevelClass.Token
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 TopLevelClass.Token.getImage()
.
getOriginalImage
in interface TopLevelClass.Token
this
token corresponds to.TopLevelClass.Token.getImage()
public java.lang.String getSourceName() throws java.lang.UnsupportedOperationException
TopLevelClass.Token
this
token coressponds to.
getSourceName
in interface TopLevelClass.Token
this
token coressponds to.
java.lang.UnsupportedOperationException
- if the method is not suported.public int getIndex() throws java.lang.UnsupportedOperationException
TopLevelClass.Token
this
token begins.
getIndex
in interface TopLevelClass.Token
this
token begins.
java.lang.UnsupportedOperationException
- if the method is not suported.public int getLine() throws java.lang.UnsupportedOperationException
TopLevelClass.Token
this
token begins.
getLine
in interface TopLevelClass.Token
this
token begins.
java.lang.UnsupportedOperationException
- if the method is not suported.public int getColumn() throws java.lang.UnsupportedOperationException
TopLevelClass.Token
this
token begins.
getColumn
in interface TopLevelClass.Token
this
token begins.
java.lang.UnsupportedOperationException
- if the method is not suported.public java.lang.String toString()
TopLevelClass.Token
this
token if supported.
For instance, `identifier' (line 2, column 3)
or `identifier'
.
The format is not specified strictly.
toString
in interface TopLevelClass.Token
toString
in class TopLevelClass.Default.Node
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |