From a6a02f26e4b3090a1e7b8e1005a16d2f8c18c04b Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 7 Mar 2024 16:19:24 -0500 Subject: [PATCH] Add map values --- src/abstract_tree/value_node.rs | 2 +- src/value.rs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/abstract_tree/value_node.rs b/src/abstract_tree/value_node.rs index 567c071..f06fce0 100644 --- a/src/abstract_tree/value_node.rs +++ b/src/abstract_tree/value_node.rs @@ -45,7 +45,7 @@ impl<'src> AbstractTree for ValueNode<'src> { } fn validate(&self, _context: &Context) -> Result<(), ValidationError> { - todo!() + Ok(()) } fn run(self, _context: &Context) -> Result { diff --git a/src/value.rs b/src/value.rs index a29cddf..0070887 100644 --- a/src/value.rs +++ b/src/value.rs @@ -133,9 +133,17 @@ impl Display for Value { Float(float) => write!(f, "{float}"), Integer(integer) => write!(f, "{integer}"), List(_) => todo!(), - Map(_) => todo!(), + Map(map) => { + writeln!(f, "{{")?; + + for (identifier, value) in map { + writeln!(f, " {identifier} = {value}")?; + } + + write!(f, "}}") + } Range(_) => todo!(), - String(_) => todo!(), + String(string) => write!(f, "{string}"), Enum(_, _) => todo!(), } }