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;
|
2024-03-07 11:33:54 +00:00
|
|
|
pub mod math;
|
2024-02-25 18:49:26 +00:00
|
|
|
pub mod statement;
|
2024-02-29 02:04:38 +00:00
|
|
|
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,
|
2024-03-07 11:33:54 +00:00
|
|
|
logic::Logic, math::Math, r#loop::Loop, r#type::Type, statement::Statement,
|
|
|
|
value_node::ValueNode,
|
2024-02-25 18:49:26 +00:00
|
|
|
};
|
|
|
|
|
2024-02-29 02:04:38 +00:00
|
|
|
use crate::{
|
|
|
|
context::Context,
|
|
|
|
error::{RuntimeError, ValidationError},
|
|
|
|
Value,
|
|
|
|
};
|
2024-02-25 18:49:26 +00:00
|
|
|
|
|
|
|
pub trait AbstractTree {
|
2024-02-29 02:04:38 +00:00
|
|
|
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>;
|
|
|
|
}
|