mirror of
https://github.com/janet-lang/janet
synced 2025-08-03 12:35:21 +00:00
Get rid of early termination rule in all finite loops.
This commit is contained in:
parent
d30fd27575
commit
6da44bdb6a
@ -342,8 +342,8 @@ tail:
|
|||||||
while (captured < hi) {
|
while (captured < hi) {
|
||||||
CapState cs2 = cap_save(s);
|
CapState cs2 = cap_save(s);
|
||||||
next_text = peg_rule(s, rule_a, text);
|
next_text = peg_rule(s, rule_a, text);
|
||||||
if (!next_text || next_text == text) {
|
if (!next_text || ((next_text == text) && (hi == UINT32_MAX))) {
|
||||||
if (!next_text || captured > 0) cap_load(s, cs2);
|
cap_load(s, cs2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
captured++;
|
captured++;
|
||||||
|
@ -789,13 +789,16 @@
|
|||||||
"abc123"
|
"abc123"
|
||||||
@["abc123"])
|
@["abc123"])
|
||||||
|
|
||||||
# Issue 1554
|
# Issue 1554 - 0-width match termination behavior
|
||||||
(test "issue 1554 case 1" '(any (> '1)) "abc" @["a"])
|
(test "issue 1554 case 1" '(any (> '1)) "abc" @[])
|
||||||
(test "issue 1554 case 2" '(any (? (> '1))) "abc" @["a"])
|
(test "issue 1554 case 2" '(any (? (> '1))) "abc" @[])
|
||||||
(test "issue 1554 case 3" '(any (> (? '1))) "abc" @["a"])
|
(test "issue 1554 case 3" '(any (> (? '1))) "abc" @[])
|
||||||
(test "issue 1554 case 4" '(* "a" (> '1)) "abc" @["b"])
|
(test "issue 1554 case 4" '(* "a" (> '1)) "abc" @["b"])
|
||||||
(test "issue 1554 case 5" '(* "a" (? (> '1))) "abc" @["b"])
|
(test "issue 1554 case 5" '(* "a" (? (> '1))) "abc" @["b"])
|
||||||
(test "issue 1554 case 6" '(* "a" (> (? '1))) "abc" @["b"])
|
(test "issue 1554 case 6" '(* "a" (> (? '1))) "abc" @["b"])
|
||||||
|
(test "issue 1554 case 7" '(between 0 2 (> '1)) "abc" @["a" "a"])
|
||||||
|
(test "issue 1554 case 8" '(between 2 3 (? (> '1))) "abc" @["a" "a" "a"])
|
||||||
|
(test "issue 1554 case 9" '(between 0 0 (> (? '1))) "abc" @[])
|
||||||
|
|
||||||
(end-suite)
|
(end-suite)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user