In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/85613cabfd8d8a9b6b36082819bd6c38e1bb21c7?hp=bb61cbbfe4f34b8082fca34dd9dd82cae6aaa146>
- Log ----------------------------------------------------------------- commit 85613cabfd8d8a9b6b36082819bd6c38e1bb21c7 Author: Zefram <[email protected]> Date: Wed Dec 9 17:40:05 2009 -0500 Fix for [perl #70910] wrong line number in syntax error message ----------------------------------------------------------------------- Summary of changes: MANIFEST | 1 + t/comp/final_line_num.t | 13 +++++++++++++ toke.c | 3 ++- 3 files changed, 16 insertions(+), 1 deletions(-) create mode 100644 t/comp/final_line_num.t diff --git a/MANIFEST b/MANIFEST index a85d318..43e9a49 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4187,6 +4187,7 @@ t/comp/bproto.t See if builtins conform to their prototypes t/comp/cmdopt.t See if command optimization works t/comp/colon.t See if colons are parsed correctly t/comp/decl.t See if declarations work +t/comp/final_line_num.t See if line numbers are correct at EOF t/comp/fold.t See if constant folding works t/comp/hints.aux Auxillary file for %^H test t/comp/hints.t See if %^H works diff --git a/t/comp/final_line_num.t b/t/comp/final_line_num.t new file mode 100644 index 0000000..bb06847 --- /dev/null +++ b/t/comp/final_line_num.t @@ -0,0 +1,13 @@ +#!./perl + +BEGIN { print "1..1\n"; } + +BEGIN { $SIG{__DIE__} = sub { + $_[0] =~ /\Asyntax error at [^ ]+ line ([0-9]+), at EOF/ or exit 1; + my $error_line_num = $1; + print $error_line_num == $last_line_num ? "ok 1\n" : "not ok 1\n"; + exit 0; +}; } + +# the next line causes a syntax error at end of file, to be caught above +BEGIN { $last_line_num = __LINE__; } print 1+ diff --git a/toke.c b/toke.c index d498a34..2ec5f2d 100644 --- a/toke.c +++ b/toke.c @@ -4363,7 +4363,8 @@ Perl_yylex(pTHX) PL_doextract = FALSE; } } - incline(s); + if (PL_rsfp) + incline(s); } while (PL_doextract); PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = s; PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr); -- Perl5 Master Repository
