mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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:
committed by
Ali Mohammad Pur
parent
66fb0a8394
commit
34d954e2d7
Notes:
github-actions[bot]
2026-03-27 16:35:21 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/34d954e2d70 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8612 Reviewed-by: https://github.com/jdahlin Reviewed-by: https://github.com/trflynn89
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user