summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2009-09-10 19:28:20 +0200
committerYves Orton <demerphq@gmail.com>2009-09-10 19:28:20 +0200
commit2c2969659ae1c534e7f3fac9e7a7d186defd9943 (patch)
tree3ea479f5ab0da5eddba3922e1357279f21e41e7c /regexec.c
parent831a7dd792d2967a0cfe83bb0272cf0a346df76d (diff)
downloadperl-2c2969659ae1c534e7f3fac9e7a7d186defd9943.tar.gz
add more positive gofs GPOS tests and fix some bugs too
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/regexec.c b/regexec.c
index 56dfe121ab..8d9d171983 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1821,26 +1821,38 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, register char *stre
if (prog->extflags & RXf_GPOS_SEEN) { /* Need to set reginfo->ganch */
MAGIC *mg;
-
- if (flags & REXEC_IGNOREPOS) /* Means: check only at start */
+ if (flags & REXEC_IGNOREPOS){ /* Means: check only at start */
reginfo.ganch = startpos + prog->gofs;
- else if (sv && SvTYPE(sv) >= SVt_PVMG
+ DEBUG_GPOS_r(PerlIO_printf(Perl_debug_log,
+ "GPOS IGNOREPOS: reginfo.ganch = startpos + %"UVxf"\n",prog->gofs));
+ } else if (sv && SvTYPE(sv) >= SVt_PVMG
&& SvMAGIC(sv)
&& (mg = mg_find(sv, PERL_MAGIC_regex_global))
&& mg->mg_len >= 0) {
reginfo.ganch = strbeg + mg->mg_len; /* Defined pos() */
+ DEBUG_GPOS_r(PerlIO_printf(Perl_debug_log,
+ "GPOS MAGIC: reginfo.ganch = strbeg + %"IVdf"\n",mg->mg_len));
+
if (prog->extflags & RXf_ANCH_GPOS) {
if (s > reginfo.ganch)
goto phooey;
s = reginfo.ganch - prog->gofs;
+ DEBUG_GPOS_r(PerlIO_printf(Perl_debug_log,
+ "GPOS ANCH_GPOS: s = ganch - %"UVxf"\n",prog->gofs));
if (s < strbeg)
goto phooey;
}
}
else if (data) {
reginfo.ganch = strbeg + PTR2UV(data);
- } else /* pos() not defined */
+ DEBUG_GPOS_r(PerlIO_printf(Perl_debug_log,
+ "GPOS DATA: reginfo.ganch= strbeg + %"UVxf"\n",PTR2UV(data)));
+
+ } else { /* pos() not defined */
reginfo.ganch = strbeg;
+ DEBUG_GPOS_r(PerlIO_printf(Perl_debug_log,
+ "GPOS: reginfo.ganch = strbeg\n"));
+ }
}
if (PL_curpm && (PM_GETRE(PL_curpm) == rx)) {
/* We have to be careful. If the previous successful match