This commit is contained in:
Erin 2022-07-21 19:25:33 +02:00 committed by ondra05
parent ee6c092577
commit 91bbdf0b37

View file

@ -13,17 +13,24 @@ pub enum Value<'a> {
Vector(Vec<Self>),
Map(BTreeMap<Self, Self>),
Module(Module<'a>),
Function(Function),
Symbol(Symbol<'a>),
Keyword(Cow<'a, str>),
Function {
// TODO: Fields,
},
Bool(bool),
Number(OrderedFloat<f64>),
String(Cow<'a, str>),
Nil,
}
#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct Module<'a> {
members: BTreeMap<u64, Value<'a>>,
symbol_table: BTreeMap<String, u64>,
}
#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct Function {}
#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub enum Symbol<'a> {
Interned(u64),
@ -45,12 +52,6 @@ impl<'a> Display for Symbol<'a> {
}
}
#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct Module<'a> {
members: BTreeMap<u64, Value<'a>>,
symbol_table: BTreeMap<String, u64>,
}
impl<'a> Display for Value<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {