#define G_KEEPERR 16 /* Append errors to $@, don't overwrite it */
#define G_NODEBUG 32 /* Disable debugging at toplevel. */
+/* flag bits for PL_in_eval */
+#define EVAL_NULL 0 /* not in an eval */
+#define EVAL_INEVAL 1 /* some enclosing scope is an eval */
+#define EVAL_WARNONLY 2 /* used by yywarn() when calling yyerror() */
+#define EVAL_KEEPERR 4 /* set by perl_call_sv if G_KEEPERR */
+
/* Support for switching (stack and block) contexts.
* This ensures magic doesn't invalidate local stack and cx pointers.
*/
SV *msg = sv_2mortal(
newSVpvf("(Did you mean $ or @ instead of %c?)\n",
type == OP_ENTERSUB ? '&' : '%'));
- if (PL_in_eval & 2)
+ if (PL_in_eval & EVAL_WARNONLY)
warn("%_", msg);
else if (PL_in_eval)
sv_catsv(GvSV(PL_errgv), msg);
if (PL_in_eval) {
if (PL_eval_root)
return;
- PL_eval_root = newUNOP(OP_LEAVEEVAL, ((PL_in_eval & 4) ? OPf_SPECIAL : 0), o);
+ PL_eval_root = newUNOP(OP_LEAVEEVAL,
+ ((PL_in_eval & EVAL_KEEPERR)
+ ? OPf_SPECIAL : 0), o);
PL_eval_start = linklist(PL_eval_root);
PL_eval_root->op_next = 0;
peep(PL_eval_start);
if (strEQ(s, "BEGIN")) {
char *not_safe =
"BEGIN not safe after errors--compilation aborted";
- if (PL_in_eval & 4)
+ if (PL_in_eval & EVAL_KEEPERR)
croak(not_safe);
else {
/* force display of errors found but not reported */
PUSHEVAL(cx, 0, 0);
PL_eval_root = PL_op; /* Only needed so that goto works right. */
- PL_in_eval = 1;
+ PL_in_eval = EVAL_INEVAL;
if (flags & G_KEEPERR)
- PL_in_eval |= 4;
+ PL_in_eval |= EVAL_KEEPERR;
else
sv_setpv(ERRSV,"");
}
SV **newsp;
if (message) {
- if (PL_in_eval & 4) {
+ if (PL_in_eval & EVAL_KEEPERR) {
SV **svp;
svp = hv_fetch(ERRHV, message, msglen, TRUE);
AV* comppadlist;
I32 i;
- PL_in_eval = 1;
+ PL_in_eval = EVAL_INEVAL;
PUSHMARK(SP);
SvREFCNT_dec(PL_rs);
PL_rs = newSVpvn("\n", 1);
if (saveop && saveop->op_flags & OPf_SPECIAL)
- PL_in_eval |= 4;
+ PL_in_eval |= EVAL_KEEPERR;
else
sv_setpv(ERRSV,"");
if (yyparse() || PL_error_count || !PL_eval_root) {
PUSHEVAL(cx, 0, 0);
PL_eval_root = PL_op; /* Only needed so that goto works right. */
- PL_in_eval = 1;
+ PL_in_eval = EVAL_INEVAL;
sv_setpv(ERRSV,"");
PUTBACK;
return DOCATCH(PL_op->op_next);
{
dTHR;
--PL_error_count;
- PL_in_eval |= 2;
+ PL_in_eval |= EVAL_WARNONLY;
yyerror(s);
- PL_in_eval &= ~2;
+ PL_in_eval &= ~EVAL_WARNONLY;
return 0;
}
(int)PL_multi_open,(int)PL_multi_close,(long)PL_multi_start);
PL_multi_end = 0;
}
- if (PL_in_eval & 2)
+ if (PL_in_eval & EVAL_WARNONLY)
warn("%_", msg);
else if (PL_in_eval)
sv_catsv(ERRSV, msg);
PL_start_env.je_mustcatch = TRUE;
PL_top_env = &PL_start_env;
- PL_in_eval = FALSE;
+ PL_in_eval = EVAL_NULL; /* ~(EVAL_INEVAL|EVAL_WARNONLY|EVAL_KEEPERR) */
PL_restartop = 0;
PL_statname = NEWSV(66,0);