}
} break;
- case bh_allocator_action_free:
- case bh_allocator_action_resize:
- // Do nothing
- break;
+ case bh_allocator_action_free: break;
+
+ case bh_allocator_action_resize: {
+ if (size > scratch->end - scratch->memory) {
+ return NULL;
+ }
+
+ retval = scratch->curr;
+ scratch->curr += size;
+
+ if (scratch->curr >= scratch->end) {
+ scratch->curr = scratch->memory;
+ retval = scratch->curr;
+ }
+
+ // HACK!!!!!: Using size instead of some kind of "old size"
+ memcpy(retval, prev_memory, size);
+ } break;
}
return retval;
onyx_message_print(&msgs);
goto main_exit;
} else {
- // onyx_ast_print(program, 0);
+ onyx_ast_print(program, 0);
bh_printf("\nNo errors.\n");
}
static OnyxAstNode* parse_expression(OnyxParser* parser) {
bh_arr(OnyxAstNode*) tree_stack = NULL;
- bh_arr_new(global_scratch_allocator, tree_stack, 4);
+ bh_arr_new(global_scratch_allocator, tree_stack, 1);
bh_arr_set_length(tree_stack, 0);
OnyxAstNode* left = parse_factor(parser);