diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-11-14 14:29:51 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-11-14 14:29:51 -0800 |
commit | e68dd03a55114f7eaedbb2b0871e0facb8e91549 (patch) | |
tree | a1e6fce8ee779aa32036734b924d33d7a0c716b3 /embed.fnc | |
parent | 58534900c38f976129529850bd5168d61c39a495 (diff) | |
download | perl-e68dd03a55114f7eaedbb2b0871e0facb8e91549.tar.gz |
[perl #120463] s/// and tr/// with wide delimiters
$ perl -Mutf8 -e 's αaαα'
Substitution replacement not terminated at -e line 1.
What is happening is that the first scan goes past the delimiter at
the end of the pattern. Then a single byte is compared (the previous
character against the first byte of the opening delimiter) to see
whether the parser needs to step back one byte before scanning the
second part.
That means you can do the equivalent of s/foo/|bar|g if / is replaced
with a wide character:
$ perl -l -Mutf8 -e '$_ = "a"; s αaα|b|; print'
b
This commit fixes it by giving toke.c:S_scan_str an extra parameter,
so it can tell the callers that need this (scan_subst and scan_trans)
where to start scanning the replacement.
Diffstat (limited to 'embed.fnc')
-rw-r--r-- | embed.fnc | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -2270,7 +2270,8 @@ sR |char* |scan_inputsymbol|NN char *start sR |char* |scan_pat |NN char *start|I32 type sR |char* |scan_str |NN char *start|int keep_quoted \ |int keep_delims|int re_reparse \ - |bool deprecate_escaped_matching + |bool deprecate_escaped_matching \ + |NULLOK char **delimp sR |char* |scan_subst |NN char *start sR |char* |scan_trans |NN char *start s |char* |scan_word |NN char *s|NN char *dest|STRLEN destlen \ |