make print_expr's output readable by mere mortals

This commit is contained in:
Bill Currie 2001-07-23 06:15:33 +00:00
parent d2c266775c
commit a47a4d8038

View file

@ -181,6 +181,14 @@ get_op_string (int op)
return "("; return "(";
case '.': case '.':
return "."; return ".";
case 'i':
return "<if>";
case 'n':
return "<ifnot>";
case 'g':
return "<goto>";
case 'r':
return "<return>";
default: default:
return "unknown"; return "unknown";
} }
@ -305,20 +313,12 @@ print_expr (expr_t *e)
printf (")"); printf (")");
} else { } else {
print_expr (e->e.expr.e2); print_expr (e->e.expr.e2);
if (isprint (e->e.expr.op)) { printf (" %s", get_op_string (e->e.expr.op));
printf (" %c", e->e.expr.op);
} else {
printf (" %d", e->e.expr.op);
}
} }
break; break;
case ex_uexpr: case ex_uexpr:
print_expr (e->e.expr.e1); print_expr (e->e.expr.e1);
if (isprint (e->e.expr.op)) { printf (" u%s", get_op_string (e->e.expr.op));
printf (" u%c", e->e.expr.op);
} else {
printf (" u%d", e->e.expr.op);
}
break; break;
case ex_def: case ex_def:
printf ("%s", e->e.def->name); printf ("%s", e->e.def->name);