tool/unicode_norm_gen.tmpl, lib/unicode_normalize/tables.rb:

get rid of many .freeze commands by using frozen_string_literal
pragma.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
duerst 2015-09-29 07:54:05 +00:00
parent ed8b452e37
commit 1fb502caca
3 changed files with 857 additions and 857 deletions

View File

@ -1,3 +1,9 @@
Tue Sep 29 16:53:53 2015 Martin Duerst <duerst@it.aoyama.ac.jp>
* tool/unicode_norm_gen.tmpl, lib/unicode_normalize/tables.rb:
get rid of many .freeze commands by using frozen_string_literal
pragma.
Tue Sep 29 16:37:29 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> Tue Sep 29 16:37:29 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* compile.c (compile_dstr_fragments): fix performance by omitting * compile.c (compile_dstr_fragments): fix performance by omitting

File diff suppressed because it is too large Load Diff

View File

@ -152,17 +152,17 @@ end
# generate normalization tables file # generate normalization tables file
%># coding: us-ascii %># coding: us-ascii
# -*- frozen_string_literal: true
%# > %# >
# automatically generated by template/unicode_norm_gen.tmpl # automatically generated by template/unicode_norm_gen.tmpl
module UnicodeNormalize module UnicodeNormalize
UNICODE_VERSION = "<%=unicode_version%>".freeze UNICODE_VERSION = "<%=unicode_version%>"
accents = "" \ accents = "" \
"[<% accent_array.each_regexp_chars do |rx|%><%=rx%>" \ "[<% accent_array.each_regexp_chars do |rx|%><%=rx%>" \
"<% end%>]" \ "<% end%>]"
"".freeze
ACCENTS = accents ACCENTS = accents
REGEXP_D_STRING = "#{'' # composition starters and composition exclusions REGEXP_D_STRING = "#{'' # composition starters and composition exclusions
}" \ }" \
@ -174,8 +174,7 @@ module UnicodeNormalize
"<% end%>]?#{accents}+" \ "<% end%>]?#{accents}+" \
"|#{'' # precomposed Hangul syllables "|#{'' # precomposed Hangul syllables
}" \ }" \
"[\u{AC00}-\u{D7A4}]" \ "[\u{AC00}-\u{D7A4}]"
"".freeze
REGEXP_C_STRING = "#{'' # composition exclusions REGEXP_C_STRING = "#{'' # composition exclusions
}" \ }" \
"[<% composition_exclusions.each_regexp_chars do |rx|%><%=rx%>" \ "[<% composition_exclusions.each_regexp_chars do |rx|%><%=rx%>" \
@ -190,12 +189,10 @@ module UnicodeNormalize
"<% end%>][\u11A8-\u11C2]" \ "<% end%>][\u11A8-\u11C2]" \
"|#{'' # decomposed Hangul syllables "|#{'' # decomposed Hangul syllables
}" \ }" \
"[\u1100-\u1112][\u1161-\u1175][\u11A8-\u11C2]?" \ "[\u1100-\u1112][\u1161-\u1175][\u11A8-\u11C2]?"
"".freeze
REGEXP_K_STRING = "" \ REGEXP_K_STRING = "" \
"[<% kompatible_table.keys.each_regexp_chars do |rx|%><%=rx%>" \ "[<% kompatible_table.keys.each_regexp_chars do |rx|%><%=rx%>" \
"<%end%>]" \ "<%end%>]"
"".freeze
class_table = { class_table = {
% combining_class.each_slice(8) do |slice| % combining_class.each_slice(8) do |slice|
@ -207,19 +204,19 @@ module UnicodeNormalize
DECOMPOSITION_TABLE = { DECOMPOSITION_TABLE = {
% decomposition_table.each_slice(8) do |slice| % decomposition_table.each_slice(8) do |slice|
<% slice.each do |key, value|%> "<%=key.to_UTF8%>"=>"<%=value.to_UTF8%>".freeze<%=%>,<% end%> <% slice.each do |key, value|%> "<%=key.to_UTF8%>"=>"<%=value.to_UTF8%>"<%=%>,<% end%>
% end % end
}.freeze }.freeze
KOMPATIBLE_TABLE = { KOMPATIBLE_TABLE = {
% kompatible_table.each_slice(8) do |slice| % kompatible_table.each_slice(8) do |slice|
<% slice.each do |key, value|%> "<%=key.to_UTF8%>"=>"<%=value.to_UTF8%>".freeze<%=%>,<% end%> <% slice.each do |key, value|%> "<%=key.to_UTF8%>"=>"<%=value.to_UTF8%>"<%=%>,<% end%>
% end % end
}.freeze }.freeze
COMPOSITION_TABLE = { COMPOSITION_TABLE = {
% composition_table.each_slice(8) do |slice| % composition_table.each_slice(8) do |slice|
<% slice.each do |key, value|%> "<%=key.to_UTF8%>"=>"<%=value.to_UTF8%>".freeze<%=%>,<% end%> <% slice.each do |key, value|%> "<%=key.to_UTF8%>"=>"<%=value.to_UTF8%>"<%=%>,<% end%>
% end % end
}.freeze }.freeze
end end