pub enum ANTLRError {
LexerNoAltError {
start_index: isize,
},
NoAltError(NoViableAltError),
InputMismatchError(InputMisMatchError),
PredicateError(FailedPredicateError),
IllegalStateError(String),
FallThrough(Rc<dyn Error>),
OtherError(Rc<dyn Error>),
}
Expand description
Main ANTLR4 Rust runtime error
Variants§
LexerNoAltError
Returned from Lexer when it fails to find matching token type for current input
Usually Lexers contain last rule that captures all invalid tokens like:
ERROR_TOKEN: . ;
to prevent lexer from throwing errors and have all error handling in parser.
NoAltError(NoViableAltError)
Indicates that the parser could not decide which of two or more paths to take based upon the remaining input. It tracks the starting token of the offending input and also knows where the parser was in the various paths when the error. Reported by reportNoViableAlternative()
InputMismatchError(InputMisMatchError)
This signifies any kind of mismatched input exceptions such as when the current input does not match the expected token.
PredicateError(FailedPredicateError)
A semantic predicate failed during validation. Validation of predicates occurs when normally parsing the alternative just like matching a token. Disambiguating predicate evaluation occurs when we test a predicate during prediction.
IllegalStateError(String)
Internal error. Or user provided type returned data that is incompatible with current parser state
FallThrough(Rc<dyn Error>)
Unrecoverable error. Indicates that error should not be processed by parser/error strategy and it should abort parsing and immediately return to caller.
OtherError(Rc<dyn Error>)
Potentially recoverable error.
Used to allow user to emit his own errors from parser actions or from custom error strategy.
Parser will try to recover with provided ErrorStrategy
Implementations§
Source§impl ANTLRError
impl ANTLRError
Sourcepub fn get_offending_token(&self) -> Option<&OwningToken>
pub fn get_offending_token(&self) -> Option<&OwningToken>
Returns first token that caused parser to fail.
Trait Implementations§
Source§impl Clone for ANTLRError
impl Clone for ANTLRError
Source§fn clone(&self) -> ANTLRError
fn clone(&self) -> ANTLRError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ANTLRError
impl Debug for ANTLRError
Source§impl Display for ANTLRError
impl Display for ANTLRError
Source§impl Error for ANTLRError
impl Error for ANTLRError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl !Freeze for ANTLRError
impl !RefUnwindSafe for ANTLRError
impl !Send for ANTLRError
impl !Sync for ANTLRError
impl Unpin for ANTLRError
impl !UnwindSafe for ANTLRError
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T
behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T
behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T
behind Rc
pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T
behind Arc
pointer