From af819cba4f44bf2074ec4808e403dedf8c3ce2b2 Mon Sep 17 00:00:00 2001 From: Ilya Zakharevich Date: Tue, 21 Jul 1998 19:58:53 -0400 Subject: better RE colors Message-Id: <199807220358.XAA19811@monk.mps.ohio-state.edu> p4raw-id: //depot/maint-5.005/perl@1703 --- regexec.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'regexec.c') 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, -- cgit v1.2.1