Ifdefs, moved semantic to check, fixed error reporting for builtins
This commit is contained in:
42
AST.jai
42
AST.jai
@@ -356,6 +356,29 @@ pretty_print_node :: (node : *AST_Node, indentation : int, builder : *String_Bui
|
||||
case .If; {
|
||||
pretty_print_if(node, indentation, builder, skip_indent);
|
||||
}
|
||||
case .If_Directive; {
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
append(builder, "(#if ");
|
||||
|
||||
condition := node.children[0];
|
||||
pretty_print_node(condition, 0, builder);
|
||||
append(builder, "\n");
|
||||
|
||||
body := node.children[1];
|
||||
// indent(builder,indentation + 4);
|
||||
// append(builder, "(");
|
||||
pretty_print_node(body, indentation + 4, builder);
|
||||
// append(builder, ")");
|
||||
|
||||
if node.children.count == 3 {
|
||||
append(builder, "\n");
|
||||
pretty_print_node(node.children[2], indentation + 4, builder);
|
||||
}
|
||||
|
||||
append(builder, ")");
|
||||
}
|
||||
case .For; {
|
||||
pretty_print_for(node, indentation, builder, skip_indent);
|
||||
}
|
||||
@@ -479,9 +502,26 @@ pretty_print_declaration :: (declaration : *AST_Node, indentation : int, builder
|
||||
pretty_print_node(declaration.children[0], 0, builder);
|
||||
append(builder, "\n");
|
||||
pretty_print_node(declaration.children[1], indentation + 5, builder);
|
||||
|
||||
if declaration.children.count > 2 {
|
||||
append(builder, "\n");
|
||||
if declaration.children[2].kind == .If_Directive {
|
||||
pretty_print_declaration(declaration.children[2], indentation + 5, builder);
|
||||
} else {
|
||||
pretty_print_node(declaration.children[2], indentation + 5, builder);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print_to_builder(builder, "\n");
|
||||
pretty_print_children(declaration, indentation + 1, builder, flags = .NewLine);
|
||||
|
||||
flags := Children_Print_Flags.NewLine;
|
||||
|
||||
if declaration.parent && declaration.parent.parent {
|
||||
if declaration.parent.parent.kind == .If_Directive {
|
||||
indent(builder, indentation - 1); //@Note: Hack the indent for now... Wow this is stupid, but it works!
|
||||
}
|
||||
}
|
||||
pretty_print_children(declaration, indentation + 1, builder, flags = flags);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user