Commit Graph
4 Commits
Author SHA1 Message Date
Adrià Arrufat 90487270ba findElement: the name filter is one union; a literal is one by grammar
A name is a substring or a regex, never both, so the filter says so
instead of carrying two optionals the caller has to null against each
other. Whether `/.../x` is a literal is now decided by JavaScript's flag
alphabet rather than "looks like letters", which stops `/usr/bin` from
being read as a pattern with flags. Comments that narrated callers or
the type name are gone; the literal parser gets its own test in place
of two MCP round-trips.
2026-09-16 09:38:42 +02:00
Adrià Arrufat 5710f1d684 findElement: accept the flags of a JavaScript regex literal
A model that writes `/spice/i` should not be told the name has a
stray `i` in it. `i` and `u` are already how names match, `s` and `m`
map to their PCRE2 options, and any other letter is a tool error that
names it. Text after the closing slash that is not a letter makes the
whole thing a plain substring again.
2026-09-16 09:29:18 +02:00
Adrià Arrufat 35dbda3686 Regex: compile through the context
The context is what a pattern is compiled against, so `compile` reads
better as its method than as a free function taking it first.
2026-09-16 09:28:45 +02:00
Adrià Arrufat d2f72a9fa9 Regex: share the PCRE2 wrapper beyond adblock
Compiled patterns are useful anywhere someone else writes the pattern:
the adblock lists today, agent tool arguments next. The wrapper moves
out of the adblock directory and gains an options struct (case, UTF-8
subjects) and a compile diagnostic the caller can log or show. The App
owns the one context every consumer compiles through, the blocker
included.
2026-09-15 09:33:39 +02:00