Class TokenRegex


public class TokenRegex extends Token
A regular expression token Token.
  • Method Details

    • get

      public static TokenRegex get(String expr)
      Create a token for the specified regular expression.
      Parameters:
      expr - the expression
      Returns:
      the token
    • get

      public static TokenRegex get(String expr, ParserAttribute attribute)
      Create a token for the specified regular expression (with an attribute)
      Parameters:
      expr - the expression
      attribute - the attribute
      Returns:
      the token
      Throws:
      NullPointerException - if the attribute is null
    • get

      public static TokenRegex get(String expr, Collection<ParserAttribute> attributes)
      Create a token for the specified regular expression (with attributes)
      Parameters:
      expr - the expression
      attributes - the attributes
      Returns:
      the token
    • getValue

      public String getValue()
      Get the regular expression.
      Specified by:
      getValue in class Token
      Returns:
      The regular expression used by this token.
    • matches

      public final boolean matches(Token input)
      Does this token match the input token?

      A regular expression token matches a TokenCharacter or TokenString if the regular expression matches the value. Returns fals for all other kinds of tokens.

      Specified by:
      matches in class Token
      Parameters:
      input - The input.
      Returns:
      true if they match
    • matches

      public final String matches(String input)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object