From 583c9d5cccfe6eadf42350e2baa975576a360f02 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Mon, 6 Aug 2012 08:38:28 -0700 Subject: [perl #114040] Parse formats in interpolating constructs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- parser.h | 1 + 1 file changed, 1 insertion(+) (limited to 'parser.h') diff --git a/parser.h b/parser.h index 1d5a7a876b..bfb2480127 100644 --- a/parser.h +++ b/parser.h @@ -80,6 +80,7 @@ typedef struct yy_parser { HV *in_my_stash; /* declared class of this "my" declaration */ PerlIO *rsfp; /* current source file pointer */ AV *rsfp_filters; /* holds chain of active source filters */ + U8 form_lex_state; /* remember lex_state when parsing fmt */ #ifdef PERL_MAD SV *endwhite; -- cgit v1.2.1