summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-26 17:59:06 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-26 17:59:06 +0000
commit0ce7a947d5f547d9f81d336aee99c507d94b965c (patch)
treedc6951e6fa1aa8b8848c64f19d3464c7e5aa327c /tool
parent5c2169d4c7af399a6cf50c9d6139191e571229bb (diff)
merge revision(s) 39547: [Backport #7972] [Backport #7974]
* Merge Onigmo 0fe387da2fee089254f6b04990541c731a26757f v5.13.3 [Bug#7972] [Bug#7974] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rwxr-xr-xtool/enc-unicode.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/tool/enc-unicode.rb b/tool/enc-unicode.rb
index 7584f6e030..255d9c5175 100755
--- a/tool/enc-unicode.rb
+++ b/tool/enc-unicode.rb
@@ -225,13 +225,20 @@ def parse_block(data)
blocks << constname
end
+# shim for Ruby 1.8
+unless {}.respond_to?(:key)
+ class Hash
+ alias key index
+ end
+end
+
$const_cache = {}
# make_const(property, pairs, name): Prints a 'static const' structure for a
# given property, group of paired codepoints, and a human-friendly name for
# the group
def make_const(prop, data, name)
puts "\n/* '#{prop}': #{name} */"
- if origprop = $const_cache.index(data) # don't use Hash#key because it is 1.9 feature
+ if origprop = $const_cache.key(data)
puts "#define CR_#{prop} CR_#{origprop}"
else
$const_cache[prop] = data