Improve parser error handling

This commit is contained in:
Drew Galbraith 2023-08-29 15:57:09 -07:00
parent 7236c0b43a
commit cb5d7c7798
3 changed files with 42 additions and 10 deletions

View file

@ -67,8 +67,10 @@ fn run(allocator: std.mem.Allocator, bytes: []u8) !void {
.allocator = alloc,
};
const expression = try parse.expression();
// std.debug.print("AST: {}", .{expression.*});
expr.AstPrint(expression.*);
const expression = parse.parse();
if (err.hasError) {
return;
}
expr.AstPrint(expression);
std.debug.print("\n", .{});
}