S_scan_heredoc(pTHX_ register char *s)
{
dVAR;
- SV *herewas;
I32 op_type = OP_SCALAR;
I32 len;
SV *tmpstr;
char term;
- const char *found_newline = 0;
+ char *found_newline = 0;
char *d;
char *e;
char *peek;
s = olds;
}
#endif
- if ((infile && !PL_lex_inwhat)
- || !(found_newline = (char*)memchr((void*)s, '\n', PL_bufend - s))) {
- herewas = newSVpvn(s,PL_bufend-s);
- }
- else {
-#ifdef PERL_MAD
- herewas = newSVpvn(s-1,found_newline-s+1);
-#else
- s--;
- herewas = newSVpvn(s,found_newline-s);
-#endif
+ if (!infile || PL_lex_inwhat) {
+ found_newline = (char*)memchr((void*)s, '\n', PL_bufend - s);
}
#ifdef PERL_MAD
if (PL_madskills) {
PL_thisstuff = newSVpvn(tstart, s - tstart);
}
#endif
- s += SvCUR(herewas);
#ifdef PERL_MAD
stuffstart = s - SvPVX(PL_linestr);
-
- if (found_newline)
- s--;
#endif
tmpstr = newSV_type(SVt_PVIV);
*/
SV *linestr;
char *bufptr, *bufend;
- char * const olds = s - SvCUR(herewas);
- char * const real_olds = s;
+ char * const olds = s;
PERL_CONTEXT * const cx = &cxstack[cxstack_ix];
do {
shared = shared->ls_prev;
most lexing scope. In a file, shared->ls_linestr at that
level is just one line, so there is no body to steal. */
if (infile && !shared->ls_prev) {
- s = real_olds;
+ s = olds;
goto streaming;
}
} while (!(s = (char *)memchr(
SvCUR(linestr) - (s-d));
s = olds;
- goto retval;
}
else if (!infile || found_newline) {
- char * const olds = s - SvCUR(herewas);
+ char * const olds = s;
PERL_CONTEXT * const cx = &cxstack[cxstack_ix];
- d = s;
+ d = s = found_newline ? found_newline : PL_bufend;
while (s < PL_bufend &&
(*s != '\n' || memNE(s,PL_tokenbuf,len)) ) {
if (*s++ == '\n')
term = PL_tokenbuf[1];
len--;
linestr_save = PL_linestr; /* must restore this afterwards */
- d = s - SvCUR(herewas) - 1; /* s gets set to this afterwards */
+ d = s; /* and this */
PL_linestr = newSVpvs("");
- PL_bufptr = PL_bufend = s = SvPVX(PL_linestr);
- while (s >= PL_bufend) { /* multiple line string? */
+ PL_bufend = SvPVX(PL_linestr);
+ while (1) {
#ifdef PERL_MAD
if (PL_madskills) {
tstart = SvPVX(PL_linestr) + stuffstart;
PL_thisstuff = newSVpvn(tstart, PL_bufend - tstart);
}
#endif
- PL_bufptr = s;
+ PL_bufptr = PL_bufend;
CopLINE_set(PL_curcop,
PL_multi_start + shared->herelines);
if (!lex_next_chunk(LEX_NO_TERM)
PL_linestart = SvPVX(linestr_save);
PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
s = d;
+ break;
}
else {
- s = PL_bufend;
sv_catsv(tmpstr,PL_linestr);
}
}
}
- s++;
-retval:
PL_multi_end = CopLINE(PL_curcop);
if (SvCUR(tmpstr) + 5 < SvLEN(tmpstr)) {
SvPV_shrink_to_cur(tmpstr);
}
- SvREFCNT_dec(herewas);
if (!IN_BYTES) {
if (UTF && is_utf8_string((U8*)SvPVX_const(tmpstr), SvCUR(tmpstr)))
SvUTF8_on(tmpstr);
return s;
interminable:
- SvREFCNT_dec(herewas);
SvREFCNT_dec(tmpstr);
CopLINE_set(PL_curcop, (line_t)PL_multi_start - 1);
missingterm(PL_tokenbuf + 1);