* enc/unicode/case-folding.rb, enc/unicode/casefold.h: Flags for

upper/lower conversion added (titlecase and SpecialCasing still missing)
  (with Kimihito Matsui)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
duerst 2016-02-08 12:26:35 +00:00
Родитель 2ca7569c6d
Коммит 73ab88994f
3 изменённых файлов: 2248 добавлений и 2236 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Mon Feb 8 21:26:19 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* enc/unicode/case-folding.rb, enc/unicode/casefold.h: Flags for
upper/lower conversion added (titlecase and SpecialCasing still missing)
(with Kimihito Matsui)
Mon Feb 8 20:43:57 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* string.c, enc/unicode.c: Disassociating ONIGENC_CASE_FOLD flag from

Просмотреть файл

@ -20,7 +20,7 @@ class CaseFolding
def print_table_1(dest, type, mapping_data, data)
for k, v in data = data.sort
sk = (Array === k and k.length > 1) ? "{#{hex_seq(k)}}" : ("0x%04x" % k)
dest.print(" {#{sk}, {#{v.length}#{mapping_data.flags(k, type)}, {#{hex_seq(v)}}}},\n")
dest.print(" {#{sk}, {#{v.length}#{mapping_data.flags(k, type, v)}, {#{hex_seq(v)}}}},\n")
end
data
end
@ -178,6 +178,8 @@ class CaseFolding
end
class MapItem
attr_reader :upper, :lower
def initialize(code, upper, lower, title)
@code = code
@upper = upper unless upper == ''
@ -205,13 +207,17 @@ class CaseMapping
# IO.readlines(File.expand_path('SpecialCasing.txt', mapping_directory))
end
def flags(from, type)
def flags(from, type, to)
# types: CaseFold_11, CaseUnfold_11, CaseUnfold_12, CaseUnfold_13
flags = ""
flags += '|F' if type=='CaseFold_11'
#to = @mappings[from]
#to ? to.flags : ""
from = Array(from).map {|i| "%04X" % i}.join(" ")
to = Array(to).map {|i| "%04X" % i}.join(" ")
item = @mappings[from]
if item
flags += '|U' if to==item.upper
flags += '|D' if to==item.lower
end
flags
end
@ -221,7 +227,7 @@ class CaseMapping
end
class CaseMappingDummy
def flags(from, type)
def flags(from, type, to)
""
end
end

Разница между файлами не показана из-за своего большого размера Загрузить разницу