com.singularsys.jep.configurableparser.matchers
Class SymbolTokenMatcher

java.lang.Object
  extended by com.singularsys.jep.configurableparser.matchers.SymbolTokenMatcher
All Implemented Interfaces:
TokenMatcher

public class SymbolTokenMatcher
extends java.lang.Object
implements TokenMatcher

Matches a fixed set of symbols, each represented by a SymbolToken. Each SymbolToken behaves like an singleton, only one instance is created and this is returned by the match method.


Constructor Summary
SymbolTokenMatcher()
           
 
Method Summary
 boolean add(SymbolToken e)
          Adds a new SymbolToken to be matched.
 void init(Jep j)
          Initialize the matcher when the Jep instance is known.
 Token match(java.lang.String s)
          Attempts to match the start of the string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SymbolTokenMatcher

public SymbolTokenMatcher()
Method Detail

match

public Token match(java.lang.String s)
Description copied from interface: TokenMatcher
Attempts to match the start of the string.

Specified by:
match in interface TokenMatcher
Parameters:
s - the string to match against
Returns:
if successful returns the corresponding token, return null if failed to match

add

public boolean add(SymbolToken e)
Adds a new SymbolToken to be matched.

Parameters:
e -
Returns:
true (as specified by Collection.add)

init

public void init(Jep j)
Description copied from interface: TokenMatcher
Initialize the matcher when the Jep instance is known.

Specified by:
init in interface TokenMatcher


Copyright © 2007 Singular Systems http://www.singularsys.com/jep