This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix paren unwinding with CURLYN, CURLYM
authorDavid Mitchell <davem@iabyn.com>
Sat, 16 Jun 2012 12:56:50 +0000 (13:56 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sat, 16 Jun 2012 13:09:41 +0000 (14:09 +0100)
Historically, CURLYN and CURLYM didn't restore lastparen ($+) nor
invalidate higher numbered paren slots (reg->offs[n].end = -1)
when backtracking.

Recent commit f6033a9d6c91e0c29d5aa5049361a529b5d7cdc4 fixed the lastparen
issue, but then exposed the offs[n].end issue, which had previously been
masked by the too-high lastparen value causing a previous state (such as a
branch) to conveniently wipe out the offending parens on further
backtracking.

Or to put it another way, each backtracker should be expected to clean up
his own mess, not hope that someone previous to him will do it for him.

Fix this by doing the .end = 1 stuff on CURLYN,M failure as well as
BRANCH/TRIE. For consistency, define a new macro to do it.


No differences found