scanner
Class Token

java.lang.Object
  extended byscanner.Token
All Implemented Interfaces:
PositionableInCharStream

public class Token
extends java.lang.Object
implements PositionableInCharStream

Tokens are objects created by a scanner while scanning a stream of characters.


Constructor Summary
Token(java.lang.String val, TokenType type, CharStreamPosition position)
          Creates a new token with the specified values.
 
Method Summary
 int getLength()
          Returns the length of this positionable object.
 CharStreamPosition getPosition()
          Returns the position of this token.
 TokenType getType()
          Returns the type of this token.
 java.lang.String getValue()
          Returns the string of this token.
 java.lang.String toString()
          Returns a string representation of this token.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Token

public Token(java.lang.String val,
             TokenType type,
             CharStreamPosition position)
Creates a new token with the specified values.

Parameters:
val - The token value.
type - The type of this token
position - The position of this token : equals to the position of the first character of this token.
Method Detail

getType

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

Returns:
The type of this token.

getValue

public java.lang.String getValue()
Returns the string of this token.

Returns:
the string of this token.

getLength

public int getLength()
Description copied from interface: PositionableInCharStream
Returns the length of this positionable object.

Specified by:
getLength in interface PositionableInCharStream
Returns:
The length of this positionable object.

getPosition

public CharStreamPosition getPosition()
Returns the position of this token.

Specified by:
getPosition in interface PositionableInCharStream
Returns:
The position of this token, this is equals to the position of the first character of this token.

toString

public java.lang.String toString()
Returns a string representation of this token.

Returns:
A string representation of this token.