summaryrefslogtreecommitdiff
path: root/src/sam_edit.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 15:50:13 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitfa07370ea6cbd4be031bab2c14b24203ae329365 (patch)
tree6bcbf63c2f17ddd7f885d53fcc9eacf080377d1b /src/sam_edit.zig
parentc2e58c827bd8d2497c86b2eca23ac096cb972296 (diff)
downloadpardes-fa07370ea6cbd4be031bab2c14b24203ae329365.tar.gz
pardes-fa07370ea6cbd4be031bab2c14b24203ae329365.zip
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 <[email protected]>
Diffstat (limited to 'src/sam_edit.zig')
-rw-r--r--src/sam_edit.zig1
1 files changed, 1 insertions, 0 deletions
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}),
};
}