}
int dd_toke_scan_str(pTHX_ int offset) {
+ int remaining = sv_len(PL_linestr) - offset;
+ SV* line_copy = newSVsv(PL_linestr);
char* base_s = SvPVX(PL_linestr) + offset;
char* s = scan_str(base_s, FALSE, FALSE);
+ if (s != base_s && sv_len(PL_lex_stuff) > remaining) {
+ int ret = (s - SvPVX(PL_linestr)) + remaining;
+ sv_catsv(line_copy, PL_linestr);
+ dd_set_linestr(aTHX_ SvPV_nolen(line_copy));
+ SvREFCNT_dec(line_copy);
+ return ret;
+ }
return s - base_s;
}
my $length = Devel::Declare::toke_scan_str($self->offset);
my $proto = Devel::Declare::get_lex_stuff();
Devel::Declare::clear_lex_stuff();
- if( $length < 0 ) {
- # Need to scan ahead more
- $linestr .= $self->get_linestr();
- $length = rindex($linestr, ")") - $self->offset + 1;
- }
- else {
- $linestr = $self->get_linestr();
- }
+ $linestr = $self->get_linestr();
substr($linestr, $self->offset, $length) = '';
$self->set_linestr($linestr);