1
0
dust/src/abstract_tree/mod.rs

27 lines
707 B
Rust
Raw Normal View History

2024-02-25 18:49:26 +00:00
pub mod assignment;
pub mod block;
2024-02-26 21:27:01 +00:00
pub mod expression;
2024-02-25 18:49:26 +00:00
pub mod identifier;
pub mod logic;
pub mod r#loop;
pub mod statement;
pub mod r#type;
2024-02-26 21:27:01 +00:00
pub mod value_node;
2024-02-25 18:49:26 +00:00
pub use self::{
2024-02-26 21:27:01 +00:00
assignment::Assignment, block::Block, expression::Expression, identifier::Identifier,
logic::Logic, r#loop::Loop, r#type::Type, statement::Statement, value_node::ValueNode,
2024-02-25 18:49:26 +00:00
};
use crate::{
context::Context,
error::{RuntimeError, ValidationError},
Value,
};
2024-02-25 18:49:26 +00:00
pub trait AbstractTree {
fn expected_type(&self, context: &Context) -> Result<Type, ValidationError>;
fn validate(&self, context: &Context) -> Result<(), ValidationError>;
2024-02-25 18:49:26 +00:00
fn run(self, context: &Context) -> Result<Value, RuntimeError>;
}