Files

C++ regex engine

This bridge executes patterns with the std::wregex implementation shipped in Emscripten 6.0.4's libc++. The default grammar is the C++ standard library's modified ECMAScript grammar; it is not presented as modern browser ECMAScript.

The fixed Embind entry points accept structured values only. User patterns, subjects and replacement templates are passed as data and are never evaluated as JavaScript or C++ source. The worker remains subject to Regex Tools' hard timeout and result limits.

Replacement is streamed through the output byte limit with libc++ match_results::format default grammar. A load-time differential self-test compares bounded fixture output with the native API; capture amplification never materializes a whole per-match expansion.

Build with the pinned Emscripten checkout:

node scripts/cpp-engine-pack.mjs --empp /absolute/path/to/em++
node scripts/install-cpp-engine.mjs

The builder enables wasm-ld --trace and accepts only the reviewed archive set. The generated SOURCE-MANIFEST.json records the exact Emscripten, emsdk and LLVM identities; maps the selected Emscripten runtime, musl 1.2.6, emmalloc, compiler-rt 22.1.8, libc++ 21.1.8 and libc++abi 21.1.8 sources to their pinned legal files; and records that JavaScript exceptions select no libunwind object. The libunwind legal text is retained so that exclusion stays explicit and reviewable.

Native positions are Unicode code-point offsets because the bridge deliberately uses 32-bit wchar_t; the TypeScript adapter preserves them and separately normalizes editor ranges to UTF-16.