Add map values

This commit is contained in:
Jeff 2024-03-07 16:19:24 -05:00
parent 32028acab2
commit a6a02f26e4
2 changed files with 11 additions and 3 deletions

View File

@ -45,7 +45,7 @@ impl<'src> AbstractTree for ValueNode<'src> {
} }
fn validate(&self, _context: &Context) -> Result<(), ValidationError> { fn validate(&self, _context: &Context) -> Result<(), ValidationError> {
todo!() Ok(())
} }
fn run(self, _context: &Context) -> Result<Value, RuntimeError> { fn run(self, _context: &Context) -> Result<Value, RuntimeError> {

View File

@ -133,9 +133,17 @@ impl Display for Value {
Float(float) => write!(f, "{float}"), Float(float) => write!(f, "{float}"),
Integer(integer) => write!(f, "{integer}"), Integer(integer) => write!(f, "{integer}"),
List(_) => todo!(), List(_) => todo!(),
Map(_) => todo!(), Map(map) => {
writeln!(f, "{{")?;
for (identifier, value) in map {
writeln!(f, " {identifier} = {value}")?;
}
write!(f, "}}")
}
Range(_) => todo!(), Range(_) => todo!(),
String(_) => todo!(), String(string) => write!(f, "{string}"),
Enum(_, _) => todo!(), Enum(_, _) => todo!(),
} }
} }