Struct rusty_lr::DefaultCallback
source · pub struct DefaultCallback {}Expand description
default callback that does nothing
Trait Implementations§
source§impl<Term, NonTerm> Callback<Term, NonTerm> for DefaultCallback
impl<Term, NonTerm> Callback<Term, NonTerm> for DefaultCallback
source§fn reduce(
&mut self,
rules: &[ProductionRule<Term, NonTerm>],
states: &[State<Term, NonTerm>],
state_stack: &[usize],
rule: usize,
) -> Result<(), <DefaultCallback as Callback<Term, NonTerm>>::Error>
fn reduce( &mut self, rules: &[ProductionRule<Term, NonTerm>], states: &[State<Term, NonTerm>], state_stack: &[usize], rule: usize, ) -> Result<(), <DefaultCallback as Callback<Term, NonTerm>>::Error>
this is called after poping N states from the state stack, where N is the number of tokens of the reduced rule
production rule matched and reduce
source§fn shift_and_goto(
&mut self,
rules: &[ProductionRule<Term, NonTerm>],
states: &[State<Term, NonTerm>],
state_stack: &[usize],
term: &Term,
) -> Result<(), <DefaultCallback as Callback<Term, NonTerm>>::Error>
fn shift_and_goto( &mut self, rules: &[ProductionRule<Term, NonTerm>], states: &[State<Term, NonTerm>], state_stack: &[usize], term: &Term, ) -> Result<(), <DefaultCallback as Callback<Term, NonTerm>>::Error>
this is called after the shift of terminal symbol and state transition
the actual state-transition of DFA is managed by parser
if you are tyring to track the state transition with this method,
you must also consider
reduce method, which pop N states from the state stack,
where N is the number of tokens of the reduced rulesource§fn shift_and_goto_nonterm(
&mut self,
rules: &[ProductionRule<Term, NonTerm>],
states: &[State<Term, NonTerm>],
state_stack: &[usize],
nonterm: &NonTerm,
) -> Result<(), <DefaultCallback as Callback<Term, NonTerm>>::Error>
fn shift_and_goto_nonterm( &mut self, rules: &[ProductionRule<Term, NonTerm>], states: &[State<Term, NonTerm>], state_stack: &[usize], nonterm: &NonTerm, ) -> Result<(), <DefaultCallback as Callback<Term, NonTerm>>::Error>
this is called after the shift of non-terminal symbol and state transition
the actual state-transition of DFA is managed by parser
if you are tyring to track the state transition with this method,
you must also consider
reduce method, which pop N states from the state stack,
where N is the number of tokens of the reduced ruleAuto Trait Implementations§
impl Freeze for DefaultCallback
impl RefUnwindSafe for DefaultCallback
impl Send for DefaultCallback
impl Sync for DefaultCallback
impl Unpin for DefaultCallback
impl UnwindSafe for DefaultCallback
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more