better syn tree display
This commit is contained in:
@@ -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)?;
|
||||
|
||||
Reference in New Issue
Block a user