diff --git a/src/process.rs b/src/process.rs index 4e35a4c..97b92ea 100644 --- a/src/process.rs +++ b/src/process.rs @@ -3,6 +3,7 @@ use crate::parser::*; use crate::spans::*; use crate::validator::FnInfo; use crate::value::Value; +use chumsky::prelude::SimpleSpan; use imbl::HashMap; use imbl::Vector; use std::cell::RefCell; @@ -35,6 +36,7 @@ pub struct Process<'src> { pub locals: Vec<(String, Value<'src>)>, pub prelude: Vec<(String, Value<'src>)>, pub ast: &'src Ast, + pub span: SimpleSpan, pub fn_info: std::collections::HashMap<*const Ast, FnInfo>, } @@ -315,6 +317,11 @@ impl<'src> Process<'src> { } } + fn visit(&mut self, node: &'src Spanned) { + self.ast = &node.0; + self.span = node.1; + } + pub fn eval(&mut self) -> LResult<'src> { use Ast::*; let root = self.ast;