Add else parsing. Still a few bugs with output.
This commit is contained in:
12
AST.jai
12
AST.jai
@@ -228,9 +228,19 @@ print_return_node :: (node : *AST_Node, indentation : int, builder : *String_Bui
|
||||
}
|
||||
|
||||
pretty_print_if :: (node : *AST_Node, indentation : int, builder : *String_Builder) {
|
||||
indent(builder, indentation);
|
||||
append(builder, "(if ");
|
||||
|
||||
pretty_print_children(node, 0, builder);
|
||||
body := node.children[0];
|
||||
pretty_print_node(body, 0, builder);
|
||||
|
||||
if node.children.count == 2 {
|
||||
append(builder, "\n");
|
||||
indent(builder, indentation);
|
||||
append(builder, "(else ");
|
||||
pretty_print_node(node.children[1], 0, builder);
|
||||
append(builder, ")");
|
||||
}
|
||||
|
||||
append(builder, ")");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user