summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-06 03:08:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-06 03:08:25 +0000
commite14440e544be79d857f77dee2598ed98a8a6b59f (patch)
tree792c65a38ee11a4b57d9387ae62b8585f508d58b /tool
parent2b6fa9eb0d9b021bb861b6693eac5307e265108e (diff)
unicode_norm_gen.rb: freeze
* tool/unicode_norm_gen.rb: freeze strings and tables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rw-r--r--tool/unicode_norm_gen.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/tool/unicode_norm_gen.rb b/tool/unicode_norm_gen.rb
index 7fceaefb03..2253b9685a 100644
--- a/tool/unicode_norm_gen.rb
+++ b/tool/unicode_norm_gen.rb
@@ -23,8 +23,8 @@ class Integer
end
class Array
- def line_slice (new_line) # joins items, 16 items per line
- each_slice(16).collect(&:join).join new_line
+ def line_slice(new_line) # joins items, 8 items per line
+ each_slice(8).collect(&:join).join(new_line).gsub(/ +$/, '')
end
def to_UTF8() collect(&:to_UTF8).join end
@@ -53,7 +53,7 @@ end
class Hash
def to_hash_string
collect do |key, value|
- "\"#{key.to_UTF8}\"=>\"#{value.to_UTF8}\", "
+ "\"#{key.to_UTF8}\"=>\"#{value.to_UTF8}\".freeze, "
end.line_slice "\n "
end
end
@@ -143,7 +143,7 @@ open("#{OuputDataDir}/normalize_tables.rb", "w").print <<MAPPING_TABLE_FILE_END
module Normalize
accents = "" \\
"[#{accent_array.to_regexp_chars}]" \\
- ""
+ "".freeze
ACCENTS = accents
REGEXP_D_STRING = "\#{'' # composition starters and composition exclusions
}" \\
@@ -154,7 +154,7 @@ module Normalize
"|\#{'' # precomposed Hangul syllables
}" \\
"[\\u{AC00}-\\u{D7A4}]" \\
- ""
+ "".freeze
REGEXP_C_STRING = "\#{'' # composition exclusions
}" \\
"[#{composition_exclusions.to_regexp_chars}]\#{accents}*" \\
@@ -167,27 +167,27 @@ module Normalize
"|\#{'' # decomposed Hangul syllables
}" \\
"[\\u1100-\\u1112][\\u1161-\\u1175][\\u11A8-\\u11C2]?" \\
- ""
+ "".freeze
REGEXP_K_STRING = "" \\
"[#{kompatible_table.keys.to_regexp_chars}]" \\
- ""
+ "".freeze
class_table = {
#{class_table_str}
}
class_table.default = 0
- CLASS_TABLE = class_table
+ CLASS_TABLE = class_table.freeze
DECOMPOSITION_TABLE = {
#{decomposition_table.to_hash_string}
- }
+ }.freeze
KOMPATIBLE_TABLE = {
#{kompatible_table.to_hash_string}
- }
+ }.freeze
COMPOSITION_TABLE = {
#{composition_table.to_hash_string}
- }
+ }.freeze
end
MAPPING_TABLE_FILE_END