net.sf.parcinj
Class Token

java.lang.Object
  extended by net.sf.parcinj.Token

public final class Token
extends java.lang.Object

Immutable class representing a parsed chunk of text.


Constructor Summary
Token(TerminalSymbolType terminalSymbol, int lineNumber, int columnNumber)
          Creates an instance for the specified terminal symbol which provides the token text and TokenType.
Token(TokenType type, java.lang.String text, int lineNumber, int columnNumber)
          Creates an instance for the specified chunk of text.
 
Method Summary
 int getColumnNumber()
          Returns the column number where the token text starts.
 int getLineNumber()
          Returns the line number where the token text starts.
 java.lang.String getText()
          Returns the token text.
 TokenType getType()
          Returns the type of this token.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Token

public Token(TerminalSymbolType terminalSymbol,
             int lineNumber,
             int columnNumber)
Creates an instance for the specified terminal symbol which provides the token text and TokenType.

Parameters:
lineNumber - Line number in the text where this token starts.
columnNumber - Column number in the text where this token starts.

Token

public Token(TokenType type,
             java.lang.String text,
             int lineNumber,
             int columnNumber)
Creates an instance for the specified chunk of text.

Parameters:
type - Type of this token.
lineNumber - Line number in the text where this token starts.
columnNumber - Column number in the text where this token starts.
Method Detail

getType

public final TokenType getType()
Returns the type of this token.


getText

public final java.lang.String getText()
Returns the token text.


getLineNumber

public final int getLineNumber()
Returns the line number where the token text starts. First line has number 1.


getColumnNumber

public final int getColumnNumber()
Returns the column number where the token text starts. First column has number 1.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object