Class TokenUndefined


public class TokenUndefined extends Token
A token that can match nothing.

This is used to provide a "right hand side" for undefined tokens. They can't match anything.

  • Field Details

  • Method Details

    • getValue

      public String getValue()
      Return the string value of this token.
      Specified by:
      getValue in class Token
      Returns:
      The string value of the token ("<undefined>").
    • matches

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

      No, it does not.

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

      public boolean equals(Object obj)
      Test tokens for equality.

      The singleton TokenUndefined is only equal to itself.

      Overrides:
      equals in class Object
      Parameters:
      obj - An object.
      Returns:
      true if obj is equal to this terminal character.
    • hashCode

      public int hashCode()
      Assure that equal tokens return the same hash code.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code.
    • toString

      public String toString()
      Pretty print a token.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.