From a92951b11ab3aa2cdf759b3b743f8af006c21b95 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 00:03:55 -0300 Subject: regexp, sam_edit, ninep/addr: a pattern's compile error is told by Regex.message(err), which replaces the five e_ constants and the two switches that mapped errors onto them Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/sam_edit.zig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/sam_edit.zig') diff --git a/src/sam_edit.zig b/src/sam_edit.zig index b06379f9..a6ed5772 100644 --- a/src/sam_edit.zig +++ b/src/sam_edit.zig @@ -611,15 +611,11 @@ const Exec = struct { fn compile(ex: *Exec, pat: []const u8, c: u8) Failure!regexp.Regex { return regexp.Regex.compile(pat) catch |err| switch (err) { - error.Anchor => fail(ex.why, "{s}", .{regexp.Regex.e_anchor}), - error.TooLong => fail(ex.why, "{s}", .{regexp.Regex.e_long}), - error.WideRange => fail(ex.why, "{s}", .{regexp.Regex.e_wide}), - error.NegatedRunes => fail(ex.why, "{s}", .{regexp.Regex.e_negated}), - error.Mixed => fail(ex.why, "{s}", .{regexp.Regex.e_mixed}), error.Bad => if (c == '"' or c == 'X' or c == 'Y') fail(ex.why, "bad regexp in file match", .{}) else fail(ex.why, "bad regexp in {c} command", .{c}), + else => fail(ex.why, "{s}", .{regexp.Regex.message(err)}), }; } -- cgit v1.3