1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-30 15:13:03 +00:00
Allow for a zero length match at the end of a string when using the
to or thru combinators.
This commit is contained in:
Calvin Rose
2021-02-19 16:10:03 -06:00
parent 92928d5c4f
commit 742469a8bc
2 changed files with 10 additions and 2 deletions

View File

@@ -286,7 +286,7 @@ tail:
const uint8_t *next_text;
CapState cs = cap_save(s);
down1(s);
while (text < s->text_end) {
while (text <= s->text_end) {
CapState cs2 = cap_save(s);
next_text = peg_rule(s, rule_a, text);
if (next_text) {
@@ -296,7 +296,7 @@ tail:
text++;
}
up1(s);
if (text >= s->text_end) {
if (text > s->text_end) {
cap_load(s, cs);
return NULL;
}