summaryrefslogtreecommitdiff
path: root/parser.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-29 12:35:49 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-30 18:18:07 -0700
commit3328ab5af72319f76fe9be3910a8e07d38b14de2 (patch)
treef80d9a0a8a93eabee927ac638b230b97ddf11b67 /parser.h
parenta7922135a13574b7c0cd4fa4acc00114f1197ab9 (diff)
downloadperl-3328ab5af72319f76fe9be3910a8e07d38b14de2.tar.gz
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.
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h2
1 files changed, 2 insertions, 0 deletions
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;