display strings with quotation marks

This commit is contained in:
2024-10-15 17:28:10 -04:00
parent 0de9652360
commit 4784cc295e

View File

@@ -66,7 +66,7 @@ impl Display for Value {
Self::Float(x) => write!(f, "{x}"), Self::Float(x) => write!(f, "{x}"),
Self::Int(x) => write!(f, "{x}"), Self::Int(x) => write!(f, "{x}"),
Self::Bool(x) => write!(f, "{}", if *x { "true" } else { "false" }), Self::Bool(x) => write!(f, "{}", if *x { "true" } else { "false" }),
Self::String(x) => write!(f, "{x}"), Self::String(x) => write!(f, "\"{x}\""),
Self::Array(v) => write!(f, "[{}]", v.iter().map(|x| format!("{x}")).collect::<Vec<_>>().join(" ")), Self::Array(v) => write!(f, "[{}]", v.iter().map(|x| format!("{x}")).collect::<Vec<_>>().join(" ")),
Self::Nil => write!(f, "nil"), Self::Nil => write!(f, "nil"),
} }