diff --git a/src/parser.rs b/src/parser.rs index 07b8088..7cadac4 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -66,7 +66,7 @@ fn stream_of_lexer<'a>( mod tests { use super::*; - fn assert_parse(src: &str, expected: &[Value]) { + fn assert_parse<'a>(src: &'a str, expected: &'a [Value<'a>]) { assert_eq!(read(src).unwrap(), expected) } diff --git a/src/value.rs b/src/value.rs index c1fdd2c..eff25b2 100644 --- a/src/value.rs +++ b/src/value.rs @@ -3,7 +3,7 @@ use ordered_float::OrderedFloat; use std::{ borrow::Cow, collections::BTreeMap, - fmt::{Display, Write}, + fmt::{Debug, Display, Write}, rc::Rc, }; @@ -15,6 +15,8 @@ pub enum Value<'a> { Map(BTreeMap), Module(Module<'a>), Function(Function<'a>), + InternalFn(fn(&'a List<'a>) -> Value<'a>), + Macro(/* TODO: Bytecode */), Symbol(Symbol<'a>), Keyword(Cow<'a, str>), Bool(bool), @@ -83,7 +85,9 @@ impl<'a> Display for Value<'a> { Value::Module(_) => write!(f, "#module#"), Value::Symbol(sym) => write!(f, "{sym}"), Value::Keyword(kw) => write!(f, ":{kw}"), - Value::Function { .. } => write!(f, "fn"), + Value::Function { .. } => write!(f, "#fn#"), + Value::InternalFn(function) => write!(f, "#internal-fn@{function:p}"), + Value::Macro() => write!(f, "#macro#"), Value::Bool(b) => write!(f, "{b}"), Value::Number(n) => write!(f, "{n}"), Value::String(s) => write!(f, "\"{s}\""),