summaryrefslogtreecommitdiff
path: root/t/comp
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-26 17:51:37 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-27 23:23:59 -0700
commit83944c0156f447aea25d07bd3a03bc58fa93f849 (patch)
tree24a3d5d5d3641940c3af79b31e84ff8d1dcc7afe /t/comp
parent61dad979a56eaefa315dbe8b01c52f0cb2723105 (diff)
downloadperl-83944c0156f447aea25d07bd3a03bc58fa93f849.tar.gz
[perl #114070] Fix lines nums after <<foo
The line numbers for operators after a here-doc marker on the same line were off by the length of the here-doc. This is because the here-doc parser would artificially increase the line number as it went, because it was stealing lines out of the input stream. Instead, we can record the number of lines in the here-doc, and add it to the line number the next time we need to increment it. This also fixes the line numbers after s//<<END/e to the end of the file, which were off because the line number adjusted by the <<END was localised to the s///. Since herelines is visible to inner lexing scopes, the outer lexing scope can see changes made by the inner one. The lack of localisation does cause problems with line numbers inside quote-like operators (but they were off by one already), which will be addressed in subsequent commits.
Diffstat (limited to 't/comp')
-rw-r--r--t/comp/parser.t9
1 files changed, 8 insertions, 1 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t
index d05e92e5c7..a89294968f 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -3,7 +3,7 @@
# Checks if the parser behaves correctly in edge cases
# (including weird syntax errors)
-print "1..144\n";
+print "1..148\n";
sub failed {
my ($got, $expected, $name) = @_;
@@ -527,5 +527,12 @@ eval <<'EOSTANZA'; die $@ if $@;
check(qr/^Great hail!.*no more\.$/, 61, "Overflow both small buffer checks");
EOSTANZA
+#line 531 parser.t
+<<EOU; check('parser\.t', 531, 'on same line as heredoc');
+EOU
+s//<<EOV/e if 0;
+EOV
+check('parser\.t', 535, 'after here-doc in quotes');
+
__END__
# Don't add new tests HERE. See note above