#define COPLINE_INC_WITH_HERELINES \
STMT_START { \
CopLINE_inc(PL_curcop); \
- if (PL_parser->lex_shared->herelines) \
- CopLINE(PL_curcop) += PL_parser->lex_shared->herelines, \
- PL_parser->lex_shared->herelines = 0; \
+ if (PL_parser->herelines) \
+ CopLINE(PL_curcop) += PL_parser->herelines, \
+ PL_parser->herelines = 0; \
} STMT_END
/* Called after scan_str to update CopLINE(PL_curcop), but only when there
* is no sublex_push to follow. */
STMT_START { \
CopLINE_set(PL_curcop, PL_multi_end); \
if (PL_multi_end != PL_multi_start) \
- PL_parser->lex_shared->herelines = 0; \
+ PL_parser->herelines = 0; \
} STMT_END
break;
PL_parser->bufptr = s;
l = CopLINE(PL_curcop);
- CopLINE(PL_curcop) += PL_parser->lex_shared->herelines + 1;
+ CopLINE(PL_curcop) += PL_parser->herelines + 1;
got_more = lex_next_chunk(flags);
CopLINE_set(PL_curcop, l);
s = PL_parser->bufptr;
{
SAVECOPLINE(PL_curcop);
SAVEI32(PL_multi_end);
+ SAVEI32(PL_parser->herelines);
+ PL_parser->herelines = 0;
}
SAVEI8(PL_multi_close);
SAVEPPTR(PL_bufptr);
Newxz(shared, 1, LEXSHARED);
shared->ls_prev = PL_parser->lex_shared;
PL_parser->lex_shared = shared;
- if (!is_heredoc && PL_multi_start != PL_multi_end) {
- shared->herelines = shared->ls_prev->herelines;
- shared->ls_prev->herelines = 0;
- }
PL_lex_inwhat = PL_sublex_info.sub_inwhat;
if (PL_lex_inwhat == OP_TRANSR) PL_lex_inwhat = OP_TRANS;
if (SvTYPE(PL_linestr) >= SVt_PVNV) {
CopLINE(PL_curcop) +=
((XPVNV*)SvANY(PL_linestr))->xnv_u.xpad_cop_seq.xlow
- + PL_parser->lex_shared->herelines;
- PL_parser->lex_shared->herelines = 0;
+ + PL_parser->herelines;
+ PL_parser->herelines = 0;
}
return ',';
}
#endif
LEAVE;
if (PL_multi_close == '<')
- PL_parser->lex_shared->herelines += l - PL_multi_end;
+ PL_parser->herelines += l - PL_multi_end;
PL_bufend = SvPVX(PL_linestr);
PL_bufend += SvCUR(PL_linestr);
PL_expect = XOPERATOR;
SvIV_set(tmpstr, '\\');
}
- PL_multi_start = origline + 1;
+ PL_multi_start = origline + 1 + PL_parser->herelines;
PL_multi_open = PL_multi_close = '<';
/* inside a string eval or quote-like operator */
if (!infile || PL_lex_inwhat) {
s = (char*)memchr((void*)s, '\n', PL_bufend - s);
assert(s);
}
- PL_multi_start += shared->herelines;
linestr = shared->ls_linestr;
bufend = SvEND(linestr);
d = s;
while (s < bufend - len + 1 &&
memNE(s,PL_tokenbuf,len) ) {
if (*s++ == '\n')
- ++shared->herelines;
+ ++PL_parser->herelines;
}
if (s >= bufend - len + 1) {
goto interminable;
#endif
s += len - 1;
/* the preceding stmt passes a newline */
- shared->herelines++;
+ PL_parser->herelines++;
/* s now points to the newline after the heredoc terminator.
d points to the newline before the body of the heredoc.
{
SV *linestr_save;
streaming:
- PL_multi_start += shared->herelines;
sv_setpvs(tmpstr,""); /* avoid "uninitialized" warning */
term = PL_tokenbuf[1];
len--;
#endif
PL_bufptr = PL_bufend;
CopLINE_set(PL_curcop,
- origline + 1 + shared->herelines);
+ origline + 1 + PL_parser->herelines);
if (!lex_next_chunk(LEX_NO_TERM)
&& (!SvCUR(tmpstr) || SvEND(tmpstr)[-1] != '\n')) {
SvREFCNT_dec(linestr_save);
#ifdef PERL_MAD
stuffstart = s - SvPVX(PL_linestr);
#endif
- shared->herelines++;
+ PL_parser->herelines++;
PL_last_lop = PL_last_uni = NULL;
#ifndef PERL_STRICT_CR
if (PL_bufend - PL_linestart >= 2) {
}
}
}
- PL_multi_end = origline + shared->herelines;
+ PL_multi_end = origline + PL_parser->herelines;
if (SvCUR(tmpstr) + 5 < SvLEN(tmpstr)) {
SvPV_shrink_to_cur(tmpstr);
}
/* mark where we are */
PL_multi_start = CopLINE(PL_curcop);
PL_multi_open = term;
- herelines = PL_parser->lex_shared->herelines;
+ herelines = PL_parser->herelines;
/* find corresponding closing delimiter */
if (term && (tmps = strchr("([{< )]}> )]}>",term)))
PL_multi_end = CopLINE(PL_curcop);
CopLINE_set(PL_curcop, PL_multi_start);
- PL_parser->lex_shared->herelines = herelines;
+ PL_parser->herelines = herelines;
/* if we allocated too much space, give some back */
if (SvCUR(sv) + 5 < SvLEN(sv)) {