parser
Interface ExpressionParser.Token

All Superinterfaces:
ExpressionParser.Node
All Known Implementing Classes:
ExpressionParser.Default.Token
Enclosing interface:
ExpressionParser

public static interface ExpressionParser.Token
extends ExpressionParser.Node

A token, which is a part of a parsed text.

A token is a leaf of an abstract syntax tree.

Since:
notavaCC 1.0

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 getSourceName()
          Returns the source name this token coressponds to.
 int getSymbolID()
          Returns the kind of this token.
 java.lang.String toString()
          Returns the image and the parenthesized position of this token if supported.
 
Methods inherited from interface parser.ExpressionParser.Node
accept, getChildNodes, getParentNode, setParentNode
 

Method Detail

getSymbolID

public int getSymbolID()
Returns the kind of this token.

The result value should be one of the followings:

valuedescribed 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 "/"

Returns:
the kind of this token.
Since:
notavaCC 1.0

getImage

public java.lang.String getImage()
Returns the string this token corresponds to.

Returns:
the string this token corresponds to.
Since:
notavaCC 1.0

getSourceName

public java.lang.String getSourceName()
                               throws java.lang.UnsupportedOperationException
Returns the source name this token coressponds to.

Returns:
the source name this token coressponds to. E.g. the canonical name of the file.
Throws:
java.lang.UnsupportedOperationException - if the method is not suported.
Since:
notavaCC 1.0

getIndex

public int getIndex()
             throws java.lang.UnsupportedOperationException
Returns the zero-based index number in the source where this token begins.

Returns:
the index number in the source where this token begins.
Throws:
java.lang.UnsupportedOperationException - if the method is not suported.
Since:
notavaCC 1.0

getLine

public int getLine()
            throws java.lang.UnsupportedOperationException
Returns the one-based line number in the source where this token begins.

Returns:
the line number in the source where this token begins.
Throws:
java.lang.UnsupportedOperationException - if the method is not suported.
Since:
notavaCC 1.0

getColumn

public int getColumn()
              throws java.lang.UnsupportedOperationException
Returns the one-based column number in the source where this token begins.

Returns:
the column number in the source where this token begins.
Throws:
java.lang.UnsupportedOperationException - if the method is not suported.
Since:
notavaCC 1.0

toString

public java.lang.String toString()
Returns the image and the parenthesized position of this token if supported. E.g. "'identifier' (line 2, column 3)" or "'identifier'".

Overrides:
toString in class java.lang.Object
Returns:
the image and the parenthesized position of this token.
Since:
notavaCC 1.0