summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1998-12-03 20:02:03 -0500
committerGurusamy Sarathy <gsar@cpan.org>1999-02-01 07:09:20 +0000
commitbeed81117712f7512341eefdf74a027ce5d0e806 (patch)
tree09831647ee53c7ff752b2862fd596b6682c42fca /regexec.c
parent0fe9bf954933e342033b02b648d6eb9570aeb59a (diff)
downloadperl-beed81117712f7512341eefdf74a027ce5d0e806.tar.gz
Debugging REx with lookbehind
Message-Id: <199812040602.BAA07215@monk.mps.ohio-state.edu> p4raw-id: //depot/perl@2750
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/regexec.c b/regexec.c
index 9c1243ee28..f7210a0529 100644
--- a/regexec.c
+++ b/regexec.c
@@ -1172,6 +1172,12 @@ regmatch(regnode *prog)
int docolor = *PL_colors[0];
int taill = (docolor ? 10 : 7); /* 3 chars for "> <" */
int l = (PL_regeol - locinput > taill ? taill : PL_regeol - locinput);
+ /* The part of the string before starttry has one color
+ (pref0_len chars), between starttry and current
+ position another one (pref_len - pref0_len chars),
+ after the current position the third one.
+ We assume that pref0_len <= pref_len, otherwise we
+ decrease pref0_len. */
int pref_len = (locinput - PL_bostr > (5 + taill) - l
? (5 + taill) - l : locinput - PL_bostr);
int pref0_len = pref_len - (locinput - PL_reg_starttry);
@@ -1181,6 +1187,8 @@ regmatch(regnode *prog)
? (5 + taill) - pref_len : PL_regeol - locinput);
if (pref0_len < 0)
pref0_len = 0;
+ if (pref0_len > pref_len)
+ pref0_len = pref_len;
regprop(prop, scan);
PerlIO_printf(Perl_debug_log,
"%4i <%s%.*s%s%s%.*s%s%s%s%.*s%s>%*s|%3d:%*s%s\n",