Class PunctuationToken


  • public class PunctuationToken
    extends Token
    A token representing a punctuation character.
    • Constructor Summary

      Constructors 
      Constructor Description
      PunctuationToken​(java.lang.String lexeme, int position)
      Create a token.
    • Constructor Detail

      • PunctuationToken

        public PunctuationToken​(java.lang.String lexeme,
                                int position)
        Create a token.
        Parameters:
        lexeme - the punctuation string
        position - position of the token within the string
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object actual)
        Compare two tokens.
        Specified by:
        equals in class Token
        Parameters:
        actual - the other token
        Returns:
        true iff actual is a PunctuationToken and their lexemes match.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hash code