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 Detail

      • undefined

        public static final TokenUndefined undefined
        The undefined token.
    • Method Detail

      • getValue

        public java.lang.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.
      • export

        public void export​(GrammarExporter exporter)
        Description copied from class: Token
        Export the token using the specified exporter.
        Specified by:
        export in class Token
        Parameters:
        exporter - the exporter.
      • equals

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

        The singleton TokenUndefined is only equal to itself.

        Overrides:
        equals in class java.lang.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 java.lang.Object
        Returns:
        the hash code.
      • toString

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