+
+pub fn parseError(allocator: Allocator, token: Token, message: []const u8) !void {
+ if (token.type == .eof) {
+ try report(token.line, " at end", message);
+ } else {
+ try report(token.line, try std.fmt.allocPrint(allocator, " at '{s}'", .{token.lexeme}), message);
+ }
+}
+
+pub fn runtimeError(err: ErrorPayload) !void {
+ try stderr.print("{s}\n[line {}]\n", .{ err.message, err.token.line });
+ try stderr.flush();
+ hadRuntimeError = true;
+}