1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* enc/unicode/case-folding.rb, casefold.h: Reading casing data from

SpecialCasing.txt.
  (with Kimihito Matsui)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
duerst 2016-02-23 06:21:55 +00:00
parent 0a0d452588
commit 8aa8847b7c
3 changed files with 97 additions and 80 deletions

View file

@ -1,3 +1,9 @@
Tue Feb 23 15:21:14 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* enc/unicode/case-folding.rb, casefold.h: Reading casing data from
SpecialCasing.txt.
(with Kimihito Matsui)
Mon Feb 22 18:33:55 2016 Martin Duerst <duerst@it.aoyama.ac.jp> Mon Feb 22 18:33:55 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* enc/unicode/case-folding.rb, casefold.h: Adding flag for title-case, * enc/unicode/case-folding.rb, casefold.h: Adding flag for title-case,

View file

@ -187,7 +187,7 @@ class CaseFolding
end end
class MapItem class MapItem
attr_reader :upper, :lower, :title attr_accessor :upper, :lower, :title
def initialize(code, upper, lower, title) def initialize(code, upper, lower, title)
@code = code @code = code
@ -212,7 +212,18 @@ class CaseMapping
end end
end end
# IO.readlines(File.expand_path('SpecialCasing.txt', mapping_directory)) IO.readlines(File.expand_path('SpecialCasing.txt', mapping_directory), encoding: Encoding::ASCII_8BIT).each do |line|
line.chomp!
line, comment = line.split(/ *#/)
next if not line or line == ''
code, lower, title, upper, conditions = line.split(/ *; */)
unless conditions
item = @mappings[code]
item.lower = lower
item.title = title
item.upper = upper
end
end
end end
def flags(from, type, to) def flags(from, type, to)

View file

@ -59,7 +59,7 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x00dc, {1|F|D, {0x00fc}}}, {0x00dc, {1|F|D, {0x00fc}}},
{0x00dd, {1|F|D, {0x00fd}}}, {0x00dd, {1|F|D, {0x00fd}}},
{0x00de, {1|F|D, {0x00fe}}}, {0x00de, {1|F|D, {0x00fe}}},
{0x00df, {2|F, {0x0073, 0x0073}}}, {0x00df, {2|F|T, {0x0073, 0x0073}}},
{0x0100, {1|F|D, {0x0101}}}, {0x0100, {1|F|D, {0x0101}}},
{0x0102, {1|F|D, {0x0103}}}, {0x0102, {1|F|D, {0x0103}}},
{0x0104, {1|F|D, {0x0105}}}, {0x0104, {1|F|D, {0x0105}}},
@ -486,7 +486,7 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x0554, {1|F|D, {0x0584}}}, {0x0554, {1|F|D, {0x0584}}},
{0x0555, {1|F|D, {0x0585}}}, {0x0555, {1|F|D, {0x0585}}},
{0x0556, {1|F|D, {0x0586}}}, {0x0556, {1|F|D, {0x0586}}},
{0x0587, {2|F, {0x0565, 0x0582}}}, {0x0587, {2|F|T, {0x0565, 0x0582}}},
{0x10a0, {1|F|D, {0x2d00}}}, {0x10a0, {1|F|D, {0x2d00}}},
{0x10a1, {1|F|D, {0x2d01}}}, {0x10a1, {1|F|D, {0x2d01}}},
{0x10a2, {1|F|D, {0x2d02}}}, {0x10a2, {1|F|D, {0x2d02}}},
@ -715,75 +715,75 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x1f6d, {1|F|D, {0x1f65}}}, {0x1f6d, {1|F|D, {0x1f65}}},
{0x1f6e, {1|F|D, {0x1f66}}}, {0x1f6e, {1|F|D, {0x1f66}}},
{0x1f6f, {1|F|D, {0x1f67}}}, {0x1f6f, {1|F|D, {0x1f67}}},
{0x1f80, {2|F, {0x1f00, 0x03b9}}}, {0x1f80, {2|F|T, {0x1f00, 0x03b9}}},
{0x1f81, {2|F, {0x1f01, 0x03b9}}}, {0x1f81, {2|F|T, {0x1f01, 0x03b9}}},
{0x1f82, {2|F, {0x1f02, 0x03b9}}}, {0x1f82, {2|F|T, {0x1f02, 0x03b9}}},
{0x1f83, {2|F, {0x1f03, 0x03b9}}}, {0x1f83, {2|F|T, {0x1f03, 0x03b9}}},
{0x1f84, {2|F, {0x1f04, 0x03b9}}}, {0x1f84, {2|F|T, {0x1f04, 0x03b9}}},
{0x1f85, {2|F, {0x1f05, 0x03b9}}}, {0x1f85, {2|F|T, {0x1f05, 0x03b9}}},
{0x1f86, {2|F, {0x1f06, 0x03b9}}}, {0x1f86, {2|F|T, {0x1f06, 0x03b9}}},
{0x1f87, {2|F, {0x1f07, 0x03b9}}}, {0x1f87, {2|F|T, {0x1f07, 0x03b9}}},
{0x1f88, {2|F, {0x1f00, 0x03b9}}}, {0x1f88, {2|F|T, {0x1f00, 0x03b9}}},
{0x1f89, {2|F, {0x1f01, 0x03b9}}}, {0x1f89, {2|F|T, {0x1f01, 0x03b9}}},
{0x1f8a, {2|F, {0x1f02, 0x03b9}}}, {0x1f8a, {2|F|T, {0x1f02, 0x03b9}}},
{0x1f8b, {2|F, {0x1f03, 0x03b9}}}, {0x1f8b, {2|F|T, {0x1f03, 0x03b9}}},
{0x1f8c, {2|F, {0x1f04, 0x03b9}}}, {0x1f8c, {2|F|T, {0x1f04, 0x03b9}}},
{0x1f8d, {2|F, {0x1f05, 0x03b9}}}, {0x1f8d, {2|F|T, {0x1f05, 0x03b9}}},
{0x1f8e, {2|F, {0x1f06, 0x03b9}}}, {0x1f8e, {2|F|T, {0x1f06, 0x03b9}}},
{0x1f8f, {2|F, {0x1f07, 0x03b9}}}, {0x1f8f, {2|F|T, {0x1f07, 0x03b9}}},
{0x1f90, {2|F, {0x1f20, 0x03b9}}}, {0x1f90, {2|F|T, {0x1f20, 0x03b9}}},
{0x1f91, {2|F, {0x1f21, 0x03b9}}}, {0x1f91, {2|F|T, {0x1f21, 0x03b9}}},
{0x1f92, {2|F, {0x1f22, 0x03b9}}}, {0x1f92, {2|F|T, {0x1f22, 0x03b9}}},
{0x1f93, {2|F, {0x1f23, 0x03b9}}}, {0x1f93, {2|F|T, {0x1f23, 0x03b9}}},
{0x1f94, {2|F, {0x1f24, 0x03b9}}}, {0x1f94, {2|F|T, {0x1f24, 0x03b9}}},
{0x1f95, {2|F, {0x1f25, 0x03b9}}}, {0x1f95, {2|F|T, {0x1f25, 0x03b9}}},
{0x1f96, {2|F, {0x1f26, 0x03b9}}}, {0x1f96, {2|F|T, {0x1f26, 0x03b9}}},
{0x1f97, {2|F, {0x1f27, 0x03b9}}}, {0x1f97, {2|F|T, {0x1f27, 0x03b9}}},
{0x1f98, {2|F, {0x1f20, 0x03b9}}}, {0x1f98, {2|F|T, {0x1f20, 0x03b9}}},
{0x1f99, {2|F, {0x1f21, 0x03b9}}}, {0x1f99, {2|F|T, {0x1f21, 0x03b9}}},
{0x1f9a, {2|F, {0x1f22, 0x03b9}}}, {0x1f9a, {2|F|T, {0x1f22, 0x03b9}}},
{0x1f9b, {2|F, {0x1f23, 0x03b9}}}, {0x1f9b, {2|F|T, {0x1f23, 0x03b9}}},
{0x1f9c, {2|F, {0x1f24, 0x03b9}}}, {0x1f9c, {2|F|T, {0x1f24, 0x03b9}}},
{0x1f9d, {2|F, {0x1f25, 0x03b9}}}, {0x1f9d, {2|F|T, {0x1f25, 0x03b9}}},
{0x1f9e, {2|F, {0x1f26, 0x03b9}}}, {0x1f9e, {2|F|T, {0x1f26, 0x03b9}}},
{0x1f9f, {2|F, {0x1f27, 0x03b9}}}, {0x1f9f, {2|F|T, {0x1f27, 0x03b9}}},
{0x1fa0, {2|F, {0x1f60, 0x03b9}}}, {0x1fa0, {2|F|T, {0x1f60, 0x03b9}}},
{0x1fa1, {2|F, {0x1f61, 0x03b9}}}, {0x1fa1, {2|F|T, {0x1f61, 0x03b9}}},
{0x1fa2, {2|F, {0x1f62, 0x03b9}}}, {0x1fa2, {2|F|T, {0x1f62, 0x03b9}}},
{0x1fa3, {2|F, {0x1f63, 0x03b9}}}, {0x1fa3, {2|F|T, {0x1f63, 0x03b9}}},
{0x1fa4, {2|F, {0x1f64, 0x03b9}}}, {0x1fa4, {2|F|T, {0x1f64, 0x03b9}}},
{0x1fa5, {2|F, {0x1f65, 0x03b9}}}, {0x1fa5, {2|F|T, {0x1f65, 0x03b9}}},
{0x1fa6, {2|F, {0x1f66, 0x03b9}}}, {0x1fa6, {2|F|T, {0x1f66, 0x03b9}}},
{0x1fa7, {2|F, {0x1f67, 0x03b9}}}, {0x1fa7, {2|F|T, {0x1f67, 0x03b9}}},
{0x1fa8, {2|F, {0x1f60, 0x03b9}}}, {0x1fa8, {2|F|T, {0x1f60, 0x03b9}}},
{0x1fa9, {2|F, {0x1f61, 0x03b9}}}, {0x1fa9, {2|F|T, {0x1f61, 0x03b9}}},
{0x1faa, {2|F, {0x1f62, 0x03b9}}}, {0x1faa, {2|F|T, {0x1f62, 0x03b9}}},
{0x1fab, {2|F, {0x1f63, 0x03b9}}}, {0x1fab, {2|F|T, {0x1f63, 0x03b9}}},
{0x1fac, {2|F, {0x1f64, 0x03b9}}}, {0x1fac, {2|F|T, {0x1f64, 0x03b9}}},
{0x1fad, {2|F, {0x1f65, 0x03b9}}}, {0x1fad, {2|F|T, {0x1f65, 0x03b9}}},
{0x1fae, {2|F, {0x1f66, 0x03b9}}}, {0x1fae, {2|F|T, {0x1f66, 0x03b9}}},
{0x1faf, {2|F, {0x1f67, 0x03b9}}}, {0x1faf, {2|F|T, {0x1f67, 0x03b9}}},
{0x1fb2, {2|F, {0x1f70, 0x03b9}}}, {0x1fb2, {2|F|T, {0x1f70, 0x03b9}}},
{0x1fb3, {2|F, {0x03b1, 0x03b9}}}, {0x1fb3, {2|F|T, {0x03b1, 0x03b9}}},
{0x1fb4, {2|F, {0x03ac, 0x03b9}}}, {0x1fb4, {2|F|T, {0x03ac, 0x03b9}}},
{0x1fb6, {2|F, {0x03b1, 0x0342}}}, {0x1fb6, {2|F, {0x03b1, 0x0342}}},
{0x1fb7, {3|F, {0x03b1, 0x0342, 0x03b9}}}, {0x1fb7, {3|F|T, {0x03b1, 0x0342, 0x03b9}}},
{0x1fb8, {1|F|D, {0x1fb0}}}, {0x1fb8, {1|F|D, {0x1fb0}}},
{0x1fb9, {1|F|D, {0x1fb1}}}, {0x1fb9, {1|F|D, {0x1fb1}}},
{0x1fba, {1|F|D, {0x1f70}}}, {0x1fba, {1|F|D, {0x1f70}}},
{0x1fbb, {1|F|D, {0x1f71}}}, {0x1fbb, {1|F|D, {0x1f71}}},
{0x1fbc, {2|F, {0x03b1, 0x03b9}}}, {0x1fbc, {2|F|T, {0x03b1, 0x03b9}}},
{0x1fbe, {1|F, {0x03b9}}}, {0x1fbe, {1|F, {0x03b9}}},
{0x1fc2, {2|F, {0x1f74, 0x03b9}}}, {0x1fc2, {2|F|T, {0x1f74, 0x03b9}}},
{0x1fc3, {2|F, {0x03b7, 0x03b9}}}, {0x1fc3, {2|F|T, {0x03b7, 0x03b9}}},
{0x1fc4, {2|F, {0x03ae, 0x03b9}}}, {0x1fc4, {2|F|T, {0x03ae, 0x03b9}}},
{0x1fc6, {2|F, {0x03b7, 0x0342}}}, {0x1fc6, {2|F, {0x03b7, 0x0342}}},
{0x1fc7, {3|F, {0x03b7, 0x0342, 0x03b9}}}, {0x1fc7, {3|F|T, {0x03b7, 0x0342, 0x03b9}}},
{0x1fc8, {1|F|D, {0x1f72}}}, {0x1fc8, {1|F|D, {0x1f72}}},
{0x1fc9, {1|F|D, {0x1f73}}}, {0x1fc9, {1|F|D, {0x1f73}}},
{0x1fca, {1|F|D, {0x1f74}}}, {0x1fca, {1|F|D, {0x1f74}}},
{0x1fcb, {1|F|D, {0x1f75}}}, {0x1fcb, {1|F|D, {0x1f75}}},
{0x1fcc, {2|F, {0x03b7, 0x03b9}}}, {0x1fcc, {2|F|T, {0x03b7, 0x03b9}}},
{0x1fd2, {3|F, {0x03b9, 0x0308, 0x0300}}}, {0x1fd2, {3|F, {0x03b9, 0x0308, 0x0300}}},
{0x1fd3, {3|F, {0x03b9, 0x0308, 0x0301}}}, {0x1fd3, {3|F, {0x03b9, 0x0308, 0x0301}}},
{0x1fd6, {2|F, {0x03b9, 0x0342}}}, {0x1fd6, {2|F, {0x03b9, 0x0342}}},
@ -802,16 +802,16 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x1fea, {1|F|D, {0x1f7a}}}, {0x1fea, {1|F|D, {0x1f7a}}},
{0x1feb, {1|F|D, {0x1f7b}}}, {0x1feb, {1|F|D, {0x1f7b}}},
{0x1fec, {1|F|D, {0x1fe5}}}, {0x1fec, {1|F|D, {0x1fe5}}},
{0x1ff2, {2|F, {0x1f7c, 0x03b9}}}, {0x1ff2, {2|F|T, {0x1f7c, 0x03b9}}},
{0x1ff3, {2|F, {0x03c9, 0x03b9}}}, {0x1ff3, {2|F|T, {0x03c9, 0x03b9}}},
{0x1ff4, {2|F, {0x03ce, 0x03b9}}}, {0x1ff4, {2|F|T, {0x03ce, 0x03b9}}},
{0x1ff6, {2|F, {0x03c9, 0x0342}}}, {0x1ff6, {2|F, {0x03c9, 0x0342}}},
{0x1ff7, {3|F, {0x03c9, 0x0342, 0x03b9}}}, {0x1ff7, {3|F|T, {0x03c9, 0x0342, 0x03b9}}},
{0x1ff8, {1|F|D, {0x1f78}}}, {0x1ff8, {1|F|D, {0x1f78}}},
{0x1ff9, {1|F|D, {0x1f79}}}, {0x1ff9, {1|F|D, {0x1f79}}},
{0x1ffa, {1|F|D, {0x1f7c}}}, {0x1ffa, {1|F|D, {0x1f7c}}},
{0x1ffb, {1|F|D, {0x1f7d}}}, {0x1ffb, {1|F|D, {0x1f7d}}},
{0x1ffc, {2|F, {0x03c9, 0x03b9}}}, {0x1ffc, {2|F|T, {0x03c9, 0x03b9}}},
{0x2126, {1|F|D, {0x03c9}}}, {0x2126, {1|F|D, {0x03c9}}},
{0x212a, {1|F|D, {0x006b}}}, {0x212a, {1|F|D, {0x006b}}},
{0x212b, {1|F|D, {0x00e5}}}, {0x212b, {1|F|D, {0x00e5}}},
@ -1161,18 +1161,18 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0xabbd, {1|F|U, {0x13ed}}}, {0xabbd, {1|F|U, {0x13ed}}},
{0xabbe, {1|F|U, {0x13ee}}}, {0xabbe, {1|F|U, {0x13ee}}},
{0xabbf, {1|F|U, {0x13ef}}}, {0xabbf, {1|F|U, {0x13ef}}},
{0xfb00, {2|F, {0x0066, 0x0066}}}, {0xfb00, {2|F|T, {0x0066, 0x0066}}},
{0xfb01, {2|F, {0x0066, 0x0069}}}, {0xfb01, {2|F|T, {0x0066, 0x0069}}},
{0xfb02, {2|F, {0x0066, 0x006c}}}, {0xfb02, {2|F|T, {0x0066, 0x006c}}},
{0xfb03, {3|F, {0x0066, 0x0066, 0x0069}}}, {0xfb03, {3|F|T, {0x0066, 0x0066, 0x0069}}},
{0xfb04, {3|F, {0x0066, 0x0066, 0x006c}}}, {0xfb04, {3|F|T, {0x0066, 0x0066, 0x006c}}},
{0xfb05, {2|F, {0x0073, 0x0074}}}, {0xfb05, {2|F|T, {0x0073, 0x0074}}},
{0xfb06, {2|F, {0x0073, 0x0074}}}, {0xfb06, {2|F|T, {0x0073, 0x0074}}},
{0xfb13, {2|F, {0x0574, 0x0576}}}, {0xfb13, {2|F|T, {0x0574, 0x0576}}},
{0xfb14, {2|F, {0x0574, 0x0565}}}, {0xfb14, {2|F|T, {0x0574, 0x0565}}},
{0xfb15, {2|F, {0x0574, 0x056b}}}, {0xfb15, {2|F|T, {0x0574, 0x056b}}},
{0xfb16, {2|F, {0x057e, 0x0576}}}, {0xfb16, {2|F|T, {0x057e, 0x0576}}},
{0xfb17, {2|F, {0x0574, 0x056d}}}, {0xfb17, {2|F|T, {0x0574, 0x056d}}},
{0xff21, {1|F|D, {0xff41}}}, {0xff21, {1|F|D, {0xff41}}},
{0xff22, {1|F|D, {0xff42}}}, {0xff22, {1|F|D, {0xff42}}},
{0xff23, {1|F|D, {0xff43}}}, {0xff23, {1|F|D, {0xff43}}},
@ -1324,7 +1324,7 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x118bf, {1|F|D, {0x118df}}}, {0x118bf, {1|F|D, {0x118df}}},
#define CaseFold_Locale (*(CaseFold_11_Type (*)[2])(CaseFold_11_Table+1319)) #define CaseFold_Locale (*(CaseFold_11_Type (*)[2])(CaseFold_11_Table+1319))
{0x0049, {1|F|D, {0x0069}}}, {0x0049, {1|F|D, {0x0069}}},
{0x0130, {2|F, {0x0069, 0x0307}}}, {0x0130, {2|F|D, {0x0069, 0x0307}}},
}; };
/* C code produced by gperf version 3.0.4 */ /* C code produced by gperf version 3.0.4 */