diff options
author | Ilya Zakharevich <ilya@math.berkeley.edu> | 1998-07-21 19:58:53 -0400 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-08-02 06:26:57 +0000 |
commit | af819cba4f44bf2074ec4808e403dedf8c3ce2b2 (patch) | |
tree | 242fa243bf24d2cb1e544f0da4275b64fd508f2c /regcomp.c | |
parent | aab1f907125f90712decb35f2a57d7c7c35d30a2 (diff) | |
download | perl-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 'regcomp.c')
-rw-r--r-- | regcomp.c | 53 |
1 files changed, 26 insertions, 27 deletions
@@ -730,8 +730,32 @@ pregcomp(char *exp, char *xend, PMOP *pm) FAIL("NULL regexp argument"); PL_regprecomp = savepvn(exp, xend - exp); - DEBUG_r(PerlIO_printf(Perl_debug_log, "compiling RE `%*s'\n", - xend - exp, PL_regprecomp)); + DEBUG_r( + if (!PL_colorset) { + int i = 0; + char *s = PerlEnv_getenv("PERL_RE_COLORS"); + + if (s) { + PL_colors[0] = s = savepv(s); + while (++i < 6) { + s = strchr(s, '\t'); + if (s) { + *s = '\0'; + PL_colors[i] = ++s; + } + else + PL_colors[i] = ""; + } + } else { + while (i < 6) + PL_colors[i++] = ""; + } + PL_colorset = 1; + } + ); + DEBUG_r(PerlIO_printf(Perl_debug_log, "%sCompiling%s RE `%s%*s%s'\n", + PL_colors[4],PL_colors[5],PL_colors[0], + xend - exp, PL_regprecomp, PL_colors[1])); PL_regflags = pm->op_pmflags; PL_regsawback = 0; @@ -755,31 +779,6 @@ pregcomp(char *exp, char *xend, PMOP *pm) } DEBUG_r(PerlIO_printf(Perl_debug_log, "size %d ", PL_regsize)); - DEBUG_r( - if (!PL_colorset) { - int i = 0; - char *s = PerlEnv_getenv("TERMCAP_COLORS"); - - PL_colorset = 1; - if (s) { - PL_colors[0] = s = savepv(s); - while (++i < 4) { - s = strchr(s, '\t'); - if (!s) - FAIL("Not enough TABs in TERMCAP_COLORS"); - *s = '\0'; - PL_colors[i] = ++s; - } - } else { - while (i < 4) - PL_colors[i++] = ""; - } - /* Reset colors: */ - PerlIO_printf(Perl_debug_log, "%s%s%s%s", - PL_colors[0],PL_colors[1],PL_colors[2],PL_colors[3]); - } - ); - /* Small enough for pointer-storage convention? If extralen==0, this means that we will not need long jumps. */ if (PL_regsize >= 0x10000L && PL_extralen) |