From: Rafael Garcia-Suarez Date: Thu, 8 Aug 2002 19:47:44 +0000 (+0000) Subject: Fix bug #16080 : an attribute list should end at '}' X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8e7ae056e33b3389a21755f55fa95e623bcad80f;p=p5sagit%2Fp5-mst-13.2.git Fix bug #16080 : an attribute list should end at '}' p4raw-id: //depot/perl@17704 --- diff --git a/t/op/attrs.t b/t/op/attrs.t index dc604f3..264de8a 100644 --- a/t/op/attrs.t +++ b/t/op/attrs.t @@ -8,7 +8,7 @@ BEGIN { require './test.pl'; } -plan tests => 37; +plan tests => 39; $SIG{__WARN__} = sub { die @_ }; @@ -50,6 +50,12 @@ eval_ok 'my ($x,$y) : ;'; eval 'my ($x,$y) : plugh;'; like $@, qr/^Invalid SCALAR attribute: ["']?plugh["']? at/; +# bug #16080 +eval '{my $x : plugh}'; +like $@, qr/^Invalid SCALAR attribute: ["']?plugh["']? at/; +eval '{my ($x,$y) : plugh(})}'; +like $@, qr/^Invalid SCALAR attribute: ["']?plugh\(}\)["']? at/; + sub A::MODIFY_SCALAR_ATTRIBUTES { return } eval 'my A $x : plugh;'; like $@, qr/^SCALAR package attribute may clash with future reserved word: ["']?plugh["']? at/; diff --git a/toke.c b/toke.c index 761f0e7..6bacaea 100644 --- a/toke.c +++ b/toke.c @@ -3049,7 +3049,7 @@ Perl_yylex(pTHX) break; /* require real whitespace or :'s */ } tmp = (PL_expect == XOPERATOR ? '=' : '{'); /*'}(' for vi */ - if (*s != ';' && *s != tmp && (tmp != '=' || *s != ')')) { + if (*s != ';' && *s != '}' && *s != tmp && (tmp != '=' || *s != ')')) { char q = ((*s == '\'') ? '"' : '\''); /* If here for an expression, and parsed no attrs, back off. */ if (tmp == '=' && !attrs) {