From 855088127b85a7b03f3833b2274d4f26946f203d Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 20 Sep 2010 18:26:33 -0600 Subject: [PATCH 1/1] Change to use mnemonic instead of char constant The new '^' in (?^...) should really be a macro. --- regcomp.c | 5 +++-- regexp.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/regcomp.c b/regcomp.c index de95789..c080fcd 100644 --- 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; diff --git a/regexp.h b/regexp.h index 198b510..17f9983 100644 --- 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' -- 1.8.3.1