lang F0.1: extractContext utility for diagnostic renderer
Adds LineInfo, ContextLines, and extractContext(allocator, source, span) to errors.zig — a pure utility that returns the source lines covered by a span plus columns for caret rendering. Prereq for F0.2's new render path which will produce Rust-style multi-line diagnostics with code excerpts. 8 unit tests cover the boundary cases: single-line span, multi-line spans (1 and 2 newlines crossed), span on an empty line, span at end-of-file without trailing newline, empty source, and offsets beyond source.len (clamping). No render surface change yet; F0.2 wires this into a new render mode kept behind a RenderStyle flag so old gcc-style output remains available during the transition.
This commit is contained in:
@@ -7,6 +7,7 @@ pub const types = @import("types.zig");
|
||||
pub const target = @import("target.zig");
|
||||
pub const builtins = @import("builtins.zig");
|
||||
pub const errors = @import("errors.zig");
|
||||
pub const errors_tests = @import("errors.test.zig");
|
||||
pub const sema = @import("sema.zig");
|
||||
pub const imports = @import("imports.zig");
|
||||
pub const core = @import("core.zig");
|
||||
|
||||
Reference in New Issue
Block a user