Added macro and internal fn types
This commit is contained in:
parent
a825b082cf
commit
6c71bde8a8
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Self, Self>),
|
||||
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}\""),
|
||||
|
|
Loading…
Reference in a new issue