diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-07-22 10:37:27 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-07-22 10:37:27 +0000 |
commit | a1530c751e6c484b6217565f3db2b0614735710c (patch) | |
tree | bfb9cae2410306cc39845fa836c44f546034290b /lib/jcode.rb | |
parent | 86307f52ee1b3c5aa76e2fd6ee118e681dd76905 (diff) |
backtrace may be Qnil
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/jcode.rb')
-rw-r--r-- | lib/jcode.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/jcode.rb b/lib/jcode.rb index 1ed82327b8..5b5b80d797 100644 --- a/lib/jcode.rb +++ b/lib/jcode.rb @@ -1,6 +1,6 @@ # jcode.rb - ruby code to handle japanese (EUC/SJIS) string -$vsave, $VERBOSE = $VERBOSE, FALSE +$vsave, $VERBOSE = $VERBOSE, false class String printf STDERR, "feel free for some warnings:\n" if $VERBOSE @@ -58,7 +58,10 @@ class String return nil end + ExpandChCache = {} + def _expand_ch + return ExpandChCache[self] if ExpandChCache.key? self a = [] self.scan(/(.|\n)-(.|\n)|(.|\n)/) do |r| if $3 @@ -71,6 +74,7 @@ class String $1.upto($2) { |c| a.push c } end end + ExpandChCache[self] = a a end @@ -78,7 +82,7 @@ class String return self.delete!(from) if to.length == 0 if from =~ /^\^/ - comp=TRUE + comp=true from = $' end afrom = from._expand_ch @@ -109,7 +113,7 @@ class String def delete!(del) if del =~ /^\^/ - comp=TRUE + comp=true del = $' end adel = del._expand_ch @@ -133,7 +137,7 @@ class String def squeeze!(del=nil) if del if del =~ /^\^/ - comp=TRUE + comp=true del = $' end adel = del._expand_ch @@ -161,7 +165,7 @@ class String def tr_s!(from, to) return self.delete!(from) if to.length == 0 if from =~ /^\^/ - comp=TRUE + comp=true from = $' end afrom = from._expand_ch |