pub trait LRBuilder<'i, I, C, S, P, TK>: Builder{
// Required methods
fn shift_action(&mut self, context: &mut C, token: Token<'i, I, TK>);
fn reduce_action(&mut self, context: &mut C, prod: P, prod_len: usize);
}
Expand description
A builder variant for LR parsing.
Builder should keep its internal stack of subresults, similar to the way LR parsing operates.
Required Methods§
sourcefn shift_action(&mut self, context: &mut C, token: Token<'i, I, TK>)
fn shift_action(&mut self, context: &mut C, token: Token<'i, I, TK>)
Called when LR shifting is taking place.
§Arguments
term_idx
- A terminal unique identifier - index.token
- A token recognized in the input.
sourcefn reduce_action(&mut self, context: &mut C, prod: P, prod_len: usize)
fn reduce_action(&mut self, context: &mut C, prod: P, prod_len: usize)
Called when LR reduce is taking place.
§Arguments
prod_idx
- A production unique identifier, used to decide the action to perform.prod_len
- A RHS length, used to pop appropriate number of subresults from the stack