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 /proto.h | |
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 'proto.h')
-rw-r--r-- | proto.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -7497,7 +7497,7 @@ STATIC char* S_scan_pat(pTHX_ char *start, I32 type) #define PERL_ARGS_ASSERT_SCAN_PAT \ assert(start) -STATIC char* S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims, int re_reparse, bool deprecate_escaped_matching) +STATIC char* S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims, int re_reparse, bool deprecate_escaped_matching, char **delimp) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SCAN_STR \ |