From: Rafael Garcia-Suarez Date: Wed, 26 Aug 2009 13:30:35 +0000 (+0200) Subject: Make MAD understand the "..." operator X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=950f2ea2662b3cc90a921896855174e32ecb4697;p=p5sagit%2Fp5-mst-13.2.git Make MAD understand the "..." operator --- diff --git a/perly.act b/perly.act index cb1d67d..864fd61 100644 --- a/perly.act +++ b/perly.act @@ -1458,11 +1458,12 @@ case 2: { (yyval.opval) = newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0), newSVOP(OP_CONST, 0, newSVpvs("Unimplemented"))); + TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'X'); ;} break; case 189: -#line 1246 "perly.y" +#line 1247 "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'); @@ -1473,14 +1474,14 @@ case 2: break; case 190: -#line 1254 "perly.y" +#line 1255 "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 191: -#line 1261 "perly.y" +#line 1262 "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),')'); @@ -1488,7 +1489,7 @@ case 2: break; case 192: -#line 1266 "perly.y" +#line 1267 "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),')'); @@ -1496,42 +1497,42 @@ case 2: break; case 193: -#line 1271 "perly.y" +#line 1272 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 194: -#line 1273 "perly.y" +#line 1274 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 195: -#line 1275 "perly.y" +#line 1276 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 196: -#line 1280 "perly.y" +#line 1281 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 197: -#line 1282 "perly.y" +#line 1283 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 198: -#line 1286 "perly.y" +#line 1287 "perly.y" { (yyval.opval) = (OP*)NULL; ;} break; case 199: -#line 1288 "perly.y" +#line 1289 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; case 200: -#line 1290 "perly.y" +#line 1291 "perly.y" { #ifdef MAD OP* op = newNULLLIST(); @@ -1545,71 +1546,74 @@ case 2: break; case 201: -#line 1305 "perly.y" +#line 1306 "perly.y" { PL_parser->in_my = 0; (yyval.opval) = my((ps[(1) - (1)].val.opval)); ;} break; case 202: -#line 1309 "perly.y" +#line 1310 "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 203: -#line 1315 "perly.y" +#line 1316 "perly.y" { (yyval.opval) = newSVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'$'); ;} break; case 204: -#line 1321 "perly.y" +#line 1322 "perly.y" { (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'@'); ;} break; case 205: -#line 1327 "perly.y" +#line 1328 "perly.y" { (yyval.opval) = newHVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'%'); ;} break; case 206: -#line 1333 "perly.y" +#line 1334 "perly.y" { (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'l'); ;} break; case 207: -#line 1339 "perly.y" +#line 1340 "perly.y" { (yyval.opval) = newGVREF(0,(ps[(2) - (2)].val.opval)); TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'*'); ;} break; case 208: -#line 1346 "perly.y" +#line 1347 "perly.y" { (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;} break; case 209: -#line 1348 "perly.y" +#line 1349 "perly.y" { (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;} break; case 210: -#line 1350 "perly.y" +#line 1351 "perly.y" { (yyval.opval) = scope((ps[(1) - (1)].val.opval)); ;} break; case 211: -#line 1353 "perly.y" +#line 1354 "perly.y" { (yyval.opval) = (ps[(1) - (1)].val.opval); ;} break; + +/* Line 1267 of yacc.c. */ + default: break; diff --git a/perly.h b/perly.h index a8c7f04..802da29 100644 --- a/perly.h +++ b/perly.h @@ -1,24 +1,25 @@ #ifdef PERL_CORE - -/* A Bison parser, made by GNU Bison 2.4.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,11 +30,10 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ - /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -111,7 +111,6 @@ PEG = 326 }; #endif - /* Tokens. */ #define WORD 258 #define METHOD 259 @@ -185,13 +184,11 @@ + #endif /* PERL_CORE */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { - -/* Line 1676 of yacc.c */ - I32 ival; /* __DEFAULT__ (marker for regen_perly.pl; must always be 1st union member) */ char *pval; @@ -207,16 +204,13 @@ typedef union YYSTYPE #ifdef PERL_MAD TOKEN* tkval; #endif - - - -/* Line 1676 of yacc.c */ -} YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 +} +/* Line 1489 of yacc.c. */ + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 #endif - diff --git a/perly.tab b/perly.tab index 2b78718..af065cc 100644 --- a/perly.tab +++ b/perly.tab @@ -185,10 +185,10 @@ static const yytype_uint16 yyrline[] = 1079, 1080, 1085, 1089, 1091, 1095, 1100, 1105, 1107, 1109, 1111, 1113, 1115, 1117, 1126, 1137, 1139, 1141, 1146, 1159, 1164, 1169, 1173, 1177, 1181, 1185, 1189, 1193, 1197, 1199, - 1202, 1206, 1212, 1215, 1224, 1230, 1235, 1236, 1237, 1245, - 1253, 1260, 1265, 1270, 1272, 1274, 1279, 1281, 1286, 1287, - 1289, 1304, 1308, 1314, 1320, 1326, 1332, 1338, 1345, 1347, - 1349, 1352 + 1202, 1206, 1212, 1215, 1224, 1230, 1235, 1236, 1237, 1246, + 1254, 1261, 1266, 1271, 1273, 1275, 1280, 1282, 1287, 1288, + 1290, 1305, 1309, 1315, 1321, 1327, 1333, 1339, 1346, 1348, + 1350, 1353 }; #endif @@ -214,7 +214,7 @@ static const char *const yytname[] = "loop", "switch", "mintro", "nexpr", "texpr", "iexpr", "mexpr", "mnexpr", "miexpr", "label", "decl", "peg", "format", "formname", "mysubrout", "subrout", "startsub", "startanonsub", "startformsub", "subname", - "proto", "subattrlist", "myattrlist", "subbody", "package", "use", "$@1", + "proto", "subattrlist", "myattrlist", "subbody", "package", "use", "@1", "expr", "argexpr", "listop", "@2", "method", "subscripted", "termbinop", "termunop", "anonymous", "termdo", "term", "myattrterm", "myterm", "listexpr", "listexprcom", "my_scalar", "amper", "scalar", "ary", "hsh", diff --git a/perly.y b/perly.y index c07f48a..bcdd434 100644 --- a/perly.y +++ b/perly.y @@ -1238,6 +1238,7 @@ term : termbinop { $$ = newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0), newSVOP(OP_CONST, 0, newSVpvs("Unimplemented"))); + TOKEN_GETMAD($1,$$,'X'); } ;