summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2007-05-12 19:21:02 +0000
committerDave Mitchell <davem@fdisolutions.com>2007-05-12 19:21:02 +0000
commit5486870fe7f0fd0e99bf9619d5fd857a5b972014 (patch)
tree9f5b70fdc6e84c85d8ccf54834fcd75578ed3a17
parent2f9285f84584cb56950bf07de6ded6ebcdc3d302 (diff)
downloadperl-5486870fe7f0fd0e99bf9619d5fd857a5b972014.tar.gz
move PL_rsfp_filters into the parser struct
p4raw-id: //depot/perl@31200
-rw-r--r--embed.fnc2
-rw-r--r--embed.h2
-rw-r--r--embedvar.h2
-rw-r--r--ext/Devel/PPPort/parts/inc/variables4
-rw-r--r--ext/Filter/Util/Call/Call.pm2
-rw-r--r--ext/Filter/Util/Call/Call.xs5
-rw-r--r--intrpvar.h1
-rw-r--r--op.c2
-rw-r--r--parser.h1
-rw-r--r--perl.c12
-rw-r--r--perl.h10
-rw-r--r--perlapi.h2
-rw-r--r--perly.act241
-rw-r--r--perly.tab28
-rw-r--r--perly.y3
-rw-r--r--pp_ctl.c8
-rw-r--r--proto.h2
-rw-r--r--sv.c6
-rw-r--r--toke.c27
19 files changed, 191 insertions, 169 deletions
diff --git a/embed.fnc b/embed.fnc
index 97e3422014..fec5643193 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -403,7 +403,7 @@ p |OP* |jmaybe |NN OP* arg
pP |I32 |keyword |NN const char* d|I32 len|bool all_keywords
Ap |void |leave_scope |I32 base
EXp |void |lex_end
-p |void |lex_start |NULLOK SV* line|NULLOK PerlIO *rsfp
+p |void |lex_start |NULLOK SV* line|NULLOK PerlIO *rsfp|bool new_filter
Ap |void |op_null |NN OP* o
EXp |void |op_clear |NN OP* o
Ap |void |op_refcnt_lock
diff --git a/embed.h b/embed.h
index 1737ad3e6c..8e0ecba3c5 100644
--- a/embed.h
+++ b/embed.h
@@ -2661,7 +2661,7 @@
#define lex_end() Perl_lex_end(aTHX)
#endif
#ifdef PERL_CORE
-#define lex_start(a,b) Perl_lex_start(aTHX_ a,b)
+#define lex_start(a,b,c) Perl_lex_start(aTHX_ a,b,c)
#endif
#define op_null(a) Perl_op_null(aTHX_ a)
#if defined(PERL_CORE) || defined(PERL_EXT)
diff --git a/embedvar.h b/embedvar.h
index 338db265dc..ba97800b49 100644
--- a/embedvar.h
+++ b/embedvar.h
@@ -298,7 +298,6 @@
#define PL_rehash_seed (vTHX->Irehash_seed)
#define PL_rehash_seed_set (vTHX->Irehash_seed_set)
#define PL_replgv (vTHX->Ireplgv)
-#define PL_rsfp_filters (vTHX->Irsfp_filters)
#define PL_runops (vTHX->Irunops)
#define PL_runops_dbg (vTHX->Irunops_dbg)
#define PL_runops_std (vTHX->Irunops_std)
@@ -547,7 +546,6 @@
#define PL_Irehash_seed PL_rehash_seed
#define PL_Irehash_seed_set PL_rehash_seed_set
#define PL_Ireplgv PL_replgv
-#define PL_Irsfp_filters PL_rsfp_filters
#define PL_Irunops PL_runops
#define PL_Irunops_dbg PL_runops_dbg
#define PL_Irunops_std PL_runops_std
diff --git a/ext/Devel/PPPort/parts/inc/variables b/ext/Devel/PPPort/parts/inc/variables
index 1011b1a084..be1625b591 100644
--- a/ext/Devel/PPPort/parts/inc/variables
+++ b/ext/Devel/PPPort/parts/inc/variables
@@ -98,6 +98,7 @@ __NEED_VAR__ U32 PL_signals = D_PPP_PERL_SIGNALS_INIT;
# define PL_expect (PL_parser ? PL_parser->expect : 0)
# define PL_copline (PL_parser ? PL_parser->copline : 0)
# define PL_rsfp (PL_parser ? PL_parser->rsfp : 0)
+# define PL_rsfp_filters (PL_parser ? PL_parser->rsfp_filters : 0)
#endif
=xsinit
@@ -227,11 +228,12 @@ other_variables()
ppp_TESTVAR(PL_no_modify);
ppp_TESTVAR(PL_perl_destruct_level);
ppp_TESTVAR(PL_perldb);
- ppp_TESTVAR(PL_rsfp_filters);
#ifdef PL_PARSER_EXISTS
ppp_TESTVAR(PL_parser); /* just any var that isn't PL_expect */
+ ppp_TESTVAR(PL_parser);
#else
ppp_TESTVAR(PL_rsfp);
+ ppp_TESTVAR(PL_rsfp_filters);
#endif
ppp_TESTVAR(PL_stack_base);
ppp_TESTVAR(PL_stack_sp);
diff --git a/ext/Filter/Util/Call/Call.pm b/ext/Filter/Util/Call/Call.pm
index 5aacd2d9e5..8a37a83f0d 100644
--- a/ext/Filter/Util/Call/Call.pm
+++ b/ext/Filter/Util/Call/Call.pm
@@ -18,7 +18,7 @@ use vars qw($VERSION @ISA @EXPORT) ;
@ISA = qw(Exporter DynaLoader);
@EXPORT = qw( filter_add filter_del filter_read filter_read_exact) ;
-$VERSION = "1.0601" ;
+$VERSION = "1.0602" ;
sub filter_read_exact($)
{
diff --git a/ext/Filter/Util/Call/Call.xs b/ext/Filter/Util/Call/Call.xs
index f3344dcc60..7755618554 100644
--- a/ext/Filter/Util/Call/Call.xs
+++ b/ext/Filter/Util/Call/Call.xs
@@ -25,6 +25,9 @@
#define FILTER_ACTIVE(s) IoLINES(s)
#define BUF_OFFSET(sv) IoPAGE_LEN(sv)
#define CODE_REF(sv) IoPAGE(sv)
+#ifndef PERL_FILTER_EXISTS
+# define PERL_FILTER_EXISTS(i) (PL_rsfp_filters && (i) <= av_len(PL_rsfp_filters))
+#endif
#define SET_LEN(sv,len) \
do { SvPVX(sv)[len] = '\0'; SvCUR_set(sv, len); } while (0)
@@ -235,7 +238,7 @@ void
filter_del()
CODE:
dMY_CXT;
- if (PL_rsfp_filters && IDX <= av_len(PL_rsfp_filters) && FILTER_DATA(IDX) && FILTER_ACTIVE(FILTER_DATA(IDX)))
+ if (PERL_FILTER_EXISTS(IDX) && FILTER_DATA(IDX) && FILTER_ACTIVE(FILTER_DATA(IDX)))
FILTER_ACTIVE(FILTER_DATA(IDX)) = FALSE ;
diff --git a/intrpvar.h b/intrpvar.h
index 6f88ca723c..fbbe64f535 100644
--- a/intrpvar.h
+++ b/intrpvar.h
@@ -214,7 +214,6 @@ PERLVAR(Imodglobal, HV *) /* per-interp module data */
/* these used to be in global before 5.004_68 */
PERLVARI(Iprofiledata, U32 *, NULL) /* table of ops, counts */
-PERLVARI(Irsfp_filters, AV *, NULL) /* keeps active source filters */
PERLVAR(Icompiling, COP) /* compiling/done executing marker */
diff --git a/op.c b/op.c
index 701569548f..e679ecb965 100644
--- a/op.c
+++ b/op.c
@@ -3866,7 +3866,7 @@ Perl_vload_module(pTHX_ U32 flags, SV *name, SV *ver, va_list *args)
ENTER;
SAVEVPTR(PL_curcop);
- lex_start(NULL, NULL);
+ lex_start(NULL, NULL, FALSE);
utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0),
veop, modname, imop);
LEAVE;
diff --git a/parser.h b/parser.h
index 082e493fd8..02509e49b5 100644
--- a/parser.h
+++ b/parser.h
@@ -71,6 +71,7 @@ typedef struct yy_parser {
char *last_lop; /* position of last list operator */
U8 lex_state; /* next token is determined */
PerlIO *rsfp; /* current source file pointer */
+ AV *rsfp_filters; /* holds chain of active source filters */
#ifdef PERL_MAD
SV *endwhite;
diff --git a/perl.c b/perl.c
index d4abea89fb..e6256e267d 100644
--- a/perl.c
+++ b/perl.c
@@ -874,10 +874,6 @@ perl_destruct(pTHXx)
PL_parser->rsfp = NULL;
}
- /* Filters for program text */
- SvREFCNT_dec(PL_rsfp_filters);
- PL_rsfp_filters = NULL;
-
if (PL_minus_F) {
Safefree(PL_splitstr);
PL_splitstr = NULL;
@@ -1668,6 +1664,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
bool minus_f = FALSE;
#endif
SV *linestr_sv = newSV_type(SVt_PVIV);
+ bool add_read_e_script = FALSE;
SvGROW(linestr_sv, 80);
sv_setpvn(linestr_sv,"",0);
@@ -1751,7 +1748,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
forbid_setid('e', -1);
if (!PL_e_script) {
PL_e_script = newSVpvs("");
- filter_add(read_e_script, NULL);
+ add_read_e_script = TRUE;
}
if (*++s)
sv_catpv(PL_e_script, s);
@@ -2261,9 +2258,12 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
}
#endif
- lex_start(linestr_sv, rsfp);
+ lex_start(linestr_sv, rsfp, TRUE);
PL_subname = newSVpvs("main");
+ if (add_read_e_script)
+ filter_add(read_e_script, NULL);
+
/* now parse the script */
SETERRNO(0,SS_NORMAL);
diff --git a/perl.h b/perl.h
index 1220de1426..8cd8753f0f 100644
--- a/perl.h
+++ b/perl.h
@@ -3214,8 +3214,14 @@ union any {
typedef I32 (*filter_t) (pTHX_ int, SV *, int);
#define FILTER_READ(idx, sv, len) filter_read(idx, sv, len)
-#define FILTER_DATA(idx) (AvARRAY(PL_rsfp_filters)[idx])
-#define FILTER_ISREADER(idx) (idx >= AvFILLp(PL_rsfp_filters))
+#define FILTER_DATA(idx) \
+ (PL_parser ? AvARRAY(PL_parser->rsfp_filters)[idx] : NULL)
+#define FILTER_ISREADER(idx) \
+ (PL_parser && PL_parser->rsfp_filters \
+ && idx >= AvFILLp(PL_parser->rsfp_filters))
+#define PERL_FILTER_EXISTS(i) \
+ (PL_parser && PL_parser->rsfp_filters \
+ && (i) <= av_len(PL_parser->rsfp_filters))
#if defined(_AIX) && !defined(_AIX43)
#if defined(USE_REENTRANT) || defined(_REENTRANT) || defined(_THREAD_SAFE)
diff --git a/perlapi.h b/perlapi.h
index a3e37219ed..a4600d8e44 100644
--- a/perlapi.h
+++ b/perlapi.h
@@ -472,8 +472,6 @@ END_EXTERN_C
#define PL_rehash_seed_set (*Perl_Irehash_seed_set_ptr(aTHX))
#undef PL_replgv
#define PL_replgv (*Perl_Ireplgv_ptr(aTHX))
-#undef PL_rsfp_filters
-#define PL_rsfp_filters (*Perl_Irsfp_filters_ptr(aTHX))
#undef PL_runops
#define PL_runops (*Perl_Irunops_ptr(aTHX))
#undef PL_runops_dbg
diff --git a/perly.act b/perly.act
index ca93fb8a5a..294194b87d 100644
--- a/perly.act
+++ b/perly.act
@@ -625,7 +625,8 @@ case 2:
(yyval.opval) = utilize(IVAL((ps[(1) - (7)].val.i_tkval)), (ps[(2) - (7)].val.ival), (ps[(4) - (7)].val.opval), (ps[(5) - (7)].val.opval), (ps[(6) - (7)].val.opval));
token_getmad((ps[(1) - (7)].val.i_tkval),(yyval.opval),'o');
token_getmad((ps[(7) - (7)].val.i_tkval),(yyval.opval),';');
- if (PL_rsfp_filters && AvFILLp(PL_rsfp_filters) >= 0)
+ if (PL_parser->rsfp_filters &&
+ AvFILLp(PL_parser->rsfp_filters) >= 0)
append_madprops(newMADPROP('!', MAD_PV, "", 0), (yyval.opval), 0);
#else
utilize(IVAL((ps[(1) - (7)].val.i_tkval)), (ps[(2) - (7)].val.ival), (ps[(4) - (7)].val.opval), (ps[(5) - (7)].val.opval), (ps[(6) - (7)].val.opval));
@@ -635,28 +636,28 @@ case 2:
break;
case 82:
-#line 661 "perly.y"
+#line 662 "perly.y"
{ (yyval.opval) = newLOGOP(OP_AND, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 83:
-#line 665 "perly.y"
+#line 666 "perly.y"
{ (yyval.opval) = newLOGOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 84:
-#line 669 "perly.y"
+#line 670 "perly.y"
{ (yyval.opval) = newLOGOP(OP_DOR, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 86:
-#line 677 "perly.y"
+#line 678 "perly.y"
{
#ifdef MAD
OP* op = newNULLLIST();
@@ -669,7 +670,7 @@ case 2:
break;
case 87:
-#line 687 "perly.y"
+#line 688 "perly.y"
{
OP* term = (ps[(3) - (3)].val.opval);
DO_MAD(
@@ -681,7 +682,7 @@ case 2:
break;
case 89:
-#line 700 "perly.y"
+#line 701 "perly.y"
{ (yyval.opval) = convert(IVAL((ps[(1) - (3)].val.i_tkval)), OPf_STACKED,
prepend_elem(OP_LIST, newGVREF(IVAL((ps[(1) - (3)].val.i_tkval)),(ps[(2) - (3)].val.opval)), (ps[(3) - (3)].val.opval)) );
TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'o');
@@ -689,7 +690,7 @@ case 2:
break;
case 90:
-#line 705 "perly.y"
+#line 706 "perly.y"
{ (yyval.opval) = convert(IVAL((ps[(1) - (5)].val.i_tkval)), OPf_STACKED,
prepend_elem(OP_LIST, newGVREF(IVAL((ps[(1) - (5)].val.i_tkval)),(ps[(3) - (5)].val.opval)), (ps[(4) - (5)].val.opval)) );
TOKEN_GETMAD((ps[(1) - (5)].val.i_tkval),(yyval.opval),'o');
@@ -699,7 +700,7 @@ case 2:
break;
case 91:
-#line 712 "perly.y"
+#line 713 "perly.y"
{ (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED,
append_elem(OP_LIST,
prepend_elem(OP_LIST, scalar((ps[(1) - (6)].val.opval)), (ps[(5) - (6)].val.opval)),
@@ -711,7 +712,7 @@ case 2:
break;
case 92:
-#line 721 "perly.y"
+#line 722 "perly.y"
{ (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED,
append_elem(OP_LIST, scalar((ps[(1) - (3)].val.opval)),
newUNOP(OP_METHOD, 0, (ps[(3) - (3)].val.opval))));
@@ -720,7 +721,7 @@ case 2:
break;
case 93:
-#line 727 "perly.y"
+#line 728 "perly.y"
{ (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED,
append_elem(OP_LIST,
prepend_elem(OP_LIST, (ps[(2) - (3)].val.opval), (ps[(3) - (3)].val.opval)),
@@ -729,7 +730,7 @@ case 2:
break;
case 94:
-#line 733 "perly.y"
+#line 734 "perly.y"
{ (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED,
append_elem(OP_LIST,
prepend_elem(OP_LIST, (ps[(2) - (5)].val.opval), (ps[(4) - (5)].val.opval)),
@@ -740,14 +741,14 @@ case 2:
break;
case 95:
-#line 741 "perly.y"
+#line 742 "perly.y"
{ (yyval.opval) = convert(IVAL((ps[(1) - (2)].val.i_tkval)), 0, (ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 96:
-#line 745 "perly.y"
+#line 746 "perly.y"
{ (yyval.opval) = convert(IVAL((ps[(1) - (4)].val.i_tkval)), 0, (ps[(3) - (4)].val.opval));
TOKEN_GETMAD((ps[(1) - (4)].val.i_tkval),(yyval.opval),'o');
TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'(');
@@ -756,13 +757,13 @@ case 2:
break;
case 97:
-#line 751 "perly.y"
+#line 752 "perly.y"
{ SvREFCNT_inc_simple_void(PL_compcv);
(yyval.opval) = newANONATTRSUB((ps[(2) - (3)].val.ival), 0, Nullop, (ps[(3) - (3)].val.opval)); ;}
break;
case 98:
-#line 754 "perly.y"
+#line 755 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
append_elem(OP_LIST,
prepend_elem(OP_LIST, (ps[(4) - (5)].val.opval), (ps[(5) - (5)].val.opval)), (ps[(1) - (5)].val.opval)));
@@ -770,7 +771,7 @@ case 2:
break;
case 101:
-#line 769 "perly.y"
+#line 770 "perly.y"
{ (yyval.opval) = newBINOP(OP_GELEM, 0, (ps[(1) - (5)].val.opval), scalar((ps[(3) - (5)].val.opval)));
PL_parser->expect = XOPERATOR;
TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),'{');
@@ -780,7 +781,7 @@ case 2:
break;
case 102:
-#line 776 "perly.y"
+#line 777 "perly.y"
{ (yyval.opval) = newBINOP(OP_AELEM, 0, oopsAV((ps[(1) - (4)].val.opval)), scalar((ps[(3) - (4)].val.opval)));
TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'[');
TOKEN_GETMAD((ps[(4) - (4)].val.i_tkval),(yyval.opval),']');
@@ -788,7 +789,7 @@ case 2:
break;
case 103:
-#line 781 "perly.y"
+#line 782 "perly.y"
{ (yyval.opval) = newBINOP(OP_AELEM, 0,
ref(newAVREF((ps[(1) - (5)].val.opval)),OP_RV2AV),
scalar((ps[(4) - (5)].val.opval)));
@@ -799,7 +800,7 @@ case 2:
break;
case 104:
-#line 789 "perly.y"
+#line 790 "perly.y"
{ (yyval.opval) = newBINOP(OP_AELEM, 0,
ref(newAVREF((ps[(1) - (4)].val.opval)),OP_RV2AV),
scalar((ps[(3) - (4)].val.opval)));
@@ -809,7 +810,7 @@ case 2:
break;
case 105:
-#line 796 "perly.y"
+#line 797 "perly.y"
{ (yyval.opval) = newBINOP(OP_HELEM, 0, oopsHV((ps[(1) - (5)].val.opval)), jmaybe((ps[(3) - (5)].val.opval)));
PL_parser->expect = XOPERATOR;
TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),'{');
@@ -819,7 +820,7 @@ case 2:
break;
case 106:
-#line 803 "perly.y"
+#line 804 "perly.y"
{ (yyval.opval) = newBINOP(OP_HELEM, 0,
ref(newHVREF((ps[(1) - (6)].val.opval)),OP_RV2HV),
jmaybe((ps[(4) - (6)].val.opval)));
@@ -832,7 +833,7 @@ case 2:
break;
case 107:
-#line 813 "perly.y"
+#line 814 "perly.y"
{ (yyval.opval) = newBINOP(OP_HELEM, 0,
ref(newHVREF((ps[(1) - (5)].val.opval)),OP_RV2HV),
jmaybe((ps[(3) - (5)].val.opval)));
@@ -844,7 +845,7 @@ case 2:
break;
case 108:
-#line 822 "perly.y"
+#line 823 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
newCVREF(0, scalar((ps[(1) - (4)].val.opval))));
TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'a');
@@ -854,7 +855,7 @@ case 2:
break;
case 109:
-#line 829 "perly.y"
+#line 830 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
append_elem(OP_LIST, (ps[(4) - (5)].val.opval),
newCVREF(0, scalar((ps[(1) - (5)].val.opval)))));
@@ -865,7 +866,7 @@ case 2:
break;
case 110:
-#line 838 "perly.y"
+#line 839 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
append_elem(OP_LIST, (ps[(3) - (4)].val.opval),
newCVREF(0, scalar((ps[(1) - (4)].val.opval)))));
@@ -875,7 +876,7 @@ case 2:
break;
case 111:
-#line 845 "perly.y"
+#line 846 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
newCVREF(0, scalar((ps[(1) - (3)].val.opval))));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'(');
@@ -884,7 +885,7 @@ case 2:
break;
case 112:
-#line 851 "perly.y"
+#line 852 "perly.y"
{ (yyval.opval) = newSLICEOP(0, (ps[(5) - (6)].val.opval), (ps[(2) - (6)].val.opval));
TOKEN_GETMAD((ps[(1) - (6)].val.i_tkval),(yyval.opval),'(');
TOKEN_GETMAD((ps[(3) - (6)].val.i_tkval),(yyval.opval),')');
@@ -894,7 +895,7 @@ case 2:
break;
case 113:
-#line 858 "perly.y"
+#line 859 "perly.y"
{ (yyval.opval) = newSLICEOP(0, (ps[(4) - (5)].val.opval), Nullop);
TOKEN_GETMAD((ps[(1) - (5)].val.i_tkval),(yyval.opval),'(');
TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),')');
@@ -904,21 +905,21 @@ case 2:
break;
case 114:
-#line 868 "perly.y"
+#line 869 "perly.y"
{ (yyval.opval) = newASSIGNOP(OPf_STACKED, (ps[(1) - (3)].val.opval), IVAL((ps[(2) - (3)].val.i_tkval)), (ps[(3) - (3)].val.opval));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 115:
-#line 872 "perly.y"
+#line 873 "perly.y"
{ (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 116:
-#line 876 "perly.y"
+#line 877 "perly.y"
{ if (IVAL((ps[(2) - (3)].val.i_tkval)) != OP_REPEAT)
scalar((ps[(1) - (3)].val.opval));
(yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, (ps[(1) - (3)].val.opval), scalar((ps[(3) - (3)].val.opval)));
@@ -927,49 +928,49 @@ case 2:
break;
case 117:
-#line 882 "perly.y"
+#line 883 "perly.y"
{ (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 118:
-#line 886 "perly.y"
+#line 887 "perly.y"
{ (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 119:
-#line 890 "perly.y"
+#line 891 "perly.y"
{ (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 120:
-#line 894 "perly.y"
+#line 895 "perly.y"
{ (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 121:
-#line 898 "perly.y"
+#line 899 "perly.y"
{ (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 122:
-#line 902 "perly.y"
+#line 903 "perly.y"
{ (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 123:
-#line 906 "perly.y"
+#line 907 "perly.y"
{
(yyval.opval) = newRANGE(IVAL((ps[(2) - (3)].val.i_tkval)), scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
DO_MAD(
@@ -984,28 +985,28 @@ case 2:
break;
case 124:
-#line 918 "perly.y"
+#line 919 "perly.y"
{ (yyval.opval) = newLOGOP(OP_AND, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 125:
-#line 922 "perly.y"
+#line 923 "perly.y"
{ (yyval.opval) = newLOGOP(OP_OR, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 126:
-#line 926 "perly.y"
+#line 927 "perly.y"
{ (yyval.opval) = newLOGOP(OP_DOR, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 127:
-#line 930 "perly.y"
+#line 931 "perly.y"
{ (yyval.opval) = bind_match(IVAL((ps[(2) - (3)].val.i_tkval)), (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),
((yyval.opval)->op_type == OP_NOT
@@ -1015,14 +1016,14 @@ case 2:
break;
case 128:
-#line 940 "perly.y"
+#line 941 "perly.y"
{ (yyval.opval) = newUNOP(OP_NEGATE, 0, scalar((ps[(2) - (2)].val.opval)));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 129:
-#line 944 "perly.y"
+#line 945 "perly.y"
{ (yyval.opval) = IF_MAD(
newUNOP(OP_NULL, 0, (ps[(2) - (2)].val.opval)),
(ps[(2) - (2)].val.opval)
@@ -1032,21 +1033,21 @@ case 2:
break;
case 130:
-#line 951 "perly.y"
+#line 952 "perly.y"
{ (yyval.opval) = newUNOP(OP_NOT, 0, scalar((ps[(2) - (2)].val.opval)));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 131:
-#line 955 "perly.y"
+#line 956 "perly.y"
{ (yyval.opval) = newUNOP(OP_COMPLEMENT, 0, scalar((ps[(2) - (2)].val.opval)));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 132:
-#line 959 "perly.y"
+#line 960 "perly.y"
{ (yyval.opval) = newUNOP(OP_POSTINC, 0,
mod(scalar((ps[(1) - (2)].val.opval)), OP_POSTINC));
TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),'o');
@@ -1054,7 +1055,7 @@ case 2:
break;
case 133:
-#line 964 "perly.y"
+#line 965 "perly.y"
{ (yyval.opval) = newUNOP(OP_POSTDEC, 0,
mod(scalar((ps[(1) - (2)].val.opval)), OP_POSTDEC));
TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),'o');
@@ -1062,7 +1063,7 @@ case 2:
break;
case 134:
-#line 969 "perly.y"
+#line 970 "perly.y"
{ (yyval.opval) = newUNOP(OP_PREINC, 0,
mod(scalar((ps[(2) - (2)].val.opval)), OP_PREINC));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
@@ -1070,7 +1071,7 @@ case 2:
break;
case 135:
-#line 974 "perly.y"
+#line 975 "perly.y"
{ (yyval.opval) = newUNOP(OP_PREDEC, 0,
mod(scalar((ps[(2) - (2)].val.opval)), OP_PREDEC));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
@@ -1078,7 +1079,7 @@ case 2:
break;
case 136:
-#line 983 "perly.y"
+#line 984 "perly.y"
{ (yyval.opval) = newANONLIST((ps[(2) - (3)].val.opval));
TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'[');
TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),']');
@@ -1086,7 +1087,7 @@ case 2:
break;
case 137:
-#line 988 "perly.y"
+#line 989 "perly.y"
{ (yyval.opval) = newANONLIST(Nullop);
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'[');
TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),']');
@@ -1094,7 +1095,7 @@ case 2:
break;
case 138:
-#line 993 "perly.y"
+#line 994 "perly.y"
{ (yyval.opval) = newANONHASH((ps[(2) - (4)].val.opval));
TOKEN_GETMAD((ps[(1) - (4)].val.i_tkval),(yyval.opval),'{');
TOKEN_GETMAD((ps[(3) - (4)].val.i_tkval),(yyval.opval),';');
@@ -1103,7 +1104,7 @@ case 2:
break;
case 139:
-#line 999 "perly.y"
+#line 1000 "perly.y"
{ (yyval.opval) = newANONHASH(Nullop);
TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'{');
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),';');
@@ -1112,7 +1113,7 @@ case 2:
break;
case 140:
-#line 1005 "perly.y"
+#line 1006 "perly.y"
{ SvREFCNT_inc_simple_void(PL_compcv);
(yyval.opval) = newANONATTRSUB((ps[(2) - (5)].val.ival), (ps[(3) - (5)].val.opval), (ps[(4) - (5)].val.opval), (ps[(5) - (5)].val.opval));
TOKEN_GETMAD((ps[(1) - (5)].val.i_tkval),(yyval.opval),'o');
@@ -1122,21 +1123,21 @@ case 2:
break;
case 141:
-#line 1016 "perly.y"
+#line 1017 "perly.y"
{ (yyval.opval) = dofile((ps[(2) - (2)].val.opval), IVAL((ps[(1) - (2)].val.i_tkval)));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 142:
-#line 1020 "perly.y"
+#line 1021 "perly.y"
{ (yyval.opval) = newUNOP(OP_NULL, OPf_SPECIAL, scope((ps[(2) - (2)].val.opval)));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'D');
;}
break;
case 143:
-#line 1024 "perly.y"
+#line 1025 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB,
OPf_SPECIAL|OPf_STACKED,
prepend_elem(OP_LIST,
@@ -1151,7 +1152,7 @@ case 2:
break;
case 144:
-#line 1036 "perly.y"
+#line 1037 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB,
OPf_SPECIAL|OPf_STACKED,
append_elem(OP_LIST,
@@ -1167,7 +1168,7 @@ case 2:
break;
case 145:
-#line 1049 "perly.y"
+#line 1050 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
prepend_elem(OP_LIST,
scalar(newCVREF(0,scalar((ps[(2) - (4)].val.opval)))), Nullop)); dep();
@@ -1178,7 +1179,7 @@ case 2:
break;
case 146:
-#line 1057 "perly.y"
+#line 1058 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
prepend_elem(OP_LIST,
(ps[(4) - (5)].val.opval),
@@ -1190,7 +1191,7 @@ case 2:
break;
case 151:
-#line 1073 "perly.y"
+#line 1074 "perly.y"
{ (yyval.opval) = newCONDOP(0, (ps[(1) - (5)].val.opval), (ps[(3) - (5)].val.opval), (ps[(5) - (5)].val.opval));
TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),'?');
TOKEN_GETMAD((ps[(4) - (5)].val.i_tkval),(yyval.opval),':');
@@ -1198,26 +1199,26 @@ case 2:
break;
case 152:
-#line 1078 "perly.y"
+#line 1079 "perly.y"
{ (yyval.opval) = newUNOP(OP_REFGEN, 0, mod((ps[(2) - (2)].val.opval),OP_REFGEN));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 153:
-#line 1082 "perly.y"
+#line 1083 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 154:
-#line 1084 "perly.y"
+#line 1085 "perly.y"
{ (yyval.opval) = localize((ps[(2) - (2)].val.opval),IVAL((ps[(1) - (2)].val.i_tkval)));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'d');
;}
break;
case 155:
-#line 1088 "perly.y"
+#line 1089 "perly.y"
{ (yyval.opval) = sawparens(IF_MAD(newUNOP(OP_NULL,0,(ps[(2) - (3)].val.opval)), (ps[(2) - (3)].val.opval)));
TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'(');
TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),')');
@@ -1225,7 +1226,7 @@ case 2:
break;
case 156:
-#line 1093 "perly.y"
+#line 1094 "perly.y"
{ (yyval.opval) = sawparens(newNULLLIST());
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'(');
TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),')');
@@ -1233,37 +1234,37 @@ case 2:
break;
case 157:
-#line 1098 "perly.y"
+#line 1099 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 158:
-#line 1100 "perly.y"
+#line 1101 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 159:
-#line 1102 "perly.y"
+#line 1103 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 160:
-#line 1104 "perly.y"
+#line 1105 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 161:
-#line 1106 "perly.y"
+#line 1107 "perly.y"
{ (yyval.opval) = newUNOP(OP_AV2ARYLEN, 0, ref((ps[(1) - (1)].val.opval), OP_AV2ARYLEN));;}
break;
case 162:
-#line 1108 "perly.y"
+#line 1109 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 163:
-#line 1110 "perly.y"
+#line 1111 "perly.y"
{ (yyval.opval) = prepend_elem(OP_ASLICE,
newOP(OP_PUSHMARK, 0),
newLISTOP(OP_ASLICE, 0,
@@ -1275,7 +1276,7 @@ case 2:
break;
case 164:
-#line 1119 "perly.y"
+#line 1120 "perly.y"
{ (yyval.opval) = prepend_elem(OP_HSLICE,
newOP(OP_PUSHMARK, 0),
newLISTOP(OP_HSLICE, 0,
@@ -1289,17 +1290,17 @@ case 2:
break;
case 165:
-#line 1130 "perly.y"
+#line 1131 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 166:
-#line 1132 "perly.y"
+#line 1133 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, 0, scalar((ps[(1) - (1)].val.opval))); ;}
break;
case 167:
-#line 1134 "perly.y"
+#line 1135 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((ps[(1) - (3)].val.opval)));
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'(');
TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),')');
@@ -1307,7 +1308,7 @@ case 2:
break;
case 168:
-#line 1139 "perly.y"
+#line 1140 "perly.y"
{
(yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
append_elem(OP_LIST, (ps[(3) - (4)].val.opval), scalar((ps[(1) - (4)].val.opval))));
@@ -1323,7 +1324,7 @@ case 2:
break;
case 169:
-#line 1152 "perly.y"
+#line 1153 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
append_elem(OP_LIST, (ps[(3) - (3)].val.opval), scalar((ps[(2) - (3)].val.opval))));
TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'o');
@@ -1331,7 +1332,7 @@ case 2:
break;
case 170:
-#line 1157 "perly.y"
+#line 1158 "perly.y"
{ (yyval.opval) = newOP(IVAL((ps[(1) - (1)].val.i_tkval)), OPf_SPECIAL);
PL_hints |= HINT_BLOCK_SCOPE;
TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o');
@@ -1339,74 +1340,74 @@ case 2:
break;
case 171:
-#line 1162 "perly.y"
+#line 1163 "perly.y"
{ (yyval.opval) = newLOOPEX(IVAL((ps[(1) - (2)].val.i_tkval)),(ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 172:
-#line 1166 "perly.y"
+#line 1167 "perly.y"
{ (yyval.opval) = newUNOP(OP_NOT, 0, scalar((ps[(2) - (2)].val.opval)));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 173:
-#line 1170 "perly.y"
+#line 1171 "perly.y"
{ (yyval.opval) = newOP(IVAL((ps[(1) - (1)].val.i_tkval)), 0);
TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 174:
-#line 1174 "perly.y"
+#line 1175 "perly.y"
{ (yyval.opval) = newUNOP(IVAL((ps[(1) - (2)].val.i_tkval)), 0, (ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 175:
-#line 1178 "perly.y"
+#line 1179 "perly.y"
{ (yyval.opval) = newUNOP(IVAL((ps[(1) - (2)].val.i_tkval)), 0, (ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 176:
-#line 1182 "perly.y"
+#line 1183 "perly.y"
{ (yyval.opval) = newOP(OP_REQUIRE, (ps[(1) - (1)].val.i_tkval) ? OPf_SPECIAL : 0);
TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 177:
-#line 1186 "perly.y"
+#line 1187 "perly.y"
{ (yyval.opval) = newUNOP(OP_REQUIRE, (ps[(1) - (2)].val.i_tkval) ? OPf_SPECIAL : 0, (ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 178:
-#line 1190 "perly.y"
+#line 1191 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((ps[(1) - (1)].val.opval))); ;}
break;
case 179:
-#line 1192 "perly.y"
+#line 1193 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
append_elem(OP_LIST, (ps[(2) - (2)].val.opval), scalar((ps[(1) - (2)].val.opval)))); ;}
break;
case 180:
-#line 1195 "perly.y"
+#line 1196 "perly.y"
{ (yyval.opval) = newOP(IVAL((ps[(1) - (1)].val.i_tkval)), 0);
TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o');
;}
break;
case 181:
-#line 1199 "perly.y"
+#line 1200 "perly.y"
{ (yyval.opval) = newOP(IVAL((ps[(1) - (3)].val.i_tkval)), 0);
TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'o');
TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'(');
@@ -1415,13 +1416,13 @@ case 2:
break;
case 182:
-#line 1205 "perly.y"
+#line 1206 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
scalar((ps[(1) - (1)].val.opval))); ;}
break;
case 183:
-#line 1208 "perly.y"
+#line 1209 "perly.y"
{ (yyval.opval) = (IVAL((ps[(1) - (3)].val.i_tkval)) == OP_NOT)
? newUNOP(IVAL((ps[(1) - (3)].val.i_tkval)), 0, newSVOP(OP_CONST, 0, newSViv(0)))
: newOP(IVAL((ps[(1) - (3)].val.i_tkval)), OPf_SPECIAL);
@@ -1433,7 +1434,7 @@ case 2:
break;
case 184:
-#line 1217 "perly.y"
+#line 1218 "perly.y"
{ (yyval.opval) = newUNOP(IVAL((ps[(1) - (4)].val.i_tkval)), 0, (ps[(3) - (4)].val.opval));
TOKEN_GETMAD((ps[(1) - (4)].val.i_tkval),(yyval.opval),'o');
TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'(');
@@ -1442,7 +1443,7 @@ case 2:
break;
case 185:
-#line 1223 "perly.y"
+#line 1224 "perly.y"
{ (yyval.opval) = pmruntime((ps[(1) - (4)].val.opval), (ps[(3) - (4)].val.opval), 1);
TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'(');
TOKEN_GETMAD((ps[(4) - (4)].val.i_tkval),(yyval.opval),')');
@@ -1450,7 +1451,7 @@ case 2:
break;
case 188:
-#line 1233 "perly.y"
+#line 1234 "perly.y"
{ (yyval.opval) = my_attrs((ps[(2) - (3)].val.opval),(ps[(3) - (3)].val.opval));
DO_MAD(
token_getmad((ps[(1) - (3)].val.i_tkval),(yyval.opval),'d');
@@ -1461,14 +1462,14 @@ case 2:
break;
case 189:
-#line 1241 "perly.y"
+#line 1242 "perly.y"
{ (yyval.opval) = localize((ps[(2) - (2)].val.opval),IVAL((ps[(1) - (2)].val.i_tkval)));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'d');
;}
break;
case 190:
-#line 1248 "perly.y"
+#line 1249 "perly.y"
{ (yyval.opval) = sawparens((ps[(2) - (3)].val.opval));
TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'(');
TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),')');
@@ -1476,7 +1477,7 @@ case 2:
break;
case 191:
-#line 1253 "perly.y"
+#line 1254 "perly.y"
{ (yyval.opval) = sawparens(newNULLLIST());
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'(');
TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),')');
@@ -1484,42 +1485,42 @@ case 2:
break;
case 192:
-#line 1258 "perly.y"
+#line 1259 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 193:
-#line 1260 "perly.y"
+#line 1261 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 194:
-#line 1262 "perly.y"
+#line 1263 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 195:
-#line 1267 "perly.y"
+#line 1268 "perly.y"
{ (yyval.opval) = Nullop; ;}
break;
case 196:
-#line 1269 "perly.y"
+#line 1270 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 197:
-#line 1273 "perly.y"
+#line 1274 "perly.y"
{ (yyval.opval) = Nullop; ;}
break;
case 198:
-#line 1275 "perly.y"
+#line 1276 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 199:
-#line 1277 "perly.y"
+#line 1278 "perly.y"
{
#ifdef MAD
OP* op = newNULLLIST();
@@ -1533,69 +1534,69 @@ case 2:
break;
case 200:
-#line 1292 "perly.y"
+#line 1293 "perly.y"
{ PL_in_my = 0; (yyval.opval) = my((ps[(1) - (1)].val.opval)); ;}
break;
case 201:
-#line 1296 "perly.y"
+#line 1297 "perly.y"
{ (yyval.opval) = newCVREF(IVAL((ps[(1) - (2)].val.i_tkval)),(ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'&');
;}
break;
case 202:
-#line 1302 "perly.y"
+#line 1303 "perly.y"
{ (yyval.opval) = newSVREF((ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'$');
;}
break;
case 203:
-#line 1308 "perly.y"
+#line 1309 "perly.y"
{ (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'@');
;}
break;
case 204:
-#line 1314 "perly.y"
+#line 1315 "perly.y"
{ (yyval.opval) = newHVREF((ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'%');
;}
break;
case 205:
-#line 1320 "perly.y"
+#line 1321 "perly.y"
{ (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'l');
;}
break;
case 206:
-#line 1326 "perly.y"
+#line 1327 "perly.y"
{ (yyval.opval) = newGVREF(0,(ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'*');
;}
break;
case 207:
-#line 1333 "perly.y"
+#line 1334 "perly.y"
{ (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;}
break;
case 208:
-#line 1335 "perly.y"
+#line 1336 "perly.y"
{ (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;}
break;
case 209:
-#line 1337 "perly.y"
+#line 1338 "perly.y"
{ (yyval.opval) = scope((ps[(1) - (1)].val.opval)); ;}
break;
case 210:
-#line 1340 "perly.y"
+#line 1341 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
diff --git a/perly.tab b/perly.tab
index 605066a18b..f7e3fe20ea 100644
--- a/perly.tab
+++ b/perly.tab
@@ -175,20 +175,20 @@ static const yytype_uint16 yyrline[] =
459, 463, 469, 478, 482, 484, 486, 488, 490, 495,
499, 505, 519, 520, 524, 537, 558, 564, 569, 574,
584, 585, 590, 591, 595, 605, 609, 619, 620, 629,
- 643, 642, 660, 664, 668, 672, 676, 686, 695, 699,
- 704, 711, 720, 726, 732, 740, 744, 751, 750, 761,
- 762, 766, 775, 780, 788, 795, 802, 812, 821, 828,
- 837, 844, 850, 857, 867, 871, 875, 881, 885, 889,
- 893, 897, 901, 905, 917, 921, 925, 929, 939, 943,
- 950, 954, 958, 963, 968, 973, 982, 987, 992, 998,
- 1004, 1015, 1019, 1023, 1035, 1048, 1056, 1068, 1069, 1070,
- 1071, 1072, 1077, 1081, 1083, 1087, 1092, 1097, 1099, 1101,
- 1103, 1105, 1107, 1109, 1118, 1129, 1131, 1133, 1138, 1151,
- 1156, 1161, 1165, 1169, 1173, 1177, 1181, 1185, 1189, 1191,
- 1194, 1198, 1204, 1207, 1216, 1222, 1227, 1228, 1232, 1240,
- 1247, 1252, 1257, 1259, 1261, 1266, 1268, 1273, 1274, 1276,
- 1291, 1295, 1301, 1307, 1313, 1319, 1325, 1332, 1334, 1336,
- 1339
+ 643, 642, 661, 665, 669, 673, 677, 687, 696, 700,
+ 705, 712, 721, 727, 733, 741, 745, 752, 751, 762,
+ 763, 767, 776, 781, 789, 796, 803, 813, 822, 829,
+ 838, 845, 851, 858, 868, 872, 876, 882, 886, 890,
+ 894, 898, 902, 906, 918, 922, 926, 930, 940, 944,
+ 951, 955, 959, 964, 969, 974, 983, 988, 993, 999,
+ 1005, 1016, 1020, 1024, 1036, 1049, 1057, 1069, 1070, 1071,
+ 1072, 1073, 1078, 1082, 1084, 1088, 1093, 1098, 1100, 1102,
+ 1104, 1106, 1108, 1110, 1119, 1130, 1132, 1134, 1139, 1152,
+ 1157, 1162, 1166, 1170, 1174, 1178, 1182, 1186, 1190, 1192,
+ 1195, 1199, 1205, 1208, 1217, 1223, 1228, 1229, 1233, 1241,
+ 1248, 1253, 1258, 1260, 1262, 1267, 1269, 1274, 1275, 1277,
+ 1292, 1296, 1302, 1308, 1314, 1320, 1326, 1333, 1335, 1337,
+ 1340
};
#endif
diff --git a/perly.y b/perly.y
index 0a857c7170..40836be9f8 100644
--- a/perly.y
+++ b/perly.y
@@ -647,7 +647,8 @@ use : USE startsub
$$ = utilize(IVAL($1), $2, $4, $5, $6);
token_getmad($1,$$,'o');
token_getmad($7,$$,';');
- if (PL_rsfp_filters && AvFILLp(PL_rsfp_filters) >= 0)
+ if (PL_parser->rsfp_filters &&
+ AvFILLp(PL_parser->rsfp_filters) >= 0)
append_madprops(newMADPROP('!', MAD_PV, "", 0), $$, 0);
#else
utilize(IVAL($1), $2, $4, $5, $6);
diff --git a/pp_ctl.c b/pp_ctl.c
index 60b6b0a47d..032ffaa4c6 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2745,7 +2745,7 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp)
STRLEN len;
ENTER;
- lex_start(sv, NULL);
+ lex_start(sv, NULL, FALSE);
SAVETMPS;
/* switch to eval mode */
@@ -3377,9 +3377,7 @@ PP(pp_require)
ENTER;
SAVETMPS;
- lex_start(NULL, tryrsfp);
- SAVEGENERICSV(PL_rsfp_filters);
- PL_rsfp_filters = NULL;
+ lex_start(NULL, tryrsfp, TRUE);
SAVEHINTS();
PL_hints = 0;
@@ -3448,7 +3446,7 @@ PP(pp_entereval)
TAINT_PROPER("eval");
ENTER;
- lex_start(sv, NULL);
+ lex_start(sv, NULL, FALSE);
SAVETMPS;
/* switch to eval mode */
diff --git a/proto.h b/proto.h
index cbd261cdaa..dee615fc73 100644
--- a/proto.h
+++ b/proto.h
@@ -1025,7 +1025,7 @@ PERL_CALLCONV I32 Perl_keyword(pTHX_ const char* d, I32 len, bool all_keywords)
PERL_CALLCONV void Perl_leave_scope(pTHX_ I32 base);
PERL_CALLCONV void Perl_lex_end(pTHX);
-PERL_CALLCONV void Perl_lex_start(pTHX_ SV* line, PerlIO *rsfp);
+PERL_CALLCONV void Perl_lex_start(pTHX_ SV* line, PerlIO *rsfp, bool new_filter);
PERL_CALLCONV void Perl_op_null(pTHX_ OP* o)
__attribute__nonnull__(pTHX_1);
diff --git a/sv.c b/sv.c
index 71fdd43468..f2c2147d53 100644
--- a/sv.c
+++ b/sv.c
@@ -9577,6 +9577,8 @@ Perl_parser_dup(pTHX_ const yy_parser *proto, CLONE_PARAMS* param)
parser->last_lop_op = proto->last_lop_op;
parser->lex_state = proto->lex_state;
parser->rsfp = fp_dup(proto->rsfp, '<', param);
+ /* rsfp_filters entries have fake IoDIRP() */
+ parser->rsfp_filters= av_dup_inc(proto->rsfp_filters, param);
parser->linestr = sv_dup_inc(proto->linestr, param);
@@ -10134,7 +10136,7 @@ Perl_sv_dup(pTHX_ const SV *sstr, CLONE_PARAMS* param)
IoOFP(dstr) = IoIFP(dstr);
else
IoOFP(dstr) = fp_dup(IoOFP(dstr), IoTYPE(dstr), param);
- /* PL_rsfp_filters entries have fake IoDIRP() */
+ /* PL_parser->rsfp_filters entries have fake IoDIRP() */
if(IoFLAGS(dstr) & IOf_FAKE_DIRP) {
/* I have no idea why fake dirp (rsfps)
should be treated differently but otherwise
@@ -11216,8 +11218,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
PL_custom_op_descs = hv_dup_inc(proto_perl->Icustom_op_descs,param);
PL_profiledata = NULL;
- /* PL_rsfp_filters entries have fake IoDIRP() */
- PL_rsfp_filters = av_dup_inc(proto_perl->Irsfp_filters, param);
PL_compcv = cv_dup(proto_perl->Icompcv, param);
diff --git a/toke.c b/toke.c
index 40eeb2aebe..b1a9ff6a03 100644
--- a/toke.c
+++ b/toke.c
@@ -62,6 +62,7 @@
#define PL_last_lop_op (PL_parser->last_lop_op)
#define PL_lex_state (PL_parser->lex_state)
#define PL_rsfp (PL_parser->rsfp)
+#define PL_rsfp_filters (PL_parser->rsfp_filters)
#ifdef PERL_MAD
# define PL_endwhite (PL_parser->endwhite)
@@ -91,7 +92,6 @@ S_pending_ident(pTHX);
static const char ident_too_long[] = "Identifier too long";
static const char commaless_variable_list[] = "comma-less variable list";
-static void restore_rsfp(pTHX_ void *f);
#ifndef PERL_NO_UTF16_FILTER
static I32 utf16_textfilter(pTHX_ int idx, SV *sv, int maxlen);
static I32 utf16rev_textfilter(pTHX_ int idx, SV *sv, int maxlen);
@@ -635,21 +635,30 @@ S_cr_textfilter(pTHX_ int idx, SV *sv, int maxlen)
/*
* Perl_lex_start
+ *
* Create a parser object and initialise its parser and lexer fields
+ *
+ * rsfp is the opened file handle to read from (if any),
+ *
+ * line holds any initial content already read from the file (or in
+ * the case of no file, such as an eval, the whole contents);
+ *
+ * new_filter indicates that this is a new file and it shouldn't inherit
+ * the filters from the current parser (ie require).
*/
void
-Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp)
+Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, bool new_filter)
{
dVAR;
const char *s = NULL;
STRLEN len;
- yy_parser *parser;
+ yy_parser *parser, *oparser;
/* create and initialise a parser */
Newxz(parser, 1, yy_parser);
- parser->old_parser = PL_parser;
+ parser->old_parser = oparser = PL_parser;
PL_parser = parser;
Newx(parser->stack, YYINITDEPTH, yy_stack_frame);
@@ -676,6 +685,8 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp)
PL_lex_state = LEX_NORMAL;
parser->expect = XSTATE;
parser->rsfp = rsfp;
+ parser->rsfp_filters = (new_filter || !oparser) ? NULL
+ : (AV*)SvREFCNT_inc(oparser->rsfp_filters);
Newx(parser->lex_brackstack, 120, char);
Newx(parser->lex_casestack, 12, char);
@@ -719,6 +730,7 @@ Perl_parser_free(pTHX_ const yy_parser *parser)
else if (parser->rsfp && parser->old_parser
&& parser->rsfp != parser->old_parser->rsfp)
PerlIO_close(parser->rsfp);
+ SvREFCNT_dec(parser->rsfp_filters);
Safefree(parser->stack);
Safefree(parser->lex_brackstack);
@@ -2764,6 +2776,9 @@ Perl_filter_add(pTHX_ filter_t funcp, SV *datasv)
if (!funcp)
return NULL;
+ if (!PL_parser)
+ return NULL;
+
if (!PL_rsfp_filters)
PL_rsfp_filters = newAV();
if (!datasv)
@@ -2791,7 +2806,7 @@ Perl_filter_del(pTHX_ filter_t funcp)
DEBUG_P(PerlIO_printf(Perl_debug_log, "filter_del func %p",
FPTR2DPTR(void*, funcp)));
#endif
- if (!PL_rsfp_filters || AvFILLp(PL_rsfp_filters)<0)
+ if (!PL_parser || !PL_rsfp_filters || AvFILLp(PL_rsfp_filters)<0)
return;
/* if filter is on top of stack (usual case) just pop it off */
datasv = FILTER_DATA(AvFILLp(PL_rsfp_filters));
@@ -2827,7 +2842,7 @@ Perl_filter_read(pTHX_ int idx, SV *buf_sv, int maxlen)
#endif
: maxlen;
- if (!PL_rsfp_filters)
+ if (!PL_parser || !PL_rsfp_filters)
return -1;
if (idx > AvFILLp(PL_rsfp_filters)) { /* Any more filters? */
/* Provide a default input filter to make life easy. */