public class RecognitionException extends RuntimeException
Constructor and Description |
---|
RecognitionException(Recognizer<?,?> recognizer,
IntStream input,
ParserRuleContext ctx) |
RecognitionException(String message,
Recognizer<?,?> recognizer,
IntStream input,
ParserRuleContext ctx) |
Modifier and Type | Method and Description |
---|---|
RuleContext |
getCtx()
Gets the
RuleContext at the time this exception was thrown. |
IntervalSet |
getExpectedTokens()
Gets the set of input symbols which could potentially follow the
previously matched symbol at the time this exception was thrown.
|
IntStream |
getInputStream()
Gets the input stream which is the symbol source for the recognizer where
this exception was thrown.
|
int |
getOffendingState()
Get the ATN state number the parser was in at the time the error
occurred.
|
Token |
getOffendingToken() |
Recognizer<?,?> |
getRecognizer()
Gets the
Recognizer where this exception occurred. |
protected void |
setOffendingState(int offendingState) |
protected void |
setOffendingToken(Token offendingToken) |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public RecognitionException(Recognizer<?,?> recognizer, IntStream input, ParserRuleContext ctx)
public RecognitionException(String message, Recognizer<?,?> recognizer, IntStream input, ParserRuleContext ctx)
public int getOffendingState()
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.
protected final void setOffendingState(int offendingState)
public IntervalSet getExpectedTokens()
If the set of expected tokens is not known and could not be computed,
this method returns null
.
null
if the information is not available.public RuleContext getCtx()
RuleContext
at the time this exception was thrown.
If the context is not available, this method returns null
.
RuleContext
at the time this exception was thrown.
If the context is not available, this method returns null
.public IntStream getInputStream()
If the input stream is not available, this method returns null
.
null
if the stream is not
available.public Token getOffendingToken()
protected final void setOffendingToken(Token offendingToken)
public Recognizer<?,?> getRecognizer()
Recognizer
where this exception occurred.
If the recognizer is not available, this method returns null
.
null
if
the recognizer is not available.Copyright © 1992–2018 ANTLR. All rights reserved.