[−][src]Struct antlr_rust::error_strategy::BailErrorStrategy
This implementation of ANTLRErrorStrategy
responds to syntax errors
by immediately canceling the parse operation with a
ParseCancellationException
. The implementation ensures that the
ParserRuleContext.exception
field is set for all parse tree nodes
that were not completed prior to encountering the error.
This error strategy is useful in the following scenarios.
- Two-stage parsing: This error strategy allows the first stage of two-stage parsing to immediately terminate if an error is encountered, and immediately fall back to the second stage. In addition to avoiding wasted work by attempting to recover from errors here, the empty implementation of `sync` improves the performance of the first stage.
- Silent validation: When syntax errors are not being reported or logged, and the parse result is simply ignored if errors occur, the `BailErrorStrategy` avoids wasting work on recovering from errors when the result will be ignored either way.
Usage
ⓘThis example is not tested
use antlr_rust::error_strategy::BailErrorStrategy; myparser.err_handler = BailErrorStrategy::new();
Implementations
impl<'input, Ctx: ParserNodeType<'input>> BailErrorStrategy<'input, Ctx>
[src]
Trait Implementations
impl<'input, Ctx: Debug + ParserNodeType<'input>> Debug for BailErrorStrategy<'input, Ctx>
[src]
impl<'input, Ctx: Default + ParserNodeType<'input>> Default for BailErrorStrategy<'input, Ctx>
[src]
fn default() -> BailErrorStrategy<'input, Ctx>
[src]
impl<'a, T: Parser<'a>> ErrorStrategy<'a, T> for BailErrorStrategy<'a, T::Node>
[src]
fn reset(&mut self, recognizer: &mut T)
[src]
fn recover_inline(
&mut self,
recognizer: &mut T
) -> Result<<T::TF as TokenFactory<'a>>::Tok, ANTLRError>
[src]
&mut self,
recognizer: &mut T
) -> Result<<T::TF as TokenFactory<'a>>::Tok, ANTLRError>
fn recover(
&mut self,
recognizer: &mut T,
e: &ANTLRError
) -> Result<(), ANTLRError>
[src]
&mut self,
recognizer: &mut T,
e: &ANTLRError
) -> Result<(), ANTLRError>
fn sync(&mut self, _recognizer: &mut T) -> Result<(), ANTLRError>
[src]
fn in_error_recovery_mode(&mut self, recognizer: &mut T) -> bool
[src]
fn report_error(&mut self, recognizer: &mut T, e: &ANTLRError)
[src]
fn report_match(&mut self, recognizer: &mut T)
[src]
impl<'input, Ctx: ParserNodeType<'input>> TidAble<'input> for BailErrorStrategy<'input, Ctx> where
Ctx: TidAble<'input>,
[src]
Ctx: TidAble<'input>,
Auto Trait Implementations
impl<'input, Ctx> !RefUnwindSafe for BailErrorStrategy<'input, Ctx>
impl<'input, Ctx> !Send for BailErrorStrategy<'input, Ctx>
impl<'input, Ctx> !Sync for BailErrorStrategy<'input, Ctx>
impl<'input, Ctx> Unpin for BailErrorStrategy<'input, Ctx>
impl<'input, Ctx> UnwindSafe for BailErrorStrategy<'input, Ctx> where
<Ctx as ParserNodeType<'input>>::Type: RefUnwindSafe,
<Ctx as ParserNodeType<'input>>::Type: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> NodeText for T
[src]
impl<'input, T> NodeText for T where
T: CustomRuleContext<'input>,
[src]
T: CustomRuleContext<'input>,
impl<'a, T> Tid<'a> for T where
T: TidAble<'a> + ?Sized,
[src]
T: TidAble<'a> + ?Sized,
impl<'a, X> TidExt<'a> for X where
X: Tid<'a> + ?Sized,
[src]
X: Tid<'a> + ?Sized,
pub fn is<T>(&self) -> bool where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_ref<T>(&'b self) -> Option<&'b T> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_mut<T>(&'b mut self) -> Option<&'b mut T> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_rc<T>(self: Rc<X>) -> Result<Rc<T>, Rc<X>> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_arc<T>(self: Arc<X>) -> Result<Arc<T>, Arc<X>> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_box<T>(self: Box<X>) -> Result<Box<T>, Box<X>> where
T: Tid<'a>,
[src]
T: Tid<'a>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,