UserActionsTrait

Trait UserActionsTrait 

Source
pub trait UserActionsTrait<'t> {
    // Required methods
    fn call_semantic_action_for_production_number(
        &mut self,
        prod_num: usize,
        children: &[ParseTreeType<'t>],
    ) -> Result<()>;
    fn on_comment(&mut self, _token: Token<'t>);
}
Expand description

This trait is used as a coupling point between the generated parser and the user item that implements the actual semantic actions. The trait is generated for the users item and implemented for it automatically.

The lifetime parameter 't refers to the lifetime of the scanned text.

Required Methods§

Source

fn call_semantic_action_for_production_number( &mut self, prod_num: usize, children: &[ParseTreeType<'t>], ) -> Result<()>

This function is implemented automatically for the user’s item.

Source

fn on_comment(&mut self, _token: Token<'t>)

This function is called when a token is parsed that is associated to the user defined terminals declared by %line_comment and %block_comment directives. This can improve handling of comments that are not captured by the grammar definition itself.

Implementors§