provided.token
Class Token

java.lang.Object
  extended by provided.token.Token

public class Token
extends java.lang.Object

Represents a token in the language.


Field Summary
private  java.lang.String _lexeme
          The _lexeme (lexical value) this token is representing.
(package private)  java.lang.String _name
          The name of this token, which is its id.
 
Constructor Summary
Token(java.lang.String name, java.lang.String lexeme)
          Token constructor.
 
Method Summary
 java.lang.Object execute(ITokVisitor algo, java.lang.Object... params)
          Executes (accepts) the visitor, calling the case associated with this host's name value.
 java.lang.String getLexeme()
          Accessor for the lexeme of this token
 java.lang.String getName()
          Accessor for the name of this token
 java.lang.String toString()
          Return a string representation of the token: "[name] lexeme"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_name

java.lang.String _name
The name of this token, which is its id.


_lexeme

private java.lang.String _lexeme
The _lexeme (lexical value) this token is representing.

Constructor Detail

Token

public Token(java.lang.String name,
             java.lang.String lexeme)
Token constructor.

Parameters:
name - The name associated with this token. This is the id value when it executes its visitors.
lexeme - _lexeme this token is representing.
Method Detail

execute

public java.lang.Object execute(ITokVisitor algo,
                                java.lang.Object... params)
Executes (accepts) the visitor, calling the case associated with this host's name value.

Parameters:
algo - The visitor to execute
params - The input parameters supplied to the algo when its appropriate case is called.
Returns:
The return value from executing the appropriate case on the visitor.

getName

public java.lang.String getName()
Accessor for the name of this token

Returns:
The name of this token

getLexeme

public java.lang.String getLexeme()
Accessor for the lexeme of this token

Returns:
The lexeme of this token

toString

public java.lang.String toString()
Return a string representation of the token: "[name] lexeme"

Overrides:
toString in class java.lang.Object
Returns:
string representation