aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-02 19:29:33 -0500
committerMustafa Quraish <[email protected]>2022-02-02 19:29:33 -0500
commitb770cd8f596cd195ae263dae14acfce033fe1818 (patch)
treedf0368b7006f7b846925d530876502ff0a9c6176 /src
parentAdd initial support for arrays (also no testing) (diff)
downloadcup-b770cd8f596cd195ae263dae14acfce033fe1818.tar.xz
cup-b770cd8f596cd195ae263dae14acfce033fe1818.zip
Handle OP_ASSIGN in `print_ast()`
Diffstat (limited to 'src')
-rw-r--r--src/ast.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ast.c b/src/ast.c
index f75e531..84aafca 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -144,6 +144,12 @@ static void do_print_ast(Node *node, int depth)
printf(" ");
}
printf("}\n");
+ } else if (node->type == OP_ASSIGN) {
+ printf("(= \n");
+ do_print_ast(node->assign.var, depth + 1);
+ printf("%*s,\n", 2*depth, "");
+ do_print_ast(node->assign.value, depth + 1);
+ printf("%*s)\n", 2*depth, "");
} else if (node->type == AST_FUNC) {
dump_func(node, depth);
} else if (node->type == AST_LITERAL) {