summaryrefslogtreecommitdiff
path: root/perly.y
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-08 08:40:44 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-12 09:11:25 -0700
commit7eb971ee54c13db586d1afe434b0fa7d3fb759af (patch)
tree09697b122ec54e4b91c6adb45408027bd39ea8f8 /perly.y
parentf4ef369354bb1dbebc128000108d3c4964e1cbf0 (diff)
downloadperl-7eb971ee54c13db586d1afe434b0fa7d3fb759af.tar.gz
[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.
Diffstat (limited to 'perly.y')
-rw-r--r--perly.y9
1 files changed, 8 insertions, 1 deletions
diff --git a/perly.y b/perly.y
index 9c308a3853..ec030b9933 100644
--- a/perly.y
+++ b/perly.y
@@ -74,7 +74,7 @@
%token <i_tkval> '{' '}' '[' ']' '-' '+' '$' '@' '%' '*' '&' ';'
%token <opval> WORD METHOD FUNCMETH THING PMFUNC PRIVATEREF QWLIST
-%token <opval> FUNC0SUB UNIOPSUB LSTOPSUB
+%token <opval> FUNC0OP FUNC0SUB UNIOPSUB LSTOPSUB
%token <opval> PLUGEXPR PLUGSTMT
%token <p_tkval> LABEL
%token <i_tkval> FORMAT SUB ANONSUB PACKAGE USE
@@ -1232,6 +1232,13 @@ term : termbinop
TOKEN_GETMAD($2,$$,'(');
TOKEN_GETMAD($3,$$,')');
}
+ | FUNC0OP /* Same as above, but op created in toke.c */
+ { $$ = $1; }
+ | FUNC0OP '(' ')'
+ { $$ = $1;
+ TOKEN_GETMAD($2,$$,'(');
+ TOKEN_GETMAD($3,$$,')');
+ }
| FUNC0SUB /* Sub treated as nullop */
{ $$ = newUNOP(OP_ENTERSUB, OPf_STACKED,
scalar($1)); }