summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorMoritz Lenz <moritz@casella.verplant.org>2008-01-05 18:14:37 +0100
committerYves Orton <demerphq@gmail.com>2008-01-05 20:35:26 +0000
commit0357f1fd55a0c9e8fad7103cf9d7638747f9d9ee (patch)
tree671591ff1e3bb7f36ef2827bda0b23a995619157 /regexec.c
parent9d6c4c89d7abc4ff8da33eead5dcb715c685a2e8 (diff)
downloadperl-0357f1fd55a0c9e8fad7103cf9d7638747f9d9ee.tar.gz
Fix regexec.c so $^N and $+ are correctly updated so that they work properly inside of (?{...}) blocks as reported by Moritz Lenz in
Subject: Bugs in extended regexp features Message-ID: <477FACED.4000505@casella.verplant.org> p4raw-id: //depot/perl@32857
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/regexec.c b/regexec.c
index e6527f5129..64966941c7 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3807,8 +3807,12 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
PL_regoffs = re->offs; /* essentially NOOP on GOSUB */
- *PL_reglastparen = 0;
- *PL_reglastcloseparen = 0;
+ /* see regtry, specifically PL_reglast(?:close)?paren is a pointer! (i dont know why) :dmq */
+ PL_reglastparen = &re->lastparen;
+ PL_reglastcloseparen = &re->lastcloseparen;
+ re->lastparen = 0;
+ re->lastcloseparen = 0;
+
PL_reginput = locinput;
PL_regsize = 0;
@@ -3851,6 +3855,10 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
regcpblow(ST.cp);
cur_eval = ST.prev_eval;
cur_curlyx = ST.prev_curlyx;
+
+ PL_reglastparen = &rex->lastparen;
+ PL_reglastcloseparen = &rex->lastcloseparen;
+
/* XXXX This is too dramatic a measure... */
PL_reg_maxiter = 0;
if ( nochange_depth )
@@ -3865,6 +3873,9 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog)
SETREX(rex_sv,ST.prev_rex);
rex = (struct regexp *)SvANY(rex_sv);
rexi = RXi_GET(rex);
+ PL_reglastparen = &rex->lastparen;
+ PL_reglastcloseparen = &rex->lastcloseparen;
+
PL_reginput = locinput;
REGCP_UNWIND(ST.lastcp);
regcppop(rex);