Class RegExpTokenMatcher

    • Constructor Summary

      Constructors 
      Constructor Description
      RegExpTokenMatcher​(java.lang.String regex)
      A token matcher which matches a regular expression of pattern.
      RegExpTokenMatcher​(java.util.regex.Pattern pattern)
      A token matcher which matches a specified of pattern.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract Token buildToken​(java.lang.String s)
      Builds a token following a successful match.
      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
      • Methods inherited from interface com.singularsys.jep.configurableparser.matchers.TokenMatcher

        init
    • Constructor Detail

      • RegExpTokenMatcher

        public RegExpTokenMatcher​(java.util.regex.Pattern pattern)
        A token matcher which matches a specified of pattern.
        Parameters:
        pattern - Pattern to match
      • RegExpTokenMatcher

        public RegExpTokenMatcher​(java.lang.String regex)
        A token matcher which matches a regular expression of pattern.
        Parameters:
        regex - the expression to match
    • Method Detail

      • match

        public Token match​(java.lang.String s)
        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
      • buildToken

        public abstract Token buildToken​(java.lang.String s)
        Builds a token following a successful match. Note new objects should be created each time as error reporting information is later attached to tokens.
        Specified by:
        buildToken in interface TokenBuilder
        Parameters:
        s - String representing the completed matched token
        Returns:
        the appropriate type of token.