This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Change to use mnemonic instead of char constant
authorKarl Williamson <public@khwilliamson.com>
Tue, 21 Sep 2010 00:26:33 +0000 (18:26 -0600)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 23 Sep 2010 05:48:08 +0000 (22:48 -0700)
The new '^' in (?^...) should really be a macro.

regcomp.c
regexp.h

index de95789..c080fcd 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4442,7 +4442,7 @@ Perl_re_compile(pTHX_ SV * const pattern, U32 pm_flags)
        SvFLAGS(rx) |= SvUTF8(pattern);
         *p++='('; *p++='?';
         if (has_minus) {    /* If a default, cover it using the caret */
-            *p++='^';
+            *p++= DEFAULT_PAT_MOD;
         }
         if (has_p)
             *p++ = KEEPCOPY_PAT_MOD; /*'p'*/
@@ -6120,7 +6120,8 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
                RExC_parse--; /* for vFAIL to print correctly */
                 vFAIL("Sequence (? incomplete");
                 break;
-            case '^':   /* Use default flags with the exceptions that follow */
+            case DEFAULT_PAT_MOD:   /* Use default flags with the exceptions
+                                      that follow */
                 has_use_defaults = TRUE;
                 STD_PMMOD_FLAGS_CLEAR(&RExC_flags);
                 goto parse_flags;
index 198b510..17f9983 100644 (file)
--- a/regexp.h
+++ b/regexp.h
@@ -247,6 +247,7 @@ and check for NULL.
  * for compatibility reasons with Regexp::Common which highjacked (?k:...)
  * for its own uses. So 'k' is out as well.
  */
+#define DEFAULT_PAT_MOD      '^'    /* Short for all the default modifiers */
 #define EXEC_PAT_MOD         'e'
 #define KEEPCOPY_PAT_MOD     'p'
 #define ONCE_PAT_MOD         'o'