org.metasyntactic.math.automata.tool
Class BaseToken

java.lang.Object
  |
  +--org.metasyntactic.math.automata.tool.BaseToken
All Implemented Interfaces:
Token

public class BaseToken
extends java.lang.Object
implements Token

The most basic token that a lexical analyzer can pass to the parser. This class should be subclassed to add functionality such as: Keyword, Storing


Field Summary
protected  java.util.List lexeme
          The actual elements matched
protected  int location
          The position in the original input where the first element of the lexeme was matched
protected  RegularExpression pattern
          The pattern that matched this token
 
Constructor Summary
protected BaseToken()
          Only for subclasses to call
  BaseToken(RegularExpression pattern, java.util.List lexeme, int location)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 boolean equals(Token t)
           
 java.util.List getLexeme()
           
 int getLocation()
           
 RegularExpression getPattern()
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

pattern

protected RegularExpression pattern
The pattern that matched this token


lexeme

protected java.util.List lexeme
The actual elements matched


location

protected int location
The position in the original input where the first element of the lexeme was matched

Constructor Detail

BaseToken

protected BaseToken()
Only for subclasses to call


BaseToken

public BaseToken(RegularExpression pattern,
                 java.util.List lexeme,
                 int location)
Method Detail

getPattern

public RegularExpression getPattern()
Specified by:
getPattern in interface Token

getLexeme

public java.util.List getLexeme()
Specified by:
getLexeme in interface Token

getLocation

public int getLocation()
Specified by:
getLocation in interface Token

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

equals

public boolean equals(Token t)

toString

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