mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
LibRegex: Flatten capture group list in MatchState
This makes copying the capture group COWVector significantly cheaper, as we no longer have to run any constructors for it - just memcpy.
This commit is contained in:
parent
bbef0e8375
commit
76f5dce3db
Notes:
github-actions[bot]
2025-04-18 15:10:37 +00:00
Author: https://github.com/alimpfard
Commit: 76f5dce3db
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4375
14 changed files with 98 additions and 87 deletions
|
@ -228,7 +228,6 @@ PatternErrorOr<Component> Component::compile(Utf8View const& input, PatternParse
|
|||
auto flags = regex::RegexOptions<ECMAScriptFlags> {
|
||||
(regex::ECMAScriptFlags)regex::AllFlags::SingleMatch
|
||||
| (regex::ECMAScriptFlags)regex::AllFlags::Global
|
||||
| (regex::ECMAScriptFlags)regex::AllFlags::SkipTrimEmptyMatches
|
||||
| regex::ECMAScriptFlags::BrowserExtended
|
||||
};
|
||||
|
||||
|
@ -288,7 +287,7 @@ Component::Result Component::create_match_result(String const& input, regex::Reg
|
|||
// 4. Let index be 1.
|
||||
// 5. While index is less than Get(execResult, "length"):
|
||||
for (size_t index = 1; index <= exec_result.n_capture_groups; ++index) {
|
||||
auto const& capture = exec_result.capture_group_matches[0][index];
|
||||
auto const& capture = exec_result.capture_group_matches[0][index - 1];
|
||||
|
||||
// 1. Let name be component’s group name list[index − 1].
|
||||
auto name = group_name_list[index - 1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue