feat: add multi-engine regex flavour support

This commit is contained in:
2026-07-27 11:43:51 +02:00
parent 7079cde15f
commit 7f3a91ad37
340 changed files with 643286 additions and 483 deletions

25
engines/rust/README.md Normal file
View File

@@ -0,0 +1,25 @@
# Rust regex WebAssembly engine
This directory builds the actual Rust `regex` crate 1.13.1 for
`wasm32-unknown-unknown` with Rust 1.97.1 and wasm-bindgen 0.2.126.
The fixed bridge accepts JSON values only. The adapter measures the exact
encoded request size, and the native cap includes JSON's worst-case sixfold
escaping for every accepted string field. It exposes native UTF-8 byte offsets,
capture names, iteration, and `Captures::expand` replacement syntax. It does
not evaluate user values as Rust or JavaScript source.
Replacement uses a bounded streaming implementation of
`Captures::expand` grammar. Load-time differential fixtures compare it with
the native API, and capture references stop expanding as soon as the UTF-8
output cap is reached.
The bounded bytes cross the JSON bridge as base64, so control-heavy output has
a fixed 4:3 transport expansion instead of JSON's content-dependent escaping.
Flags `i`, `m`, `s`, `U`, `x`, and `R` map directly to `RegexBuilder`.
Unicode is the crate's native default; the accepted `u` flag explicitly
affirms that default. `g` selects the crate's native iterator.
The crate deliberately excludes look-around and backreferences. Compile-size,
DFA-cache, pattern, subject, match, capture-row, and output limits are enforced
inside the module. Replacement output is clipped only at a UTF-8 boundary.