summaryrefslogtreecommitdiff
path: root/src/ninep/addr.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/ninep/addr.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/ninep/addr.zig')
-rw-r--r--src/ninep/addr.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ninep/addr.zig b/src/ninep/addr.zig
index f60c07b1..c052a665 100644
--- a/src/ninep/addr.zig
+++ b/src/ninep/addr.zig
@@ -299,7 +299,11 @@ pub const Addr = struct {
return null;
}
var rx = regexp_.Regex.compile(pat) catch |err| {
- a.err = if (err == error.Anchor) regexp_.Regex.e_anchor else e_regexp;
+ a.err = switch (err) {
+ error.Anchor => regexp_.Regex.e_anchor,
+ error.TooLong => regexp_.Regex.e_long,
+ error.Bad => e_regexp,
+ };
return null;
};
// sam's nextmatch (editors/sam/address.c:97-119): an empty match