Class IdentifierTokenMatcher

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

public class IdentifierTokenMatcher extends RegExpTokenMatcher
Matches identifiers: variables or function names.
See Also:
  • Constructor Details

    • IdentifierTokenMatcher

      public IdentifierTokenMatcher(Pattern pattern)
    • IdentifierTokenMatcher

      public IdentifierTokenMatcher(String regex)
      Construct and identifier matcher.
      Parameters:
      regex - a regular expression specifying the allowed identifier names.
      See Also:
  • Method Details

    • buildToken

      public Token buildToken(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.
    • basicIdentifierMatcher

      public static IdentifierTokenMatcher basicIdentifierMatcher()
      Matches identifiers which start with a letter or underscore and are followed by 0 or more letters digits or underscores. Correctly spelled version
      Returns:
      the matcher
      Since:
      3.5
    • dottedIdentifierMatcher

      public static IdentifierTokenMatcher dottedIdentifierMatcher()
      Matches identifiers which start with a letter or underscore and are followed by 0 or more letters digits or underscores or . characters. Correctly spelled version
      Returns:
      the matcher
      Since:
      3.5
    • init

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