diff --git a/dsl/src/dsl_parse.rs b/dsl/src/dsl_parse.rs index ee06792..d81c54b 100644 --- a/dsl/src/dsl_parse.rs +++ b/dsl/src/dsl_parse.rs @@ -189,6 +189,21 @@ pub const fn to_digit (c: char) -> DslResult { Exp(usize, TokenIter<'source>), } +impl<'source> std::fmt::Display for Value<'source> { + fn fmt (&self, out: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { + write!(out, "{}", match self { + Nil => String::new(), + Err(e) => format!("[error: {e}]"), + Num(n) => format!("{n}"), + Sym(s) => format!("{s}"), + Key(s) => format!("{s}"), + Str(s) => format!("{s}"), + Exp(_, e) => format!("{e:?}"), + }); + Ok(()) + } +} + impl<'source> Token<'source> { pub const fn new ( source: &'source str, start: usize, length: usize, value: Value<'source>