: (REGEXP *)NULL)
#endif
+
+/* chars and strings used as regex pattern modifiers
+ * Singlular is a 'c'har, plural is a "string"
+ */
+#define EXEC_PAT_MOD 'e'
+#define KEEPCOPY_PAT_MOD 'k'
+#define ONCE_PAT_MOD 'o'
+#define GLOBAL_PAT_MOD 'g'
+#define CONTINUE_PAT_MOD 'c'
+#define MULTILINE_PAT_MOD 'm'
+#define SINGLE_PAT_MOD 's'
+#define IGNORE_PAT_MOD 'i'
+#define XTENDED_PAT_MOD 'x'
+
+#define ONCE_PAT_MODS "o"
+#define KEEPCOPY_PAT_MODS "k"
+#define EXEC_PAT_MODS "e"
+#define LOOP_PAT_MODS "gc"
+
+#define STD_PAT_MODS "msix"
+
+#define EXT_PAT_MODS ONCE_PAT_MODS KEEPCOPY_PAT_MODS
+#define QR_PAT_MODS STD_PAT_MODS EXT_PAT_MODS
+#define M_PAT_MODS QR_PAT_MODS LOOP_PAT_MODS
+#define S_PAT_MODS M_PAT_MODS EXEC_PAT_MODS
+
+
/*
* Because of backward compatibility reasons the PERL_UNUSED_DECL
* cannot be changed from postfix to PERL_UNUSED_DECL(x). Sigh.
const regexp * const re = (regexp *)mg->mg_obj;
if (!mg->mg_ptr) {
- const char *fptr = "msix";
+ const char *fptr = STD_PAT_MODS; /*"msix"*/
char reflags[7];
char ch;
bool hask = ((re->extflags & RXf_PMf_KEEPCOPY) == RXf_PMf_KEEPCOPY);
int left = 0;
int right = 4 + hask;
if (hask)
- reflags[left++]='k';
+ reflags[left++] = KEEPCOPY_PAT_MOD; /*'k'*/
while((ch = *fptr++)) {
if(reganch & 1) {
reflags[left++] = ch;
#define RXf_PMf_STD_PMMOD (RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_FOLD|RXf_PMf_EXTENDED)
#define RXf_PMf_COMPILETIME (RXf_PMf_MULTILINE|RXf_PMf_SINGLELINE|RXf_PMf_LOCALE|RXf_PMf_FOLD|RXf_PMf_EXTENDED|RXf_PMf_KEEPCOPY)
-#define CASE_STD_PMMOD_FLAGS_PARSE_SET(pmfl) \
- case 'i': *(pmfl) |= RXf_PMf_FOLD; break; \
- case 'm': *(pmfl) |= RXf_PMf_MULTILINE; break; \
- case 's': *(pmfl) |= RXf_PMf_SINGLELINE; break; \
- case 'x': *(pmfl) |= RXf_PMf_EXTENDED; break
+#define CASE_STD_PMMOD_FLAGS_PARSE_SET(pmfl) \
+ case IGNORE_PAT_MOD: *(pmfl) |= RXf_PMf_FOLD; break; \
+ case MULTILINE_PAT_MOD: *(pmfl) |= RXf_PMf_MULTILINE; break; \
+ case SINGLE_PAT_MOD: *(pmfl) |= RXf_PMf_SINGLELINE; break; \
+ case XTENDED_PAT_MOD: *(pmfl) |= RXf_PMf_EXTENDED; break
/* What we have seen */
#define RXf_LOOKBEHIND_SEEN 0x00020000
char c = (char)ch;
switch (c) {
CASE_STD_PMMOD_FLAGS_PARSE_SET(pmfl);
- case 'g': *pmfl |= PMf_GLOBAL; break;
- case 'c': *pmfl |= PMf_CONTINUE; break;
- case 'o': *pmfl |= PMf_KEEP; break;
- case 'k': *pmfl |= PMf_KEEPCOPY; break;
+ case GLOBAL_PAT_MOD: *pmfl |= PMf_GLOBAL; break;
+ case CONTINUE_PAT_MOD: *pmfl |= PMf_CONTINUE; break;
+ case ONCE_PAT_MOD: *pmfl |= PMf_KEEP; break;
+ case KEEPCOPY_PAT_MOD: *pmfl |= PMf_KEEPCOPY; break;
}
}
}
PMOP *pm;
char *s = scan_str(start,!!PL_madskills,FALSE);
const char * const valid_flags =
- (const char *)((type == OP_QR) ? "iomsxk" : "iogcmsxk");
+ (const char *)((type == OP_QR) ? QR_PAT_MODS : M_PAT_MODS);
#ifdef PERL_MAD
char *modstart;
#endif
if ((pm->op_pmflags & PMf_CONTINUE) && !(pm->op_pmflags & PMf_GLOBAL)
&& ckWARN(WARN_REGEXP))
{
- Perl_warner(aTHX_ packWARN(WARN_REGEXP), "Use of /c modifier is meaningless without /g" );
+ Perl_warner(aTHX_ packWARN(WARN_REGEXP),
+ "Use of /c modifier is meaningless without /g" );
}
pm->op_pmpermflags = pm->op_pmflags;
#endif
while (*s) {
- if (*s == 'e') {
+ if (*s == EXEC_PAT_MOD) {
s++;
es++;
}
- else if (strchr("iogcmsxk", *s))
+ else if (strchr(S_PAT_MODS, *s))
pmflag(&pm->op_pmflags,*s++);
else
break;