diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-01-02 22:49:49 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-01-02 22:49:49 +0000 |
commit | 48c4c8631a1d991929e0c3a63face75159cdfddb (patch) | |
tree | 852a7ae5f0e72eb612df2b80951cf2660fdb9b5a /toke.c | |
parent | 01a19ab0a2917aedc73dc22d27746912f8baa335 (diff) | |
download | perl-48c4c8631a1d991929e0c3a63face75159cdfddb.tar.gz |
Change 23727 broke code that relied on \ being escaped.
Fix this. *Everything* should work now.
p4raw-id: //depot/perl@23730
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -2594,9 +2594,22 @@ Perl_yylex(pTHX) else { /* "q\0${splitstr}\0" is legal perl. Yes, even NUL bytes can be used as quoting characters. :-) */ - Perl_sv_catpvf(aTHX_ PL_linestr, - "our @F=split(q%c%s%c);", - 0, PL_splitstr, 0); + /* The count here deliberately includes the NUL + that terminates the C string constant. This + embeds the opening NUL into the string. */ + Perl_sv_catpvn(aTHX_ PL_linestr, + "our @F=split(q", 15); + s = PL_splitstr; + do { + /* Need to \ \s */ + if (*s == '\\') + sv_catpvn(PL_linestr, s, 1); + sv_catpvn(PL_linestr, s, 1); + } while (*s++); + /* This loop will embed the trailing NUL of + PL_linestr as the last thing it does before + terminating. */ + Perl_sv_catpvn(aTHX_ PL_linestr, ");", 2); } } else |