Package com.singularsys.jep.configurableparser.matchers

# Class IdentifierTokenMatcher

java.lang.Object
com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher
com.singularsys.jep.configurableparser.matchers.IdentifierTokenMatcher

All Implemented Interfaces:
  `TokenBuilder`, `TokenMatcher`, `Serializable`

Direct Known Subclasses:
  `CaseInsensitiveIdentifierTokenManager`

public class IdentifierTokenMatcher extends RegExpTokenMatcher
Matches identifiers: variables or function names.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IdentifierTokenMatcher(String regex)`
  Construct and identifier matcher.
  `IdentifierTokenMatcher(Pattern pattern)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static IdentifierTokenMatcher`
  `basicIdentifierMatcher()`
  Matches identifiers which start with a letter or underscore and are followed by 0 or more letters digits or underscores.
  `Token`
  `buildToken(String s)`
  Create the token, if the name matches a function name return a FunctionToken otherwise return an IdentifierToken.
  `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.
  `void`
  `init(Jep j)`
  Initialize the matcher when the Jep instance is known.
  `static IdentifierTokenMatcher`
  `javaIdentifierMatcher()`
  Matches java rules for identifiers.
  `static IdentifierTokenMatcher`
  `unicodeIdentifierMatcher()`
  Matches identifiers which start with a Unicode-letter or an underscore and are followed by 0 or more Unicode letters digits or underscores.

  ### Methods inherited from class com.singularsys.jep.configurableparser.matchers.RegExpTokenMatcher

  `match, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## 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:
      - `Pattern`

- ## 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

  - ### unicodeIdentifierMatcher

    public static IdentifierTokenMatcher unicodeIdentifierMatcher()
    Matches identifiers which start with a Unicode-letter or an underscore and are followed by 0 or more Unicode letters digits or underscores. Equivalent to `new IdentifierTokenMatcher("[\\p{L}_][\\p{L}\\p{Digit}_]*")`
    Returns:
      the matcher
    Since:
      Jep 4.1

  - ### javaIdentifierMatcher

    public static IdentifierTokenMatcher javaIdentifierMatcher()
    Matches java rules for identifiers. Can include currency symbols; $, ¥, £; Roman numerals: ⅳ, Equivalent to `new IdentifierTokenMatcher("[\\p{javaJavaIdentifierStart}][\\p{javaJavaIdentifierPart}]*")`
    Returns:
    Since:
      Jep 4.1

  - ### 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