This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Finish fixing here-docs in re-evals
authorFather Chrysostomos <sprout@cpan.org>
Wed, 29 Aug 2012 19:35:49 +0000 (12:35 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 31 Aug 2012 01:18:07 +0000 (18:18 -0700)
commit3328ab5af72319f76fe9be3910a8e07d38b14de2
treef80d9a0a8a93eabee927ac638b230b97ddf11b67
parenta7922135a13574b7c0cd4fa4acc00114f1197ab9
Finish fixing here-docs in re-evals

This commit fixes here-docs in single-line re-evals in files (as
opposed to evals) and here-docs in single-line quote-like operators
inside re-evals.

In both cases, the here-doc parser has to look into an outer
lexing scope to find the here-doc body.  And in both cases it
was stomping on PL_linestr (the current line buffer) while
PL_sublex_info.re_eval_start was pointing to an offset in that buffer.
(re_eval_start is used to construct the string to include in the
regexp’s stringification once the lexer reaches the end of the
re-eval.)

Fixing this entails moving re_eval_start and re_eval_str to
PL_parser->lex_shared, making the pre-localised values visible.
This is so that the code that peeks into an outer linestr buffer to
steal the here-doc body can set up re_eval_str in the right scope.
(re_eval_str is used to store the re-eval text when the here-
oc parser has no choice but to modify linestr; see also commit
db4442662555874019.)

It also entails making the stream-based parser (i.e., that reads from
an input stream) leave PL_linestr alone, instead of clobbering it and
then reconstructing part of it afterwards.
parser.h
perl.h
t/base/lex.t
toke.c