Files
rust_browser/crates/js_vm/Cargo.toml
Zachary D. Rowitsch a42d1b4718 Add JavaScript RegExp support with regex literals, constructor, and String integration
Implement full RegExp support using the `regress` crate for ECMAScript-compatible
regex semantics. This includes parser-driven regex literal disambiguation,
RegExp constructor, prototype methods (test, exec, toString), and String method
integration (match, search, replace, split with regex args).

Key implementation details:
- Parser rescans source from `/` in expression-start position via scan_regexp()
- RegExpData stored as PrimitiveValue internal slot on JsObject
- Flags sorted in canonical ECMAScript order (d g i m s u v y)
- NativeFn signature upgraded to return Result for proper error propagation
- Unicode-safe: char_indices iteration in scanner, char-based offset conversion
  for exec().index, search(), and lastIndex
- $-substitution patterns in replace ($&, $$, $`, $', $n, $nn)

92 unit tests covering parsing, properties, test/exec/constructor, toString,
String method integration, and error cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 10:13:41 -05:00

217 B