org.jscience.computing.ai.expertsystem.compiler.parser
Class Token

java.lang.Object
  extended by org.jscience.computing.ai.expertsystem.compiler.parser.Token
All Implemented Interfaces:
TokenConstants

public class Token
extends java.lang.Object
implements TokenConstants

Class used to store the tokens read from the rules file. It's returned by the scanner to the parser of the rules.


Field Summary
static Token EOF_TOKEN
          The EOF token.
 
Fields inherited from interface org.jscience.computing.ai.expertsystem.compiler.parser.TokenConstants
ACTIONS, ASTERISK, CLOSE_CURLY_BRACKET, COMMA, COMMENT, CONDITIONS, DECLARATIONS, DOT, EOF, EQUALS, ERROR, EXTENDS, IDENT, IMPLEMENTS, IMPORT, LOCALDECL, NONE_ABOVE, OPEN_CURLY_BRACKET, PACKAGE, PUBLIC, RULE, RULE_BASE, SEMICOLON, STRING, WHITE_SPACE
 
Constructor Summary
Token(int type, java.lang.String lexeme)
          Class constructor.
 
Method Summary
 java.lang.String getLexeme()
          Returns the lexeme associated with this token.
 int getTokenType()
          Returns the type of this token.
 java.lang.String toString()
          Returns a string representing this token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EOF_TOKEN

public static final Token EOF_TOKEN
The EOF token.

Constructor Detail

Token

public Token(int type,
             java.lang.String lexeme)
Class constructor.

Parameters:
type - the type of this token.
lexeme - the lexeme associated with this token.
Method Detail

getLexeme

public java.lang.String getLexeme()
Returns the lexeme associated with this token.

Returns:
the lexeme associated with this token.

getTokenType

public int getTokenType()
Returns the type of this token.

Returns:
the type of this token.
See Also:
TokenConstants

toString

public java.lang.String toString()
Returns a string representing this token. Useful for debugging.

Overrides:
toString in class java.lang.Object
Returns:
a string representing this token.