This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move herelines out of the lex_shared struct
authorFather Chrysostomos <sprout@cpan.org>
Sun, 8 Sep 2013 01:34:24 +0000 (18:34 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 8 Sep 2013 01:34:37 +0000 (18:34 -0700)
commit851b527ad18524f953bb52604a2b669eb2e68648
tree6a5bddc4ec56f49668e4977d25c7381c433b1efb
parentb42366d4c37f0739fb5f9105feb416811057931a
Move herelines out of the lex_shared struct

Previously, the line number was localised in lexing scopes.  herelines
had to be in the lex_shared struct so that inner lexing scopes
could peek into values belonging to outer lexing scopes and set the
herelines value belonging to the same scope that a here-doc body was
extracted from.  (herelines records how much extra to increase the
line number at the next line ending, to jump over a here-doc.)

In commit ffdb8b167e, I changed things so that lexing scopes no longer
localised the line number, except for here-docs, and the line number
was incremented within the inner lexing scope, instead of during the
initial scan for the terminator.  That meant the herelines value had
to be copied into the inner lexing scope.

For nested here-docs, the inner here-doc’s body is always inside the
outer here-doc, so no peeking into outer scopes is necessary.

Hence, there is no longer any reason for herelines to be inside the
lex_shared struct.  We can put it directly inside the parser struct.
Here-docs will localise it.  Other quote-like constructs will not (and
can avoid the copy.)
parser.h
toke.c