implemented import parsing
This commit is contained in:
parent
1ca6f024ee
commit
bb3da4d20a
6 changed files with 40 additions and 18 deletions
9
lc.c
9
lc.c
|
|
@ -73,8 +73,9 @@ void print_ast(ast_node *node, int depth) {
|
|||
print_ast(node->expr.cast.value, depth + 1);
|
||||
break;
|
||||
case NODE_ACCESS:
|
||||
printf("Access: %.*s\n", (int)node->expr.access.member_len, node->expr.access.member);
|
||||
print_ast(node->expr.access.expr, depth + 1);
|
||||
printf("Access:\n");
|
||||
print_ast(node->expr.access.expr, depth + 1);
|
||||
print_ast(node->expr.access.member, depth + 1);
|
||||
break;
|
||||
case NODE_LABEL:
|
||||
printf("Label: %.*s\n", (int)node->expr.label.name_len, node->expr.label.name);
|
||||
|
|
@ -142,6 +143,10 @@ void print_ast(ast_node *node, int depth) {
|
|||
printf("Return:\n");
|
||||
print_ast(node->expr.ret.value, depth + 1);
|
||||
break;
|
||||
case NODE_IMPORT:
|
||||
printf("Import:\n");
|
||||
print_ast(node->expr.import.path, depth + 1);
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Node Type: %d\n", node->type);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue