Class ParserException

  • All Implemented Interfaces:
    Serializable

    public class ParserException
    extends RuntimeException
    A simple subclass of RuntimeException that indicates errors when trying to parse the input to Parser. The exception stores the token that caused the error.
    See Also:
    Serialized Form
    • Constructor Detail

      • ParserException

        public ParserException​(String message)
        Construct the evaluation exception with a message.
        Parameters:
        message - the message containing the cause of the exception
      • ParserException

        public ParserException​(String message,
                               Token token)
        Construct the evaluation exception with a message and a token.
        Parameters:
        message - the message containing the cause of the exception
        token - the token that caused the exception
    • Method Detail

      • getToken

        public Token getToken()
        Get the token.
        Returns:
        the token that caused the exception
      • getMessage

        public String getMessage()
        Overrides RuntimeException.getMessage to add the token information into the error message.
        Overrides:
        getMessage in class Throwable
        Returns:
        the error message