1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:57:35 +00:00

LibRegex: Make FailForks fail all forks up to the last save point

This makes negative lookarounds with more than one fork behave
correctly.
Fixes #11350.
This commit is contained in:
Ali Mohammad Pur 2021-12-25 05:35:09 +03:30 committed by Andreas Kling
parent 105d558922
commit 1a35e27490
4 changed files with 30 additions and 15 deletions

View file

@ -514,6 +514,7 @@ struct MatchInput {
mutable size_t fail_counter { 0 };
mutable Vector<size_t> saved_positions;
mutable Vector<size_t> saved_code_unit_positions;
mutable Vector<size_t> saved_forks_since_last_save;
mutable HashMap<u64, u64> checkpoints;
mutable Optional<size_t> fork_to_replace;
};
@ -524,6 +525,7 @@ struct MatchState {
size_t string_position_in_code_units { 0 };
size_t instruction_position { 0 };
size_t fork_at_position { 0 };
size_t forks_since_last_save { 0 };
Optional<size_t> initiating_fork;
Vector<Match> matches;
Vector<Vector<Match>> capture_group_matches;