Change 31417 by [EMAIL PROTECTED] on 2007/06/18 15:10:32
[perl #43159] 5.9.4 regexp capturing wrongly
change #28398 accidently made the last branch of an alternation
not restore the paren state after failure backtrack. Fix this by
removing the last-branch-skips-pushing-a-state optimisation.
Affected files ...
... //depot/perl/regexec.c#542 edit
... //depot/perl/t/op/re_tests#123 edit
Differences ...
==== //depot/perl/regexec.c#542 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#541~31408~ 2007-06-17 17:00:30.000000000 -0700
+++ perl/regexec.c 2007-06-18 08:10:32.000000000 -0700
@@ -4219,12 +4219,6 @@
case BRANCH: /* /(...|A|...)/ */
scan = NEXTOPER(scan); /* scan now points to inner node */
- if ((!next || (OP(next) != BRANCH && OP(next) != BRANCHJ))
- && !has_cutgroup)
- {
- /* last branch; skip state push and jump direct to node */
- continue;
- }
ST.lastparen = *PL_reglastparen;
ST.next_branch = next;
REGCP_SET(ST.cp);
==== //depot/perl/t/op/re_tests#123 (text) ====
Index: perl/t/op/re_tests
--- perl/t/op/re_tests#122~31408~ 2007-06-17 17:00:30.000000000 -0700
+++ perl/t/op/re_tests 2007-06-18 08:10:32.000000000 -0700
@@ -1327,3 +1327,4 @@
.*\z foo\n y - -
^(?:(\d)x)?\d$ 1 y ${\(defined($1)?1:0)} 0
+.*?(?:(\w)|(\w))x abx y $1-$2 b-
End of Patch.