pub trait ListenerWrapper {
// Required method
fn get_log_mut(&mut self) -> &mut impl Logger;
// Provided methods
fn switch(
&mut self,
call: Call,
nt: u16,
alt_id: u16,
t_data: Option<Vec<String>>,
) { ... }
fn check_abort_request(&self) -> Terminate { ... }
fn abort(&mut self) { ... }
fn report(&mut self, span_opt: Option<&PosSpan>, msg: LogMsg) { ... }
fn push_span(&mut self, span: PosSpan) { ... }
fn is_stack_empty(&self) -> bool { ... }
fn is_stack_t_empty(&self) -> bool { ... }
fn is_stack_span_empty(&self) -> bool { ... }
fn hook(&mut self, token: u16, text: &str, span: &PosSpan) -> u16 { ... }
fn intercept_token(&mut self, token: u16, text: &str, span: &PosSpan) -> u16 { ... }
}Required Methods§
Sourcefn get_log_mut(&mut self) -> &mut impl Logger
fn get_log_mut(&mut self) -> &mut impl Logger
Gets access to the listener’s log to report possible errors and information about the parsing.
Provided Methods§
Sourcefn switch(
&mut self,
call: Call,
nt: u16,
alt_id: u16,
t_data: Option<Vec<String>>,
)
fn switch( &mut self, call: Call, nt: u16, alt_id: u16, t_data: Option<Vec<String>>, )
Calls the listener to execute Enter, Loop, Exit, and End actions.
Sourcefn check_abort_request(&self) -> Terminate
fn check_abort_request(&self) -> Terminate
Checks if the listener requests an abort (wrapper pass-through). This method is called at the end of each parser iteration. If an error is too difficult to recover from, the listener can set a flag that tells to return a Terminate::Abort on the next call, and implement this method to return the appropriate status.
In that case, the parser
- calls abort(…)
- calls [switch(Call::End)](ListenerWrapper::switch) (if there was no syntax error)
- returns ParserError::AbortRequest.
Sourcefn report(&mut self, span_opt: Option<&PosSpan>, msg: LogMsg)
fn report(&mut self, span_opt: Option<&PosSpan>, msg: LogMsg)
Reports a message (note, info, warning, or error). The default behaviour adds the message to the log.
Sourcefn is_stack_empty(&self) -> bool
fn is_stack_empty(&self) -> bool
Checks that the stack is empty (the parser only checks that the stack is empty after successfully parsing a text)
Sourcefn is_stack_t_empty(&self) -> bool
fn is_stack_t_empty(&self) -> bool
Checks that the stack_t is empty (the parser only checks that the stack is empty after successfully parsing a text)
Sourcefn is_stack_span_empty(&self) -> bool
fn is_stack_span_empty(&self) -> bool
Checks that the stack_span is empty (the parser only checks that the stack is empty after successfully parsing a text)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.