/* FALL THROUGH */
case OP_PUSHRE:
case OP_MATCH:
+ case OP_QR:
ReREFCNT_dec(cPMOPo->op_pmregexp);
break;
}
}
/* FALL THROUGH */
case OP_MATCH:
+ case OP_QR:
case OP_SUBST:
case OP_NULL:
default:
break;
default:
case OP_MATCH:
+ case OP_QR:
case OP_SUBST:
case OP_NULL:
if (!(o->op_flags & OPf_KIDS))
case OP_CONCAT:
case OP_SUBST:
case OP_TRANS:
+ case OP_READ:
+ case OP_SYSREAD:
+ case OP_RECV:
case OP_ANDASSIGN: /* may work later */
case OP_ORASSIGN: /* may work later */
return TRUE;
return o;
}
+void
+save_hints(void)
+{
+ SAVEI32(hints);
+ SAVESPTR(GvHV(hintgv));
+ GvHV(hintgv) = newHVhv(GvHV(hintgv));
+ SAVEFREESV(GvHV(hintgv));
+}
+
int
block_start(int full)
{
dTHR;
int retval = savestack_ix;
+
SAVEI32(comppad_name_floor);
if (full) {
if ((comppad_name_fill = AvFILLp(comppad_name)) > 0)
SAVEI32(padix_floor);
padix_floor = padix;
pad_reset_pending = FALSE;
- SAVEI32(hints);
+ SAVEHINTS();
hints &= ~HINT_BLOCK_SCOPE;
return retval;
}
unop->op_first = first;
unop->op_flags = flags | OPf_KIDS;
unop->op_private = 1 | (flags >> 8);
-#if 1
- if(type == OP_STUDY && first->op_type == OP_MATCH) {
- first->op_type = OP_PUSHRE;
- first->op_ppaddr = ppaddr[OP_PUSHRE];
- }
-#endif
unop = (UNOP*) CHECKOP(type, unop);
if (unop->op_next)
return (OP*)unop;
pmop->op_flags = flags;
pmop->op_private = 0 | (flags >> 8);
+ if (hints & HINT_RE_TAINT)
+ pmop->op_pmpermflags |= PMf_RETAINT;
if (hints & HINT_LOCALE)
- pmop->op_pmpermflags = (pmop->op_pmflags |= PMf_LOCALE);
+ pmop->op_pmpermflags |= PMf_LOCALE;
+ pmop->op_pmflags = pmop->op_pmpermflags;
/* link into pm list */
if (type != OP_TRANS && curstash) {
OP *
pmruntime(OP *o, OP *expr, OP *repl)
{
+ dTHR;
PMOP *pm;
LOGOP *rcop;
I32 repl_has_vars = 0;
p = SvPV(pat, plen);
pm->op_pmflags |= PMf_SKIPWHITE;
}
- pm->op_pmregexp = pregcomp(p, p + plen, pm);
+ pm->op_pmregexp = CALLREGCOMP(p, p + plen, pm);
if (strEQ("\\s+", pm->op_pmregexp->precomp))
pm->op_pmflags |= PMf_WHITE;
op_free(expr);
}
else {
- if (pm->op_pmflags & PMf_KEEP)
- expr = newUNOP(OP_REGCMAYBE,0,expr);
+ if (pm->op_pmflags & PMf_KEEP || !(hints & HINT_RE_EVAL))
+ expr = newUNOP((!(hints & HINT_RE_EVAL)
+ ? OP_REGCRESET
+ : OP_REGCMAYBE),0,expr);
Newz(1101, rcop, 1, LOGOP);
rcop->op_type = OP_REGCOMP;
rcop->op_ppaddr = ppaddr[OP_REGCOMP];
rcop->op_first = scalar(expr);
- rcop->op_flags |= OPf_KIDS;
+ rcop->op_flags |= ((hints & HINT_RE_EVAL)
+ ? (OPf_SPECIAL | OPf_KIDS)
+ : OPf_KIDS);
rcop->op_private = 1;
rcop->op_other = o;
/* establish postfix order */
- if (pm->op_pmflags & PMf_KEEP) {
+ if (pm->op_pmflags & PMf_KEEP || !(hints & HINT_RE_EVAL)) {
LINKLIST(expr);
rcop->op_next = expr;
((UNOP*)expr)->op_first->op_next = (OP*)rcop;
curop->op_type == OP_PADANY) {
repl_has_vars = 1;
}
+ else if (curop->op_type == OP_PUSHRE)
+ ; /* Okay here, dangerous in newASSIGNOP */
else
break;
}
if (lastop->op_type != OP_GV) /* funny deref? */
break;
}
+ else if (curop->op_type == OP_PUSHRE) {
+ if (((PMOP*)curop)->op_pmreplroot) {
+ GV *gv = (GV*)((PMOP*)curop)->op_pmreplroot;
+ if (gv == defgv || SvCUR(gv) == generation)
+ break;
+ SvCUR(gv) = generation;
+ }
+ }
else
break;
}
CONDOP* range = (CONDOP*) flip->op_first;
OP* left = range->op_first;
OP* right = left->op_sibling;
- LISTOP* list;
+ LISTOP* listop;
range->op_flags &= ~OPf_KIDS;
range->op_first = Nullop;
- list = (LISTOP*)newLISTOP(OP_LIST, 0, left, right);
- list->op_first->op_next = range->op_true;
+ listop = (LISTOP*)newLISTOP(OP_LIST, 0, left, right);
+ listop->op_first->op_next = range->op_true;
left->op_next = range->op_false;
- right->op_next = (OP*)list;
- list->op_next = list->op_first;
+ right->op_next = (OP*)listop;
+ listop->op_next = listop->op_first;
op_free(expr);
- expr = (OP*)(list);
+ expr = (OP*)(listop);
null(expr);
iterflags |= OPf_STACKED;
}
goto done;
}
/* ahem, death to those who redefine active sort subs */
- if (curstackinfo->si_type == SI_SORT && sortcop == CvSTART(cv))
+ if (curstackinfo->si_type == PERLSI_SORT && sortcop == CvSTART(cv))
croak("Can't redefine active sort subroutine %s", name);
if(const_sv = cv_const_sv(cv))
const_changed = sv_cmp(const_sv, op_const_sv(block, Nullcv));
case OP_PADAV:
if (o->op_next->op_type == OP_RV2AV
- && (o->op_next->op_flags && OPf_REF))
+ && (o->op_next->op_flags & OPf_REF))
{
null(o->op_next);
o->op_next = o->op_next->op_next;
case OP_PADHV:
if (o->op_next->op_type == OP_RV2HV
- && (o->op_next->op_flags && OPf_REF))
+ && (o->op_next->op_flags & OPf_REF))
{
null(o->op_next);
o->op_next = o->op_next->op_next;
peep(cLOOP->op_lastop);
break;
+ case OP_QR:
case OP_MATCH:
case OP_SUBST:
o->op_seq = op_seqmax++;