diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-08-06 08:38:28 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-08-06 14:04:03 -0700 |
commit | 583c9d5cccfe6eadf42350e2baa975576a360f02 (patch) | |
tree | 91dc5b7f31dfa5657961e48c06e34383d2a53d03 /t/comp | |
parent | fbfa7c02afa6e3e6975eb25b333402cf754833e3 (diff) | |
download | perl-583c9d5cccfe6eadf42350e2baa975576a360f02.tar.gz |
[perl #114040] Parse formats in interpolating constructs
For re-evals, this is something that broke recently, post-5.16 (the
jumbo fix). For other interpolating constructs, this has never
worked, as far as I can tell.
The lexer was losing track of PL_lex_state (aka PL_parser->lex_state)
when parsing formats. Usually, the state alternates between
LEX_FORMLINE (a picture line) and LEX_NORMAL (an argument line), but
the LEX_NORMAL should actually be whatever the state was before the
format started.
This commit adds a new parser member to track the ‘normal’ state when
parsing a format.
It also tweaks S_scan_formline to handle multi-line buffers outside of
string eval (such as happens in interpolating constructs).
That bufend assignment that is removed as a result is not necessary as
of a0d0e21ea6ea (perl 5.000). That very commit added a bufend assign-
ment after the sv_gets (later filter_gets; later lex_next_chunk) fur-
ther down in the loop in scan_formline.
Diffstat (limited to 't/comp')
-rw-r--r-- | t/comp/parser.t | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t index ac6742e103..8ada9ab720 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..137\n"; +print "1..138\n"; sub failed { my ($got, $expected, $name) = @_; @@ -388,6 +388,15 @@ is $::{waru}, undef, 'sub w attr+proto ignored after compilation error'; is $::{iwa}, undef, 'non-empty sub decl ignored after compilation error'; is *BEGIN{CODE}, undef, 'BEGIN leaves no stub after compilation error'; +$test = $test + 1; +"ok $test - format inside re-eval" =~ /(?{ + format = +@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +$_ +. +write +}).*/; + # Add new tests HERE (above this line) # bug #74022: Loop on characters in \p{OtherIDContinue} |