main
ondra05 2022-07-21 19:25:33 +02:00
parent 18ab03945e
commit fa1ffff146
1 changed files with 10 additions and 9 deletions

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 {