Optimize regex match iterator.

Reuse virtual machine and capture groups between matches.
This commit is contained in:
Jeroen van Rijn
2025-04-07 14:58:41 +02:00
parent c13b68f103
commit a5e513567b
3 changed files with 51 additions and 19 deletions
@@ -1126,9 +1126,8 @@ test_match_iterator :: proc(t: ^testing.T) {
testing.expect_value(t, err, nil)
(err == nil) or_continue
count: int
for capture, idx in regex.match(&it) {
if count > len(test.expected) {
if idx >= len(test.expected) {
break
}
check_capture(t, capture, test.expected[idx])