summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-04 09:46:08 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-04 09:46:08 +0000
commite26348cdd23870d841d356a5a4903540601888f7 (patch)
treecd4ebf2558e6f9404db333e51bf3fce06dc8737d /string.c
parent07a9a501e281f5e067b8809371573ab555d5532a (diff)
* string.c (trnext): support backslash escape in String#tr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/string.c b/string.c
index 2cdcf26651..9ea6942e31 100644
--- a/string.c
+++ b/string.c
@@ -1791,7 +1791,10 @@ trnext(t)
if (!t->gen) {
if (t->p == t->pend) return -1;
t->now = *(USTR)t->p++;
- if (t->p < t->pend - 1 && *t->p == '-') {
+ if (t->p < t->pend - 1 && *t->p == '\\') {
+ t->p++;
+ }
+ else if (t->p < t->pend - 1 && *t->p == '-') {
t->p++;
if (t->p < t->pend) {
if (t->now > *(USTR)t->p) {