From 37808b008bc94c39c5452495998b0106d6d38f6f Mon Sep 17 00:00:00 2001 From: Lukas Mai Date: Sat, 4 Jun 2016 12:44:57 +0200 Subject: [PATCH] fix bogus "at end of line" error message for "my (my $x, $y, $z)" --- t/lib/croak/toke | 14 +++++++------- toke.c | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/t/lib/croak/toke b/t/lib/croak/toke index c295534..9f90500 100644 --- a/t/lib/croak/toke +++ b/t/lib/croak/toke @@ -251,46 +251,46 @@ Unterminated delimiter for here document at - line 1. # NAME my (our $x) errors my (our $x); EXPECT -Can't redeclare "our" in "my" at - line 1, at end of line +Can't redeclare "our" in "my" at - line 1, near "(our" Execution of - aborted due to compilation errors. ######## # NAME our (my $x) errors our (my $x); EXPECT -Can't redeclare "my" in "our" at - line 1, at end of line +Can't redeclare "my" in "our" at - line 1, near "(my" Execution of - aborted due to compilation errors. ######## # NAME state (my $x) errors use feature 'state'; state (my $x); EXPECT -Can't redeclare "my" in "state" at - line 2, at end of line +Can't redeclare "my" in "state" at - line 2, near "(my" Execution of - aborted due to compilation errors. ######## # NAME our (state $x) errors use feature 'state'; our (state $x); EXPECT -Can't redeclare "state" in "our" at - line 2, at end of line +Can't redeclare "state" in "our" at - line 2, near "(state" Execution of - aborted due to compilation errors. ######## # NAME my (my $x) errors my (my $x, $y, $z); EXPECT -Can't redeclare "my" in "my" at - line 1, at end of line +Can't redeclare "my" in "my" at - line 1, near "(my" Execution of - aborted due to compilation errors. ######## # NAME our (our $x) errors our ($x, our($y), $z); EXPECT -Can't redeclare "our" in "our" at - line 1, near ", " +Can't redeclare "our" in "our" at - line 1, near ", our" Execution of - aborted due to compilation errors. ######## # NAME state (state $x) errors use feature 'state'; state ($x, $y, state $z); EXPECT -Can't redeclare "state" in "state" at - line 2, near ", " +Can't redeclare "state" in "state" at - line 2, near ", state" Execution of - aborted due to compilation errors. ######## # NAME BEGIN <> [perl #125341] diff --git a/toke.c b/toke.c index 7a9bc89..e6f6bf9 100644 --- a/toke.c +++ b/toke.c @@ -7777,6 +7777,7 @@ Perl_yylex(pTHX) case KEY_my: case KEY_state: if (PL_in_my) { + PL_bufptr = s; yyerror(Perl_form(aTHX_ "Can't redeclare \"%s\" in \"%s\"", tmp == KEY_my ? "my" : -- 1.8.3.1