Don't include captures of last match from `to` combinator.

This commit is contained in:
Calvin Rose 2022-04-29 19:21:10 -05:00
parent a895219d2f
commit 9fa945ad93
1 changed files with 4 additions and 1 deletions

View File

@ -289,7 +289,10 @@ tail:
while (text <= s->text_end) {
CapState cs2 = cap_save(s);
next_text = peg_rule(s, rule_a, text);
if (next_text) break;
if (next_text) {
if (rule[0] == RULE_TO) cap_load(s, cs2);
break;
}
cap_load(s, cs2);
text++;
}