1
0

better syn tree display

This commit is contained in:
2024-10-24 09:27:17 +03:00
parent d13dfe82ae
commit 552dec9401

View File

@@ -10,7 +10,7 @@ mod parse;
mod symbols;
fn write_expr(expr: &Expr, writer: &mut impl Write, prefix: &str, is_last: bool) -> io::Result<()> {
let branch = if is_last { "+--" } else { "|--" };
let branch = if is_last { "└──" } else { "├──" };
match expr {
Expr::Int { value, .. } => writeln!(writer, "{}{}<{}>", prefix, branch, value),
@@ -22,7 +22,7 @@ fn write_expr(expr: &Expr, writer: &mut impl Write, prefix: &str, is_last: bool)
let new_prefix = if is_last {
format!("{} ", prefix)
} else {
format!("{}| ", prefix)
format!("{} ", prefix)
};
write_expr(lhs, writer, &new_prefix, false)?;