2019-09-18 18:59:11 +00:00
|
|
|
const std = @import("std");
|
|
|
|
|
2019-09-20 16:16:55 +00:00
|
|
|
pub fn report(line: usize, where: []const u8, ctx_opt: ?[]const u8, message: []const u8) void {
|
|
|
|
if (ctx_opt) |ctx| {
|
|
|
|
std.debug.warn("[line {}] Error{} on {}: {}", line, where, ctx, message);
|
|
|
|
} else {
|
|
|
|
std.debug.warn("[line {}] Error{}: {}", line, where, message);
|
|
|
|
}
|
2019-09-18 18:59:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn reportN(line: usize, message: []const u8) void {
|
|
|
|
report(line, "", message);
|
|
|
|
}
|
|
|
|
|
2019-09-20 16:16:55 +00:00
|
|
|
pub fn reportFmt(line: usize, ctx_opt: ?[]const u8, comptime fmt: []const u8, args: ...) void {
|
|
|
|
if (ctx_opt) |ctx| {
|
|
|
|
std.debug.warn("[line {}] Error on {}", line, ctx);
|
|
|
|
} else {
|
|
|
|
std.debug.warn("[line {}] Error", line);
|
|
|
|
}
|
|
|
|
|
2019-09-18 18:59:11 +00:00
|
|
|
std.debug.warn(fmt, args);
|
|
|
|
std.debug.warn("\n");
|
|
|
|
}
|