tweak pretty output
This commit is contained in:
parent
f4dbadced9
commit
3e772d74c1
2 changed files with 2 additions and 2 deletions
|
|
@ -98,7 +98,7 @@ impl fmt::Display for Ast {
|
||||||
write!(f, "{{{}}}", body.join(" "))
|
write!(f, "{{{}}}", body.join(" "))
|
||||||
}
|
}
|
||||||
Ast::App(func, x) => write!(f, "({func} {x})"),
|
Ast::App(func, x) => write!(f, "({func} {x})"),
|
||||||
Ast::BinOp(lhs, op, rhs) => write!(f, "({op} {lhs} {rhs})"),
|
Ast::BinOp(lhs, op, rhs) => write!(f, "({lhs} {op} {rhs})"),
|
||||||
Ast::Num(n) => write!(f, "{n}"),
|
Ast::Num(n) => write!(f, "{n}"),
|
||||||
Ast::Block(body) => {
|
Ast::Block(body) => {
|
||||||
let body: Vec<_> = body.iter().map(|stmt| format!("{stmt}")).collect();
|
let body: Vec<_> = body.iter().map(|stmt| format!("{stmt}")).collect();
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,6 @@ fn main() {
|
||||||
let src = &env::args().nth(1).expect("give me an argument now");
|
let src = &env::args().nth(1).expect("give me an argument now");
|
||||||
let res = parse(src);
|
let res = parse(src);
|
||||||
for stmt in res {
|
for stmt in res {
|
||||||
println!("{stmt}");
|
println!("{stmt};");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue