From fa07370ea6cbd4be031bab2c14b24203ae329365 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 15:50:13 -0300 Subject: A pattern up to 512 characters compiles; a longer one is refused naming the limit mvzr's Regex holds 64 operations, so a pattern much past 64 bytes was refused as bad regular expression. pardes now compiles into mvzr's SizedRegex(512, 64), and a pattern that is too long (told apart from a malformed one by compiling it with room) says it is longer than mvzr's 512 operations. Co-Authored-By: Claude Opus 5.5 --- src/sam_edit.zig | 1 + 1 file changed, 1 insertion(+) (limited to 'src/sam_edit.zig') diff --git a/src/sam_edit.zig b/src/sam_edit.zig index a88728aa..113ad14f 100644 --- a/src/sam_edit.zig +++ b/src/sam_edit.zig @@ -445,6 +445,7 @@ 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.Bad => fail(ex.why, "bad regexp in {c} command", .{c}), }; } -- cgit v1.3