com.singularsys.jep.configurableparser.matchers
Class IdentifierTokenMatcher

java.lang.Object
  extended by com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher
      extended by com.singularsys.jep.configurableparser.matchers.IdentifierTokenMatcher
All Implemented Interfaces:
TokenBuilder, TokenMatcher, java.io.Serializable

public class IdentifierTokenMatcher
extends RegExpTokenMatcher

Matches identifiers: variables or function names.

See Also:
Serialized Form

Constructor Summary
IdentifierTokenMatcher(java.util.regex.Pattern pattern)
           
IdentifierTokenMatcher(java.lang.String regex)
          Construct and identifier matcher.
 
Method Summary
static IdentifierTokenMatcher basicIndetifierMatcher()
          Matches identifiers which start with a letter or underscore and are followed by 0 or more letters digits or underscores.
 Token buildToken(java.lang.String s)
          Create the token, if the name matches a function name return a FunctionToken otherwise return an IdentifierToken.
static IdentifierTokenMatcher dottedIndetifierMatcher()
          Matches identifiers which start with a letter or underscore and are followed by 0 or more letters digits or underscores or . characters.
 void init(Jep j)
          Initialize the matcher when the Jep instance is known.
 
Methods inherited from class com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher
match
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentifierTokenMatcher

public IdentifierTokenMatcher(java.util.regex.Pattern pattern)

IdentifierTokenMatcher

public IdentifierTokenMatcher(java.lang.String regex)
Construct and identifier matcher.

Parameters:
regex - a regular expression specifying the allowed identifier names.
See Also:
Pattern
Method Detail

buildToken

public Token buildToken(java.lang.String s)
Create the token, if the name matches a function name return a FunctionToken otherwise return an IdentifierToken.

Specified by:
buildToken in interface TokenBuilder
Specified by:
buildToken in class RegExpTokenMatcher
Parameters:
s - String representing the completed matched token
Returns:
the appropriate type of token.

basicIndetifierMatcher

public static IdentifierTokenMatcher basicIndetifierMatcher()
Matches identifiers which start with a letter or underscore and are followed by 0 or more letters digits or underscores.


dottedIndetifierMatcher

public static IdentifierTokenMatcher dottedIndetifierMatcher()
Matches identifiers which start with a letter or underscore and are followed by 0 or more letters digits or underscores or . characters.


init

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



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