From: Stephen McCamant Date: Sun, 31 May 1998 12:56:14 +0000 (-0500) Subject: Added patch, regenerated perly.c and perly.c.diff X-Git-Tag: perl-5.005~478 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/640b9ef65a730c6484f9d9597619ff4535510ea6 Added patch, regenerated perly.c and perly.c.diff Message-Id: Subject: [PATCH] too many RV2GVs in *foo{THING} p4raw-id: //depot/perl@1112 --- diff --git a/perly.c b/perly.c index 3b8e56b..2f115b8 100644 --- a/perly.c +++ b/perly.c @@ -1282,7 +1282,7 @@ int yyerrflag; int yychar; YYSTYPE yyval; YYSTYPE yylval; -#line 636 "perly.y" +#line 635 "perly.y" /* PROGRAM */ #line 1349 "perly.c" #define YYABORT goto yyabort @@ -2005,70 +2005,69 @@ case 114: break; case 115: #line 445 "perly.y" -{ yyval.opval = newBINOP(OP_GELEM, 0, newGVREF(0,yyvsp[-4].opval), - scalar(yyvsp[-2].opval)); } +{ yyval.opval = newBINOP(OP_GELEM, 0, yyvsp[-4].opval, scalar(yyvsp[-2].opval)); } break; case 116: -#line 448 "perly.y" +#line 447 "perly.y" { yyval.opval = yyvsp[0].opval; } break; case 117: -#line 450 "perly.y" +#line 449 "perly.y" { yyval.opval = newBINOP(OP_AELEM, 0, oopsAV(yyvsp[-3].opval), scalar(yyvsp[-1].opval)); } break; case 118: -#line 452 "perly.y" +#line 451 "perly.y" { yyval.opval = newBINOP(OP_AELEM, 0, ref(newAVREF(yyvsp[-4].opval),OP_RV2AV), scalar(yyvsp[-1].opval));} break; case 119: -#line 456 "perly.y" +#line 455 "perly.y" { assertref(yyvsp[-3].opval); yyval.opval = newBINOP(OP_AELEM, 0, ref(newAVREF(yyvsp[-3].opval),OP_RV2AV), scalar(yyvsp[-1].opval));} break; case 120: -#line 460 "perly.y" +#line 459 "perly.y" { yyval.opval = yyvsp[0].opval; } break; case 121: -#line 462 "perly.y" +#line 461 "perly.y" { yyval.opval = yyvsp[0].opval; } break; case 122: -#line 464 "perly.y" +#line 463 "perly.y" { yyval.opval = newUNOP(OP_AV2ARYLEN, 0, ref(yyvsp[0].opval, OP_AV2ARYLEN));} break; case 123: -#line 466 "perly.y" +#line 465 "perly.y" { yyval.opval = newBINOP(OP_HELEM, 0, oopsHV(yyvsp[-4].opval), jmaybe(yyvsp[-2].opval)); expect = XOPERATOR; } break; case 124: -#line 469 "perly.y" +#line 468 "perly.y" { yyval.opval = newBINOP(OP_HELEM, 0, ref(newHVREF(yyvsp[-5].opval),OP_RV2HV), jmaybe(yyvsp[-2].opval)); expect = XOPERATOR; } break; case 125: -#line 474 "perly.y" +#line 473 "perly.y" { assertref(yyvsp[-4].opval); yyval.opval = newBINOP(OP_HELEM, 0, ref(newHVREF(yyvsp[-4].opval),OP_RV2HV), jmaybe(yyvsp[-2].opval)); expect = XOPERATOR; } break; case 126: -#line 479 "perly.y" +#line 478 "perly.y" { yyval.opval = newSLICEOP(0, yyvsp[-1].opval, yyvsp[-4].opval); } break; case 127: -#line 481 "perly.y" +#line 480 "perly.y" { yyval.opval = newSLICEOP(0, yyvsp[-1].opval, Nullop); } break; case 128: -#line 483 "perly.y" +#line 482 "perly.y" { yyval.opval = prepend_elem(OP_ASLICE, newOP(OP_PUSHMARK, 0), newLISTOP(OP_ASLICE, 0, @@ -2076,7 +2075,7 @@ case 128: ref(yyvsp[-3].opval, OP_ASLICE))); } break; case 129: -#line 489 "perly.y" +#line 488 "perly.y" { yyval.opval = prepend_elem(OP_HSLICE, newOP(OP_PUSHMARK, 0), newLISTOP(OP_HSLICE, 0, @@ -2085,37 +2084,37 @@ case 129: expect = XOPERATOR; } break; case 130: -#line 496 "perly.y" +#line 495 "perly.y" { yyval.opval = yyvsp[0].opval; } break; case 131: -#line 498 "perly.y" +#line 497 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, 0, scalar(yyvsp[0].opval)); } break; case 132: -#line 500 "perly.y" +#line 499 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar(yyvsp[-2].opval)); } break; case 133: -#line 502 "perly.y" +#line 501 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, yyvsp[-1].opval, scalar(yyvsp[-3].opval))); } break; case 134: -#line 505 "perly.y" +#line 504 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, yyvsp[0].opval, scalar(yyvsp[-1].opval))); } break; case 135: -#line 508 "perly.y" +#line 507 "perly.y" { yyval.opval = newUNOP(OP_DOFILE, 0, scalar(yyvsp[0].opval)); } break; case 136: -#line 510 "perly.y" +#line 509 "perly.y" { yyval.opval = newUNOP(OP_NULL, OPf_SPECIAL, scope(yyvsp[0].opval)); } break; case 137: -#line 512 "perly.y" +#line 511 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, prepend_elem(OP_LIST, @@ -2125,7 +2124,7 @@ case 137: )),Nullop)); dep();} break; case 138: -#line 520 "perly.y" +#line 519 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, append_elem(OP_LIST, @@ -2136,161 +2135,161 @@ case 138: )))); dep();} break; case 139: -#line 529 "perly.y" +#line 528 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, prepend_elem(OP_LIST, scalar(newCVREF(0,scalar(yyvsp[-2].opval))), Nullop)); dep();} break; case 140: -#line 533 "perly.y" +#line 532 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED, prepend_elem(OP_LIST, yyvsp[-1].opval, scalar(newCVREF(0,scalar(yyvsp[-3].opval))))); dep();} break; case 141: -#line 538 "perly.y" +#line 537 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, OPf_STACKED, newCVREF(0, scalar(yyvsp[-3].opval))); } break; case 142: -#line 541 "perly.y" +#line 540 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, yyvsp[-1].opval, newCVREF(0, scalar(yyvsp[-4].opval)))); } break; case 143: -#line 545 "perly.y" +#line 544 "perly.y" { yyval.opval = newOP(yyvsp[0].ival, OPf_SPECIAL); hints |= HINT_BLOCK_SCOPE; } break; case 144: -#line 548 "perly.y" +#line 547 "perly.y" { yyval.opval = newLOOPEX(yyvsp[-1].ival,yyvsp[0].opval); } break; case 145: -#line 550 "perly.y" +#line 549 "perly.y" { yyval.opval = newUNOP(OP_NOT, 0, scalar(yyvsp[0].opval)); } break; case 146: -#line 552 "perly.y" +#line 551 "perly.y" { yyval.opval = newOP(yyvsp[0].ival, 0); } break; case 147: -#line 554 "perly.y" +#line 553 "perly.y" { yyval.opval = newUNOP(yyvsp[-1].ival, 0, yyvsp[0].opval); } break; case 148: -#line 556 "perly.y" +#line 555 "perly.y" { yyval.opval = newUNOP(yyvsp[-1].ival, 0, yyvsp[0].opval); } break; case 149: -#line 558 "perly.y" +#line 557 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, yyvsp[0].opval, scalar(yyvsp[-1].opval))); } break; case 150: -#line 561 "perly.y" +#line 560 "perly.y" { yyval.opval = newOP(yyvsp[0].ival, 0); } break; case 151: -#line 563 "perly.y" +#line 562 "perly.y" { yyval.opval = newOP(yyvsp[-2].ival, 0); } break; case 152: -#line 565 "perly.y" +#line 564 "perly.y" { yyval.opval = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar(yyvsp[0].opval)); } break; case 153: -#line 568 "perly.y" +#line 567 "perly.y" { yyval.opval = newOP(yyvsp[-2].ival, OPf_SPECIAL); } break; case 154: -#line 570 "perly.y" +#line 569 "perly.y" { yyval.opval = newUNOP(yyvsp[-3].ival, 0, yyvsp[-1].opval); } break; case 155: -#line 572 "perly.y" +#line 571 "perly.y" { yyval.opval = pmruntime(yyvsp[-3].opval, yyvsp[-1].opval, Nullop); } break; case 156: -#line 574 "perly.y" +#line 573 "perly.y" { yyval.opval = pmruntime(yyvsp[-5].opval, yyvsp[-3].opval, yyvsp[-1].opval); } break; case 159: -#line 580 "perly.y" +#line 579 "perly.y" { yyval.opval = Nullop; } break; case 160: -#line 582 "perly.y" +#line 581 "perly.y" { yyval.opval = yyvsp[0].opval; } break; case 161: -#line 586 "perly.y" +#line 585 "perly.y" { yyval.opval = Nullop; } break; case 162: -#line 588 "perly.y" +#line 587 "perly.y" { yyval.opval = yyvsp[0].opval; } break; case 163: -#line 590 "perly.y" +#line 589 "perly.y" { yyval.opval = yyvsp[-1].opval; } break; case 164: -#line 593 "perly.y" +#line 592 "perly.y" { yyval.ival = 0; } break; case 165: -#line 594 "perly.y" +#line 593 "perly.y" { yyval.ival = 1; } break; case 166: -#line 598 "perly.y" +#line 597 "perly.y" { in_my = 0; yyval.opval = my(yyvsp[0].opval); } break; case 167: -#line 602 "perly.y" +#line 601 "perly.y" { yyval.opval = newCVREF(yyvsp[-1].ival,yyvsp[0].opval); } break; case 168: -#line 606 "perly.y" +#line 605 "perly.y" { yyval.opval = newSVREF(yyvsp[0].opval); } break; case 169: -#line 610 "perly.y" +#line 609 "perly.y" { yyval.opval = newAVREF(yyvsp[0].opval); } break; case 170: -#line 614 "perly.y" +#line 613 "perly.y" { yyval.opval = newHVREF(yyvsp[0].opval); } break; case 171: -#line 618 "perly.y" +#line 617 "perly.y" { yyval.opval = newAVREF(yyvsp[0].opval); } break; case 172: -#line 622 "perly.y" +#line 621 "perly.y" { yyval.opval = newGVREF(0,yyvsp[0].opval); } break; case 173: -#line 626 "perly.y" +#line 625 "perly.y" { yyval.opval = scalar(yyvsp[0].opval); } break; case 174: -#line 628 "perly.y" +#line 627 "perly.y" { yyval.opval = scalar(yyvsp[0].opval); } break; case 175: -#line 630 "perly.y" +#line 629 "perly.y" { yyval.opval = scope(yyvsp[0].opval); } break; case 176: -#line 633 "perly.y" +#line 632 "perly.y" { yyval.opval = yyvsp[0].opval; } break; -#line 2267 "perly.c" +#line 2266 "perly.c" } yyssp -= yym; yystate = *yyssp; diff --git a/perly.c.diff b/perly.c.diff index 55f0a11..0ee7cb2 100644 --- a/perly.c.diff +++ b/perly.c.diff @@ -1,8 +1,24 @@ Index: perly.c -*** perly.c.orig Sun Mar 1 21:44:24 1998 ---- perly.c Sun Mar 1 21:46:32 1998 +*** perly.c.old Wed Jun 10 03:48:43 1998 +--- perly.c Wed Jun 10 03:55:10 1998 *************** -*** 13,82 **** +*** 7,10 **** +--- 7,18 ---- + #include "perl.h" + ++ #ifdef PERL_OBJECT ++ static void ++ Dep(CPerlObj *pPerl) ++ { ++ pPerl->deprecate("\"do\" to call subroutines"); ++ } ++ #define dep() Dep(this) ++ #else + static void + dep(void) +*************** +*** 12,82 **** + deprecate("\"do\" to call subroutines"); } ! #line 29 "perly.y" @@ -73,14 +89,16 @@ Index: perly.c ! #define ARROW 314 #define YYERRCODE 256 short yylhs[] = { -1, ---- 13,17 ---- +--- 20,26 ---- + deprecate("\"do\" to call subroutines"); } ++ #endif ! #line 16 "perly.c" #define YYERRCODE 256 short yylhs[] = { -1, *************** -*** 1337,1347 **** +*** 1337,1361 **** int yyerrflag; int yychar; - short *yyssp; @@ -90,11 +108,10 @@ Index: perly.c - short yyss[YYSTACKSIZE]; - YYSTYPE yyvs[YYSTACKSIZE]; - #define yystacksize YYSTACKSIZE - #line 636 "perly.y" + #line 635 "perly.y" /* PROGRAM */ ---- 1272,1277 ---- -*************** -*** 1350,1361 **** +! #line 1349 "y.tab.c" + #define YYABORT goto yyabort #define YYACCEPT goto yyaccept #define YYERROR goto yyerrlab int @@ -107,7 +124,15 @@ Index: perly.c if (yys = getenv("YYDEBUG")) { ---- 1280,1338 ---- +--- 1281,1347 ---- + int yyerrflag; + int yychar; + YYSTYPE yyval; + YYSTYPE yylval; + #line 635 "perly.y" + /* PROGRAM */ +! #line 1349 "perly.c" + #define YYABORT goto yyabort #define YYACCEPT goto yyaccept #define YYERROR goto yyerrlab + @@ -169,7 +194,7 @@ Index: perly.c { *************** *** 1370,1373 **** ---- 1347,1360 ---- +--- 1356,1369 ---- yychar = (-1); + /* @@ -191,7 +216,7 @@ Index: perly.c ! printf("yydebug: state %d, reading %d (%s)\n", yystate, yychar, yys); } ---- 1372,1376 ---- +--- 1381,1385 ---- if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; ! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", yystate, @@ -209,7 +234,7 @@ Index: perly.c ! goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; ---- 1382,1405 ---- +--- 1391,1414 ---- #if YYDEBUG if (yydebug) ! PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n", @@ -246,7 +271,7 @@ Index: perly.c ! goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; ---- 1437,1461 ---- +--- 1446,1470 ---- #if YYDEBUG if (yydebug) ! PerlIO_printf(Perl_debug_log, @@ -280,7 +305,7 @@ Index: perly.c ! *yyssp); #endif if (yyssp <= yyss) goto yyabort; ---- 1467,1473 ---- +--- 1476,1482 ---- #if YYDEBUG if (yydebug) ! PerlIO_printf(Perl_debug_log, @@ -296,7 +321,7 @@ Index: perly.c ! yystate, yychar, yys); } #endif ---- 1486,1492 ---- +--- 1495,1501 ---- if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; ! PerlIO_printf(Perl_debug_log, @@ -311,21 +336,34 @@ Index: perly.c ! printf("yydebug: state %d, reducing by rule %d (%s)\n", yystate, yyn, yyrule[yyn]); #endif ---- 1497,1501 ---- +--- 1506,1510 ---- #if YYDEBUG if (yydebug) ! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reducing by rule %d (%s)\n", yystate, yyn, yyrule[yyn]); #endif *************** -*** 2274,2279 **** +*** 2263,2267 **** + { yyval.opval = yyvsp[0].opval; } + break; +! #line 2266 "y.tab.c" + } + yyssp -= yym; +--- 2290,2294 ---- + { yyval.opval = yyvsp[0].opval; } + break; +! #line 2266 "perly.c" + } + yyssp -= yym; +*************** +*** 2273,2278 **** #if YYDEBUG if (yydebug) ! printf("yydebug: after reduction, shifting from state 0 to\ ! state %d\n", YYFINAL); #endif yystate = YYFINAL; ---- 2292,2298 ---- +--- 2300,2306 ---- #if YYDEBUG if (yydebug) ! PerlIO_printf(Perl_debug_log, @@ -334,20 +372,20 @@ Index: perly.c #endif yystate = YYFINAL; *************** -*** 2289,2293 **** +*** 2288,2292 **** if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; ! printf("yydebug: state %d, reading %d (%s)\n", YYFINAL, yychar, yys); } ---- 2308,2312 ---- +--- 2316,2320 ---- if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; ! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", YYFINAL, yychar, yys); } *************** -*** 2304,2313 **** +*** 2303,2312 **** #if YYDEBUG if (yydebug) ! printf("yydebug: after reduction, shifting from state %d \ @@ -358,7 +396,7 @@ Index: perly.c ! goto yyoverflow; } *++yyssp = yystate; ---- 2323,2347 ---- +--- 2331,2355 ---- #if YYDEBUG if (yydebug) ! PerlIO_printf(Perl_debug_log, @@ -385,7 +423,7 @@ Index: perly.c } *++yyssp = yystate; *************** -*** 2315,2322 **** +*** 2314,2321 **** goto yyloop; yyoverflow: ! yyerror("yacc stack overflow"); @@ -394,7 +432,7 @@ Index: perly.c yyaccept: ! return (0); } ---- 2349,2356 ---- +--- 2357,2364 ---- goto yyloop; yyoverflow: ! yyerror("Out of memory for yacc stack"); diff --git a/perly.y b/perly.y index 7eda39e..a1a1f0d 100644 --- a/perly.y +++ b/perly.y @@ -442,8 +442,7 @@ term : term ASSIGNOP term | scalar %prec '(' { $$ = $1; } | star '{' expr ';' '}' - { $$ = newBINOP(OP_GELEM, 0, newGVREF(0,$1), - scalar($3)); } + { $$ = newBINOP(OP_GELEM, 0, $1, scalar($3)); } | star %prec '(' { $$ = $1; } | scalar '[' expr ']' %prec '(' diff --git a/t/op/gv.t b/t/op/gv.t index dc71595..c253e4b 100755 --- a/t/op/gv.t +++ b/t/op/gv.t @@ -4,7 +4,7 @@ # various typeglob tests # -print "1..16\n"; +print "1..23\n"; # type coersion on assignment $foo = 'foo'; @@ -83,3 +83,16 @@ print +($foo || @foo || %foo) ? "not ok" : "ok", " 14\n"; *foo = undef; print $msg ? "ok" : "not ok", " 16\n"; } + +# test *glob{THING} syntax +$x = "ok 17\n"; +@x = ("ok 18\n"); +%x = ("ok 19" => "\n"); +sub x { "ok 20\n" } +print ${*x{SCALAR}}, @{*x{ARRAY}}, %{*x{HASH}}, &{*x{CODE}}; +*x = *STDOUT; +print *{*x{GLOB}} eq "*main::STDOUT" ? "ok 21\n" : "not ok 21\n"; +print {*x{IO}} "ok 22\n"; +print {*x{FILEHANDLE}} "ok 23\n"; + +