summaryrefslogtreecommitdiff
path: root/tool/enc-unicode.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-10 22:54:01 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-10 22:54:01 +0000
commitee4b59a4191ecabc1a9d396e234f20be5e5e9f8c (patch)
treec365ce9fa86e8f507df68c5c616066e7fdea8d02 /tool/enc-unicode.rb
parente519c9d960549163c17571689cc977f7ca45073e (diff)
* unicode.c (onigenc_unicode_property_name_to_ctype):
ignore case of properties. * tool/enc-unicode.rb: downcase properties list. * enc/unicode/name2ctype.h, enc/unicode/name2ctype.h.blt, enc/unicode/name2ctype.kwd, enc/unicode/name2ctype.src: follow above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/enc-unicode.rb')
-rwxr-xr-xtool/enc-unicode.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/tool/enc-unicode.rb b/tool/enc-unicode.rb
index b9f19c9..8429bcc 100755
--- a/tool/enc-unicode.rb
+++ b/tool/enc-unicode.rb
@@ -176,6 +176,12 @@ def make_const(prop, pairs, name)
puts "}; /* CR_#{prop} */"
end
+def normalize_propname(name)
+ name = name.downcase
+ name.gsub!(/[- _]/, '')
+ name
+end
+
puts '%{'
gcps, data = parse_unicode_data(ARGV[0])
POSIX_NAMES.each do |name|
@@ -213,10 +219,10 @@ struct uniname2ctype_struct;
%%
__HEREDOC
i = -1
-POSIX_NAMES.each {|name|puts"%-21s %3d"%[name+',', i+=1]}
+POSIX_NAMES.each {|name|puts"%-21s %3d" % [normalize_propname(name)+',', i+=1]}
puts "#ifdef USE_UNICODE_PROPERTIES"
-gcps.each{|name|puts"%-21s %3d"%[name+',', i+=1]}
-scripts.each{|name|puts"%-21s %3d"%[name+',', i+=1]}
+gcps.each{|name|puts"%-21s %3d" % [normalize_propname(name)+',', i+=1]}
+scripts.each{|name|puts"%-21s %3d" % [normalize_propname(name)+',', i+=1]}
puts "#endif /* USE_UNICODE_PROPERTIES */\n"
puts(<<'__HEREDOC')
%%