Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
joelreymont committed Nov 4, 2024
1 parent b1ed481 commit a2a7a71
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mecha.zig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,24 @@ pub fn Parser(comptime _T: type) type {
pub const mapConst = mecha.mapConst;
pub const map = mecha.map;
pub const opt = mecha.opt;

const Self = @This();

fn report(allocator: mem.Allocator, str: []const u8) Error!Result(T) {
var ctx = mecha.Context{};
Self.parse(allocator, &ctx, str) catch |e| {
if (e == error.ParserFailed) {
std.debug.print("Parser {s} ({s}:{d}:{d}) failed at position {d}", .{
ctx.loc.fn_name,
ctx.loc.file,
ctx.loc.line,
ctx.loc.column,
ctx.pos,
});
return e;
}
};
}
};
}

Expand Down

0 comments on commit a2a7a71

Please sign in to comment.