Class Token

java.lang.Object
  |
  +--Token

public class Token
extends Object

Class Token describes a lexical entity in the input. The following Token types are recognized:


Field Summary
static int ASSIGN
          Assignment Token type.
static int COMMA
          Comma Token type.
static int IDENTIFIER
          Identifier Token type.
static int LEFT_PAREN
          Left parenthesis Token type.
static int RIGHT_PAREN
          Right parenthesis Token type.
static int SEMICOLON
          Semicolon Token type.
static int STRING
          String Token type.
protected  int type
          The type of this Token.
static int UNKNOWN
          Unknown Token type.
protected  String value
          The (possibly empty) string value of this Token.
 
Constructor Summary
Token(int type, String value)
          Creates a new Token with the given type and value.
 
Method Summary
 int getType()
          Get the type of the Token.
 String getValue()
          Get the value of the Token..
 String toString()
          Constructs a string representation of this Token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IDENTIFIER

public static final int IDENTIFIER
Identifier Token type.

STRING

public static final int STRING
String Token type.

LEFT_PAREN

public static final int LEFT_PAREN
Left parenthesis Token type.

RIGHT_PAREN

public static final int RIGHT_PAREN
Right parenthesis Token type.

COMMA

public static final int COMMA
Comma Token type.

SEMICOLON

public static final int SEMICOLON
Semicolon Token type.

ASSIGN

public static final int ASSIGN
Assignment Token type.

UNKNOWN

public static final int UNKNOWN
Unknown Token type.

type

protected int type
The type of this Token.

value

protected String value
The (possibly empty) string value of this Token.
Constructor Detail

Token

public Token(int type,
             String value)
Creates a new Token with the given type and value.
Parameters:
type - The type of the Token.
value - The value of the Token. May be null or "".
Method Detail

getType

public int getType()
Get the type of the Token.
Returns:
The type of the Token.

getValue

public String getValue()
Get the value of the Token..
Returns:
The token value; may be null or "".

toString

public String toString()
Constructs a string representation of this Token.
Overrides:
toString in class Object
Returns:
A string representation of the Token.