From 8dc9a978fc2b0d01c20270b1b690e815e74fdcc7 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Mon, 4 May 2026 16:40:38 +0200 Subject: feat(lexer): error contains line --- src/root.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/root.zig') diff --git a/src/root.zig b/src/root.zig index 30386e9..cef8519 100644 --- a/src/root.zig +++ b/src/root.zig @@ -53,7 +53,7 @@ const typdown_Document = extern struct { const typdown_Error = extern struct { code: u8, - location: extern struct { beg: usize, end: usize }, + location: extern struct { beg: usize, end: usize, line: usize }, }; }; @@ -65,7 +65,7 @@ fn from(alloc: Allocator, doc: Document) typdown_Document { for (errors) |err| { res.errors.?[0] = .{ .code = getErrorCode(err.err), - .location = .{ .beg = err.location.beg, .end = err.location.end }, + .location = .{ .beg = err.location.beg, .end = err.location.end, .line = err.location.line }, }; } res.errors_len = errors.len; @@ -75,7 +75,7 @@ fn from(alloc: Allocator, doc: Document) typdown_Document { fn fromError(alloc: Allocator, err: Error) typdown_Document { var v = alloc.alloc(typdown_Document.typdown_Error, 1) catch |e| @panic(@errorName(e)); - v[0] = .{ .code = getErrorCode(err), .location = .{ .beg = 0, .end = 0 } }; + v[0] = .{ .code = getErrorCode(err), .location = .{ .beg = 0, .end = 0, .line = 0 } }; return .{ .errors = v.ptr, .errors_len = 1 }; } -- cgit v1.2.3