summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1998-07-21 19:58:53 -0400
committerGurusamy Sarathy <gsar@cpan.org>1998-08-02 06:26:57 +0000
commitaf819cba4f44bf2074ec4808e403dedf8c3ce2b2 (patch)
tree242fa243bf24d2cb1e544f0da4275b64fd508f2c /regexec.c
parentaab1f907125f90712decb35f2a57d7c7c35d30a2 (diff)
downloadperl-af819cba4f44bf2074ec4808e403dedf8c3ce2b2.tar.gz
better RE colors
Message-Id: <199807220358.XAA19811@monk.mps.ohio-state.edu> p4raw-id: //depot/maint-5.005/perl@1703
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/regexec.c b/regexec.c
index f8c5e7e997..e052912e10 100644
--- a/regexec.c
+++ b/regexec.c
@@ -318,11 +318,14 @@ regexec_flags(register regexp *prog, char *stringarg, register char *strend,
DEBUG_r(
PerlIO_printf(Perl_debug_log,
- "Matching `%.60s%s' against `%.*s%s'\n",
- prog->precomp,
+ "%sMatching%s `%s%.60s%s%s' against `%s%.*s%s%s'\n",
+ PL_colors[4],PL_colors[5],PL_colors[0],
+ prog->precomp,
+ PL_colors[1],
(strlen(prog->precomp) > 60 ? "..." : ""),
+ PL_colors[0],
(strend - startpos > 60 ? 60 : strend - startpos),
- startpos,
+ startpos, PL_colors[1],
(strend - startpos > 60 ? "..." : ""))
);
@@ -794,15 +797,21 @@ regmatch(regnode *prog)
int l = (PL_regeol - locinput > taill ? taill : PL_regeol - locinput);
int pref_len = (locinput - PL_bostr > (5 + taill) - l
? (5 + taill) - l : locinput - PL_bostr);
+ int pref0_len = pref_len - (locinput - PL_reginput);
if (l + pref_len < (5 + taill) && l < PL_regeol - locinput)
l = ( PL_regeol - locinput > (5 + taill) - pref_len
? (5 + taill) - pref_len : PL_regeol - locinput);
+ if (pref0_len < 0)
+ pref0_len = 0;
regprop(prop, scan);
PerlIO_printf(Perl_debug_log,
- "%4i <%s%.*s%s%s%s%.*s%s>%*s|%3d:%*s%s\n",
+ "%4i <%s%.*s%s%s%.*s%s%s%s%.*s%s>%*s|%3d:%*s%s\n",
locinput - PL_bostr,
- PL_colors[2], pref_len, locinput - pref_len, PL_colors[3],
+ PL_colors[4], pref0_len,
+ locinput - pref_len, PL_colors[5],
+ PL_colors[2], pref_len - pref0_len,
+ locinput - pref_len + pref0_len, PL_colors[3],
(docolor ? "" : "> <"),
PL_colors[0], l, locinput, PL_colors[1],
15 - l - pref_len + 1,