diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-08-28 01:11:30 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-08-28 01:13:17 -0700 |
commit | 60f40a389519ab4482a60df44e5e9a03c8710752 (patch) | |
tree | 3655689f6491d244b0fa3b5aa0806206490e5fef /parser.h | |
parent | 473015163cb5f5f4cc6ef07c71f34b9d6c8608f1 (diff) | |
download | perl-60f40a389519ab4482a60df44e5e9a03c8710752.tar.gz |
Use PL_parser->lex_shared instead of Sv[IN]VX(PL_linestr)
Unfortunately, PL_parser->linestr and PL_parser->bufptr are both
part of the API, so we can’t just move them to PL_parser->lex_shared.
Instead, we have to copy them in sublex_push, to make them visible to
inner lexing scopes.
This allows the SvIVX(PL_linestr) and SvNVX(PL_linestr) hack to
be removed.
It should also speed things up slightly. We are already allocating
PL_parser->lex_shared in sublex_push, so there should be no need to
upgrade PL_linestr to SvNVX as well.
I was pleasantly surprised to see how the here-doc code seemed to
shrink all by itself when modified to account.
PL_sublex_info.super_bufptr is also superseded by the addition of
->ls_bufptr to the LEXSHARED struct. Its old values when localised
were not visible, being stashed away on the savestack, so it was
harder to use.
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -25,6 +25,8 @@ typedef struct { ing scopes. */ typedef struct yy_lexshared { struct yy_lexshared *ls_prev; + SV *ls_linestr; /* mirrors PL_parser->linestr */ + char *ls_bufptr; /* mirrors PL_parser->bufptr */ line_t herelines; /* number of lines in here-doc */ } LEXSHARED; |