From 3328ab5af72319f76fe9be3910a8e07d38b14de2 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Wed, 29 Aug 2012 12:35:49 -0700 Subject: Finish fixing here-docs in re-evals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 2 ++ 1 file changed, 2 insertions(+) (limited to 'parser.h') diff --git a/parser.h b/parser.h index 95083d6e63..97e016d10c 100644 --- a/parser.h +++ b/parser.h @@ -27,6 +27,8 @@ typedef struct yy_lexshared { struct yy_lexshared *ls_prev; SV *ls_linestr; /* mirrors PL_parser->linestr */ char *ls_bufptr; /* mirrors PL_parser->bufptr */ + char *re_eval_start; /* start of "(?{..." text */ + SV *re_eval_str; /* "(?{...})" text */ line_t herelines; /* number of lines in here-doc */ } LEXSHARED; -- cgit v1.2.1