New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrong line number in syntax error message #9991
Comments
From frank.wiegand@gmail.comThis is a bug report for perl from frank.wiegand@gmail.com, $ bleadperl -e '+' This broke between 5.11.0 and 5.11.2, git bisect reports: f0e67a1 is the first bad commit lexer API Attached is a patch that adds a public API for the lowest layers of :100644 100644 22db6a3c9011829aff5176a7bacd4373f9c1d354 b8073eb771a2c615c876970bc1883bd4316cc88c M MANIFEST Frank Flags: Site configuration information for perl 5.11.2: Configured by fw at Sat Nov 28 22:03:13 CET 2009. Summary of my perl5 (revision 5 version 11 subversion 2) configuration: Locally applied patches: @INC for perl 5.11.2: Environment for perl 5.11.2: |
From zefram@fysh.orgFrank Wiegand wrote:
Bah, that's another area where I tested a bunch of variations while -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From zefram@fysh.orgFrank Wiegand wrote:
Fixed by the attached patch. -zefram |
From zefram@fysh.orgInline Patchdiff --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); |
@obra - Status changed from 'open' to 'resolved' |
From @obraThanks. Applied as 85613ca On Wed, Dec 09, 2009 at 10:08:33PM +0000, Zefram wrote:
-- |
Migrated from rt.perl.org#70910 (status was 'resolved')
Searchable as RT70910$
The text was updated successfully, but these errors were encountered: