Fix some missing operators not getting parsed properly. Fixed field access type checking with depth more than 1.
This commit is contained in:
25
AST.jai
25
AST.jai
@@ -150,10 +150,16 @@ Children_Print_Flags :: enum_flags {
|
||||
|
||||
pretty_print_block :: (node : *AST_Node, indentation : int, builder : *String_Builder, skip_indent := false) {
|
||||
if node.children.count == 0 {
|
||||
indent(builder, indentation);
|
||||
if !skip_indent {
|
||||
indent(builder, indentation);
|
||||
}
|
||||
append(builder, "()");
|
||||
} else {
|
||||
pretty_print_children(node, indentation, builder, flags = .NewLine | .Dont_Skip_Indent_On_First);
|
||||
flags := Children_Print_Flags.NewLine;
|
||||
if !skip_indent {
|
||||
flags |= .Dont_Skip_Indent_On_First;
|
||||
}
|
||||
pretty_print_children(node, indentation, builder, flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,6 +216,16 @@ op_to_string :: (oper : Token) -> string {
|
||||
return "*";
|
||||
case .TOKEN_SLASH;
|
||||
return "/";
|
||||
case .TOKEN_MINUSEQUALS;
|
||||
return "-=";
|
||||
case .TOKEN_PLUSEQUALS;
|
||||
return "+=";
|
||||
case .TOKEN_DIVEQUALS;
|
||||
return "/=";
|
||||
case .TOKEN_TIMESEQUALS;
|
||||
return "*=";
|
||||
case .TOKEN_MODEQUALS;
|
||||
return "%=";
|
||||
case .TOKEN_ISEQUAL;
|
||||
return "==";
|
||||
case .TOKEN_ASSIGN;
|
||||
@@ -280,7 +296,10 @@ pretty_print_if :: (node : *AST_Node, indentation : int, builder : *String_Build
|
||||
append(builder, "\n");
|
||||
|
||||
body := node.children[1];
|
||||
pretty_print_node(body, indentation + 4, builder);
|
||||
indent(builder,indentation + 4);
|
||||
append(builder, "(");
|
||||
pretty_print_node(body, indentation + 5, builder, true);
|
||||
append(builder, ")");
|
||||
|
||||
if node.children.count == 3 {
|
||||
append(builder, "\n");
|
||||
|
||||
Reference in New Issue
Block a user