Fix quoted string handling

This commit is contained in:
Jonathan Turner
2019-05-18 07:42:55 -07:00
parent 2e2831de95
commit 75b7842618
3 changed files with 16 additions and 15 deletions

View File

@ -65,18 +65,16 @@ impl Item {
Item::Operator(o) => Value::Primitive(Primitive::Operator(o.clone())),
}
}
}
crate fn print_items(items: &[Item]) -> String {
let formatted = items.iter().map(|item| match item {
Item::Bare(s) => format!("{}", s),
Item::Quoted(s) => format!("{:?}", s),
Item::Int(i) => format!("{:?}", i),
Item::Boolean(b) => format!("{:?}", b),
Item::Operator(o) => o.print(),
});
itertools::join(formatted, " ")
pub fn print(&self) -> String {
match self {
Item::Bare(s) => format!("{}", s),
Item::Quoted(s) => format!("{}", s),
Item::Int(i) => format!("{:?}", i),
Item::Boolean(b) => format!("{:?}", b),
Item::Operator(o) => o.print(),
}
}
}
impl Item {