Change 34766 by [EMAIL PROTECTED] on 2008/11/07 11:45:22

        Make sure inversion sign is shown in all anyof classes that we show in 
regprop
        
        And refactor the code that adds the extra braces into a macro, and make 
it support the colorization stuff.

Affected files ...

... //depot/perl/regcomp.c#673 edit

Differences ...

==== //depot/perl/regcomp.c#673 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#672~34755~   2008-11-06 10:48:28.000000000 -0800
+++ perl/regcomp.c      2008-11-07 03:45:22.000000000 -0800
@@ -8974,6 +8974,17 @@
 /*
 - regprop - printable representation of opcode
 */
+#define EMIT_ANYOF_TEST_SEPARATOR(do_sep,sv,flags) \
+STMT_START { \
+        if (do_sep) {                           \
+            Perl_sv_catpvf(aTHX_ sv,"%s][%s",PL_colors[1],PL_colors[0]); \
+            if (flags & ANYOF_INVERT)           \
+                /*make sure the invert info is in each */ \
+                sv_catpvs(sv, "^");             \
+            do_sep = 0;                         \
+        }                                       \
+} STMT_END
+
 void
 Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
 {
@@ -9142,6 +9153,8 @@
        Perl_sv_catpvf(aTHX_ sv, "[%s", PL_colors[0]);
        if (flags & ANYOF_INVERT)
            sv_catpvs(sv, "^");
+       
+       /* output what the standard cp 0-255 bitmap matches */
        for (i = 0; i <= 256; i++) {
            if (i < 256 && ANYOF_BITMAP_TEST(o,i)) {
                if (rangestart == -1)
@@ -9159,11 +9172,9 @@
                rangestart = -1;
            }
        }
-        if (do_sep) {
-            sv_catpvs(sv,"][");
-            do_sep = 0;
-        }
-            
+        
+        EMIT_ANYOF_TEST_SEPARATOR(do_sep,sv,flags);
+        /* output any special charclass tests (used mostly under use locale) */
        if (o->flags & ANYOF_CLASS)
            for (i = 0; i < (int)(sizeof(anyofs)/sizeof(char*)); i++)
                if (ANYOF_CLASS_TEST(o,i)) {
@@ -9171,11 +9182,9 @@
                    do_sep = 1;
                }
         
-        if (do_sep) {
-            sv_catpvs(sv,"][");
-            do_sep = 0;
-        }
-
+        EMIT_ANYOF_TEST_SEPARATOR(do_sep,sv,flags);
+        
+        /* output information about the unicode matching */
        if (flags & ANYOF_UNICODE)
            sv_catpvs(sv, "{unicode}");
        else if (flags & ANYOF_UNICODE_ALL)
End of Patch.

Reply via email to