Added modules
This commit is contained in:
parent
5ad89874fb
commit
ee6c092577
|
@ -12,6 +12,7 @@ pub enum Value<'a> {
|
|||
List(Box<List<'a>>),
|
||||
Vector(Vec<Self>),
|
||||
Map(BTreeMap<Self, Self>),
|
||||
Module(Module<'a>),
|
||||
Symbol(Symbol<'a>),
|
||||
Keyword(Cow<'a, str>),
|
||||
Function {
|
||||
|
@ -44,6 +45,12 @@ 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 {
|
||||
|
@ -55,6 +62,7 @@ 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"),
|
||||
|
|
Loading…
Reference in a new issue