|NULLOK const regexp_engine* eng \
|NULLOK REGEXP *VOL old_re \
|NULLOK int *is_bare_re \
- |U32 rx_flags
+ |U32 rx_flags|U32 pm_flags
Ap |REGEXP*|re_compile |NN SV * const pattern|U32 orig_rx_flags
Ap |char* |re_intuit_start|NN REGEXP * const rx|NULLOK SV* sv|NN char* strpos \
|NN char* strend|const U32 flags \
#define parser_free(a) Perl_parser_free(aTHX_ a)
#define peep(a) Perl_peep(aTHX_ a)
#define pmruntime(a,b,c,d) Perl_pmruntime(aTHX_ a,b,c,d)
-#define re_op_compile(a,b,c,d,e,f,g) Perl_re_op_compile(aTHX_ a,b,c,d,e,f,g)
+#define re_op_compile(a,b,c,d,e,f,g,h) Perl_re_op_compile(aTHX_ a,b,c,d,e,f,g,h)
#define refcounted_he_chain_2hv(a,b) Perl_refcounted_he_chain_2hv(aTHX_ a,b)
#define refcounted_he_fetch_pv(a,b,c,d) Perl_refcounted_he_fetch_pv(aTHX_ a,b,c,d)
#define refcounted_he_fetch_pvn(a,b,c,d,e) Perl_refcounted_he_fetch_pvn(aTHX_ a,b,c,d,e)
assert(floor==0 || (pm->op_pmflags & PMf_HAS_CV));
if (is_compiletime) {
- U32 pm_flags = pm->op_pmflags &
- (RXf_PMf_COMPILETIME|PMf_HAS_CV|PMf_IS_QR);
+ U32 rx_flags = pm->op_pmflags & RXf_PMf_COMPILETIME;
regexp_engine *eng = current_re_engine();
if (o->op_flags & OPf_SPECIAL)
- pm_flags |= RXf_SPLIT;
+ rx_flags |= RXf_SPLIT;
if (!has_code || (eng && eng != &PL_core_reg_engine)) {
/* compile-time simple constant pattern */
pat = newSVpvn_flags(p, len, SVs_TEMP);
}
- PM_SETRE(pm, CALLREGCOMP(pat, pm_flags));
+ PM_SETRE(pm, CALLREGCOMP(pat, rx_flags));
#ifdef PERL_MAD
op_getmad(expr,(OP*)pm,'e');
#else
}
else {
/* compile-time pattern that includes literal code blocks */
- REGEXP* re =
- re_op_compile(NULL, 0, expr, NULL, NULL, NULL, pm_flags);
+ REGEXP* re = re_op_compile(NULL, 0, expr, NULL, NULL, NULL,
+ rx_flags, pm->op_pmflags);
PM_SETRE(pm, re);
if (pm->op_pmflags & PMf_HAS_CV) {
CV *cv;
new_re = re_op_compile(args, nargs, pm->op_code_list, eng, re,
&is_bare_re,
- (pm->op_pmflags & (RXf_PMf_COMPILETIME|PMf_HAS_CV|PMf_IS_QR)));
+ (pm->op_pmflags & RXf_PMf_COMPILETIME),
+ pm->op_pmflags);
if (pm->op_pmflags & PMf_HAS_CV)
((struct regexp *)SvANY(new_re))->qr_anoncv
= (CV*) SvREFCNT_inc(PAD_SV(PL_op->op_targ));
#define PERL_ARGS_ASSERT_RE_INTUIT_STRING \
assert(r)
-PERL_CALLCONV REGEXP* Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count, OP *expr, const regexp_engine* eng, REGEXP *VOL old_re, int *is_bare_re, U32 rx_flags);
+PERL_CALLCONV REGEXP* Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count, OP *expr, const regexp_engine* eng, REGEXP *VOL old_re, int *is_bare_re, U32 rx_flags, U32 pm_flags);
PERL_CALLCONV Malloc_t Perl_realloc(Malloc_t where, MEM_SIZE nbytes)
__attribute__malloc__
__attribute__warn_unused_result__;
typedef struct RExC_state_t {
- U32 flags; /* are we folding, multilining? */
+ U32 flags; /* RXf_* are we folding, multilining? */
+ U32 pm_flags; /* PMf_* stuff from the calling PMOP */
char *precomp; /* uncompiled string. */
REGEXP *rx_sv; /* The SV that is the regexp. */
regexp *rx; /* perl core regexp structure */
} RExC_state_t;
#define RExC_flags (pRExC_state->flags)
+#define RExC_pm_flags (pRExC_state->pm_flags)
#define RExC_precomp (pRExC_state->precomp)
#define RExC_rx_sv (pRExC_state->rx_sv)
#define RExC_rx (pRExC_state->rx)
SV *pat = pattern; /* defeat constness! */
PERL_ARGS_ASSERT_RE_COMPILE;
return Perl_re_op_compile(aTHX_ &pat, 1, NULL,
- NULL, NULL, NULL, rx_flags);
+ NULL, NULL, NULL, rx_flags, 0);
}
* arg list reduced (after overloading) to a single bare regex which has
* been returned (i.e. /$qr/).
*
+ * orig_rx_flags contains RXf_* flags. See perlreapi.pod for more details.
+ *
+ * pm_flags contains the PMf_* flags from the calling PMOP. Currently
+ * we're only interested in PMf_HAS_CV and PMf_IS_QR.
+ *
* We can't allocate space until we know how big the compiled form will be,
* but we can't compile it (and thus know how big it is) until we've got a
* place to put the code. So we cheat: we compile it twice, once with code
REGEXP *
Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count,
OP *expr, const regexp_engine* eng, REGEXP *VOL old_re,
- int *is_bare_re, U32 orig_rx_flags)
+ int *is_bare_re, U32 orig_rx_flags, U32 pm_flags)
{
dVAR;
REGEXP *rx;
RExC_precomp = exp;
RExC_flags = rx_flags;
+ RExC_pm_flags = pm_flags;
RExC_sawback = 0;
RExC_seen = 0;
RXi_SET( r, ri );
r->engine= RE_ENGINE_PTR;
r->extflags = rx_flags;
- if (orig_rx_flags & PMf_IS_QR) {
+ if (pm_flags & PMf_IS_QR) {
ri->code_blocks = pRExC_state->code_blocks;
ri->num_code_blocks = pRExC_state->num_code_blocks;
}
/* Second pass: emit code. */
RExC_flags = rx_flags; /* don't let top level (?i) bleed */
+ RExC_pm_flags = pm_flags;
RExC_parse = exp;
RExC_end = xend;
RExC_naughty = 0;
}
else {
n = add_data(pRExC_state, 1,
- (RExC_flags & PMf_HAS_CV) ? "L" : "l");
+ (RExC_pm_flags & PMf_HAS_CV) ? "L" : "l");
RExC_rxi->data->data[n] = (void*)o->op_next;
}
}