summaryrefslogtreecommitdiff
path: root/perly.y
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-09-15 16:07:11 -0700
committerRicardo Signes <rjbs@cpan.org>2013-10-05 14:20:09 -0400
commit76eba8ab520b5c85d3a1566e1ae17ca49faeccf1 (patch)
tree981a0c8b4908f600f55c4c2ebe5e846d710796ec /perly.y
parented3f8f871063863e8e0cf35f2b79b686fd23a622 (diff)
downloadperl-76eba8ab520b5c85d3a1566e1ae17ca49faeccf1.tar.gz
->%{ ->%[
Diffstat (limited to 'perly.y')
-rw-r--r--perly.y13
1 files changed, 10 insertions, 3 deletions
diff --git a/perly.y b/perly.y
index 92c61f0972..f7e8b634db 100644
--- a/perly.y
+++ b/perly.y
@@ -94,7 +94,7 @@
%type <opval> stmtseq fullstmt labfullstmt barestmt block mblock else
%type <opval> expr term subscripted scalar ary hsh arylen star amper sideff
-%type <opval> sliceme gelem
+%type <opval> sliceme kvslice gelem
%type <opval> listexpr nexpr texpr iexpr mexpr mnexpr miexpr
%type <opval> optlistexpr optexpr indirob listop method
%type <opval> formname subname proto subbody cont my_scalar formblock
@@ -1208,7 +1208,7 @@ term : termbinop
TOKEN_GETMAD($2,$$,'[');
TOKEN_GETMAD($4,$$,']');
}
- | hsh '[' expr ']' /* array key/value slice */
+ | kvslice '[' expr ']' /* array key/value slice */
{ $$ = op_prepend_elem(OP_KVASLICE,
newOP(OP_PUSHMARK, 0),
newLISTOP(OP_KVASLICE, 0,
@@ -1234,7 +1234,7 @@ term : termbinop
TOKEN_GETMAD($4,$$,';');
TOKEN_GETMAD($5,$$,'}');
}
- | hsh '{' expr ';' '}' /* %hash{@keys} */
+ | kvslice '{' expr ';' '}' /* %hash{@keys} */
{ $$ = op_prepend_elem(OP_KVHSLICE,
newOP(OP_PUSHMARK, 0),
newLISTOP(OP_KVHSLICE, 0,
@@ -1494,6 +1494,13 @@ sliceme : ary
}
;
+kvslice : hsh
+ | term ARROW '%'
+ { $$ = newHVREF($1);
+ TOKEN_GETMAD($3,$$,'@');
+ }
+ ;
+
gelem : star
| term ARROW '*'
{ $$ = newGVREF(0,$1);