public class RecognitionException extends RuntimeException
| Constructor and Description |
|---|
RecognitionException(Lexer lexer,
CharStream input) |
RecognitionException(Recognizer<Token,?> recognizer,
IntStream input,
ParserRuleContext ctx) |
RecognitionException(String message,
Recognizer<Token,?> recognizer,
IntStream input,
ParserRuleContext ctx) |
| Modifier and Type | Method and Description |
|---|---|
RuleContext |
getContext()
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() |
<T> T |
getOffendingToken(Recognizer<T,?> recognizer) |
Recognizer<?,?> |
getRecognizer()
Gets the
Recognizer where this exception occurred. |
protected void |
setOffendingState(int offendingState) |
protected <Symbol extends Token> |
setOffendingToken(Recognizer<Symbol,?> recognizer,
Symbol offendingToken) |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic RecognitionException(@Nullable
Lexer lexer,
CharStream input)
public RecognitionException(@Nullable
Recognizer<Token,?> recognizer,
@Nullable
IntStream input,
@Nullable
ParserRuleContext ctx)
public RecognitionException(String message, @Nullable Recognizer<Token,?> recognizer, @Nullable IntStream input, @Nullable 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)
@Nullable 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.@Nullable public RuleContext getContext()
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.@Nullable public IntStream getInputStream()
If the input stream is not available, this method returns null.
null if the stream is not
available.@Nullable public Token getOffendingToken()
protected final <Symbol extends Token> void setOffendingToken(Recognizer<Symbol,?> recognizer, @Nullable Symbol offendingToken)
@Nullable 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.public <T> T getOffendingToken(Recognizer<T,?> recognizer)
Copyright © 1992–2024 Daniel Sun. All rights reserved.