From: Dave Mitchell Date: Wed, 13 Dec 2006 17:16:22 +0000 (+0000) Subject: misc MAD coredump fixes and parser leak fixes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=295222340ad6893caa0a1c3479155f88ea290dc3;p=p5sagit%2Fp5-mst-13.2.git misc MAD coredump fixes and parser leak fixes - fix MAD coredump in tr/// - fix mad coredump in multi-line string literals - kill some MAD uninit value warnings - don't allow assignment to $n in perly.y - make op_dump handle op_latefree flags p4raw-id: //depot/perl@29548 --- diff --git a/dump.c b/dump.c index 1853691..fad5060 100644 --- a/dump.c +++ b/dump.c @@ -739,7 +739,7 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o) #ifdef DUMPADDR Perl_dump_indent(aTHX_ level, file, "ADDR = 0x%"UVxf" => 0x%"UVxf"\n", (UV)o, (UV)o->op_next); #endif - if (o->op_flags) { + if (o->op_flags || o->op_latefree || o->op_latefreed) { SV * const tmpsv = newSVpvs(""); switch (o->op_flags & OPf_WANT) { case OPf_WANT_VOID: @@ -767,6 +767,10 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o) sv_catpv(tmpsv, ",MOD"); if (o->op_flags & OPf_SPECIAL) sv_catpv(tmpsv, ",SPECIAL"); + if (o->op_latefree) + sv_catpv(tmpsv, ",LATEFREE"); + if (o->op_latefreed) + sv_catpv(tmpsv, ",LATEFREED"); Perl_dump_indent(aTHX_ level, file, "FLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX_const(tmpsv) + 1 : ""); SvREFCNT_dec(tmpsv); } @@ -2389,7 +2393,7 @@ Perl_do_pmop_xmldump(pTHX_ I32 level, PerlIO *file, const PMOP *pm) level++; if (PM_GETRE(pm)) { char *s = PM_GETRE(pm)->precomp; - SV *tmpsv = newSV(0); + SV *tmpsv = newSVpvn("",0); SvUTF8_on(tmpsv); sv_catxmlpvn(tmpsv, s, strlen(s), 1); Perl_xmldump_indent(aTHX_ level, file, "pre=\"%s\"\n", @@ -2681,7 +2685,7 @@ Perl_do_op_xmldump(pTHX_ I32 level, PerlIO *file, const OP *o) #else if (cSVOPo->op_sv) { SV *tmpsv1 = newSV(0); - SV *tmpsv2 = newSV(0); + SV *tmpsv2 = newSVpvn("",0); char *s; STRLEN len; SvUTF8_on(tmpsv1); diff --git a/op.c b/op.c index cacad6e..66587c0 100644 --- a/op.c +++ b/op.c @@ -2826,7 +2826,9 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl) { dVAR; SV * const tstr = ((SVOP*)expr)->op_sv; - SV * const rstr = ((SVOP*)repl)->op_sv; + SV * const rstr = (repl->op_type == OP_NULL) + ? ((SVOP*)((LISTOP*)repl)->op_first)->op_sv + : ((SVOP*)repl)->op_sv; STRLEN tlen; STRLEN rlen; const U8 *t = (U8*)SvPV_const(tstr, tlen); diff --git a/perly.act b/perly.act index 80d4e96..60c7f79 100644 --- a/perly.act +++ b/perly.act @@ -1,10 +1,10 @@ case 2: -#line 133 "perly.y" +#line 137 "perly.y" { (yyval.ival) = (yyvsp[(1) - (2)].ival); newPROG(block_end((yyvsp[(1) - (2)].ival),(yyvsp[(2) - (2)].opval))); ;} break; case 3: -#line 138 "perly.y" +#line 142 "perly.y" { if (PL_copline > (line_t)IVAL((yyvsp[(1) - (4)].i_tkval))) PL_copline = (line_t)IVAL((yyvsp[(1) - (4)].i_tkval)); (yyval.opval) = block_end((yyvsp[(2) - (4)].ival), (yyvsp[(3) - (4)].opval)); @@ -14,24 +14,24 @@ case 2: break; case 4: -#line 147 "perly.y" +#line 151 "perly.y" { (yyval.ival) = block_start(TRUE); ;} break; case 5: -#line 151 "perly.y" +#line 155 "perly.y" { (yyval.ival) = (I32) allocmy("$_"); ;} break; case 6: -#line 155 "perly.y" +#line 159 "perly.y" { PL_expect = XSTATE; (yyval.ival) = block_start(TRUE); ;} break; case 7: -#line 162 "perly.y" +#line 166 "perly.y" { if (PL_copline > (line_t)IVAL((yyvsp[(1) - (4)].i_tkval))) PL_copline = (line_t)IVAL((yyvsp[(1) - (4)].i_tkval)); (yyval.opval) = block_end((yyvsp[(2) - (4)].ival), (yyvsp[(3) - (4)].opval)); @@ -41,22 +41,22 @@ case 2: break; case 8: -#line 171 "perly.y" +#line 175 "perly.y" { (yyval.ival) = block_start(FALSE); ;} break; case 9: -#line 175 "perly.y" +#line 179 "perly.y" { (yyval.ival) = PL_savestack_ix; ;} break; case 10: -#line 179 "perly.y" +#line 183 "perly.y" { (yyval.opval) = Nullop; ;} break; case 11: -#line 181 "perly.y" +#line 185 "perly.y" { (yyval.opval) = IF_MAD( append_list(OP_LINESEQ, @@ -66,7 +66,7 @@ case 2: break; case 12: -#line 188 "perly.y" +#line 192 "perly.y" { LEAVE_SCOPE((yyvsp[(2) - (3)].ival)); (yyval.opval) = append_list(OP_LINESEQ, (LISTOP*)(yyvsp[(1) - (3)].opval), (LISTOP*)(yyvsp[(3) - (3)].opval)); @@ -75,23 +75,23 @@ case 2: break; case 13: -#line 197 "perly.y" +#line 201 "perly.y" { (yyval.opval) = newSTATEOP(0, PVAL((yyvsp[(1) - (2)].p_tkval)), (yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].p_tkval),((LISTOP*)(yyval.opval))->op_first,'L'); ;} break; case 15: -#line 201 "perly.y" +#line 205 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 16: -#line 203 "perly.y" +#line 207 "perly.y" { (yyval.opval) = newSTATEOP(0, PVAL((yyvsp[(1) - (2)].p_tkval)), (yyvsp[(2) - (2)].opval)); ;} break; case 17: -#line 205 "perly.y" +#line 209 "perly.y" { if (PVAL((yyvsp[(1) - (2)].p_tkval))) { (yyval.opval) = newSTATEOP(0, PVAL((yyvsp[(1) - (2)].p_tkval)), newOP(OP_NULL, 0)); @@ -111,7 +111,7 @@ case 2: break; case 18: -#line 222 "perly.y" +#line 226 "perly.y" { (yyval.opval) = newSTATEOP(0, PVAL((yyvsp[(1) - (3)].p_tkval)), (yyvsp[(2) - (3)].opval)); PL_expect = XSTATE; @@ -130,45 +130,45 @@ case 2: break; case 19: -#line 241 "perly.y" +#line 245 "perly.y" { (yyval.opval) = Nullop; ;} break; case 20: -#line 243 "perly.y" +#line 247 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 21: -#line 245 "perly.y" +#line 249 "perly.y" { (yyval.opval) = newLOGOP(OP_AND, 0, (yyvsp[(3) - (3)].opval), (yyvsp[(1) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'i'); ;} break; case 22: -#line 249 "perly.y" +#line 253 "perly.y" { (yyval.opval) = newLOGOP(OP_OR, 0, (yyvsp[(3) - (3)].opval), (yyvsp[(1) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'i'); ;} break; case 23: -#line 253 "perly.y" +#line 257 "perly.y" { (yyval.opval) = newLOOPOP(OPf_PARENS, 1, scalar((yyvsp[(3) - (3)].opval)), (yyvsp[(1) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'w'); ;} break; case 24: -#line 257 "perly.y" +#line 261 "perly.y" { (yyval.opval) = newLOOPOP(OPf_PARENS, 1, (yyvsp[(3) - (3)].opval), (yyvsp[(1) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'w'); ;} break; case 25: -#line 261 "perly.y" +#line 265 "perly.y" { (yyval.opval) = newFOROP(0, Nullch, (line_t)IVAL((yyvsp[(2) - (3)].i_tkval)), Nullop, (yyvsp[(3) - (3)].opval), (yyvsp[(1) - (3)].opval), Nullop); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),((LISTOP*)(yyval.opval))->op_first->op_sibling,'w'); @@ -176,19 +176,19 @@ case 2: break; case 26: -#line 269 "perly.y" +#line 273 "perly.y" { (yyval.opval) = Nullop; ;} break; case 27: -#line 271 "perly.y" +#line 275 "perly.y" { ((yyvsp[(2) - (2)].opval))->op_flags |= OPf_PARENS; (yyval.opval) = scope((yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 28: -#line 275 "perly.y" +#line 279 "perly.y" { PL_copline = (line_t)IVAL((yyvsp[(1) - (6)].i_tkval)); (yyval.opval) = newCONDOP(0, (yyvsp[(3) - (6)].opval), scope((yyvsp[(5) - (6)].opval)), (yyvsp[(6) - (6)].opval)); PL_hints |= HINT_BLOCK_SCOPE; @@ -199,7 +199,7 @@ case 2: break; case 29: -#line 286 "perly.y" +#line 290 "perly.y" { PL_copline = (line_t)IVAL((yyvsp[(1) - (7)].i_tkval)); (yyval.opval) = block_end((yyvsp[(3) - (7)].ival), newCONDOP(0, (yyvsp[(4) - (7)].opval), scope((yyvsp[(6) - (7)].opval)), (yyvsp[(7) - (7)].opval))); @@ -210,7 +210,7 @@ case 2: break; case 30: -#line 294 "perly.y" +#line 298 "perly.y" { PL_copline = (line_t)IVAL((yyvsp[(1) - (7)].i_tkval)); (yyval.opval) = block_end((yyvsp[(3) - (7)].ival), newCONDOP(0, (yyvsp[(4) - (7)].opval), scope((yyvsp[(6) - (7)].opval)), (yyvsp[(7) - (7)].opval))); @@ -221,30 +221,30 @@ case 2: break; case 31: -#line 305 "perly.y" +#line 309 "perly.y" { (yyval.opval) = block_end((yyvsp[(3) - (6)].ival), newWHENOP((yyvsp[(4) - (6)].opval), scope((yyvsp[(6) - (6)].opval)))); ;} break; case 32: -#line 308 "perly.y" +#line 312 "perly.y" { (yyval.opval) = newWHENOP(0, scope((yyvsp[(2) - (2)].opval))); ;} break; case 33: -#line 313 "perly.y" +#line 317 "perly.y" { (yyval.opval) = Nullop; ;} break; case 34: -#line 315 "perly.y" +#line 319 "perly.y" { (yyval.opval) = scope((yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 35: -#line 322 "perly.y" +#line 326 "perly.y" { OP *innerop; PL_copline = (line_t)(yyvsp[(2) - (9)].i_tkval); (yyval.opval) = block_end((yyvsp[(4) - (9)].ival), @@ -259,7 +259,7 @@ case 2: break; case 36: -#line 335 "perly.y" +#line 339 "perly.y" { OP *innerop; PL_copline = (line_t)(yyvsp[(2) - (9)].i_tkval); (yyval.opval) = block_end((yyvsp[(4) - (9)].ival), @@ -274,7 +274,7 @@ case 2: break; case 37: -#line 347 "perly.y" +#line 351 "perly.y" { OP *innerop; (yyval.opval) = block_end((yyvsp[(4) - (10)].ival), innerop = newFOROP(0, PVAL((yyvsp[(1) - (10)].p_tkval)), (line_t)IVAL((yyvsp[(2) - (10)].i_tkval)), @@ -288,7 +288,7 @@ case 2: break; case 38: -#line 358 "perly.y" +#line 362 "perly.y" { OP *innerop; (yyval.opval) = block_end((yyvsp[(5) - (9)].ival), innerop = newFOROP(0, PVAL((yyvsp[(1) - (9)].p_tkval)), (line_t)IVAL((yyvsp[(2) - (9)].i_tkval)), @@ -301,7 +301,7 @@ case 2: break; case 39: -#line 368 "perly.y" +#line 372 "perly.y" { OP *innerop; (yyval.opval) = block_end((yyvsp[(4) - (8)].ival), innerop = newFOROP(0, PVAL((yyvsp[(1) - (8)].p_tkval)), (line_t)IVAL((yyvsp[(2) - (8)].i_tkval)), @@ -314,7 +314,7 @@ case 2: break; case 40: -#line 380 "perly.y" +#line 384 "perly.y" { OP *forop; PL_copline = (line_t)IVAL((yyvsp[(2) - (12)].i_tkval)); forop = newSTATEOP(0, PVAL((yyvsp[(1) - (12)].p_tkval)), @@ -322,13 +322,11 @@ case 2: IVAL((yyvsp[(2) - (12)].i_tkval)), scalar((yyvsp[(7) - (12)].opval)), (yyvsp[(12) - (12)].opval), (yyvsp[(10) - (12)].opval), (yyvsp[(9) - (12)].ival))); #ifdef MAD - if (!(yyvsp[(5) - (12)].opval)) - (yyvsp[(5) - (12)].opval) = newOP(OP_NULL, 0); forop = newUNOP(OP_NULL, 0, append_elem(OP_LINESEQ, newSTATEOP(0, (((yyvsp[(1) - (12)].p_tkval))->tk_lval.pval ?savepv(((yyvsp[(1) - (12)].p_tkval))->tk_lval.pval):Nullch), - (yyvsp[(5) - (12)].opval)), + ((yyvsp[(5) - (12)].opval) ? newOP(OP_NULL, 0) : (yyvsp[(5) - (12)].opval)) ), forop)); token_getmad((yyvsp[(2) - (12)].i_tkval),forop,'3'); @@ -351,7 +349,7 @@ case 2: break; case 41: -#line 414 "perly.y" +#line 416 "perly.y" { (yyval.opval) = newSTATEOP(0, PVAL((yyvsp[(1) - (3)].p_tkval)), newWHILEOP(0, 1, (LOOP*)Nullop, NOLINE, Nullop, (yyvsp[(2) - (3)].opval), (yyvsp[(3) - (3)].opval), 0)); @@ -359,7 +357,7 @@ case 2: break; case 42: -#line 422 "perly.y" +#line 424 "perly.y" { PL_copline = (line_t) (yyvsp[(2) - (8)].i_tkval); (yyval.opval) = block_end((yyvsp[(4) - (8)].ival), newSTATEOP(0, PVAL((yyvsp[(1) - (8)].p_tkval)), @@ -368,46 +366,46 @@ case 2: break; case 43: -#line 431 "perly.y" +#line 433 "perly.y" { (yyval.ival) = (PL_min_intro_pending && PL_max_intro_pending >= PL_min_intro_pending); intro_my(); ;} break; case 44: -#line 437 "perly.y" +#line 439 "perly.y" { (yyval.opval) = Nullop; ;} break; case 46: -#line 443 "perly.y" +#line 445 "perly.y" { YYSTYPE tmplval; (void)scan_num("1", &tmplval); (yyval.opval) = tmplval.opval; ;} break; case 48: -#line 451 "perly.y" +#line 453 "perly.y" { (yyval.opval) = invert(scalar((yyvsp[(1) - (1)].opval))); ;} break; case 49: -#line 456 "perly.y" +#line 458 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); intro_my(); ;} break; case 50: -#line 460 "perly.y" +#line 462 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); intro_my(); ;} break; case 51: -#line 464 "perly.y" +#line 466 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); intro_my(); ;} break; case 52: -#line 469 "perly.y" +#line 471 "perly.y" { #ifdef MAD YYSTYPE tmplval; @@ -420,44 +418,44 @@ case 2: break; case 54: -#line 483 "perly.y" +#line 485 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 55: -#line 485 "perly.y" +#line 487 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 56: -#line 487 "perly.y" +#line 489 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 57: -#line 489 "perly.y" +#line 491 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 58: -#line 491 "perly.y" +#line 493 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 59: -#line 496 "perly.y" +#line 498 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 60: -#line 500 "perly.y" +#line 502 "perly.y" { (yyval.opval) = newOP(OP_NULL,0); TOKEN_GETMAD((yyvsp[(1) - (1)].i_tkval),(yyval.opval),'p'); ;} break; case 61: -#line 506 "perly.y" +#line 508 "perly.y" { SvREFCNT_inc(PL_compcv); #ifdef MAD (yyval.opval) = newFORM((yyvsp[(2) - (4)].ival), (yyvsp[(3) - (4)].opval), (yyvsp[(4) - (4)].opval)); @@ -472,17 +470,17 @@ case 2: break; case 62: -#line 519 "perly.y" +#line 521 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 63: -#line 520 "perly.y" +#line 522 "perly.y" { (yyval.opval) = Nullop; ;} break; case 64: -#line 525 "perly.y" +#line 527 "perly.y" { SvREFCNT_inc(PL_compcv); #ifdef MAD (yyval.opval) = newMYSUB((yyvsp[(2) - (6)].ival), (yyvsp[(3) - (6)].opval), (yyvsp[(4) - (6)].opval), (yyvsp[(5) - (6)].opval), (yyvsp[(6) - (6)].opval)); @@ -495,7 +493,7 @@ case 2: break; case 65: -#line 538 "perly.y" +#line 540 "perly.y" { SvREFCNT_inc(PL_compcv); #ifdef MAD OP* o = newSVOP(OP_ANONCODE, 0, @@ -516,25 +514,25 @@ case 2: break; case 66: -#line 558 "perly.y" +#line 560 "perly.y" { (yyval.ival) = start_subparse(FALSE, 0); SAVEFREESV(PL_compcv); ;} break; case 67: -#line 564 "perly.y" +#line 566 "perly.y" { (yyval.ival) = start_subparse(FALSE, CVf_ANON); SAVEFREESV(PL_compcv); ;} break; case 68: -#line 569 "perly.y" +#line 571 "perly.y" { (yyval.ival) = start_subparse(TRUE, 0); SAVEFREESV(PL_compcv); ;} break; case 69: -#line 574 "perly.y" +#line 576 "perly.y" { const char *const name = SvPV_nolen_const(((SVOP*)(yyvsp[(1) - (1)].opval))->op_sv); if (strEQ(name, "BEGIN") || strEQ(name, "END") || strEQ(name, "INIT") || strEQ(name, "CHECK") @@ -544,24 +542,24 @@ case 2: break; case 70: -#line 584 "perly.y" +#line 586 "perly.y" { (yyval.opval) = Nullop; ;} break; case 72: -#line 590 "perly.y" +#line 592 "perly.y" { (yyval.opval) = Nullop; ;} break; case 73: -#line 592 "perly.y" +#line 594 "perly.y" { (yyval.opval) = (yyvsp[(2) - (2)].opval); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),':'); ;} break; case 74: -#line 596 "perly.y" +#line 598 "perly.y" { (yyval.opval) = IF_MAD( newOP(OP_NULL, 0), Nullop @@ -571,14 +569,14 @@ case 2: break; case 75: -#line 606 "perly.y" +#line 608 "perly.y" { (yyval.opval) = (yyvsp[(2) - (2)].opval); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),':'); ;} break; case 76: -#line 610 "perly.y" +#line 612 "perly.y" { (yyval.opval) = IF_MAD( newOP(OP_NULL, 0), Nullop @@ -588,12 +586,12 @@ case 2: break; case 77: -#line 619 "perly.y" +#line 621 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 78: -#line 620 "perly.y" +#line 622 "perly.y" { (yyval.opval) = IF_MAD( newOP(OP_NULL,0), Nullop @@ -604,7 +602,7 @@ case 2: break; case 79: -#line 630 "perly.y" +#line 632 "perly.y" { #ifdef MAD (yyval.opval) = package((yyvsp[(2) - (3)].opval)); @@ -618,12 +616,12 @@ case 2: break; case 80: -#line 643 "perly.y" +#line 645 "perly.y" { CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ ;} break; case 81: -#line 645 "perly.y" +#line 647 "perly.y" { SvREFCNT_inc(PL_compcv); #ifdef MAD (yyval.opval) = utilize(IVAL((yyvsp[(1) - (7)].i_tkval)), (yyvsp[(2) - (7)].ival), (yyvsp[(4) - (7)].opval), (yyvsp[(5) - (7)].opval), (yyvsp[(6) - (7)].opval)); @@ -639,28 +637,28 @@ case 2: break; case 82: -#line 661 "perly.y" +#line 663 "perly.y" { (yyval.opval) = newLOGOP(OP_AND, 0, (yyvsp[(1) - (3)].opval), (yyvsp[(3) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 83: -#line 665 "perly.y" +#line 667 "perly.y" { (yyval.opval) = newLOGOP(IVAL((yyvsp[(2) - (3)].i_tkval)), 0, (yyvsp[(1) - (3)].opval), (yyvsp[(3) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 84: -#line 669 "perly.y" +#line 671 "perly.y" { (yyval.opval) = newLOGOP(OP_DOR, 0, (yyvsp[(1) - (3)].opval), (yyvsp[(3) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 86: -#line 677 "perly.y" +#line 679 "perly.y" { #ifdef MAD OP* op = newNULLLIST(); @@ -673,18 +671,19 @@ case 2: break; case 87: -#line 687 "perly.y" +#line 689 "perly.y" { + OP* term = (yyvsp[(3) - (3)].opval); DO_MAD( - (yyvsp[(3) - (3)].opval) = newUNOP(OP_NULL, 0, (yyvsp[(3) - (3)].opval)); - token_getmad((yyvsp[(2) - (3)].i_tkval),(yyvsp[(3) - (3)].opval),','); + term = newUNOP(OP_NULL, 0, term); + token_getmad((yyvsp[(2) - (3)].i_tkval),term,','); ) - (yyval.opval) = append_elem(OP_LIST, (yyvsp[(1) - (3)].opval), (yyvsp[(3) - (3)].opval)); + (yyval.opval) = append_elem(OP_LIST, (yyvsp[(1) - (3)].opval), term); ;} break; case 89: -#line 699 "perly.y" +#line 702 "perly.y" { (yyval.opval) = convert(IVAL((yyvsp[(1) - (3)].i_tkval)), OPf_STACKED, prepend_elem(OP_LIST, newGVREF(IVAL((yyvsp[(1) - (3)].i_tkval)),(yyvsp[(2) - (3)].opval)), (yyvsp[(3) - (3)].opval)) ); TOKEN_GETMAD((yyvsp[(1) - (3)].i_tkval),(yyval.opval),'o'); @@ -692,7 +691,7 @@ case 2: break; case 90: -#line 704 "perly.y" +#line 707 "perly.y" { (yyval.opval) = convert(IVAL((yyvsp[(1) - (5)].i_tkval)), OPf_STACKED, prepend_elem(OP_LIST, newGVREF(IVAL((yyvsp[(1) - (5)].i_tkval)),(yyvsp[(3) - (5)].opval)), (yyvsp[(4) - (5)].opval)) ); TOKEN_GETMAD((yyvsp[(1) - (5)].i_tkval),(yyval.opval),'o'); @@ -702,7 +701,7 @@ case 2: break; case 91: -#line 711 "perly.y" +#line 714 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, prepend_elem(OP_LIST, scalar((yyvsp[(1) - (6)].opval)), (yyvsp[(5) - (6)].opval)), @@ -714,7 +713,7 @@ case 2: break; case 92: -#line 720 "perly.y" +#line 723 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, scalar((yyvsp[(1) - (3)].opval)), newUNOP(OP_METHOD, 0, (yyvsp[(3) - (3)].opval)))); @@ -723,7 +722,7 @@ case 2: break; case 93: -#line 726 "perly.y" +#line 729 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, prepend_elem(OP_LIST, (yyvsp[(2) - (3)].opval), (yyvsp[(3) - (3)].opval)), @@ -732,7 +731,7 @@ case 2: break; case 94: -#line 732 "perly.y" +#line 735 "perly.y" { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, prepend_elem(OP_LIST, (yyvsp[(2) - (5)].opval), (yyvsp[(4) - (5)].opval)), @@ -743,14 +742,14 @@ case 2: break; case 95: -#line 740 "perly.y" +#line 743 "perly.y" { (yyval.opval) = convert(IVAL((yyvsp[(1) - (2)].i_tkval)), 0, (yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 96: -#line 744 "perly.y" +#line 747 "perly.y" { (yyval.opval) = convert(IVAL((yyvsp[(1) - (4)].i_tkval)), 0, (yyvsp[(3) - (4)].opval)); TOKEN_GETMAD((yyvsp[(1) - (4)].i_tkval),(yyval.opval),'o'); TOKEN_GETMAD((yyvsp[(2) - (4)].i_tkval),(yyval.opval),'('); @@ -759,21 +758,21 @@ case 2: break; case 97: -#line 750 "perly.y" +#line 753 "perly.y" { SvREFCNT_inc(PL_compcv); - (yyvsp[(3) - (3)].opval) = newANONATTRSUB((yyvsp[(2) - (3)].ival), 0, Nullop, (yyvsp[(3) - (3)].opval)); ;} + (yyval.opval) = newANONATTRSUB((yyvsp[(2) - (3)].ival), 0, Nullop, (yyvsp[(3) - (3)].opval)); ;} break; case 98: -#line 753 "perly.y" +#line 756 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, - prepend_elem(OP_LIST, (yyvsp[(3) - (5)].opval), (yyvsp[(5) - (5)].opval)), (yyvsp[(1) - (5)].opval))); + prepend_elem(OP_LIST, (yyvsp[(4) - (5)].opval), (yyvsp[(5) - (5)].opval)), (yyvsp[(1) - (5)].opval))); ;} break; case 101: -#line 768 "perly.y" +#line 771 "perly.y" { (yyval.opval) = newBINOP(OP_GELEM, 0, (yyvsp[(1) - (5)].opval), scalar((yyvsp[(3) - (5)].opval))); PL_expect = XOPERATOR; TOKEN_GETMAD((yyvsp[(2) - (5)].i_tkval),(yyval.opval),'{'); @@ -783,7 +782,7 @@ case 2: break; case 102: -#line 775 "perly.y" +#line 778 "perly.y" { (yyval.opval) = newBINOP(OP_AELEM, 0, oopsAV((yyvsp[(1) - (4)].opval)), scalar((yyvsp[(3) - (4)].opval))); TOKEN_GETMAD((yyvsp[(2) - (4)].i_tkval),(yyval.opval),'['); TOKEN_GETMAD((yyvsp[(4) - (4)].i_tkval),(yyval.opval),']'); @@ -791,7 +790,7 @@ case 2: break; case 103: -#line 780 "perly.y" +#line 783 "perly.y" { (yyval.opval) = newBINOP(OP_AELEM, 0, ref(newAVREF((yyvsp[(1) - (5)].opval)),OP_RV2AV), scalar((yyvsp[(4) - (5)].opval))); @@ -802,7 +801,7 @@ case 2: break; case 104: -#line 788 "perly.y" +#line 791 "perly.y" { (yyval.opval) = newBINOP(OP_AELEM, 0, ref(newAVREF((yyvsp[(1) - (4)].opval)),OP_RV2AV), scalar((yyvsp[(3) - (4)].opval))); @@ -812,7 +811,7 @@ case 2: break; case 105: -#line 795 "perly.y" +#line 798 "perly.y" { (yyval.opval) = newBINOP(OP_HELEM, 0, oopsHV((yyvsp[(1) - (5)].opval)), jmaybe((yyvsp[(3) - (5)].opval))); PL_expect = XOPERATOR; TOKEN_GETMAD((yyvsp[(2) - (5)].i_tkval),(yyval.opval),'{'); @@ -822,7 +821,7 @@ case 2: break; case 106: -#line 802 "perly.y" +#line 805 "perly.y" { (yyval.opval) = newBINOP(OP_HELEM, 0, ref(newHVREF((yyvsp[(1) - (6)].opval)),OP_RV2HV), jmaybe((yyvsp[(4) - (6)].opval))); @@ -835,7 +834,7 @@ case 2: break; case 107: -#line 812 "perly.y" +#line 815 "perly.y" { (yyval.opval) = newBINOP(OP_HELEM, 0, ref(newHVREF((yyvsp[(1) - (5)].opval)),OP_RV2HV), jmaybe((yyvsp[(3) - (5)].opval))); @@ -847,7 +846,7 @@ case 2: break; case 108: -#line 821 "perly.y" +#line 824 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, newCVREF(0, scalar((yyvsp[(1) - (4)].opval)))); TOKEN_GETMAD((yyvsp[(2) - (4)].i_tkval),(yyval.opval),'a'); @@ -857,7 +856,7 @@ case 2: break; case 109: -#line 828 "perly.y" +#line 831 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, (yyvsp[(4) - (5)].opval), newCVREF(0, scalar((yyvsp[(1) - (5)].opval))))); @@ -868,7 +867,7 @@ case 2: break; case 110: -#line 837 "perly.y" +#line 840 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, (yyvsp[(3) - (4)].opval), newCVREF(0, scalar((yyvsp[(1) - (4)].opval))))); @@ -878,7 +877,7 @@ case 2: break; case 111: -#line 844 "perly.y" +#line 847 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, newCVREF(0, scalar((yyvsp[(1) - (3)].opval)))); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'('); @@ -887,7 +886,7 @@ case 2: break; case 112: -#line 850 "perly.y" +#line 853 "perly.y" { (yyval.opval) = newSLICEOP(0, (yyvsp[(5) - (6)].opval), (yyvsp[(2) - (6)].opval)); TOKEN_GETMAD((yyvsp[(1) - (6)].i_tkval),(yyval.opval),'('); TOKEN_GETMAD((yyvsp[(3) - (6)].i_tkval),(yyval.opval),')'); @@ -897,7 +896,7 @@ case 2: break; case 113: -#line 857 "perly.y" +#line 860 "perly.y" { (yyval.opval) = newSLICEOP(0, (yyvsp[(4) - (5)].opval), Nullop); TOKEN_GETMAD((yyvsp[(1) - (5)].i_tkval),(yyval.opval),'('); TOKEN_GETMAD((yyvsp[(2) - (5)].i_tkval),(yyval.opval),')'); @@ -907,21 +906,21 @@ case 2: break; case 114: -#line 867 "perly.y" +#line 870 "perly.y" { (yyval.opval) = newASSIGNOP(OPf_STACKED, (yyvsp[(1) - (3)].opval), IVAL((yyvsp[(2) - (3)].i_tkval)), (yyvsp[(3) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 115: -#line 871 "perly.y" +#line 874 "perly.y" { (yyval.opval) = newBINOP(IVAL((yyvsp[(2) - (3)].i_tkval)), 0, scalar((yyvsp[(1) - (3)].opval)), scalar((yyvsp[(3) - (3)].opval))); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 116: -#line 875 "perly.y" +#line 878 "perly.y" { if (IVAL((yyvsp[(2) - (3)].i_tkval)) != OP_REPEAT) scalar((yyvsp[(1) - (3)].opval)); (yyval.opval) = newBINOP(IVAL((yyvsp[(2) - (3)].i_tkval)), 0, (yyvsp[(1) - (3)].opval), scalar((yyvsp[(3) - (3)].opval))); @@ -930,49 +929,49 @@ case 2: break; case 117: -#line 881 "perly.y" +#line 884 "perly.y" { (yyval.opval) = newBINOP(IVAL((yyvsp[(2) - (3)].i_tkval)), 0, scalar((yyvsp[(1) - (3)].opval)), scalar((yyvsp[(3) - (3)].opval))); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 118: -#line 885 "perly.y" +#line 888 "perly.y" { (yyval.opval) = newBINOP(IVAL((yyvsp[(2) - (3)].i_tkval)), 0, scalar((yyvsp[(1) - (3)].opval)), scalar((yyvsp[(3) - (3)].opval))); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 119: -#line 889 "perly.y" +#line 892 "perly.y" { (yyval.opval) = newBINOP(IVAL((yyvsp[(2) - (3)].i_tkval)), 0, scalar((yyvsp[(1) - (3)].opval)), scalar((yyvsp[(3) - (3)].opval))); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 120: -#line 893 "perly.y" +#line 896 "perly.y" { (yyval.opval) = newBINOP(IVAL((yyvsp[(2) - (3)].i_tkval)), 0, scalar((yyvsp[(1) - (3)].opval)), scalar((yyvsp[(3) - (3)].opval))); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 121: -#line 897 "perly.y" +#line 900 "perly.y" { (yyval.opval) = newBINOP(IVAL((yyvsp[(2) - (3)].i_tkval)), 0, scalar((yyvsp[(1) - (3)].opval)), scalar((yyvsp[(3) - (3)].opval))); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 122: -#line 901 "perly.y" +#line 904 "perly.y" { (yyval.opval) = newBINOP(IVAL((yyvsp[(2) - (3)].i_tkval)), 0, scalar((yyvsp[(1) - (3)].opval)), scalar((yyvsp[(3) - (3)].opval))); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 123: -#line 905 "perly.y" +#line 908 "perly.y" { (yyval.opval) = newRANGE(IVAL((yyvsp[(2) - (3)].i_tkval)), scalar((yyvsp[(1) - (3)].opval)), scalar((yyvsp[(3) - (3)].opval))); DO_MAD( @@ -987,28 +986,28 @@ case 2: break; case 124: -#line 917 "perly.y" +#line 920 "perly.y" { (yyval.opval) = newLOGOP(OP_AND, 0, (yyvsp[(1) - (3)].opval), (yyvsp[(3) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 125: -#line 921 "perly.y" +#line 924 "perly.y" { (yyval.opval) = newLOGOP(OP_OR, 0, (yyvsp[(1) - (3)].opval), (yyvsp[(3) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 126: -#line 925 "perly.y" +#line 928 "perly.y" { (yyval.opval) = newLOGOP(OP_DOR, 0, (yyvsp[(1) - (3)].opval), (yyvsp[(3) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'o'); ;} break; case 127: -#line 929 "perly.y" +#line 932 "perly.y" { (yyval.opval) = bind_match(IVAL((yyvsp[(2) - (3)].i_tkval)), (yyvsp[(1) - (3)].opval), (yyvsp[(3) - (3)].opval)); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval), ((yyval.opval)->op_type == OP_NOT @@ -1018,14 +1017,14 @@ case 2: break; case 128: -#line 939 "perly.y" +#line 942 "perly.y" { (yyval.opval) = newUNOP(OP_NEGATE, 0, scalar((yyvsp[(2) - (2)].opval))); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 129: -#line 943 "perly.y" +#line 946 "perly.y" { (yyval.opval) = IF_MAD( newUNOP(OP_NULL, 0, (yyvsp[(2) - (2)].opval)), (yyvsp[(2) - (2)].opval) @@ -1035,21 +1034,21 @@ case 2: break; case 130: -#line 950 "perly.y" +#line 953 "perly.y" { (yyval.opval) = newUNOP(OP_NOT, 0, scalar((yyvsp[(2) - (2)].opval))); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 131: -#line 954 "perly.y" +#line 957 "perly.y" { (yyval.opval) = newUNOP(OP_COMPLEMENT, 0, scalar((yyvsp[(2) - (2)].opval))); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 132: -#line 958 "perly.y" +#line 961 "perly.y" { (yyval.opval) = newUNOP(OP_POSTINC, 0, mod(scalar((yyvsp[(1) - (2)].opval)), OP_POSTINC)); TOKEN_GETMAD((yyvsp[(2) - (2)].i_tkval),(yyval.opval),'o'); @@ -1057,7 +1056,7 @@ case 2: break; case 133: -#line 963 "perly.y" +#line 966 "perly.y" { (yyval.opval) = newUNOP(OP_POSTDEC, 0, mod(scalar((yyvsp[(1) - (2)].opval)), OP_POSTDEC)); TOKEN_GETMAD((yyvsp[(2) - (2)].i_tkval),(yyval.opval),'o'); @@ -1065,7 +1064,7 @@ case 2: break; case 134: -#line 968 "perly.y" +#line 971 "perly.y" { (yyval.opval) = newUNOP(OP_PREINC, 0, mod(scalar((yyvsp[(2) - (2)].opval)), OP_PREINC)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); @@ -1073,7 +1072,7 @@ case 2: break; case 135: -#line 973 "perly.y" +#line 976 "perly.y" { (yyval.opval) = newUNOP(OP_PREDEC, 0, mod(scalar((yyvsp[(2) - (2)].opval)), OP_PREDEC)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); @@ -1081,7 +1080,7 @@ case 2: break; case 136: -#line 982 "perly.y" +#line 985 "perly.y" { (yyval.opval) = newANONLIST((yyvsp[(2) - (3)].opval)); TOKEN_GETMAD((yyvsp[(1) - (3)].i_tkval),(yyval.opval),'['); TOKEN_GETMAD((yyvsp[(3) - (3)].i_tkval),(yyval.opval),']'); @@ -1089,7 +1088,7 @@ case 2: break; case 137: -#line 987 "perly.y" +#line 990 "perly.y" { (yyval.opval) = newANONLIST(Nullop); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'['); TOKEN_GETMAD((yyvsp[(2) - (2)].i_tkval),(yyval.opval),']'); @@ -1097,7 +1096,7 @@ case 2: break; case 138: -#line 992 "perly.y" +#line 995 "perly.y" { (yyval.opval) = newANONHASH((yyvsp[(2) - (4)].opval)); TOKEN_GETMAD((yyvsp[(1) - (4)].i_tkval),(yyval.opval),'{'); TOKEN_GETMAD((yyvsp[(3) - (4)].i_tkval),(yyval.opval),';'); @@ -1106,7 +1105,7 @@ case 2: break; case 139: -#line 998 "perly.y" +#line 1001 "perly.y" { (yyval.opval) = newANONHASH(Nullop); TOKEN_GETMAD((yyvsp[(1) - (3)].i_tkval),(yyval.opval),'{'); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),';'); @@ -1115,7 +1114,7 @@ case 2: break; case 140: -#line 1004 "perly.y" +#line 1007 "perly.y" { SvREFCNT_inc(PL_compcv); (yyval.opval) = newANONATTRSUB((yyvsp[(2) - (5)].ival), (yyvsp[(3) - (5)].opval), (yyvsp[(4) - (5)].opval), (yyvsp[(5) - (5)].opval)); TOKEN_GETMAD((yyvsp[(1) - (5)].i_tkval),(yyval.opval),'o'); @@ -1125,21 +1124,21 @@ case 2: break; case 141: -#line 1015 "perly.y" +#line 1018 "perly.y" { (yyval.opval) = dofile((yyvsp[(2) - (2)].opval), IVAL((yyvsp[(1) - (2)].i_tkval))); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 142: -#line 1019 "perly.y" +#line 1022 "perly.y" { (yyval.opval) = newUNOP(OP_NULL, OPf_SPECIAL, scope((yyvsp[(2) - (2)].opval))); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'D'); ;} break; case 143: -#line 1023 "perly.y" +#line 1026 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, prepend_elem(OP_LIST, @@ -1154,7 +1153,7 @@ case 2: break; case 144: -#line 1035 "perly.y" +#line 1038 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, append_elem(OP_LIST, @@ -1170,7 +1169,7 @@ case 2: break; case 145: -#line 1048 "perly.y" +#line 1051 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, prepend_elem(OP_LIST, scalar(newCVREF(0,scalar((yyvsp[(2) - (4)].opval)))), Nullop)); dep(); @@ -1181,7 +1180,7 @@ case 2: break; case 146: -#line 1056 "perly.y" +#line 1059 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, prepend_elem(OP_LIST, (yyvsp[(4) - (5)].opval), @@ -1193,7 +1192,7 @@ case 2: break; case 151: -#line 1072 "perly.y" +#line 1075 "perly.y" { (yyval.opval) = newCONDOP(0, (yyvsp[(1) - (5)].opval), (yyvsp[(3) - (5)].opval), (yyvsp[(5) - (5)].opval)); TOKEN_GETMAD((yyvsp[(2) - (5)].i_tkval),(yyval.opval),'?'); TOKEN_GETMAD((yyvsp[(4) - (5)].i_tkval),(yyval.opval),':'); @@ -1201,26 +1200,26 @@ case 2: break; case 152: -#line 1077 "perly.y" +#line 1080 "perly.y" { (yyval.opval) = newUNOP(OP_REFGEN, 0, mod((yyvsp[(2) - (2)].opval),OP_REFGEN)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 153: -#line 1081 "perly.y" +#line 1084 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 154: -#line 1083 "perly.y" +#line 1086 "perly.y" { (yyval.opval) = localize((yyvsp[(2) - (2)].opval),IVAL((yyvsp[(1) - (2)].i_tkval))); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'d'); ;} break; case 155: -#line 1087 "perly.y" +#line 1090 "perly.y" { (yyval.opval) = sawparens(IF_MAD(newUNOP(OP_NULL,0,(yyvsp[(2) - (3)].opval)), (yyvsp[(2) - (3)].opval))); TOKEN_GETMAD((yyvsp[(1) - (3)].i_tkval),(yyval.opval),'('); TOKEN_GETMAD((yyvsp[(3) - (3)].i_tkval),(yyval.opval),')'); @@ -1228,7 +1227,7 @@ case 2: break; case 156: -#line 1092 "perly.y" +#line 1095 "perly.y" { (yyval.opval) = sawparens(newNULLLIST()); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'('); TOKEN_GETMAD((yyvsp[(2) - (2)].i_tkval),(yyval.opval),')'); @@ -1236,37 +1235,37 @@ case 2: break; case 157: -#line 1097 "perly.y" +#line 1100 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 158: -#line 1099 "perly.y" +#line 1102 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 159: -#line 1101 "perly.y" +#line 1104 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 160: -#line 1103 "perly.y" +#line 1106 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 161: -#line 1105 "perly.y" +#line 1108 "perly.y" { (yyval.opval) = newUNOP(OP_AV2ARYLEN, 0, ref((yyvsp[(1) - (1)].opval), OP_AV2ARYLEN));;} break; case 162: -#line 1107 "perly.y" +#line 1110 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 163: -#line 1109 "perly.y" +#line 1112 "perly.y" { (yyval.opval) = prepend_elem(OP_ASLICE, newOP(OP_PUSHMARK, 0), newLISTOP(OP_ASLICE, 0, @@ -1278,7 +1277,7 @@ case 2: break; case 164: -#line 1118 "perly.y" +#line 1121 "perly.y" { (yyval.opval) = prepend_elem(OP_HSLICE, newOP(OP_PUSHMARK, 0), newLISTOP(OP_HSLICE, 0, @@ -1292,17 +1291,17 @@ case 2: break; case 165: -#line 1129 "perly.y" +#line 1132 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 166: -#line 1131 "perly.y" +#line 1134 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, 0, scalar((yyvsp[(1) - (1)].opval))); ;} break; case 167: -#line 1133 "perly.y" +#line 1136 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((yyvsp[(1) - (3)].opval))); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'('); TOKEN_GETMAD((yyvsp[(3) - (3)].i_tkval),(yyval.opval),')'); @@ -1310,7 +1309,7 @@ case 2: break; case 168: -#line 1138 "perly.y" +#line 1141 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, (yyvsp[(3) - (4)].opval), scalar((yyvsp[(1) - (4)].opval)))); @@ -1326,7 +1325,7 @@ case 2: break; case 169: -#line 1151 "perly.y" +#line 1154 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, (yyvsp[(3) - (3)].opval), scalar((yyvsp[(2) - (3)].opval)))); TOKEN_GETMAD((yyvsp[(1) - (3)].i_tkval),(yyval.opval),'o'); @@ -1334,7 +1333,7 @@ case 2: break; case 170: -#line 1156 "perly.y" +#line 1159 "perly.y" { (yyval.opval) = newOP(IVAL((yyvsp[(1) - (1)].i_tkval)), OPf_SPECIAL); PL_hints |= HINT_BLOCK_SCOPE; TOKEN_GETMAD((yyvsp[(1) - (1)].i_tkval),(yyval.opval),'o'); @@ -1342,70 +1341,70 @@ case 2: break; case 171: -#line 1161 "perly.y" +#line 1164 "perly.y" { (yyval.opval) = newLOOPEX(IVAL((yyvsp[(1) - (2)].i_tkval)),(yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 172: -#line 1165 "perly.y" +#line 1168 "perly.y" { (yyval.opval) = newUNOP(OP_NOT, 0, scalar((yyvsp[(2) - (2)].opval))); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 173: -#line 1169 "perly.y" +#line 1172 "perly.y" { (yyval.opval) = newOP(IVAL((yyvsp[(1) - (1)].i_tkval)), 0); TOKEN_GETMAD((yyvsp[(1) - (1)].i_tkval),(yyval.opval),'o'); ;} break; case 174: -#line 1173 "perly.y" +#line 1176 "perly.y" { (yyval.opval) = newUNOP(IVAL((yyvsp[(1) - (2)].i_tkval)), 0, (yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 175: -#line 1177 "perly.y" +#line 1180 "perly.y" { (yyval.opval) = newUNOP(IVAL((yyvsp[(1) - (2)].i_tkval)), 0, (yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'o'); ;} break; case 176: -#line 1181 "perly.y" +#line 1184 "perly.y" { (yyval.opval) = newOP(OP_REQUIRE, (yyvsp[(1) - (1)].i_tkval) ? OPf_SPECIAL : 0); ;} break; case 177: -#line 1183 "perly.y" +#line 1186 "perly.y" { (yyval.opval) = newUNOP(OP_REQUIRE, (yyvsp[(1) - (2)].i_tkval) ? OPf_SPECIAL : 0, (yyvsp[(2) - (2)].opval)); ;} break; case 178: -#line 1185 "perly.y" +#line 1188 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((yyvsp[(1) - (1)].opval))); ;} break; case 179: -#line 1187 "perly.y" +#line 1190 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, (yyvsp[(2) - (2)].opval), scalar((yyvsp[(1) - (2)].opval)))); ;} break; case 180: -#line 1190 "perly.y" +#line 1193 "perly.y" { (yyval.opval) = newOP(IVAL((yyvsp[(1) - (1)].i_tkval)), 0); TOKEN_GETMAD((yyvsp[(1) - (1)].i_tkval),(yyval.opval),'o'); ;} break; case 181: -#line 1194 "perly.y" +#line 1197 "perly.y" { (yyval.opval) = newOP(IVAL((yyvsp[(1) - (3)].i_tkval)), 0); TOKEN_GETMAD((yyvsp[(1) - (3)].i_tkval),(yyval.opval),'o'); TOKEN_GETMAD((yyvsp[(2) - (3)].i_tkval),(yyval.opval),'('); @@ -1414,13 +1413,13 @@ case 2: break; case 182: -#line 1200 "perly.y" +#line 1203 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((yyvsp[(1) - (1)].opval))); ;} break; case 183: -#line 1203 "perly.y" +#line 1206 "perly.y" { (yyval.opval) = (IVAL((yyvsp[(1) - (3)].i_tkval)) == OP_NOT) ? newUNOP(IVAL((yyvsp[(1) - (3)].i_tkval)), 0, newSVOP(OP_CONST, 0, newSViv(0))) : newOP(IVAL((yyvsp[(1) - (3)].i_tkval)), OPf_SPECIAL); @@ -1432,7 +1431,7 @@ case 2: break; case 184: -#line 1212 "perly.y" +#line 1215 "perly.y" { (yyval.opval) = newUNOP(IVAL((yyvsp[(1) - (4)].i_tkval)), 0, (yyvsp[(3) - (4)].opval)); TOKEN_GETMAD((yyvsp[(1) - (4)].i_tkval),(yyval.opval),'o'); TOKEN_GETMAD((yyvsp[(2) - (4)].i_tkval),(yyval.opval),'('); @@ -1441,7 +1440,7 @@ case 2: break; case 185: -#line 1218 "perly.y" +#line 1221 "perly.y" { (yyval.opval) = pmruntime((yyvsp[(1) - (4)].opval), (yyvsp[(3) - (4)].opval), 1); TOKEN_GETMAD((yyvsp[(2) - (4)].i_tkval),(yyval.opval),'('); TOKEN_GETMAD((yyvsp[(4) - (4)].i_tkval),(yyval.opval),')'); @@ -1449,7 +1448,7 @@ case 2: break; case 188: -#line 1228 "perly.y" +#line 1231 "perly.y" { (yyval.opval) = my_attrs((yyvsp[(2) - (3)].opval),(yyvsp[(3) - (3)].opval)); DO_MAD( token_getmad((yyvsp[(1) - (3)].i_tkval),(yyval.opval),'d'); @@ -1460,14 +1459,14 @@ case 2: break; case 189: -#line 1236 "perly.y" +#line 1239 "perly.y" { (yyval.opval) = localize((yyvsp[(2) - (2)].opval),IVAL((yyvsp[(1) - (2)].i_tkval))); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'d'); ;} break; case 190: -#line 1243 "perly.y" +#line 1246 "perly.y" { (yyval.opval) = sawparens((yyvsp[(2) - (3)].opval)); TOKEN_GETMAD((yyvsp[(1) - (3)].i_tkval),(yyval.opval),'('); TOKEN_GETMAD((yyvsp[(3) - (3)].i_tkval),(yyval.opval),')'); @@ -1475,7 +1474,7 @@ case 2: break; case 191: -#line 1248 "perly.y" +#line 1251 "perly.y" { (yyval.opval) = sawparens(newNULLLIST()); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'('); TOKEN_GETMAD((yyvsp[(2) - (2)].i_tkval),(yyval.opval),')'); @@ -1483,42 +1482,42 @@ case 2: break; case 192: -#line 1253 "perly.y" +#line 1256 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 193: -#line 1255 "perly.y" +#line 1258 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 194: -#line 1257 "perly.y" +#line 1260 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 195: -#line 1262 "perly.y" +#line 1265 "perly.y" { (yyval.opval) = Nullop; ;} break; case 196: -#line 1264 "perly.y" +#line 1267 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 197: -#line 1268 "perly.y" +#line 1271 "perly.y" { (yyval.opval) = Nullop; ;} break; case 198: -#line 1270 "perly.y" +#line 1273 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; case 199: -#line 1272 "perly.y" +#line 1275 "perly.y" { #ifdef MAD OP* op = newNULLLIST(); @@ -1532,69 +1531,69 @@ case 2: break; case 200: -#line 1287 "perly.y" +#line 1290 "perly.y" { PL_in_my = 0; (yyval.opval) = my((yyvsp[(1) - (1)].opval)); ;} break; case 201: -#line 1291 "perly.y" +#line 1294 "perly.y" { (yyval.opval) = newCVREF(IVAL((yyvsp[(1) - (2)].i_tkval)),(yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'&'); ;} break; case 202: -#line 1297 "perly.y" +#line 1300 "perly.y" { (yyval.opval) = newSVREF((yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'$'); ;} break; case 203: -#line 1303 "perly.y" +#line 1306 "perly.y" { (yyval.opval) = newAVREF((yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'@'); ;} break; case 204: -#line 1309 "perly.y" +#line 1312 "perly.y" { (yyval.opval) = newHVREF((yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'%'); ;} break; case 205: -#line 1315 "perly.y" +#line 1318 "perly.y" { (yyval.opval) = newAVREF((yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'l'); ;} break; case 206: -#line 1321 "perly.y" +#line 1324 "perly.y" { (yyval.opval) = newGVREF(0,(yyvsp[(2) - (2)].opval)); TOKEN_GETMAD((yyvsp[(1) - (2)].i_tkval),(yyval.opval),'*'); ;} break; case 207: -#line 1328 "perly.y" +#line 1331 "perly.y" { (yyval.opval) = scalar((yyvsp[(1) - (1)].opval)); ;} break; case 208: -#line 1330 "perly.y" +#line 1333 "perly.y" { (yyval.opval) = scalar((yyvsp[(1) - (1)].opval)); ;} break; case 209: -#line 1332 "perly.y" +#line 1335 "perly.y" { (yyval.opval) = scope((yyvsp[(1) - (1)].opval)); ;} break; case 210: -#line 1335 "perly.y" +#line 1338 "perly.y" { (yyval.opval) = (yyvsp[(1) - (1)].opval); ;} break; diff --git a/perly.tab b/perly.tab index 9d974ce..6791a64 100644 --- a/perly.tab +++ b/perly.tab @@ -167,28 +167,28 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 131, 131, 137, 147, 151, 155, 161, 171, 175, - 179, 180, 187, 196, 199, 200, 202, 204, 221, 240, - 242, 244, 248, 252, 256, 260, 269, 270, 274, 285, - 293, 304, 307, 313, 314, 321, 334, 346, 357, 367, - 377, 413, 421, 431, 437, 438, 443, 446, 450, 455, - 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, 694, 698, - 703, 710, 719, 725, 731, 739, 743, 750, 749, 760, - 761, 765, 774, 779, 787, 794, 801, 811, 820, 827, - 836, 843, 849, 856, 866, 870, 874, 880, 884, 888, - 892, 896, 900, 904, 916, 920, 924, 928, 938, 942, - 949, 953, 957, 962, 967, 972, 981, 986, 991, 997, - 1003, 1014, 1018, 1022, 1034, 1047, 1055, 1067, 1068, 1069, - 1070, 1071, 1076, 1080, 1082, 1086, 1091, 1096, 1098, 1100, - 1102, 1104, 1106, 1108, 1117, 1128, 1130, 1132, 1137, 1150, - 1155, 1160, 1164, 1168, 1172, 1176, 1180, 1182, 1184, 1186, - 1189, 1193, 1199, 1202, 1211, 1217, 1222, 1223, 1227, 1235, - 1242, 1247, 1252, 1254, 1256, 1261, 1263, 1268, 1269, 1271, - 1286, 1290, 1296, 1302, 1308, 1314, 1320, 1327, 1329, 1331, - 1334 + 0, 135, 135, 141, 151, 155, 159, 165, 175, 179, + 183, 184, 191, 200, 203, 204, 206, 208, 225, 244, + 246, 248, 252, 256, 260, 264, 273, 274, 278, 289, + 297, 308, 311, 317, 318, 325, 338, 350, 361, 371, + 381, 415, 423, 433, 439, 440, 445, 448, 452, 457, + 461, 465, 471, 480, 484, 486, 488, 490, 492, 497, + 501, 507, 521, 522, 526, 539, 560, 566, 571, 576, + 586, 587, 592, 593, 597, 607, 611, 621, 622, 631, + 645, 644, 662, 666, 670, 674, 678, 688, 697, 701, + 706, 713, 722, 728, 734, 742, 746, 753, 752, 763, + 764, 768, 777, 782, 790, 797, 804, 814, 823, 830, + 839, 846, 852, 859, 869, 873, 877, 883, 887, 891, + 895, 899, 903, 907, 919, 923, 927, 931, 941, 945, + 952, 956, 960, 965, 970, 975, 984, 989, 994, 1000, + 1006, 1017, 1021, 1025, 1037, 1050, 1058, 1070, 1071, 1072, + 1073, 1074, 1079, 1083, 1085, 1089, 1094, 1099, 1101, 1103, + 1105, 1107, 1109, 1111, 1120, 1131, 1133, 1135, 1140, 1153, + 1158, 1163, 1167, 1171, 1175, 1179, 1183, 1185, 1187, 1189, + 1192, 1196, 1202, 1205, 1214, 1220, 1225, 1226, 1230, 1238, + 1245, 1250, 1255, 1257, 1259, 1264, 1266, 1271, 1272, 1274, + 1289, 1293, 1299, 1305, 1311, 1317, 1323, 1330, 1332, 1334, + 1337 }; #endif diff --git a/perly.y b/perly.y index dd70c2b..e4515da 100644 --- a/perly.y +++ b/perly.y @@ -32,6 +32,10 @@ * The main job of of this grammar is to call the various newFOO() * functions in op.c to build a syntax tree of OP structs. * It relies on the lexer in toke.c to do the tokenizing. + * + * Note: due to the way that the cleanup code works WRT to freeing ops on + * the parse stack, it is dangerous to assign to the $n variables within + * an action. */ /* Make the parser re-entrant. */ @@ -384,13 +388,11 @@ loop : label WHILE '(' remember texpr ')' mintro mblock cont IVAL($2), scalar($7), $12, $10, $9)); #ifdef MAD - if (!$5) - $5 = newOP(OP_NULL, 0); forop = newUNOP(OP_NULL, 0, append_elem(OP_LINESEQ, newSTATEOP(0, (($1)->tk_lval.pval ?savepv(($1)->tk_lval.pval):Nullch), - $5), + ($5 ? newOP(OP_NULL, 0) : $5) ), forop)); token_getmad($2,forop,'3'); @@ -685,11 +687,12 @@ argexpr : argexpr ',' } | argexpr ',' term { + OP* term = $3; DO_MAD( - $3 = newUNOP(OP_NULL, 0, $3); - token_getmad($2,$3,','); + term = newUNOP(OP_NULL, 0, term); + token_getmad($2,term,','); ) - $$ = append_elem(OP_LIST, $1, $3); + $$ = append_elem(OP_LIST, $1, term); } | term %prec PREC_LOW ; @@ -748,11 +751,11 @@ listop : LSTOP indirob argexpr /* map {...} @args or print $fh @args */ } | LSTOPSUB startanonsub block /* sub f(&@); f { foo } ... */ { SvREFCNT_inc(PL_compcv); - $3 = newANONATTRSUB($2, 0, Nullop, $3); } + $$ = newANONATTRSUB($2, 0, Nullop, $3); } listexpr %prec LSTOP /* ... @bar */ { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, - prepend_elem(OP_LIST, $3, $5), $1)); + prepend_elem(OP_LIST, $4, $5), $1)); } ; diff --git a/regen_perly.pl b/regen_perly.pl index 674aa78..9c1d601 100644 --- a/regen_perly.pl +++ b/regen_perly.pl @@ -216,6 +216,10 @@ sub make_type_tab { my $default_token; open my $fh, '<', $y_file or die "Can't open $y_file: $!\n"; while (<$fh>) { + if (/(\$\d+)\s*=/) { + warn "$y_file:$.: dangerous assignment to $1: $_"; + } + if (/__DEFAULT__/) { m{(\w+) \s* ; \s* /\* \s* __DEFAULT__}x or die "$y_file: can't parse __DEFAULT__ line: $_"; diff --git a/toke.c b/toke.c index c578fad..0bbc1d9 100644 --- a/toke.c +++ b/toke.c @@ -11733,7 +11733,7 @@ S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims) #ifdef PERL_MAD if (PL_madskills) { char * const tstart = SvPVX(PL_linestr) + stuffstart; - const int len = s - start; + const int len = s - tstart; if (PL_thisstuff) sv_catpvn(PL_thisstuff, tstart, len); else