diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-09-07 18:34:24 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-09-07 18:34:37 -0700 |
commit | 851b527ad18524f953bb52604a2b669eb2e68648 (patch) | |
tree | 6a5bddc4ec56f49668e4977d25c7381c433b1efb /parser.h | |
parent | b42366d4c37f0739fb5f9105feb416811057931a (diff) | |
download | perl-851b527ad18524f953bb52604a2b669eb2e68648.tar.gz |
Move herelines out of the lex_shared struct
Previously, the line number was localised in lexing scopes. herelines
had to be in the lex_shared struct so that inner lexing scopes
could peek into values belonging to outer lexing scopes and set the
herelines value belonging to the same scope that a here-doc body was
extracted from. (herelines records how much extra to increase the
line number at the next line ending, to jump over a here-doc.)
In commit ffdb8b167e, I changed things so that lexing scopes no longer
localised the line number, except for here-docs, and the line number
was incremented within the inner lexing scope, instead of during the
initial scan for the terminator. That meant the herelines value had
to be copied into the inner lexing scope.
For nested here-docs, the inner here-doc’s body is always inside the
outer here-doc, so no peeking into outer scopes is necessary.
Hence, there is no longer any reason for herelines to be inside the
lex_shared struct. We can put it directly inside the parser struct.
Here-docs will localise it. Other quote-like constructs will not (and
can avoid the copy.)
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -29,7 +29,6 @@ typedef struct yy_lexshared { 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; typedef struct yy_parser { @@ -123,7 +122,7 @@ typedef struct yy_parser { COP *saved_curcop; /* the previous PL_curcop */ char tokenbuf[256]; - + line_t herelines; /* number of lines in here-doc */ U8 lex_fakeeof; /* precedence at which to fake EOF */ U8 lex_flags; PERL_BITFIELD16 in_pod:1; /* lexer is within a =pod section */ |