Permalink
Browse files

[perl #95546] Allow () after __FILE__, etc.

This commit makes the __FILE__, __LINE__ and __PACKAGE__ token parse
the same way as nullary functions.

It adds two extra rules to perly.y to allow the op to be created in
toke.c, instead of directly inside the parser.
  • Loading branch information...
1 parent f4ef369 commit 7eb971ee54c13db586d1afe434b0fa7d3fb759af Father Chrysostomos committed Aug 8, 2011
Showing with 1,037 additions and 990 deletions.
  1. +71 −58 perly.act
  2. +133 −131 perly.h
  3. +810 −791 perly.tab
  4. +8 −1 perly.y
  5. +15 −9 toke.c
View
129 perly.act
@@ -1510,12 +1510,25 @@ case 2:
case 188:
#line 1236 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 189:
+#line 1238 "perly.y"
+ { (yyval.opval) = (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),')');
+ ;}
+ break;
+
+ case 190:
+#line 1243 "perly.y"
{ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
scalar((ps[(1) - (1)].val.opval))); ;}
break;
- case 189:
-#line 1239 "perly.y"
+ case 191:
+#line 1246 "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);
@@ -1526,34 +1539,34 @@ case 2:
;}
break;
- case 190:
-#line 1248 "perly.y"
+ case 192:
+#line 1255 "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),'(');
TOKEN_GETMAD((ps[(4) - (4)].val.i_tkval),(yyval.opval),')');
;}
break;
- case 191:
-#line 1254 "perly.y"
+ case 193:
+#line 1261 "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),')');
;}
break;
- case 194:
-#line 1261 "perly.y"
+ case 196:
+#line 1268 "perly.y"
{
(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 196:
-#line 1271 "perly.y"
+ case 198:
+#line 1278 "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');
@@ -1563,47 +1576,37 @@ case 2:
;}
break;
- case 197:
-#line 1279 "perly.y"
+ case 199:
+#line 1286 "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 198:
-#line 1286 "perly.y"
+ case 200:
+#line 1293 "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),')');
;}
break;
- case 199:
-#line 1291 "perly.y"
+ case 201:
+#line 1298 "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),')');
;}
break;
- case 200:
-#line 1296 "perly.y"
- { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
- break;
-
- case 201:
-#line 1298 "perly.y"
- { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
- break;
-
case 202:
-#line 1300 "perly.y"
+#line 1303 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 203:
#line 1305 "perly.y"
- { (yyval.opval) = (OP*)NULL; ;}
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 204:
@@ -1612,94 +1615,104 @@ case 2:
break;
case 205:
-#line 1311 "perly.y"
+#line 1312 "perly.y"
{ (yyval.opval) = (OP*)NULL; ;}
break;
case 206:
-#line 1313 "perly.y"
+#line 1314 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 207:
-#line 1317 "perly.y"
- { (yyval.i_tkval) = (ps[(1) - (1)].val.i_tkval); ;}
+#line 1318 "perly.y"
+ { (yyval.opval) = (OP*)NULL; ;}
break;
case 208:
-#line 1319 "perly.y"
- { munge_qwlist_to_paren_list((ps[(1) - (1)].val.opval)); ;}
+#line 1320 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
case 209:
-#line 1321 "perly.y"
- { (yyval.i_tkval) = (ps[(3) - (3)].val.i_tkval); ;}
+#line 1324 "perly.y"
+ { (yyval.i_tkval) = (ps[(1) - (1)].val.i_tkval); ;}
break;
case 210:
-#line 1327 "perly.y"
- { PL_parser->in_my = 0; (yyval.opval) = my((ps[(1) - (1)].val.opval)); ;}
+#line 1326 "perly.y"
+ { munge_qwlist_to_paren_list((ps[(1) - (1)].val.opval)); ;}
break;
case 211:
-#line 1331 "perly.y"
+#line 1328 "perly.y"
+ { (yyval.i_tkval) = (ps[(3) - (3)].val.i_tkval); ;}
+ break;
+
+ case 212:
+#line 1334 "perly.y"
+ { PL_parser->in_my = 0; (yyval.opval) = my((ps[(1) - (1)].val.opval)); ;}
+ break;
+
+ case 213:
+#line 1338 "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 212:
-#line 1337 "perly.y"
+ case 214:
+#line 1344 "perly.y"
{ (yyval.opval) = newSVREF((ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'$');
;}
break;
- case 213:
-#line 1343 "perly.y"
+ case 215:
+#line 1350 "perly.y"
{ (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'@');
;}
break;
- case 214:
-#line 1349 "perly.y"
+ case 216:
+#line 1356 "perly.y"
{ (yyval.opval) = newHVREF((ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'%');
;}
break;
- case 215:
-#line 1355 "perly.y"
+ case 217:
+#line 1362 "perly.y"
{ (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'l');
;}
break;
- case 216:
-#line 1361 "perly.y"
+ case 218:
+#line 1368 "perly.y"
{ (yyval.opval) = newGVREF(0,(ps[(2) - (2)].val.opval));
TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'*');
;}
break;
- case 217:
-#line 1368 "perly.y"
+ case 219:
+#line 1375 "perly.y"
{ (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;}
break;
- case 218:
-#line 1370 "perly.y"
+ case 220:
+#line 1377 "perly.y"
{ (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;}
break;
- case 219:
-#line 1372 "perly.y"
+ case 221:
+#line 1379 "perly.y"
{ (yyval.opval) = op_scope((ps[(1) - (1)].val.opval)); ;}
break;
- case 220:
-#line 1375 "perly.y"
+ case 222:
+#line 1382 "perly.y"
{ (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
break;
@@ -1710,6 +1723,6 @@ case 2:
/* Generated from:
- * 8bdd3d69bab2a9d77e0557f3b46a8845e8de190fafce0bc37841a105bbcacaa5 perly.y
+ * 7fb05fb0a9bd3f1c047696941084a07f2d9928ccde2dd343a19d32cf51669760 perly.y
* 738ca60a0b4cb075902435e976a2f393d438e8e6e32ba81e037dd773b75c87b5 regen_perly.pl
* ex: set ro: */
Oops, something went wrong.

0 comments on commit 7eb971e

Please sign in to comment.