From: Rafael Garcia-Suarez Date: Thu, 15 Mar 2007 16:14:22 +0000 (+0000) Subject: Patch by Gerard Goossen to add madprops to "require" opcode X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d2fdf8fdbe6e667aa21f187390b3b412d8fccba9;p=p5sagit%2Fp5-mst-13.2.git Patch by Gerard Goossen to add madprops to "require" opcode p4raw-id: //depot/perl@30599 --- diff --git a/perly.act b/perly.act index 84809ca..8d4b5f8 100644 --- a/perly.act +++ b/perly.act @@ -1375,34 +1375,38 @@ case 2: case 176: #line 1182 "perly.y" - { (yyval.opval) = newOP(OP_REQUIRE, (ps[(1) - (1)].val.i_tkval) ? OPf_SPECIAL : 0); ;} + { (yyval.opval) = newOP(OP_REQUIRE, (ps[(1) - (1)].val.i_tkval) ? OPf_SPECIAL : 0); + TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o'); + ;} break; case 177: -#line 1184 "perly.y" - { (yyval.opval) = newUNOP(OP_REQUIRE, (ps[(1) - (2)].val.i_tkval) ? OPf_SPECIAL : 0, (ps[(2) - (2)].val.opval)); ;} +#line 1186 "perly.y" + { (yyval.opval) = newUNOP(OP_REQUIRE, (ps[(1) - (2)].val.i_tkval) ? OPf_SPECIAL : 0, (ps[(2) - (2)].val.opval)); + TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o'); + ;} break; case 178: -#line 1186 "perly.y" +#line 1190 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((ps[(1) - (1)].val.opval))); ;} break; case 179: -#line 1188 "perly.y" +#line 1192 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, append_elem(OP_LIST, (ps[(2) - (2)].val.opval), scalar((ps[(1) - (2)].val.opval)))); ;} break; case 180: -#line 1191 "perly.y" +#line 1195 "perly.y" { (yyval.opval) = newOP(IVAL((ps[(1) - (1)].val.i_tkval)), 0); TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o'); ;} break; case 181: -#line 1195 "perly.y" +#line 1199 "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),'('); @@ -1411,13 +1415,13 @@ case 2: break; case 182: -#line 1201 "perly.y" +#line 1205 "perly.y" { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((ps[(1) - (1)].val.opval))); ;} break; case 183: -#line 1204 "perly.y" +#line 1208 "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); @@ -1429,7 +1433,7 @@ case 2: break; case 184: -#line 1213 "perly.y" +#line 1217 "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),'('); @@ -1438,7 +1442,7 @@ case 2: break; case 185: -#line 1219 "perly.y" +#line 1223 "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),')'); @@ -1446,7 +1450,7 @@ case 2: break; case 188: -#line 1229 "perly.y" +#line 1233 "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'); @@ -1457,14 +1461,14 @@ case 2: break; case 189: -#line 1237 "perly.y" +#line 1241 "perly.y" { (yyval.opval) = localize((ps[(2) - (2)].val.opval),IVAL((ps[(1) - (2)].val.i_tkval))); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'d'); ;} break; case 190: -#line 1244 "perly.y" +#line 1248 "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),')'); @@ -1472,7 +1476,7 @@ case 2: break; case 191: -#line 1249 "perly.y" +#line 1253 "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),')'); @@ -1480,42 +1484,42 @@ case 2: break; case 192: -#line 1254 "perly.y" +#line 1258 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 193: -#line 1256 "perly.y" +#line 1260 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 194: -#line 1258 "perly.y" +#line 1262 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 195: -#line 1263 "perly.y" +#line 1267 "perly.y" { (yyval.opval) = Nullop; ;} break; case 196: -#line 1265 "perly.y" +#line 1269 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 197: -#line 1269 "perly.y" +#line 1273 "perly.y" { (yyval.opval) = Nullop; ;} break; case 198: -#line 1271 "perly.y" +#line 1275 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 199: -#line 1273 "perly.y" +#line 1277 "perly.y" { #ifdef MAD OP* op = newNULLLIST(); @@ -1529,69 +1533,69 @@ case 2: break; case 200: -#line 1288 "perly.y" +#line 1292 "perly.y" { PL_in_my = 0; (yyval.opval) = my((ps[(1) - (1)].val.opval)); ;} break; case 201: -#line 1292 "perly.y" +#line 1296 "perly.y" { (yyval.opval) = newCVREF(IVAL((ps[(1) - (2)].val.i_tkval)),(ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'&'); ;} break; case 202: -#line 1298 "perly.y" +#line 1302 "perly.y" { (yyval.opval) = newSVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'$'); ;} break; case 203: -#line 1304 "perly.y" +#line 1308 "perly.y" { (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'@'); ;} break; case 204: -#line 1310 "perly.y" +#line 1314 "perly.y" { (yyval.opval) = newHVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'%'); ;} break; case 205: -#line 1316 "perly.y" +#line 1320 "perly.y" { (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'l'); ;} break; case 206: -#line 1322 "perly.y" +#line 1326 "perly.y" { (yyval.opval) = newGVREF(0,(ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'*'); ;} break; case 207: -#line 1329 "perly.y" +#line 1333 "perly.y" { (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;} break; case 208: -#line 1331 "perly.y" +#line 1335 "perly.y" { (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;} break; case 209: -#line 1333 "perly.y" +#line 1337 "perly.y" { (yyval.opval) = scope((ps[(1) - (1)].val.opval)); ;} break; case 210: -#line 1336 "perly.y" +#line 1340 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; diff --git a/perly.h b/perly.h index f442416..73dc4b8 100644 --- a/perly.h +++ b/perly.h @@ -203,7 +203,7 @@ typedef union YYSTYPE TOKEN* tkval; #endif } -/* Line 1489 of yacc.c. */ +/* Line 1529 of yacc.c. */ YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 diff --git a/perly.tab b/perly.tab index f376938..605066a 100644 --- a/perly.tab +++ b/perly.tab @@ -184,11 +184,11 @@ static const yytype_uint16 yyrline[] = 1004, 1015, 1019, 1023, 1035, 1048, 1056, 1068, 1069, 1070, 1071, 1072, 1077, 1081, 1083, 1087, 1092, 1097, 1099, 1101, 1103, 1105, 1107, 1109, 1118, 1129, 1131, 1133, 1138, 1151, - 1156, 1161, 1165, 1169, 1173, 1177, 1181, 1183, 1185, 1187, - 1190, 1194, 1200, 1203, 1212, 1218, 1223, 1224, 1228, 1236, - 1243, 1248, 1253, 1255, 1257, 1262, 1264, 1269, 1270, 1272, - 1287, 1291, 1297, 1303, 1309, 1315, 1321, 1328, 1330, 1332, - 1335 + 1156, 1161, 1165, 1169, 1173, 1177, 1181, 1185, 1189, 1191, + 1194, 1198, 1204, 1207, 1216, 1222, 1227, 1228, 1232, 1240, + 1247, 1252, 1257, 1259, 1261, 1266, 1268, 1273, 1274, 1276, + 1291, 1295, 1301, 1307, 1313, 1319, 1325, 1332, 1334, 1336, + 1339 }; #endif diff --git a/perly.y b/perly.y index a1f23ab..2abf7a1 100644 --- a/perly.y +++ b/perly.y @@ -1178,10 +1178,14 @@ term : termbinop { $$ = newUNOP(IVAL($1), 0, $2); TOKEN_GETMAD($1,$$,'o'); } - | REQUIRE /* require, $_ implied *//* FIMXE for MAD needed? */ - { $$ = newOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0); } - | REQUIRE term /* require Foo *//* FIMXE for MAD needed? */ - { $$ = newUNOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0, $2); } + | REQUIRE /* require, $_ implied */ + { $$ = newOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0); + TOKEN_GETMAD($1,$$,'o'); + } + | REQUIRE term /* require Foo */ + { $$ = newUNOP(OP_REQUIRE, $1 ? OPf_SPECIAL : 0, $2); + TOKEN_GETMAD($1,$$,'o'); + } | UNIOPSUB { $$ = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar($1)); } | UNIOPSUB term /* Sub treated as unop */