mymarkdown

My markdown
git clone https://git.grace.moe/mymarkdown
Log | Files | Refs

commit c310fb63ca2691020956ef1292add8e87b194304
parent 200b8c58cce70c76e5665ff48fd52f1ba9938ef5
Author: gracefu <81774659+gracefuu@users.noreply.github.com>
Date:   Thu, 22 May 2025 03:32:48 +0800

change elaboration error source location

Diffstat:
Msrc/AstGen3.zig | 2+-
Msrc/test.zig | 9+++++++++
Msrc/test/elaboration.my.ast | 4++--
3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/AstGen3.zig b/src/AstGen3.zig @@ -501,7 +501,7 @@ fn parseColumn( const elaboratable_idx, const required_marker_len = elab; const block_idx = self.appendAssumeCapacityContainerNode(elaboratable_idx, .elaboration, line.ptr); if (marker_len != required_marker_len) - try self.appendNodeError(.incorrect_elaboration_marker, elaboratable_idx); + try self.appendNodeError(.incorrect_elaboration_marker, block_idx); break :blk block_idx; } else blk: { const block_idx = self.appendAssumeCapacityContainerNode(parent_idx, .elaboration, line.ptr); diff --git a/src/test.zig b/src/test.zig @@ -41,11 +41,20 @@ fn testSnapshot(comptime path: []const u8) !void { try wrong_file.writer().writeAll(output_instance.items); std.debug.print( \\Snapshot test for {[path]s} failed. + \\ \\Generated output written to {[wrong_path]s}. \\If changes are expected, copy {[wrong_path]s} to {[snapshot_path]s}. + \\ + \\Diff changes with your favourite diff viewer: + \\ \\ diff {[snapshot_path]s} {[wrong_path]s} + \\ git diff --no-index -- {[snapshot_path]s} {[wrong_path]s} + \\ + \\If changes are expected: + \\ \\ mv {[wrong_path]s} {[snapshot_path]s} \\ + \\ , .{ .path = path, .wrong_path = wrong_path, .snapshot_path = snapshot_path }); return error.TestFailed; } diff --git a/src/test/elaboration.my.ast b/src/test/elaboration.my.ast @@ -33,24 +33,24 @@ "subtitle" .list .unordered_item - .error .incorrect_elaboration_marker .marker "-" .text "a" .elaboration + .error .incorrect_elaboration_marker .marker "++" .paragraph .text "bb" .unordered_item - .error .incorrect_elaboration_marker .marker "--" .text "ccc" .elaboration + .error .incorrect_elaboration_marker .marker "+" .paragraph