LibRegex: Add ECMAScriptRegex and migrate callers

Add `ECMAScriptRegex`, LibRegex's C++ facade for ECMAScript regexes.

The facade owns compilation, execution, captures, named groups, and
error translation for the Rust backend, which lets callers stop
depending on the legacy parser and matcher types directly. Use it in the
remaining non-LibJS callers: URLPattern, HTML input pattern handling,
and the places in LibHTTP that only needed token validation.

Where a full regex engine was unnecessary, replace those call sites with
direct character checks. Also update focused LibURL, LibHTTP, and WPT
coverage for the migrated callers and corrected surrogate handling.
This commit is contained in:
Andreas Kling
2026-03-25 10:52:20 +01:00
committed by Ali Mohammad Pur
parent 66fb0a8394
commit 34d954e2d7
Notes: github-actions[bot] 2026-03-27 16:35:21 +00:00
21 changed files with 394 additions and 104 deletions

View File

@@ -8,23 +8,4 @@
namespace JS::Bytecode {
RegexTableIndex RegexTable::insert(ParsedRegex parsed_regex)
{
Regex<ECMA262> regex(parsed_regex.regex, parsed_regex.pattern.to_byte_string(), parsed_regex.flags);
m_regexes.append(move(regex));
return m_regexes.size() - 1;
}
Regex<ECMA262> const& RegexTable::get(RegexTableIndex index) const
{
return m_regexes[index.value()];
}
void RegexTable::dump() const
{
outln("Regex Table:");
for (size_t i = 0; i < m_regexes.size(); i++)
outln("{}: {}", i, m_regexes[i].pattern_value);
}
}