Visitor

Trait Visitor 

Source
pub trait Visitor {
    type Output;
    type Error;

    // Required methods
    fn visit_root(&mut self, root: &Root) -> Result<Self::Output, Self::Error>;
    fn visit_condition(
        &mut self,
        condition: &Condition,
    ) -> Result<Self::Output, Self::Error>;
    fn visit_action(
        &mut self,
        action: &Action,
    ) -> Result<Self::Output, Self::Error>;
    fn visit_description(
        &mut self,
        description: &Description,
    ) -> Result<Self::Output, Self::Error>;
}
Expand description

A trait for visiting a tree AST in depth-first order.

All implementors of Visitor must provide a visit_root implementation. This is usually the entry point of the visitor, though it is best if this assumption is not held.

Required Associated Types§

Source

type Output

The result of visiting the AST.

Source

type Error

An error that might occur when visiting the AST.

Required Methods§

Source

fn visit_root(&mut self, root: &Root) -> Result<Self::Output, Self::Error>

This method is called on a root node.

Source

fn visit_condition( &mut self, condition: &Condition, ) -> Result<Self::Output, Self::Error>

This method is called on a condition node.

Source

fn visit_action(&mut self, action: &Action) -> Result<Self::Output, Self::Error>

This method is called on an action node.

Source

fn visit_description( &mut self, description: &Description, ) -> Result<Self::Output, Self::Error>

This method is called on an action description node.

Implementors§

Source§

impl Visitor for SemanticAnalyzer<'_>

A visitor that performs semantic analysis on an AST.