From e3e605bd33fc5be56cb7ec842449718bc5337a75 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 17:46:11 -0300 Subject: A class with non-ASCII runes matches them: [éa-z] is taken as (é|[a-z]), a range up to 256 runes spelled out MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mvzr's classes hold bytes, and it refused a multibyte member as a bad expression. Rewriting the class before compiling, as ^a|^b already is, needs no mvzr patch; runes that differ only in their last byte go as one alternative (\xc3[\xa0-\xbf] for [à-ÿ]) so a 256-rune range fits the 512-operation limit, which counts the pattern as rewritten. A wider range and [^é] are refused, naming why. Co-Authored-By: Claude Opus 5.5 --- src/sam_edit.zig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/sam_edit.zig') diff --git a/src/sam_edit.zig b/src/sam_edit.zig index ea1105bd..0f317a83 100644 --- a/src/sam_edit.zig +++ b/src/sam_edit.zig @@ -461,6 +461,8 @@ const Exec = struct { 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.Bad => fail(ex.why, "bad regexp in {c} command", .{c}), }; } -- cgit v1.3