diff options
author | Zefram <zefram@fysh.org> | 2010-10-26 23:58:42 +0100 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-10-26 20:22:50 -0700 |
commit | 3ad73efd7b04b72db7f9f29e241e3ed4b806e132 (patch) | |
tree | f63fae393f602974377618f63eb869c7d1ef3e5e | |
parent | 2c63ecadcb2533b7a53efa836736d86cb484d969 (diff) | |
download | perl-3ad73efd7b04b72db7f9f29e241e3ed4b806e132.tar.gz |
new API functions op_scope and op_lvalue
The function scope() goes into the API as op_scope(), and mod() goes
into the API as op_lvalue(). Both marked experimental, because their
behaviour is a little quirky and not trivially dequirkable.
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | embed.fnc | 6 | ||||
-rw-r--r-- | embed.h | 4 | ||||
-rw-r--r-- | ext/XS-APItest/APItest.xs | 48 | ||||
-rw-r--r-- | ext/XS-APItest/t/postinc.t | 60 | ||||
-rw-r--r-- | global.sym | 3 | ||||
-rw-r--r-- | intrpvar.h | 2 | ||||
-rw-r--r-- | op.c | 108 | ||||
-rw-r--r-- | op.h | 2 | ||||
-rw-r--r-- | perly.act | 391 | ||||
-rw-r--r-- | perly.tab | 38 | ||||
-rw-r--r-- | perly.y | 43 | ||||
-rw-r--r-- | proto.h | 4 |
13 files changed, 413 insertions, 297 deletions
@@ -3413,6 +3413,7 @@ ext/XS-APItest/t/op_list.t test OP list construction API ext/XS-APItest/t/op.t XS::APItest: tests for OP related APIs ext/XS-APItest/t/peep.t test PL_peepp/PL_rpeepp ext/XS-APItest/t/pmflag.t Test removal of Perl_pmflag() +ext/XS-APItest/t/postinc.t test op_lvalue() ext/XS-APItest/t/printf.t XS::APItest extension ext/XS-APItest/t/ptr_table.t Test ptr_table_* APIs ext/XS-APItest/t/push.t XS::APItest extension @@ -732,8 +732,7 @@ Apd |void |mg_magical |NN SV* sv Apd |int |mg_set |NN SV* sv Ap |I32 |mg_size |NN SV* sv Ap |void |mini_mktime |NN struct tm *ptm -: Used by MOD(), which Data::Alias uses -EXp |OP* |mod |NULLOK OP* o|I32 type +AMpd |OP* |op_lvalue |NULLOK OP* o|I32 type : Used in op.c and pp_sys.c p |int |mode_from_discipline|NULLOK const char* s|STRLEN len Ap |const char* |moreswitches |NN const char* s @@ -1099,8 +1098,7 @@ Apd |NV |scan_bin |NN const char* start|STRLEN len|NN STRLEN* retlen Apd |NV |scan_hex |NN const char* start|STRLEN len|NN STRLEN* retlen Ap |char* |scan_num |NN const char* s|NN YYSTYPE *lvalp Apd |NV |scan_oct |NN const char* start|STRLEN len|NN STRLEN* retlen -: Used in perly.y -p |OP* |scope |NULLOK OP* o +AMpd |OP* |op_scope |NULLOK OP* o Ap |char* |screaminstr |NN SV *bigstr|NN SV *littlestr|I32 start_shift \ |I32 end_shift|NN I32 *old_posp|I32 last Apd |void |setdefout |NULLOK GV* gv @@ -369,10 +369,12 @@ #define op_dump(a) Perl_op_dump(aTHX_ a) #define op_free(a) Perl_op_free(aTHX_ a) #define op_linklist(a) Perl_op_linklist(aTHX_ a) +#define op_lvalue(a,b) Perl_op_lvalue(aTHX_ a,b) #define op_null(a) Perl_op_null(aTHX_ a) #define op_prepend_elem(a,b,c) Perl_op_prepend_elem(aTHX_ a,b,c) #define op_refcnt_lock() Perl_op_refcnt_lock(aTHX) #define op_refcnt_unlock() Perl_op_refcnt_unlock(aTHX) +#define op_scope(a) Perl_op_scope(aTHX_ a) #define pack_cat(a,b,c,d,e,f,g) Perl_pack_cat(aTHX_ a,b,c,d,e,f,g) #define packlist(a,b,c,d,e) Perl_packlist(aTHX_ a,b,c,d,e) #define pad_findmy(a,b,c) Perl_pad_findmy(aTHX_ a,b,c) @@ -820,7 +822,6 @@ #define is_utf8_X_extend(a) Perl_is_utf8_X_extend(aTHX_ a) #define is_utf8_X_non_hangul(a) Perl_is_utf8_X_non_hangul(aTHX_ a) #define is_utf8_X_prepend(a) Perl_is_utf8_X_prepend(aTHX_ a) -#define mod(a,b) Perl_mod(aTHX_ a,b) #define op_clear(a) Perl_op_clear(aTHX_ a) #define qerror(a) Perl_qerror(aTHX_ a) #define reg_named_buff(a,b,c,d) Perl_reg_named_buff(aTHX_ a,b,c,d) @@ -1463,7 +1464,6 @@ #define sawparens(a) Perl_sawparens(aTHX_ a) #define scalar(a) Perl_scalar(aTHX_ a) #define scalarvoid(a) Perl_scalarvoid(aTHX_ a) -#define scope(a) Perl_scope(aTHX_ a) #define sub_crush_depth(a) Perl_sub_crush_depth(aTHX_ a) #define sv_2num(a) Perl_sv_2num(aTHX_ a) #define sv_clean_all() Perl_sv_clean_all(aTHX) diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index a3f19ea220..945a89030e 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -555,6 +555,21 @@ THX_ck_entersub_establish_cleanup(pTHX_ OP *entersubop, GV *namegv, SV *ckobj) return estop; } +STATIC OP * +THX_ck_entersub_postinc(pTHX_ OP *entersubop, GV *namegv, SV *ckobj) +{ + OP *pushop, *argop, *estop; + ck_entersub_args_proto(entersubop, namegv, ckobj); + pushop = cUNOPx(entersubop)->op_first; + if(!pushop->op_sibling) pushop = cUNOPx(pushop)->op_first; + argop = pushop->op_sibling; + pushop->op_sibling = argop->op_sibling; + argop->op_sibling = NULL; + op_free(entersubop); + return newUNOP(OP_POSTINC, 0, + op_lvalue(op_contextualize(argop, G_SCALAR), OP_POSTINC)); +} + /** RPN keyword parser **/ #define sv_is_glob(sv) (SvTYPE(sv) == SVt_PVGV) @@ -765,10 +780,9 @@ static OP *THX_parse_keyword_scopelessblock(pTHX) static OP *THX_parse_keyword_stmtasexpr(pTHX) { OP *o = parse_barestmt(0); - o = op_prepend_elem(OP_LINESEQ, newOP(OP_ENTER, 0), o); - o->op_type = OP_LEAVE; - o->op_ppaddr = PL_ppaddr[OP_LEAVE]; - return o; + if (!o) o = newOP(OP_STUB, 0); + if (PL_hints & HINT_BLOCK_SCOPE) o->op_flags |= OPf_PARENS; + return op_scope(o); } #define parse_keyword_stmtsasexpr() THX_parse_keyword_stmtsasexpr(aTHX) @@ -782,10 +796,9 @@ static OP *THX_parse_keyword_stmtsasexpr(pTHX) lex_read_space(0); if(lex_peek_unichar(0) != /*{*/'}') croak("syntax error"); lex_read_unichar(0); - o = op_prepend_elem(OP_LINESEQ, newOP(OP_ENTER, 0), o); - o->op_type = OP_LEAVE; - o->op_ppaddr = PL_ppaddr[OP_LEAVE]; - return o; + if (!o) o = newOP(OP_STUB, 0); + if (PL_hints & HINT_BLOCK_SCOPE) o->op_flags |= OPf_PARENS; + return op_scope(o); } #define parse_keyword_loopblock() THX_parse_keyword_loopblock(aTHX) @@ -799,10 +812,9 @@ static OP *THX_parse_keyword_loopblock(pTHX) static OP *THX_parse_keyword_blockasexpr(pTHX) { OP *o = parse_block(0); - o = op_prepend_elem(OP_LINESEQ, newOP(OP_ENTER, 0), o); - o->op_type = OP_LEAVE; - o->op_ppaddr = PL_ppaddr[OP_LEAVE]; - return o; + if (!o) o = newOP(OP_STUB, 0); + if (PL_hints & HINT_BLOCK_SCOPE) o->op_flags |= OPf_PARENS; + return op_scope(o); } #define parse_keyword_swaplabel() THX_parse_keyword_swaplabel(aTHX) @@ -2437,3 +2449,15 @@ BOOT: CV *estcv = get_cv("XS::APItest::establish_cleanup", 0); cv_set_call_checker(estcv, THX_ck_entersub_establish_cleanup, (SV*)estcv); } + +void +postinc(...) +PROTOTYPE: $ +CODE: + croak("postinc called as a function"); + +BOOT: +{ + CV *asscv = get_cv("XS::APItest::postinc", 0); + cv_set_call_checker(asscv, THX_ck_entersub_postinc, (SV*)asscv); +} diff --git a/ext/XS-APItest/t/postinc.t b/ext/XS-APItest/t/postinc.t new file mode 100644 index 0000000000..64196f0ab4 --- /dev/null +++ b/ext/XS-APItest/t/postinc.t @@ -0,0 +1,60 @@ +use warnings; +use strict; + +use Test::More tests => 8; + +BEGIN { $^H |= 0x20000; } + +my $t; + +$t = ""; +eval q{ + use XS::APItest qw(postinc); + $t .= "a"; + my $x = 3; + $t .= "b(".postinc($x).")"; + $t .= "c(".$x.")"; + $t .= "d"; +}; +is $@, ""; +is $t, "ab(3)c(4)d"; + +$t = ""; +eval q{ + use XS::APItest qw(postinc); + $t .= "a"; + my $x = 3; + $t .= "b(".postinc($x+1).")"; + $t .= "c(".$x.")"; + $t .= "d"; +}; +isnt $@, ""; +is $t, ""; + +$t = ""; +eval q{ + use XS::APItest qw(postinc); + $t .= "a"; + my %x = (z => 3); + my $z = postinc($x{z}); + $t .= "b(".$z.")"; + $t .= "c(".$x{z}.")"; + $t .= "d"; +}; +is $@, ""; +is $t, "ab(3)c(4)d"; + +$t = ""; +eval q{ + use XS::APItest qw(postinc); + $t .= "a"; + my %x; + my $z = postinc($x{z}); + $t .= "b(".$z.")"; + $t .= "c(".$x{z}.")"; + $t .= "d"; +}; +is $@, ""; +is $t, "ab(0)c(1)d"; + +1; diff --git a/global.sym b/global.sym index 692991dc08..8ed821e915 100644 --- a/global.sym +++ b/global.sym @@ -313,7 +313,6 @@ Perl_mg_magical Perl_mg_set Perl_mg_size Perl_mini_mktime -Perl_mod Perl_moreswitches Perl_mro_get_from_name Perl_mro_get_linear_isa @@ -414,10 +413,12 @@ Perl_op_contextualize Perl_op_dump Perl_op_free Perl_op_linklist +Perl_op_lvalue Perl_op_null Perl_op_prepend_elem Perl_op_refcnt_lock Perl_op_refcnt_unlock +Perl_op_scope Perl_pack_cat Perl_packlist Perl_pad_findmy diff --git a/intrpvar.h b/intrpvar.h index ff6f017841..d919e1d357 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -58,7 +58,7 @@ PERLVAR(Itmps_stack, SV **) /* mortals we've made */ PERLVARI(Itmps_ix, I32, -1) PERLVARI(Itmps_floor, I32, -1) PERLVAR(Itmps_max, I32) -PERLVAR(Imodcount, I32) /* how much mod()ification in +PERLVAR(Imodcount, I32) /* how much op_lvalue()ification in assignment? */ PERLVAR(Imarkstack, I32 *) /* stack_sp locations we're @@ -1397,24 +1397,28 @@ S_modkids(pTHX_ OP *o, I32 type) if (o && o->op_flags & OPf_KIDS) { OP *kid; for (kid = cLISTOPo->op_first; kid; kid = kid->op_sibling) - mod(kid, type); + op_lvalue(kid, type); } return o; } -/* Propagate lvalue ("modifiable") context to an op and its children. - * 'type' represents the context type, roughly based on the type of op that - * would do the modifying, although local() is represented by OP_NULL. - * It's responsible for detecting things that can't be modified, flag - * things that need to behave specially in an lvalue context (e.g., "$$x = 5" - * might have to vivify a reference in $x), and so on. - * - * For example, "$a+1 = 2" would cause mod() to be called with o being - * OP_ADD and type being OP_SASSIGN, and would output an error. - */ +/* +=for apidoc Amx|OP *|op_lvalue|OP *o|I32 type + +Propagate lvalue ("modifiable") context to an op and its children. +I<type> represents the context type, roughly based on the type of op that +would do the modifying, although C<local()> is represented by OP_NULL, +because it has no op type of its own (it is signalled by a flag on +the lvalue op). This function detects things that can't be modified, +such as C<$x+1>, and generates errors for them. It also flags things +that need to behave specially in an lvalue context, such as C<$$x> +which might have to vivify a reference in C<$x>. + +=cut +*/ OP * -Perl_mod(pTHX_ OP *o, I32 type) +Perl_op_lvalue(pTHX_ OP *o, I32 type) { dVAR; OP *kid; @@ -1598,7 +1602,7 @@ Perl_mod(pTHX_ OP *o, I32 type) case OP_COND_EXPR: localize = 1; for (kid = cUNOPo->op_first->op_sibling; kid; kid = kid->op_sibling) - mod(kid, type); + op_lvalue(kid, type); break; case OP_RV2AV: @@ -1686,7 +1690,7 @@ Perl_mod(pTHX_ OP *o, I32 type) o->op_targ = pad_alloc(o->op_type, SVs_PADMY); assert(SvTYPE(PAD_SV(o->op_targ)) == SVt_NULL); if (o->op_flags & OPf_KIDS) - mod(cBINOPo->op_first->op_sibling, type); + op_lvalue(cBINOPo->op_first->op_sibling, type); break; case OP_AELEM: @@ -1707,7 +1711,7 @@ Perl_mod(pTHX_ OP *o, I32 type) case OP_LINESEQ: localize = 0; if (o->op_flags & OPf_KIDS) - mod(cLISTOPo->op_last, type); + op_lvalue(cLISTOPo->op_last, type); break; case OP_NULL: @@ -1717,20 +1721,20 @@ Perl_mod(pTHX_ OP *o, I32 type) else if (!(o->op_flags & OPf_KIDS)) break; if (o->op_targ != OP_LIST) { - mod(cBINOPo->op_first, type); + op_lvalue(cBINOPo->op_first, type); break; } /* FALL THROUGH */ case OP_LIST: localize = 0; for (kid = cLISTOPo->op_first; kid; kid = kid->op_sibling) - mod(kid, type); + op_lvalue(kid, type); break; case OP_RETURN: if (type != OP_LEAVESUBLV) goto nomod; - break; /* mod()ing was handled by ck_return() */ + break; /* op_lvalue()ing was handled by ck_return() */ } /* [20011101.069] File test operators interpret OPf_REF to mean that @@ -2044,7 +2048,7 @@ S_apply_attrs_my(pTHX_ HV *stash, OP *target, OP *attrs, OP **imopsp) newSVOP(OP_CONST, 0, stashsv), op_prepend_elem(OP_LIST, newUNOP(OP_REFGEN, 0, - mod(arg, OP_REFGEN)), + op_lvalue(arg, OP_REFGEN)), dup_attrlist(attrs))); /* Fake up a method call to import */ @@ -2286,7 +2290,7 @@ Perl_bind_match(pTHX_ I32 type, OP *left, OP *right) right->op_private & OPpTRANS_IDENTICAL) && ! (rtype == OP_SUBST && (cPMOPx(right)->op_pmflags & PMf_NONDESTRUCT))) - newleft = mod(left, rtype); + newleft = op_lvalue(left, rtype); else newleft = left; if (right->op_type == OP_TRANS) @@ -2310,8 +2314,22 @@ Perl_invert(pTHX_ OP *o) return newUNOP(OP_NOT, OPf_SPECIAL, scalar(o)); } +/* +=for apidoc Amx|OP *|op_scope|OP *o + +Wraps up an op tree with some additional ops so that at runtime a dynamic +scope will be created. The original ops run in the new dynamic scope, +and then, provided that they exit normally, the scope will be unwound. +The additional ops used to create and unwind the dynamic scope will +normally be an C<enter>/C<leave> pair, but a C<scope> op may be used +instead if the ops are simple enough to not need the full dynamic scope +structure. + +=cut +*/ + OP * -Perl_scope(pTHX_ OP *o) +Perl_op_scope(pTHX_ OP *o) { dVAR; if (o) { @@ -2441,7 +2459,7 @@ Perl_newPROG(pTHX_ OP *o) S_op_destroy(aTHX_ o); return; } - PL_main_root = scope(sawparens(scalarvoid(o))); + PL_main_root = op_scope(sawparens(scalarvoid(o))); PL_curcop = &PL_compiling; PL_main_start = LINKLIST(PL_main_root); PL_main_root->op_private |= OPpREFCOUNTED; @@ -2520,7 +2538,7 @@ Perl_localize(pTHX_ OP *o, I32 lex) if (lex) o = my(o); else - o = mod(o, OP_NULL); /* a bit kludgey */ + o = op_lvalue(o, OP_NULL); /* a bit kludgey */ PL_parser->in_my = FALSE; PL_parser->in_my_stash = NULL; return o; @@ -4512,12 +4530,12 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) if (optype) { if (optype == OP_ANDASSIGN || optype == OP_ORASSIGN || optype == OP_DORASSIGN) { return newLOGOP(optype, 0, - mod(scalar(left), optype), + op_lvalue(scalar(left), optype), newUNOP(OP_SASSIGN, 0, scalar(right))); } else { return newBINOP(optype, OPf_STACKED, - mod(scalar(left), optype), scalar(right)); + op_lvalue(scalar(left), optype), scalar(right)); } } @@ -4531,7 +4549,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) /* Grandfathering $[ assignment here. Bletch.*/ /* Only simple assignments like C<< ($[) = 1 >> are allowed */ PL_eval_start = (left->op_type == OP_CONST) ? right : NULL; - left = mod(left, OP_AASSIGN); + left = op_lvalue(left, OP_AASSIGN); if (PL_eval_start) PL_eval_start = 0; else if (left->op_type == OP_CONST) { @@ -4731,12 +4749,13 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) right = newOP(OP_UNDEF, 0); if (right->op_type == OP_READLINE) { right->op_flags |= OPf_STACKED; - return newBINOP(OP_NULL, flags, mod(scalar(left), OP_SASSIGN), scalar(right)); + return newBINOP(OP_NULL, flags, op_lvalue(scalar(left), OP_SASSIGN), + scalar(right)); } else { PL_eval_start = right; /* Grandfathering $[ assignment here. Bletch.*/ o = newBINOP(OP_SASSIGN, flags, - scalar(right), mod(scalar(left), OP_SASSIGN) ); + scalar(right), op_lvalue(scalar(left), OP_SASSIGN) ); if (PL_eval_start) PL_eval_start = 0; else { @@ -5295,7 +5314,7 @@ Perl_newLOOPOP(pTHX_ I32 flags, I32 debuggable, OP *expr, OP *block) o = newUNOP(OP_NULL, 0, o); /* or do {} while 1 loses outer block */ o->op_flags |= flags; - o = scope(o); + o = op_scope(o); o->op_flags |= OPf_SPECIAL; /* suppress POPBLOCK curpm restoration*/ return o; } @@ -5369,7 +5388,7 @@ Perl_newWHILEOP(pTHX_ I32 flags, I32 debuggable, LOOP *loop, if (!block) block = newOP(OP_NULL, 0); else if (cont || has_my) { - block = scope(block); + block = op_scope(block); } if (cont) { @@ -5511,7 +5530,7 @@ Perl_newFOROP(pTHX_ I32 flags, OP *sv, OP *expr, OP *block, OP *cont) iterpflags |= OPpITER_DEF; } if (expr->op_type == OP_RV2AV || expr->op_type == OP_PADAV) { - expr = mod(force_list(scalar(ref(expr, OP_ITER))), OP_GREPSTART); + expr = op_lvalue(force_list(scalar(ref(expr, OP_ITER))), OP_GREPSTART); iterflags |= OPf_STACKED; } else if (expr->op_type == OP_NULL && @@ -5547,7 +5566,7 @@ Perl_newFOROP(pTHX_ I32 flags, OP *sv, OP *expr, OP *block, OP *cont) iterflags |= OPf_STACKED; } else { - expr = mod(force_list(expr), OP_GREPSTART); + expr = op_lvalue(force_list(expr), OP_GREPSTART); } loop = (LOOP*)list(convert(OP_ENTERITER, iterflags, @@ -5614,7 +5633,7 @@ Perl_newLOOPEX(pTHX_ I32 type, OP *label) /* Check whether it's going to be a goto &function */ if (label->op_type == OP_ENTERSUB && !(label->op_flags & OPf_STACKED)) - label = newUNOP(OP_REFGEN, 0, mod(label, OP_REFGEN)); + label = newUNOP(OP_REFGEN, 0, op_lvalue(label, OP_REFGEN)); o = newUNOP(type, OPf_STACKED, label); } PL_hints |= HINT_BLOCK_SCOPE; @@ -5633,8 +5652,7 @@ S_ref_array_or_hash(pTHX_ OP *cond) || cond->op_type == OP_RV2HV || cond->op_type == OP_PADHV)) - return newUNOP(OP_REFGEN, - 0, mod(cond, OP_REFGEN)); + return newUNOP(OP_REFGEN, 0, op_lvalue(cond, OP_REFGEN)); else if(cond && (cond->op_type == OP_ASLICE @@ -5645,7 +5663,7 @@ S_ref_array_or_hash(pTHX_ OP *cond) cond->op_flags |= ~(OPf_WANT_SCALAR | OPf_REF); cond->op_flags |= OPf_WANT_LIST; - return newANONLIST(mod(cond, OP_ANONLIST)); + return newANONLIST(op_lvalue(cond, OP_ANONLIST)); } else @@ -6348,7 +6366,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) PL_breakable_sub_gen++; if (CvLVALUE(cv)) { CvROOT(cv) = newUNOP(OP_LEAVESUBLV, 0, - mod(scalarseq(block), OP_LEAVESUBLV)); + op_lvalue(scalarseq(block), OP_LEAVESUBLV)); block->op_attached = 1; } else { @@ -7416,7 +7434,7 @@ Perl_ck_fun(pTHX_ OP *o) } else if (kid->op_type != OP_RV2AV && kid->op_type != OP_PADAV) bad_type(numargs, "array", PL_op_desc[type], kid); - mod(kid, type); + op_lvalue(kid, type); break; case OA_HVREF: if (kid->op_type == OP_CONST && @@ -7438,7 +7456,7 @@ Perl_ck_fun(pTHX_ OP *o) } else if (kid->op_type != OP_RV2HV && kid->op_type != OP_PADHV) bad_type(numargs, "hash", PL_op_desc[type], kid); - mod(kid, type); + op_lvalue(kid, type); break; case OA_CVREF: { @@ -7545,7 +7563,7 @@ Perl_ck_fun(pTHX_ OP *o) name = "__ANONIO__"; len = 10; } - mod(kid, type); + op_lvalue(kid, type); } if (name) { SV *namesv; @@ -7568,7 +7586,7 @@ Perl_ck_fun(pTHX_ OP *o) scalar(kid); break; case OA_SCALARREF: - mod(scalar(kid), type); + op_lvalue(scalar(kid), type); break; } oa >>= 4; @@ -7728,7 +7746,7 @@ Perl_ck_grep(pTHX_ OP *o) if (!kid || !kid->op_sibling) return too_few_arguments(o,OP_DESC(o)); for (kid = kid->op_sibling; kid; kid = kid->op_sibling) - mod(kid, OP_GREPSTART); + op_lvalue(kid, OP_GREPSTART); return (OP*)gwop; } @@ -8168,7 +8186,7 @@ Perl_ck_return(pTHX_ OP *o) kid = cLISTOPo->op_first->op_sibling; if (CvLVALUE(PL_compcv)) { for (; kid; kid = kid->op_sibling) - mod(kid, OP_LEAVESUBLV); + op_lvalue(kid, OP_LEAVESUBLV); } else { for (; kid; kid = kid->op_sibling) if ((kid->op_type == OP_NULL) @@ -8590,7 +8608,7 @@ Perl_ck_entersub_args_list(pTHX_ OP *entersubop) for (aop = aop->op_sibling; aop->op_sibling; aop = aop->op_sibling) { if (!(PL_madskills && aop->op_type == OP_STUB)) { list(aop); - mod(aop, OP_ENTERSUB); + op_lvalue(aop, OP_ENTERSUB); } } return entersubop; @@ -8832,7 +8850,7 @@ Perl_ck_entersub_args_proto(pTHX_ OP *entersubop, GV *namegv, SV *protosv) gv_ename(namegv), SVfARG(protosv)); } - mod(aop, OP_ENTERSUB); + op_lvalue(aop, OP_ENTERSUB); prev = aop; aop = aop->op_sibling; } @@ -201,7 +201,7 @@ Deprecated. Use C<GIMME_V> instead. /* OP_ENTERSUB only */ #define OPpENTERSUB_DB 16 /* Debug subroutine. */ #define OPpENTERSUB_HASTARG 32 /* Called from OP tree. */ -#define OPpENTERSUB_NOMOD 64 /* Immune to mod() for :attrlist. */ +#define OPpENTERSUB_NOMOD 64 /* Immune to op_lvalue() for :attrlist. */ /* OP_ENTERSUB and OP_RV2CV only */ #define OPpENTERSUB_AMPER 8 /* Used & form to call. */ #define OPpENTERSUB_NOPAREN 128 /* bare sub call (without parens) */ @@ -263,7 +263,8 @@ case 2: case 29: #line 351 "perly.y" { - (yyval.opval) = block_end((ps[(3) - (7)].val.ival), newCONDOP(0, (ps[(4) - (7)].val.opval), scope((ps[(6) - (7)].val.opval)), (ps[(7) - (7)].val.opval))); + (yyval.opval) = block_end((ps[(3) - (7)].val.ival), + newCONDOP(0, (ps[(4) - (7)].val.opval), op_scope((ps[(6) - (7)].val.opval)), (ps[(7) - (7)].val.opval))); TOKEN_GETMAD((ps[(1) - (7)].val.i_tkval),(yyval.opval),'I'); TOKEN_GETMAD((ps[(2) - (7)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(5) - (7)].val.i_tkval),(yyval.opval),')'); @@ -272,9 +273,10 @@ case 2: break; case 30: -#line 359 "perly.y" +#line 360 "perly.y" { - (yyval.opval) = block_end((ps[(3) - (7)].val.ival), newCONDOP(0, (ps[(4) - (7)].val.opval), scope((ps[(6) - (7)].val.opval)), (ps[(7) - (7)].val.opval))); + (yyval.opval) = block_end((ps[(3) - (7)].val.ival), + newCONDOP(0, (ps[(4) - (7)].val.opval), op_scope((ps[(6) - (7)].val.opval)), (ps[(7) - (7)].val.opval))); TOKEN_GETMAD((ps[(1) - (7)].val.i_tkval),(yyval.opval),'I'); TOKEN_GETMAD((ps[(2) - (7)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(5) - (7)].val.i_tkval),(yyval.opval),')'); @@ -283,26 +285,26 @@ case 2: break; case 31: -#line 367 "perly.y" +#line 369 "perly.y" { (yyval.opval) = block_end((ps[(3) - (7)].val.ival), - newGIVENOP((ps[(5) - (7)].val.opval), scope((ps[(7) - (7)].val.opval)), (PADOFFSET)(ps[(4) - (7)].val.ival))); + newGIVENOP((ps[(5) - (7)].val.opval), op_scope((ps[(7) - (7)].val.opval)), (PADOFFSET)(ps[(4) - (7)].val.ival))); PL_parser->copline = (line_t)IVAL((ps[(1) - (7)].val.i_tkval)); ;} break; case 32: -#line 373 "perly.y" - { (yyval.opval) = block_end((ps[(3) - (6)].val.ival), newWHENOP((ps[(4) - (6)].val.opval), scope((ps[(6) - (6)].val.opval)))); ;} +#line 375 "perly.y" + { (yyval.opval) = block_end((ps[(3) - (6)].val.ival), newWHENOP((ps[(4) - (6)].val.opval), op_scope((ps[(6) - (6)].val.opval)))); ;} break; case 33: -#line 375 "perly.y" - { (yyval.opval) = newWHENOP(0, scope((ps[(2) - (2)].val.opval))); ;} +#line 377 "perly.y" + { (yyval.opval) = newWHENOP(0, op_scope((ps[(2) - (2)].val.opval))); ;} break; case 34: -#line 377 "perly.y" +#line 379 "perly.y" { (yyval.opval) = block_end((ps[(3) - (8)].val.ival), newWHILEOP(0, 1, (LOOP*)(OP*)NULL, @@ -315,7 +317,7 @@ case 2: break; case 35: -#line 387 "perly.y" +#line 389 "perly.y" { (yyval.opval) = block_end((ps[(3) - (8)].val.ival), newWHILEOP(0, 1, (LOOP*)(OP*)NULL, @@ -328,7 +330,7 @@ case 2: break; case 36: -#line 398 "perly.y" +#line 400 "perly.y" { OP *initop = IF_MAD((ps[(4) - (11)].val.opval) ? (ps[(4) - (11)].val.opval) : newOP(OP_NULL, 0), (ps[(4) - (11)].val.opval)); OP *forop = newWHILEOP(0, 1, (LOOP*)(OP*)NULL, @@ -351,7 +353,7 @@ case 2: break; case 37: -#line 418 "perly.y" +#line 420 "perly.y" { (yyval.opval) = block_end((ps[(3) - (9)].val.ival), newFOROP(0, (ps[(4) - (9)].val.opval), (ps[(6) - (9)].val.opval), (ps[(8) - (9)].val.opval), (ps[(9) - (9)].val.opval))); TOKEN_GETMAD((ps[(1) - (9)].val.i_tkval),(yyval.opval),'W'); @@ -363,10 +365,10 @@ case 2: break; case 38: -#line 427 "perly.y" +#line 429 "perly.y" { (yyval.opval) = block_end((ps[(4) - (8)].val.ival), newFOROP(0, - mod((ps[(2) - (8)].val.opval), OP_ENTERLOOP), (ps[(5) - (8)].val.opval), (ps[(7) - (8)].val.opval), (ps[(8) - (8)].val.opval))); + op_lvalue((ps[(2) - (8)].val.opval), OP_ENTERLOOP), (ps[(5) - (8)].val.opval), (ps[(7) - (8)].val.opval), (ps[(8) - (8)].val.opval))); TOKEN_GETMAD((ps[(1) - (8)].val.i_tkval),(yyval.opval),'W'); TOKEN_GETMAD((ps[(3) - (8)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(6) - (8)].val.i_tkval),(yyval.opval),')'); @@ -375,7 +377,7 @@ case 2: break; case 39: -#line 436 "perly.y" +#line 438 "perly.y" { (yyval.opval) = block_end((ps[(3) - (7)].val.ival), newFOROP(0, (OP*)NULL, (ps[(4) - (7)].val.opval), (ps[(6) - (7)].val.opval), (ps[(7) - (7)].val.opval))); @@ -387,7 +389,7 @@ case 2: break; case 40: -#line 445 "perly.y" +#line 447 "perly.y" { /* a block is a loop that happens once */ (yyval.opval) = newWHILEOP(0, 1, (LOOP*)(OP*)NULL, @@ -397,7 +399,7 @@ case 2: break; case 41: -#line 452 "perly.y" +#line 454 "perly.y" { int save_3_latefree = (ps[(3) - (5)].val.opval)->op_latefree; (ps[(3) - (5)].val.opval)->op_latefree = 1; @@ -413,7 +415,7 @@ case 2: break; case 42: -#line 465 "perly.y" +#line 467 "perly.y" { /* a block is a loop that happens once */ (yyval.opval) = newWHILEOP(0, 1, (LOOP*)(OP*)NULL, @@ -429,7 +431,7 @@ case 2: break; case 43: -#line 478 "perly.y" +#line 480 "perly.y" { PL_parser->expect = XSTATE; (yyval.opval) = (ps[(1) - (2)].val.opval); @@ -438,7 +440,7 @@ case 2: break; case 44: -#line 484 "perly.y" +#line 486 "perly.y" { PL_parser->expect = XSTATE; (yyval.opval) = IF_MAD(newOP(OP_NULL, 0), (OP*)NULL); @@ -448,45 +450,45 @@ case 2: break; case 45: -#line 494 "perly.y" +#line 496 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 46: -#line 496 "perly.y" +#line 498 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 47: -#line 498 "perly.y" +#line 500 "perly.y" { (yyval.opval) = newLOGOP(OP_AND, 0, (ps[(3) - (3)].val.opval), (ps[(1) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'i'); ;} break; case 48: -#line 502 "perly.y" +#line 504 "perly.y" { (yyval.opval) = newLOGOP(OP_OR, 0, (ps[(3) - (3)].val.opval), (ps[(1) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'i'); ;} break; case 49: -#line 506 "perly.y" +#line 508 "perly.y" { (yyval.opval) = newLOOPOP(OPf_PARENS, 1, scalar((ps[(3) - (3)].val.opval)), (ps[(1) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'w'); ;} break; case 50: -#line 510 "perly.y" +#line 512 "perly.y" { (yyval.opval) = newLOOPOP(OPf_PARENS, 1, (ps[(3) - (3)].val.opval), (ps[(1) - (3)].val.opval)); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'w'); ;} break; case 51: -#line 514 "perly.y" +#line 516 "perly.y" { (yyval.opval) = newFOROP(0, (OP*)NULL, (ps[(3) - (3)].val.opval), (ps[(1) - (3)].val.opval), (OP*)NULL); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'w'); PL_parser->copline = (line_t)IVAL((ps[(2) - (3)].val.i_tkval)); @@ -494,27 +496,31 @@ case 2: break; case 52: -#line 519 "perly.y" - { (yyval.opval) = newWHENOP((ps[(3) - (3)].val.opval), scope((ps[(1) - (3)].val.opval))); ;} +#line 521 "perly.y" + { (yyval.opval) = newWHENOP((ps[(3) - (3)].val.opval), op_scope((ps[(1) - (3)].val.opval))); ;} break; case 53: -#line 524 "perly.y" +#line 526 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 54: -#line 526 "perly.y" - { ((ps[(2) - (2)].val.opval))->op_flags |= OPf_PARENS; (yyval.opval) = scope((ps[(2) - (2)].val.opval)); +#line 528 "perly.y" + { + ((ps[(2) - (2)].val.opval))->op_flags |= OPf_PARENS; + (yyval.opval) = op_scope((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 55: -#line 530 "perly.y" +#line 534 "perly.y" { PL_parser->copline = (line_t)IVAL((ps[(1) - (6)].val.i_tkval)); - (yyval.opval) = newCONDOP(0, newSTATEOP(OPf_SPECIAL,NULL,(ps[(3) - (6)].val.opval)), scope((ps[(5) - (6)].val.opval)), (ps[(6) - (6)].val.opval)); - PL_hints |= HINT_BLOCK_SCOPE; + (yyval.opval) = newCONDOP(0, + newSTATEOP(OPf_SPECIAL,NULL,(ps[(3) - (6)].val.opval)), + op_scope((ps[(5) - (6)].val.opval)), (ps[(6) - (6)].val.opval)); + PL_hints |= HINT_BLOCK_SCOPE; TOKEN_GETMAD((ps[(1) - (6)].val.i_tkval),(yyval.opval),'I'); TOKEN_GETMAD((ps[(2) - (6)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(4) - (6)].val.i_tkval),(yyval.opval),')'); @@ -522,58 +528,59 @@ case 2: break; case 56: -#line 541 "perly.y" +#line 547 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 57: -#line 543 "perly.y" - { (yyval.opval) = scope((ps[(2) - (2)].val.opval)); +#line 549 "perly.y" + { + (yyval.opval) = op_scope((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 58: -#line 550 "perly.y" +#line 557 "perly.y" { (yyval.ival) = (PL_min_intro_pending && PL_max_intro_pending >= PL_min_intro_pending); intro_my(); ;} break; case 59: -#line 556 "perly.y" +#line 563 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 61: -#line 562 "perly.y" +#line 569 "perly.y" { YYSTYPE tmplval; (void)scan_num("1", &tmplval); (yyval.opval) = tmplval.opval; ;} break; case 63: -#line 570 "perly.y" +#line 577 "perly.y" { (yyval.opval) = invert(scalar((ps[(1) - (1)].val.opval))); ;} break; case 64: -#line 575 "perly.y" +#line 582 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); intro_my(); ;} break; case 65: -#line 579 "perly.y" +#line 586 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); intro_my(); ;} break; case 66: -#line 583 "perly.y" +#line 590 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); intro_my(); ;} break; case 67: -#line 588 "perly.y" +#line 595 "perly.y" { #ifdef MAD YYSTYPE tmplval; @@ -586,35 +593,35 @@ case 2: break; case 69: -#line 600 "perly.y" +#line 607 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 70: -#line 601 "perly.y" +#line 608 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 71: -#line 605 "perly.y" +#line 612 "perly.y" { (yyval.ival) = start_subparse(FALSE, 0); SAVEFREESV(PL_compcv); ;} break; case 72: -#line 611 "perly.y" +#line 618 "perly.y" { (yyval.ival) = start_subparse(FALSE, CVf_ANON); SAVEFREESV(PL_compcv); ;} break; case 73: -#line 616 "perly.y" +#line 623 "perly.y" { (yyval.ival) = start_subparse(TRUE, 0); SAVEFREESV(PL_compcv); ;} break; case 74: -#line 621 "perly.y" +#line 628 "perly.y" { const char *const name = SvPV_nolen_const(((SVOP*)(ps[(1) - (1)].val.opval))->op_sv); if (strEQ(name, "BEGIN") || strEQ(name, "END") || strEQ(name, "INIT") || strEQ(name, "CHECK") @@ -624,24 +631,24 @@ case 2: break; case 75: -#line 631 "perly.y" +#line 638 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 77: -#line 637 "perly.y" +#line 644 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 78: -#line 639 "perly.y" +#line 646 "perly.y" { (yyval.opval) = (ps[(2) - (2)].val.opval); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),':'); ;} break; case 79: -#line 643 "perly.y" +#line 650 "perly.y" { (yyval.opval) = IF_MAD( newOP(OP_NULL, 0), (OP*)NULL @@ -651,14 +658,14 @@ case 2: break; case 80: -#line 653 "perly.y" +#line 660 "perly.y" { (yyval.opval) = (ps[(2) - (2)].val.opval); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),':'); ;} break; case 81: -#line 657 "perly.y" +#line 664 "perly.y" { (yyval.opval) = IF_MAD( newOP(OP_NULL, 0), (OP*)NULL @@ -668,12 +675,12 @@ case 2: break; case 82: -#line 666 "perly.y" +#line 673 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 83: -#line 667 "perly.y" +#line 674 "perly.y" { (yyval.opval) = IF_MAD( newOP(OP_NULL,0), (OP*)NULL @@ -684,28 +691,28 @@ case 2: break; case 84: -#line 678 "perly.y" +#line 685 "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 85: -#line 682 "perly.y" +#line 689 "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 86: -#line 686 "perly.y" +#line 693 "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 88: -#line 694 "perly.y" +#line 701 "perly.y" { #ifdef MAD OP* op = newNULLLIST(); @@ -718,7 +725,7 @@ case 2: break; case 89: -#line 704 "perly.y" +#line 711 "perly.y" { OP* term = (ps[(3) - (3)].val.opval); DO_MAD( @@ -730,7 +737,7 @@ case 2: break; case 91: -#line 717 "perly.y" +#line 724 "perly.y" { (yyval.opval) = convert(IVAL((ps[(1) - (3)].val.i_tkval)), OPf_STACKED, op_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'); @@ -738,7 +745,7 @@ case 2: break; case 92: -#line 722 "perly.y" +#line 729 "perly.y" { (yyval.opval) = convert(IVAL((ps[(1) - (5)].val.i_tkval)), OPf_STACKED, op_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'); @@ -748,7 +755,7 @@ case 2: break; case 93: -#line 729 "perly.y" +#line 736 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, op_prepend_elem(OP_LIST, scalar((ps[(1) - (6)].val.opval)), (ps[(5) - (6)].val.opval)), @@ -760,7 +767,7 @@ case 2: break; case 94: -#line 738 "perly.y" +#line 745 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, scalar((ps[(1) - (3)].val.opval)), newUNOP(OP_METHOD, 0, (ps[(3) - (3)].val.opval)))); @@ -769,7 +776,7 @@ case 2: break; case 95: -#line 744 "perly.y" +#line 751 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, op_prepend_elem(OP_LIST, (ps[(2) - (3)].val.opval), (ps[(3) - (3)].val.opval)), @@ -778,7 +785,7 @@ case 2: break; case 96: -#line 750 "perly.y" +#line 757 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, op_prepend_elem(OP_LIST, (ps[(2) - (5)].val.opval), (ps[(4) - (5)].val.opval)), @@ -789,14 +796,14 @@ case 2: break; case 97: -#line 758 "perly.y" +#line 765 "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 98: -#line 762 "perly.y" +#line 769 "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),'('); @@ -805,13 +812,13 @@ case 2: break; case 99: -#line 768 "perly.y" +#line 775 "perly.y" { SvREFCNT_inc_simple_void(PL_compcv); (yyval.opval) = newANONATTRSUB((ps[(2) - (3)].val.ival), 0, (OP*)NULL, (ps[(3) - (3)].val.opval)); ;} break; case 100: -#line 771 "perly.y" +#line 778 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, op_prepend_elem(OP_LIST, (ps[(4) - (5)].val.opval), (ps[(5) - (5)].val.opval)), (ps[(1) - (5)].val.opval))); @@ -819,7 +826,7 @@ case 2: break; case 103: -#line 786 "perly.y" +#line 793 "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),'{'); @@ -829,7 +836,7 @@ case 2: break; case 104: -#line 793 "perly.y" +#line 800 "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),']'); @@ -837,7 +844,7 @@ case 2: break; case 105: -#line 798 "perly.y" +#line 805 "perly.y" { (yyval.opval) = newBINOP(OP_AELEM, 0, ref(newAVREF((ps[(1) - (5)].val.opval)),OP_RV2AV), scalar((ps[(4) - (5)].val.opval))); @@ -848,7 +855,7 @@ case 2: break; case 106: -#line 806 "perly.y" +#line 813 "perly.y" { (yyval.opval) = newBINOP(OP_AELEM, 0, ref(newAVREF((ps[(1) - (4)].val.opval)),OP_RV2AV), scalar((ps[(3) - (4)].val.opval))); @@ -858,7 +865,7 @@ case 2: break; case 107: -#line 813 "perly.y" +#line 820 "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),'{'); @@ -868,7 +875,7 @@ case 2: break; case 108: -#line 820 "perly.y" +#line 827 "perly.y" { (yyval.opval) = newBINOP(OP_HELEM, 0, ref(newHVREF((ps[(1) - (6)].val.opval)),OP_RV2HV), jmaybe((ps[(4) - (6)].val.opval))); @@ -881,7 +888,7 @@ case 2: break; case 109: -#line 830 "perly.y" +#line 837 "perly.y" { (yyval.opval) = newBINOP(OP_HELEM, 0, ref(newHVREF((ps[(1) - (5)].val.opval)),OP_RV2HV), jmaybe((ps[(3) - (5)].val.opval))); @@ -893,7 +900,7 @@ case 2: break; case 110: -#line 839 "perly.y" +#line 846 "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'); @@ -903,7 +910,7 @@ case 2: break; case 111: -#line 846 "perly.y" +#line 853 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, (ps[(4) - (5)].val.opval), newCVREF(0, scalar((ps[(1) - (5)].val.opval))))); @@ -914,7 +921,7 @@ case 2: break; case 112: -#line 855 "perly.y" +#line 862 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, (ps[(3) - (4)].val.opval), newCVREF(0, scalar((ps[(1) - (4)].val.opval))))); @@ -924,7 +931,7 @@ case 2: break; case 113: -#line 862 "perly.y" +#line 869 "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),'('); @@ -933,7 +940,7 @@ case 2: break; case 114: -#line 868 "perly.y" +#line 875 "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),')'); @@ -943,7 +950,7 @@ case 2: break; case 115: -#line 875 "perly.y" +#line 882 "perly.y" { (yyval.opval) = newSLICEOP(0, (ps[(3) - (4)].val.opval), (ps[(1) - (4)].val.opval)); TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'['); TOKEN_GETMAD((ps[(4) - (4)].val.i_tkval),(yyval.opval),']'); @@ -951,7 +958,7 @@ case 2: break; case 116: -#line 880 "perly.y" +#line 887 "perly.y" { (yyval.opval) = newSLICEOP(0, (ps[(4) - (5)].val.opval), (OP*)NULL); TOKEN_GETMAD((ps[(1) - (5)].val.i_tkval),(yyval.opval),'('); TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),')'); @@ -961,21 +968,21 @@ case 2: break; case 117: -#line 890 "perly.y" +#line 897 "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 118: -#line 894 "perly.y" +#line 901 "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 898 "perly.y" +#line 905 "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))); @@ -984,49 +991,49 @@ case 2: break; case 120: -#line 904 "perly.y" +#line 911 "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 908 "perly.y" +#line 915 "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 912 "perly.y" +#line 919 "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 916 "perly.y" +#line 923 "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 124: -#line 920 "perly.y" +#line 927 "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 125: -#line 924 "perly.y" +#line 931 "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 126: -#line 928 "perly.y" +#line 935 "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({ @@ -1041,28 +1048,28 @@ case 2: break; case 127: -#line 940 "perly.y" +#line 947 "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 128: -#line 944 "perly.y" +#line 951 "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 129: -#line 948 "perly.y" +#line 955 "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 130: -#line 952 "perly.y" +#line 959 "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 @@ -1072,14 +1079,14 @@ case 2: break; case 131: -#line 962 "perly.y" +#line 969 "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 132: -#line 966 "perly.y" +#line 973 "perly.y" { (yyval.opval) = IF_MAD( newUNOP(OP_NULL, 0, (ps[(2) - (2)].val.opval)), (ps[(2) - (2)].val.opval) @@ -1089,53 +1096,53 @@ case 2: break; case 133: -#line 973 "perly.y" +#line 980 "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 134: -#line 977 "perly.y" +#line 984 "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 135: -#line 981 "perly.y" +#line 988 "perly.y" { (yyval.opval) = newUNOP(OP_POSTINC, 0, - mod(scalar((ps[(1) - (2)].val.opval)), OP_POSTINC)); + op_lvalue(scalar((ps[(1) - (2)].val.opval)), OP_POSTINC)); TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 136: -#line 986 "perly.y" +#line 993 "perly.y" { (yyval.opval) = newUNOP(OP_POSTDEC, 0, - mod(scalar((ps[(1) - (2)].val.opval)), OP_POSTDEC)); + op_lvalue(scalar((ps[(1) - (2)].val.opval)), OP_POSTDEC)); TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 137: -#line 991 "perly.y" +#line 998 "perly.y" { (yyval.opval) = newUNOP(OP_PREINC, 0, - mod(scalar((ps[(2) - (2)].val.opval)), OP_PREINC)); + op_lvalue(scalar((ps[(2) - (2)].val.opval)), OP_PREINC)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 138: -#line 996 "perly.y" +#line 1003 "perly.y" { (yyval.opval) = newUNOP(OP_PREDEC, 0, - mod(scalar((ps[(2) - (2)].val.opval)), OP_PREDEC)); + op_lvalue(scalar((ps[(2) - (2)].val.opval)), OP_PREDEC)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 139: -#line 1005 "perly.y" +#line 1012 "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),']'); @@ -1143,7 +1150,7 @@ case 2: break; case 140: -#line 1010 "perly.y" +#line 1017 "perly.y" { (yyval.opval) = newANONLIST((OP*)NULL); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'['); TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),']'); @@ -1151,7 +1158,7 @@ case 2: break; case 141: -#line 1015 "perly.y" +#line 1022 "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),';'); @@ -1160,7 +1167,7 @@ case 2: break; case 142: -#line 1021 "perly.y" +#line 1028 "perly.y" { (yyval.opval) = newANONHASH((OP*)NULL); TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'{'); TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),';'); @@ -1169,7 +1176,7 @@ case 2: break; case 143: -#line 1027 "perly.y" +#line 1034 "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'); @@ -1179,21 +1186,21 @@ case 2: break; case 144: -#line 1038 "perly.y" +#line 1045 "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 145: -#line 1042 "perly.y" - { (yyval.opval) = newUNOP(OP_NULL, OPf_SPECIAL, scope((ps[(2) - (2)].val.opval))); +#line 1049 "perly.y" + { (yyval.opval) = newUNOP(OP_NULL, OPf_SPECIAL, op_scope((ps[(2) - (2)].val.opval))); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'D'); ;} break; case 146: -#line 1046 "perly.y" +#line 1053 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, op_prepend_elem(OP_LIST, @@ -1208,7 +1215,7 @@ case 2: break; case 147: -#line 1058 "perly.y" +#line 1065 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, op_append_elem(OP_LIST, @@ -1224,7 +1231,7 @@ case 2: break; case 148: -#line 1071 "perly.y" +#line 1078 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, op_prepend_elem(OP_LIST, scalar(newCVREF(0,scalar((ps[(2) - (4)].val.opval)))), (OP*)NULL)); dep(); @@ -1235,7 +1242,7 @@ case 2: break; case 149: -#line 1079 "perly.y" +#line 1086 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, op_prepend_elem(OP_LIST, (ps[(4) - (5)].val.opval), @@ -1247,7 +1254,7 @@ case 2: break; case 154: -#line 1095 "perly.y" +#line 1102 "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),':'); @@ -1255,26 +1262,26 @@ case 2: break; case 155: -#line 1100 "perly.y" - { (yyval.opval) = newUNOP(OP_REFGEN, 0, mod((ps[(2) - (2)].val.opval),OP_REFGEN)); +#line 1107 "perly.y" + { (yyval.opval) = newUNOP(OP_REFGEN, 0, op_lvalue((ps[(2) - (2)].val.opval),OP_REFGEN)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); ;} break; case 156: -#line 1104 "perly.y" +#line 1111 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 157: -#line 1106 "perly.y" +#line 1113 "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),'k'); ;} break; case 158: -#line 1110 "perly.y" +#line 1117 "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),')'); @@ -1282,12 +1289,12 @@ case 2: break; case 159: -#line 1115 "perly.y" +#line 1122 "perly.y" { (yyval.opval) = IF_MAD(newUNOP(OP_NULL,0,(ps[(1) - (1)].val.opval)), (ps[(1) - (1)].val.opval)); ;} break; case 160: -#line 1117 "perly.y" +#line 1124 "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),')'); @@ -1295,37 +1302,37 @@ case 2: break; case 161: -#line 1122 "perly.y" +#line 1129 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 162: -#line 1124 "perly.y" +#line 1131 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 163: -#line 1126 "perly.y" +#line 1133 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 164: -#line 1128 "perly.y" +#line 1135 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 165: -#line 1130 "perly.y" +#line 1137 "perly.y" { (yyval.opval) = newUNOP(OP_AV2ARYLEN, 0, ref((ps[(1) - (1)].val.opval), OP_AV2ARYLEN));;} break; case 166: -#line 1132 "perly.y" +#line 1139 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 167: -#line 1134 "perly.y" +#line 1141 "perly.y" { (yyval.opval) = op_prepend_elem(OP_ASLICE, newOP(OP_PUSHMARK, 0), newLISTOP(OP_ASLICE, 0, @@ -1337,7 +1344,7 @@ case 2: break; case 168: -#line 1143 "perly.y" +#line 1150 "perly.y" { (yyval.opval) = op_prepend_elem(OP_HSLICE, newOP(OP_PUSHMARK, 0), newLISTOP(OP_HSLICE, 0, @@ -1351,17 +1358,17 @@ case 2: break; case 169: -#line 1154 "perly.y" +#line 1161 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 170: -#line 1156 "perly.y" +#line 1163 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, 0, scalar((ps[(1) - (1)].val.opval))); ;} break; case 171: -#line 1158 "perly.y" +#line 1165 "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),')'); @@ -1369,7 +1376,7 @@ case 2: break; case 172: -#line 1163 "perly.y" +#line 1170 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, (ps[(3) - (4)].val.opval), scalar((ps[(1) - (4)].val.opval)))); @@ -1385,7 +1392,7 @@ case 2: break; case 173: -#line 1176 "perly.y" +#line 1183 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, op_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'); @@ -1393,7 +1400,7 @@ case 2: break; case 174: -#line 1181 "perly.y" +#line 1188 "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'); @@ -1401,74 +1408,74 @@ case 2: break; case 175: -#line 1186 "perly.y" +#line 1193 "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 176: -#line 1190 "perly.y" +#line 1197 "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 177: -#line 1194 "perly.y" +#line 1201 "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 178: -#line 1198 "perly.y" +#line 1205 "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 179: -#line 1202 "perly.y" +#line 1209 "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 180: -#line 1206 "perly.y" +#line 1213 "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 181: -#line 1210 "perly.y" +#line 1217 "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 182: -#line 1214 "perly.y" +#line 1221 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((ps[(1) - (1)].val.opval))); ;} break; case 183: -#line 1216 "perly.y" +#line 1223 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, (ps[(2) - (2)].val.opval), scalar((ps[(1) - (2)].val.opval)))); ;} break; case 184: -#line 1219 "perly.y" +#line 1226 "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 185: -#line 1223 "perly.y" +#line 1230 "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),'('); @@ -1477,13 +1484,13 @@ case 2: break; case 186: -#line 1229 "perly.y" +#line 1236 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((ps[(1) - (1)].val.opval))); ;} break; case 187: -#line 1232 "perly.y" +#line 1239 "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); @@ -1495,7 +1502,7 @@ case 2: break; case 188: -#line 1241 "perly.y" +#line 1248 "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),'('); @@ -1504,7 +1511,7 @@ case 2: break; case 189: -#line 1247 "perly.y" +#line 1254 "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),')'); @@ -1512,7 +1519,7 @@ case 2: break; case 192: -#line 1254 "perly.y" +#line 1261 "perly.y" { (yyval.opval) = newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0), newSVOP(OP_CONST, 0, newSVpvs("Unimplemented"))); @@ -1521,7 +1528,7 @@ case 2: break; case 194: -#line 1264 "perly.y" +#line 1271 "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'); @@ -1532,14 +1539,14 @@ case 2: break; case 195: -#line 1272 "perly.y" +#line 1279 "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 196: -#line 1279 "perly.y" +#line 1286 "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),')'); @@ -1547,7 +1554,7 @@ case 2: break; case 197: -#line 1284 "perly.y" +#line 1291 "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),')'); @@ -1555,119 +1562,119 @@ case 2: break; case 198: -#line 1289 "perly.y" +#line 1296 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 199: -#line 1291 "perly.y" +#line 1298 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 200: -#line 1293 "perly.y" +#line 1300 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 201: -#line 1298 "perly.y" +#line 1305 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 202: -#line 1300 "perly.y" +#line 1307 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 203: -#line 1304 "perly.y" +#line 1311 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 204: -#line 1306 "perly.y" +#line 1313 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 205: -#line 1310 "perly.y" +#line 1317 "perly.y" { (yyval.i_tkval) = (ps[(1) - (1)].val.i_tkval); ;} break; case 206: -#line 1312 "perly.y" +#line 1319 "perly.y" { munge_qwlist_to_paren_list((ps[(1) - (1)].val.opval)); ;} break; case 207: -#line 1314 "perly.y" +#line 1321 "perly.y" { (yyval.i_tkval) = (ps[(3) - (3)].val.i_tkval); ;} break; case 208: -#line 1320 "perly.y" +#line 1327 "perly.y" { PL_parser->in_my = 0; (yyval.opval) = my((ps[(1) - (1)].val.opval)); ;} break; case 209: -#line 1324 "perly.y" +#line 1331 "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 210: -#line 1330 "perly.y" +#line 1337 "perly.y" { (yyval.opval) = newSVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'$'); ;} break; case 211: -#line 1336 "perly.y" +#line 1343 "perly.y" { (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'@'); ;} break; case 212: -#line 1342 "perly.y" +#line 1349 "perly.y" { (yyval.opval) = newHVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'%'); ;} break; case 213: -#line 1348 "perly.y" +#line 1355 "perly.y" { (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'l'); ;} break; case 214: -#line 1354 "perly.y" +#line 1361 "perly.y" { (yyval.opval) = newGVREF(0,(ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'*'); ;} break; case 215: -#line 1361 "perly.y" +#line 1368 "perly.y" { (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;} break; case 216: -#line 1363 "perly.y" +#line 1370 "perly.y" { (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;} break; case 217: -#line 1365 "perly.y" - { (yyval.opval) = scope((ps[(1) - (1)].val.opval)); ;} +#line 1372 "perly.y" + { (yyval.opval) = op_scope((ps[(1) - (1)].val.opval)); ;} break; case 218: -#line 1368 "perly.y" +#line 1375 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; @@ -173,25 +173,25 @@ static const yytype_uint16 yyrline[] = 0, 142, 142, 145, 144, 157, 156, 169, 168, 181, 180, 192, 198, 208, 212, 216, 222, 232, 237, 238, 247, 260, 262, 267, 285, 306, 318, 334, 333, 350, - 358, 366, 372, 374, 376, 386, 396, 417, 426, 435, - 444, 452, 451, 477, 483, 493, 495, 497, 501, 505, - 509, 513, 518, 524, 525, 529, 541, 542, 550, 556, - 557, 562, 565, 569, 574, 578, 582, 588, 597, 600, - 601, 605, 611, 616, 621, 631, 632, 637, 638, 642, - 652, 656, 666, 667, 677, 681, 685, 689, 693, 703, - 712, 716, 721, 728, 737, 743, 749, 757, 761, 768, - 767, 778, 779, 783, 792, 797, 805, 812, 819, 829, - 838, 845, 854, 861, 867, 874, 879, 889, 893, 897, - 903, 907, 911, 915, 919, 923, 927, 939, 943, 947, - 951, 961, 965, 972, 976, 980, 985, 990, 995, 1004, - 1009, 1014, 1020, 1026, 1037, 1041, 1045, 1057, 1070, 1078, - 1090, 1091, 1092, 1093, 1094, 1099, 1103, 1105, 1109, 1114, - 1116, 1121, 1123, 1125, 1127, 1129, 1131, 1133, 1142, 1153, - 1155, 1157, 1162, 1175, 1180, 1185, 1189, 1193, 1197, 1201, - 1205, 1209, 1213, 1215, 1218, 1222, 1228, 1231, 1240, 1246, - 1251, 1252, 1253, 1259, 1263, 1271, 1278, 1283, 1288, 1290, - 1292, 1297, 1299, 1304, 1305, 1309, 1312, 1311, 1319, 1323, - 1329, 1335, 1341, 1347, 1353, 1360, 1362, 1364, 1367 + 359, 368, 374, 376, 378, 388, 398, 419, 428, 437, + 446, 454, 453, 479, 485, 495, 497, 499, 503, 507, + 511, 515, 520, 526, 527, 533, 547, 548, 557, 563, + 564, 569, 572, 576, 581, 585, 589, 595, 604, 607, + 608, 612, 618, 623, 628, 638, 639, 644, 645, 649, + 659, 663, 673, 674, 684, 688, 692, 696, 700, 710, + 719, 723, 728, 735, 744, 750, 756, 764, 768, 775, + 774, 785, 786, 790, 799, 804, 812, 819, 826, 836, + 845, 852, 861, 868, 874, 881, 886, 896, 900, 904, + 910, 914, 918, 922, 926, 930, 934, 946, 950, 954, + 958, 968, 972, 979, 983, 987, 992, 997, 1002, 1011, + 1016, 1021, 1027, 1033, 1044, 1048, 1052, 1064, 1077, 1085, + 1097, 1098, 1099, 1100, 1101, 1106, 1110, 1112, 1116, 1121, + 1123, 1128, 1130, 1132, 1134, 1136, 1138, 1140, 1149, 1160, + 1162, 1164, 1169, 1182, 1187, 1192, 1196, 1200, 1204, 1208, + 1212, 1216, 1220, 1222, 1225, 1229, 1235, 1238, 1247, 1253, + 1258, 1259, 1260, 1266, 1270, 1278, 1285, 1290, 1295, 1297, + 1299, 1304, 1306, 1311, 1312, 1316, 1319, 1318, 1326, 1330, + 1336, 1342, 1348, 1354, 1360, 1367, 1369, 1371, 1374 }; #endif @@ -349,7 +349,8 @@ barestmt: PLUGSTMT } | IF lpar_or_qw remember mexpr ')' mblock else { - $$ = block_end($3, newCONDOP(0, $4, scope($6), $7)); + $$ = block_end($3, + newCONDOP(0, $4, op_scope($6), $7)); TOKEN_GETMAD($1,$$,'I'); TOKEN_GETMAD($2,$$,'('); TOKEN_GETMAD($5,$$,')'); @@ -357,7 +358,8 @@ barestmt: PLUGSTMT } | UNLESS lpar_or_qw remember miexpr ')' mblock else { - $$ = block_end($3, newCONDOP(0, $4, scope($6), $7)); + $$ = block_end($3, + newCONDOP(0, $4, op_scope($6), $7)); TOKEN_GETMAD($1,$$,'I'); TOKEN_GETMAD($2,$$,'('); TOKEN_GETMAD($5,$$,')'); @@ -366,13 +368,13 @@ barestmt: PLUGSTMT | GIVEN lpar_or_qw remember mydefsv mexpr ')' mblock { $$ = block_end($3, - newGIVENOP($5, scope($7), (PADOFFSET)$4)); + newGIVENOP($5, op_scope($7), (PADOFFSET)$4)); PL_parser->copline = (line_t)IVAL($1); } | WHEN lpar_or_qw remember mexpr ')' mblock - { $$ = block_end($3, newWHENOP($4, scope($6))); } + { $$ = block_end($3, newWHENOP($4, op_scope($6))); } | DEFAULT block - { $$ = newWHENOP(0, scope($2)); } + { $$ = newWHENOP(0, op_scope($2)); } | WHILE lpar_or_qw remember texpr ')' mintro mblock cont { $$ = block_end($3, @@ -426,7 +428,7 @@ barestmt: PLUGSTMT | FOR scalar lpar_or_qw remember mexpr ')' mblock cont { $$ = block_end($4, newFOROP(0, - mod($2, OP_ENTERLOOP), $5, $7, $8)); + op_lvalue($2, OP_ENTERLOOP), $5, $7, $8)); TOKEN_GETMAD($1,$$,'W'); TOKEN_GETMAD($3,$$,'('); TOKEN_GETMAD($6,$$,')'); @@ -516,20 +518,24 @@ sideff : error PL_parser->copline = (line_t)IVAL($2); } | expr WHEN expr - { $$ = newWHENOP($3, scope($1)); } + { $$ = newWHENOP($3, op_scope($1)); } ; /* else and elsif blocks */ else : /* NULL */ { $$ = (OP*)NULL; } | ELSE mblock - { ($2)->op_flags |= OPf_PARENS; $$ = scope($2); + { + ($2)->op_flags |= OPf_PARENS; + $$ = op_scope($2); TOKEN_GETMAD($1,$$,'o'); } | ELSIF lpar_or_qw mexpr ')' mblock else { PL_parser->copline = (line_t)IVAL($1); - $$ = newCONDOP(0, newSTATEOP(OPf_SPECIAL,NULL,$3), scope($5), $6); - PL_hints |= HINT_BLOCK_SCOPE; + $$ = newCONDOP(0, + newSTATEOP(OPf_SPECIAL,NULL,$3), + op_scope($5), $6); + PL_hints |= HINT_BLOCK_SCOPE; TOKEN_GETMAD($1,$$,'I'); TOKEN_GETMAD($2,$$,'('); TOKEN_GETMAD($4,$$,')'); @@ -540,7 +546,8 @@ else : /* NULL */ cont : /* NULL */ { $$ = (OP*)NULL; } | CONTINUE block - { $$ = scope($2); + { + $$ = op_scope($2); TOKEN_GETMAD($1,$$,'o'); } ; @@ -979,22 +986,22 @@ termunop : '-' term %prec UMINUS /* -$x */ } | term POSTINC /* $x++ */ { $$ = newUNOP(OP_POSTINC, 0, - mod(scalar($1), OP_POSTINC)); + op_lvalue(scalar($1), OP_POSTINC)); TOKEN_GETMAD($2,$$,'o'); } | term POSTDEC /* $x-- */ { $$ = newUNOP(OP_POSTDEC, 0, - mod(scalar($1), OP_POSTDEC)); + op_lvalue(scalar($1), OP_POSTDEC)); TOKEN_GETMAD($2,$$,'o'); } | PREINC term /* ++$x */ { $$ = newUNOP(OP_PREINC, 0, - mod(scalar($2), OP_PREINC)); + op_lvalue(scalar($2), OP_PREINC)); TOKEN_GETMAD($1,$$,'o'); } | PREDEC term /* --$x */ { $$ = newUNOP(OP_PREDEC, 0, - mod(scalar($2), OP_PREDEC)); + op_lvalue(scalar($2), OP_PREDEC)); TOKEN_GETMAD($1,$$,'o'); } @@ -1039,7 +1046,7 @@ termdo : DO term %prec UNIOP /* do $filename */ TOKEN_GETMAD($1,$$,'o'); } | DO block %prec '(' /* do { code */ - { $$ = newUNOP(OP_NULL, OPf_SPECIAL, scope($2)); + { $$ = newUNOP(OP_NULL, OPf_SPECIAL, op_scope($2)); TOKEN_GETMAD($1,$$,'D'); } | DO WORD lpar_or_qw ')' /* do somesub() */ @@ -1097,7 +1104,7 @@ term : termbinop TOKEN_GETMAD($4,$$,':'); } | REFGEN term /* \$x, \@y, \%z */ - { $$ = newUNOP(OP_REFGEN, 0, mod($2,OP_REFGEN)); + { $$ = newUNOP(OP_REFGEN, 0, op_lvalue($2,OP_REFGEN)); TOKEN_GETMAD($1,$$,'o'); } | myattrterm %prec UNIOP @@ -1362,7 +1369,7 @@ indirob : WORD | scalar %prec PREC_LOW { $$ = scalar($1); } | block - { $$ = scope($1); } + { $$ = op_scope($1); } | PRIVATEREF { $$ = $1; } @@ -2211,7 +2211,6 @@ PERL_CALLCONV void Perl_mini_mktime(pTHX_ struct tm *ptm) #define PERL_ARGS_ASSERT_MINI_MKTIME \ assert(ptm) -PERL_CALLCONV OP* Perl_mod(pTHX_ OP* o, I32 type); PERL_CALLCONV int Perl_mode_from_discipline(pTHX_ const char* s, STRLEN len); PERL_CALLCONV void * Perl_more_bodies(pTHX_ const svtype sv_type, const size_t body_size, const size_t arena_size); PERL_CALLCONV const char* Perl_moreswitches(pTHX_ const char* s) @@ -2692,6 +2691,7 @@ PERL_CALLCONV OP* Perl_op_linklist(pTHX_ OP *o) #define PERL_ARGS_ASSERT_OP_LINKLIST \ assert(o) +PERL_CALLCONV OP* Perl_op_lvalue(pTHX_ OP* o, I32 type); PERL_CALLCONV void Perl_op_null(pTHX_ OP* o) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_OP_NULL \ @@ -2700,6 +2700,7 @@ PERL_CALLCONV void Perl_op_null(pTHX_ OP* o) PERL_CALLCONV OP* Perl_op_prepend_elem(pTHX_ I32 optype, OP* first, OP* last); PERL_CALLCONV void Perl_op_refcnt_lock(pTHX); PERL_CALLCONV void Perl_op_refcnt_unlock(pTHX); +PERL_CALLCONV OP* Perl_op_scope(pTHX_ OP* o); PERL_CALLCONV void Perl_pack_cat(pTHX_ SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) @@ -3750,7 +3751,6 @@ PERL_CALLCONV char* Perl_scan_vstring(pTHX_ const char *s, const char *const e, #define PERL_ARGS_ASSERT_SCAN_VSTRING \ assert(s); assert(e); assert(sv) -PERL_CALLCONV OP* Perl_scope(pTHX_ OP* o); PERL_CALLCONV char* Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift, I32 *old_posp, I32 last) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) |