Struct rustlr::runtime_parser::StandardReporter
source · [−]pub struct StandardReporter {
pub training: bool,
pub trained: HashMap<(usize, String), String>,
pub scriptinopt: Option<BufReader<File>>,
pub scriptoutopt: Option<File>,
}
Expand description
these objects implement the ErrHandler trait. They are used in the RuntimeParser::parse_stdio, RuntimeParser::parse_stdio_train and RuntimeParser::train_from_script functions.
Fields
training: bool
trained: HashMap<(usize, String), String>
scriptinopt: Option<BufReader<File>>
scriptoutopt: Option<File>
Implementations
sourceimpl StandardReporter
impl StandardReporter
sourcepub fn new() -> StandardReporter
pub fn new() -> StandardReporter
creates default standard reporter, used by parse_stdio (does not train)
sourcepub fn new_interactive_training(existingparser: &str) -> StandardReporter
pub fn new_interactive_training(existingparser: &str) -> StandardReporter
creates a stdio error handler with interactive training, takes as argument parser file name, to create script for future retraining.
sourcepub fn new_script_training(
existingparser: &str,
scriptfile: &str
) -> StandardReporter
pub fn new_script_training(
existingparser: &str,
scriptfile: &str
) -> StandardReporter
creates a stdio error handler that trains (non-interactively) from a previously created script. It’s the user’s responsibility to match the script file with the input source.
sourceimpl StandardReporter
impl StandardReporter
pub fn augment_training(&mut self, filepath: &str) -> Result<()>
Trait Implementations
sourceimpl<AT: Default, ET: Default> ErrHandler<AT, ET> for StandardReporter
impl<AT: Default, ET: Default> ErrHandler<AT, ET> for StandardReporter
fn err_reporter(
&mut self,
parser: &mut RuntimeParser<AT, ET>,
lookahead: &Lextoken<AT>,
erropt: &Option<Stateaction>
)
fn report_err(&self, parser: &mut RuntimeParser<AT, ET>, msg: &str)
sourceimpl<AT: Default, ET: Default> ErrReporter<AT, ET> for StandardReporter
impl<AT: Default, ET: Default> ErrReporter<AT, ET> for StandardReporter
fn err_reporter(
&mut self,
parser: &mut ZCParser<AT, ET>,
lookahead: &TerminalToken<'_, AT>,
erropt: &Option<Stateaction>,
tokenizer: &dyn Tokenizer<'_, AT>
)
fn report_err(&self, parser: &mut ZCParser<AT, ET>, msg: &str)
Auto Trait Implementations
impl RefUnwindSafe for StandardReporter
impl Send for StandardReporter
impl Sync for StandardReporter
impl Unpin for StandardReporter
impl UnwindSafe for StandardReporter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more