[][src]Struct antlr_rust::BailErrorStrategy

pub struct BailErrorStrategy<'input, Ctx: ParserNodeType<'input>>(_);

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

use antlr_rust::error_strategy::BailErrorStrategy;
myparser.err_handler = BailErrorStrategy::new();

*/

Implementations

impl<'input, Ctx: ParserNodeType<'input>> BailErrorStrategy<'input, Ctx>[src]

pub fn new() -> Self[src]

Creates new instance of BailErrorStrategy

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]

impl<'a, T: Parser<'a>> ErrorStrategy<'a, T> for BailErrorStrategy<'a, T::Node>[src]

impl<'input, Ctx: ParserNodeType<'input>> TidAble<'input> for BailErrorStrategy<'input, Ctx> where
    Ctx: TidAble<'input>, 
[src]

type Static = __BailErrorStrategyinputCtx_should_never_exist<Ctx::Static>

Auto Trait Implementations

impl<'input, Ctx> !RefUnwindSafe for BailErrorStrategy<'input, Ctx>[src]

impl<'input, Ctx> !Send for BailErrorStrategy<'input, Ctx>[src]

impl<'input, Ctx> !Sync for BailErrorStrategy<'input, Ctx>[src]

impl<'input, Ctx> Unpin for BailErrorStrategy<'input, Ctx>[src]

impl<'input, Ctx> UnwindSafe for BailErrorStrategy<'input, Ctx> where
    <Ctx as ParserNodeType<'input>>::Type: RefUnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> NodeText for T[src]

impl<'a, T> Tid<'a> for T where
    T: TidAble<'a> + ?Sized
[src]

impl<'a, X> TidExt<'a> for X where
    X: Tid<'a> + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.