rustemo

Trait LRBuilder

source
pub trait LRBuilder<'i, I, C, S, P, TK>: Builder
where I: Input + ?Sized, C: Context<'i, I, S, TK>, S: State,
{ // 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§

source

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.
source

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

Implementors§

source§

impl<'i, I, C, S, P, TK> LRBuilder<'i, I, C, S, P, TK> for SliceBuilder<'i, I>
where I: Input + ?Sized, C: Context<'i, I, S, TK>, S: State,

source§

impl<'i, I, C, S, P, TK> LRBuilder<'i, I, C, S, P, TK> for TreeBuilder<'i, I, P, TK>
where I: Input + ?Sized, C: Context<'i, I, S, TK>, S: State,