summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2010-01-05 22:57:36 +0100
committerRafael Garcia-Suarez <rgs@consttype.org>2010-01-05 22:57:36 +0100
commitf09989092a6586d2bb4173c4c08882afef55b70f (patch)
treeee04b1b0b6f6fa406e29b708df04b95195cb857a /toke.c
parent2b63e250843b907e476587f037c0784d701fca62 (diff)
downloadperl-f09989092a6586d2bb4173c4c08882afef55b70f.tar.gz
[perl #71748] Bleadperl f0e67a1 breaks CPAN: Template::Plugin::YAML::Encode 0.02
Unsurprisingly, the nature of the bug is that I accidentally changed the logic of one of the several types of space skipping. Fix attached.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/toke.c b/toke.c
index 49509587bd..13984390c7 100644
--- a/toke.c
+++ b/toke.c
@@ -1401,12 +1401,14 @@ chunk will not be discarded.
=cut
*/
+#define LEX_NO_NEXT_CHUNK 0x80000000
+
void
Perl_lex_read_space(pTHX_ U32 flags)
{
char *s, *bufend;
bool need_incline = 0;
- if (flags & ~(LEX_KEEP_PREVIOUS))
+ if (flags & ~(LEX_KEEP_PREVIOUS|LEX_NO_NEXT_CHUNK))
Perl_croak(aTHX_ "Lexing code internal error (%s)", "lex_read_space");
#ifdef PERL_MAD
if (PL_skipwhite) {
@@ -1439,6 +1441,8 @@ Perl_lex_read_space(pTHX_ U32 flags)
if (PL_madskills)
sv_catpvn(PL_skipwhite, PL_parser->bufptr, s-PL_parser->bufptr);
#endif /* PERL_MAD */
+ if (flags & LEX_NO_NEXT_CHUNK)
+ break;
PL_parser->bufptr = s;
CopLINE_inc(PL_curcop);
got_more = lex_next_chunk(flags);
@@ -1714,20 +1718,12 @@ S_skipspace(pTHX_ register char *s)
if (PL_lex_formbrack && PL_lex_brackets <= PL_lex_formbrack) {
while (s < PL_bufend && SPACE_OR_TAB(*s))
s++;
- } else if (PL_sublex_info.sub_inwhat || PL_lex_state == LEX_FORMLINE) {
- while (isSPACE(*s) && *s != '\n')
- s++;
- if (*s == '#') {
- do {
- s++;
- } while (s != PL_bufend && *s != '\n');
- }
- if (*s == '\n')
- s++;
} else {
STRLEN bufptr_pos = PL_bufptr - SvPVX(PL_linestr);
PL_bufptr = s;
- lex_read_space(LEX_KEEP_PREVIOUS);
+ lex_read_space(LEX_KEEP_PREVIOUS |
+ (PL_sublex_info.sub_inwhat || PL_lex_state == LEX_FORMLINE ?
+ LEX_NO_NEXT_CHUNK : 0));
s = PL_bufptr;
PL_bufptr = SvPVX(PL_linestr) + bufptr_pos;
if (PL_linestart > PL_bufptr)