summaryrefslogtreecommitdiff
path: root/parser.h
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 /parser.h
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 'parser.h')
-rw-r--r--parser.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/parser.h b/parser.h
index bfb2480127..cdcf0b1ee3 100644
--- a/parser.h
+++ b/parser.h
@@ -108,6 +108,7 @@ typedef struct yy_parser {
COP *saved_curcop; /* the previous PL_curcop */
char tokenbuf[256];
+ line_t herelines; /* number of lines in here-doc */
U8 lex_fakeeof; /* precedence at which to fake EOF */
U8 lex_flags;
PERL_BITFIELD16 in_pod:1; /* lexer is within a =pod section */