Trait rustlr::base_parser::ErrReportMaker

source ·
pub trait ErrReportMaker<'t, AT: Default, ET: Default, TT: Tokenizer<'t, AT>> {
    // Required method
    fn err_reporter(
        &mut self,
        parser: &mut BaseParser<'t, AT, ET, TT>,
        lookahead: &TerminalToken<'_, AT>,
        erropt: &Option<Stateaction>
    );

    // Provided method
    fn report_err(&self, parser: &mut BaseParser<'t, AT, ET, TT>, msg: &str) { ... }
}
Expand description

A trait object that implements ErrReportMaker is expected by the BaseParser::parse_core function, which implements the basic LR parsing algorithm using the generated state machine. The struct StandardReporter is provided as the default ErrReportMaker that uses standard I/O as interface and has the ability to train the parser. But other implementations of the trait can be created that use different interfaces, such as a graphical IDE.

This trait replaces crate::ErrHandler in the crate::runtime_parser module.

Required Methods§

source

fn err_reporter( &mut self, parser: &mut BaseParser<'t, AT, ET, TT>, lookahead: &TerminalToken<'_, AT>, erropt: &Option<Stateaction> )

Provided Methods§

source

fn report_err(&self, parser: &mut BaseParser<'t, AT, ET, TT>, msg: &str)

Implementors§

source§

impl<'t, AT: Default, ET: Default, TT: Tokenizer<'t, AT>> ErrReportMaker<'t, AT, ET, TT> for StandardReporter