summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-09-10 15:32:49 +0200
committerJo-Philipp Wich <jo@mein.io>2020-09-10 15:32:49 +0200
commit394fe98efd6e11885d0786e9f9aabf284f6f363a (patch)
treea2ca132f873cabc9e5e264b78bf98522b5a08192
parent439136c15a5d0b5a95f49dab7c8e7513315839c4 (diff)
main: fix dumping AST
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/main.c b/main.c
index 9850b81..334d66b 100644
--- a/main.c
+++ b/main.c
@@ -92,7 +92,12 @@ static void dump_node(struct ut_op *op) {
break;
default:
- printf("n%p [label=\"%s\"];\n", op, tokennames[op->type]);
+ printf("n%p [label=\"%s", op, tokennames[op->type]);
+
+ if (op->is_postfix)
+ printf(", postfix");
+
+ printf("\"];\n");
}
}
@@ -108,7 +113,7 @@ static void dump(struct ut_state *s, uint32_t off, int level) {
dump_node(cur);
if (cur->type < __T_MAX) {
- for (i = 0; i < ARRAY_SIZE(cur->tree.operand) && cur->tree.operand[i]; i++) {
+ for (i = 0; i < ARRAY_SIZE(cur->tree.operand); i++) {
child = ut_get_op(s, cur->tree.operand[i]);
if (cur->tree.operand[i]) {