Bugfix for left recursion
This commit is contained in:
parent
892708a651
commit
e071ac7b12
2
match.c
2
match.c
@ -667,7 +667,9 @@ static match_t *match(match_ctx_t *ctx, const char *str, pat_t *pat)
|
||||
while (1) {
|
||||
const char *prev = m->end;
|
||||
rec_op.args.leftrec.match = m;
|
||||
ctx2.cache = &(cache_t){0};
|
||||
match_t *m2 = match(&ctx2, str, ref);
|
||||
cache_destroy(&ctx2);
|
||||
if (!m2) break;
|
||||
if (m2->end <= prev) {
|
||||
recycle_match(&m2);
|
||||
|
1
tests/29-left-recursion3.in
Normal file
1
tests/29-left-recursion3.in
Normal file
@ -0,0 +1 @@
|
||||
f!!!
|
1
tests/29-left-recursion3.out
Normal file
1
tests/29-left-recursion3.out
Normal file
@ -0,0 +1 @@
|
||||
{f!!!}
|
2
tests/29-left-recursion3.sh
Normal file
2
tests/29-left-recursion3.sh
Normal file
@ -0,0 +1,2 @@
|
||||
# Left recursion has some tricky edge cases like this:
|
||||
bp -p 'shout: phrase `!; phrase: shout / id; phrase => "{@0}"'
|
Loading…
Reference in New Issue
Block a user