pub trait AbstractTree: Sized {
    // Required methods
    fn from_syntax_node(
        source: &str,
        node: Node<'_>,
        context: &Map
    ) -> Result<Self>;
    fn run(&self, source: &str, context: &Map) -> Result<Value>;
    fn expected_type(&self, context: &Map) -> Result<Type>;
}
Expand description

This trait is implemented by the Evaluator’s internal types to form an executable tree that resolves to a single value.

Required Methods§

source

fn from_syntax_node(source: &str, node: Node<'_>, context: &Map) -> Result<Self>

Interpret the syntax tree at the given node and return the abstraction.

This function is used to convert nodes in the Tree Sitter concrete syntax tree into executable nodes in an abstract tree. This function is where the tree should be traversed by accessing sibling and child nodes. Each node in the CST should be traversed only once.

If necessary, the source code can be accessed directly by getting the node’s byte range.

source

fn run(&self, source: &str, context: &Map) -> Result<Value>

Execute dust code by traversing the tree.

source

fn expected_type(&self, context: &Map) -> Result<Type>

Object Safety§

This trait is not object safe.

Implementors§