From: Father Chrysostomos Date: Mon, 16 Sep 2013 19:49:12 +0000 (-0700) Subject: Fix a bug with ->@ inside "@{...}" X-Git-Tag: upstream/5.20.0~1599^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=760ca74635309e90553eeb15e5ac62e6f19f5d86;p=platform%2Fupstream%2Fperl.git Fix a bug with ->@ inside "@{...}" When encountering ->@[ or ->@{, we should only record that we are going to need a POSTJOIN at the top level of interpolation, not inside any brackets. Otherwise the ->@[ can interfere with an outer "@{...}", causing syntax errors. --- diff --git a/t/op/postfixderef.t b/t/op/postfixderef.t index 41d35ef..96dcf0f 100644 --- a/t/op/postfixderef.t +++ b/t/op/postfixderef.t @@ -16,7 +16,7 @@ BEGIN { use strict qw(refs subs); -plan(118); +plan(121); { no warnings qw 'deprecated syntax'; @@ -367,4 +367,7 @@ is "$_->@{foo}", "foo->7 8 9", '->@{ does not interpolate without feature'; is "foo$_->@*bar", "foo7 8 9bar", '->@* interpolated w/other stuff'; is "foo$_->@[0,1]bar", "foo7 8bar", '->@[ interpolated w/other stuff'; is "foo$_->@{foo}bar", "foooofbar", '->@{ interpolated w/other stuff'; + is "@{[foo->@*]}", "7 8 9", '->@* inside "@{...}"'; + is "@{[foo->@[0,1]]}", "7 8", '->@[ inside "@{...}"'; + is "@{[foo->@{foo}]}", "oof", '->@{ inside "@{...}"'; } diff --git a/toke.c b/toke.c index 5d3fdce..f9977d2 100644 --- a/toke.c +++ b/toke.c @@ -2186,7 +2186,9 @@ S_postderef(pTHX_ char const funny, char const next) PL_bufptr+=2; } else { - if ('@' == funny) PL_lex_dojoin = 2; + if ('@' == funny && PL_lex_state == LEX_INTERPNORMAL + && !PL_lex_brackets) + PL_lex_dojoin = 2; PL_expect = XOPERATOR; PL_bufptr++; }