regcomp.c: Change debug dump of bitmap/non-bitmap
authorKarl Williamson <public@khwilliamson.com>
Thu, 5 Jan 2012 20:17:19 +0000 (13:17 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 13 Jan 2012 16:58:37 +0000 (09:58 -0700)
Instead of '...' separating the two components of the output, change it
to a single space, which is output only if the first component isn't
null.

regcomp.c

index 0cca900..6904be8 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -11928,6 +11928,8 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
        if (ANYOF_NONBITMAP(o)) {
            SV *lv; /* Set if there is something outside the bit map */
            SV * const sw = regclass_swash(prog, o, FALSE, &lv, 0);
+            bool byte_output = FALSE;   /* If something in the bitmap has been
+                                           output */
 
            if (lv && lv != &PL_sv_undef) {
                if (sw) {
@@ -11940,6 +11942,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
                            if (rangestart == -1)
                                rangestart = i;
                        } else if (rangestart != -1) {
+                            byte_output = TRUE;
                            if (i <= rangestart + 3)
                                for (; rangestart < i; rangestart++) {
                                    put_byte(sv, rangestart);
@@ -11952,8 +11955,6 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
                            rangestart = -1;
                        }
                    }
-
-                   sv_catpvs(sv, "..."); /* et cetera */
                }
 
                {
@@ -11966,6 +11967,10 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
                    if (*s == '\n') {
                        const char * const t = ++s;
 
+                        if (byte_output) {
+                            sv_catpvs(sv, " ");
+                        }
+
                        while (*s) {
                            if (*s == '\n')
                                *s = ' ';