[][src]Trait antlr_rust::error_strategy::ErrorStrategy

pub trait ErrorStrategy {
    fn reset(&mut self, recognizer: &mut dyn Parser);
fn recover_inline(
        &mut self,
        recognizer: &mut dyn Parser
    ) -> Result<OwningToken, ANTLRError>;
fn recover(
        &mut self,
        recognizer: &mut dyn Parser,
        e: &ANTLRError
    ) -> Result<(), ANTLRError>;
fn sync(&mut self, recognizer: &mut dyn Parser) -> Result<(), ANTLRError>;
fn in_error_recovery_mode(&mut self, recognizer: &mut dyn Parser) -> bool;
fn report_error(&mut self, recognizer: &mut dyn Parser, e: &ANTLRError);
fn report_match(&mut self, recognizer: &mut dyn Parser); }

The interface for defining strategies to deal with syntax errors encountered during a parse by ANTLR-generated parsers. We distinguish between three different kinds of errors:

  • The parser could not figure out which path to take in the ATN (none of the available alternatives could possibly match)
  • The current input does not match what we were looking for
  • A predicate evaluated to false

Implementations of this interface report syntax errors by calling Parser.notifyErrorListeners

Required methods

fn reset(&mut self, recognizer: &mut dyn Parser)

fn recover_inline(
    &mut self,
    recognizer: &mut dyn Parser
) -> Result<OwningToken, ANTLRError>

fn recover(
    &mut self,
    recognizer: &mut dyn Parser,
    e: &ANTLRError
) -> Result<(), ANTLRError>

fn sync(&mut self, recognizer: &mut dyn Parser) -> Result<(), ANTLRError>

fn in_error_recovery_mode(&mut self, recognizer: &mut dyn Parser) -> bool

fn report_error(&mut self, recognizer: &mut dyn Parser, e: &ANTLRError)

fn report_match(&mut self, recognizer: &mut dyn Parser)

Loading content...

Implementors

impl ErrorStrategy for BailErrorStrategy[src]

impl ErrorStrategy for DefaultErrorStrategy[src]

Loading content...