Class RecognitionException

    • Method Detail

      • getOffendingState

        public int getOffendingState()
        Get the ATN state number the parser was in at the time the error occurred. For NoViableAltException and LexerNoViableAltException exceptions, this is the DecisionState number. For others, it is the state whose outgoing edge we couldn't match.

        If the state number is not known, this method returns -1.

      • setOffendingState

        protected final void setOffendingState​(int offendingState)
      • getExpectedTokens

        public IntervalSet getExpectedTokens()
        Gets the set of input symbols which could potentially follow the previously matched symbol at the time this exception was thrown.

        If the set of expected tokens is not known and could not be computed, this method returns null.

        Returns:
        The set of token types that could potentially follow the current state in the ATN, or null if the information is not available.
      • getCtx

        public RuleContext getCtx()
        Gets the RuleContext at the time this exception was thrown.

        If the context is not available, this method returns null.

        Returns:
        The RuleContext at the time this exception was thrown. If the context is not available, this method returns null.
      • getInputStream

        public IntStream getInputStream()
        Gets the input stream which is the symbol source for the recognizer where this exception was thrown.

        If the input stream is not available, this method returns null.

        Returns:
        The input stream which is the symbol source for the recognizer where this exception was thrown, or null if the stream is not available.
      • getOffendingToken

        public Token getOffendingToken()
      • setOffendingToken

        protected final void setOffendingToken​(Token offendingToken)
      • getRecognizer

        public Recognizer<?,​?> getRecognizer()
        Gets the Recognizer where this exception occurred.

        If the recognizer is not available, this method returns null.

        Returns:
        The recognizer where this exception occurred, or null if the recognizer is not available.