* enc/unicode/case-folding.rb, casefold.h: Data generation to implement

swapcase functionality for titlecase characters. Swapcase isn't defined
  by Unicode, because the purpose/usage of swapcase is unclear anyway.
  The implementation follows a proposal from Nobu, swaping the case of
  each component of a titlecase character individually.
  This means that the titlecase characters have to be decomposed.
* enc/unicode.c: Code using the above data.
* test/ruby/enc/test_case_mapping.rb: Tests for the above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
duerst 2016-04-01 11:58:47 +00:00
Родитель 69d6e315b5
Коммит 5e9d33ad49
5 изменённых файлов: 192 добавлений и 150 удалений

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

@ -1,3 +1,16 @@
Fri Apr 1 20:58:33 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* enc/unicode/case-folding.rb, casefold.h: Data generation to implement
swapcase functionality for titlecase characters. Swapcase isn't defined
by Unicode, because the purpose/usage of swapcase is unclear anyway.
The implementation follows a proposal from Nobu, swaping the case of
each component of a titlecase character individually.
This means that the titlecase characters have to be decomposed.
* enc/unicode.c: Code using the above data.
* test/ruby/enc/test_case_mapping.rb: Tests for the above.
Fri Apr 1 14:55:28 2016 Kazuki Yamaguchi <k@rhe.jp>
* configure.in (AC_CONFIG_FILES): $srcdir/.git can be a file pointing

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

@ -139,7 +139,7 @@ code3_equal(const OnigCodePoint *x, const OnigCodePoint *y)
/* macros related to ONIGENC_CASE flags */
/* defined here because not used in other files */
#define ONIGENC_CASE_SPECIALS (ONIGENC_CASE_TITLECASE|ONIGENC_CASE_UP_SPECIAL|ONIGENC_CASE_DOWN_SPECIAL)
#define ONIGENC_CASE_SPECIALS (ONIGENC_CASE_TITLECASE|ONIGENC_CASE_IS_TITLECASE|ONIGENC_CASE_UP_SPECIAL|ONIGENC_CASE_DOWN_SPECIAL)
/* macros for length in CaseMappingSpecials array in enc/unicode/casefold.h */
#define SpecialsLengthOffset 25 /* needs to be higher than the 22 bits used for Unicode codepoints */
@ -715,6 +715,13 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP,
if (flags&OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_SPECIALS) { /* special */
OnigCodePoint *SpecialsStart = CaseMappingSpecials + OnigSpecialIndexDecode(folded->n);
if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_IS_TITLECASE) { /* swapCASE available */
if ((flags&(ONIGENC_CASE_UPCASE|ONIGENC_CASE_DOWNCASE))
== (ONIGENC_CASE_UPCASE|ONIGENC_CASE_DOWNCASE)) /* swapCASE needed */
goto SpecialsCopy;
else /* swapCASE not needed */
SpecialsStart += SpecialsLengthExtract(*SpecialsStart);
}
if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_TITLECASE) { /* Titlecase available */
if (flags&ONIGENC_CASE_TITLECASE) /* Titlecase needed, but not yet Titlecase */
goto SpecialsCopy;

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

@ -244,6 +244,15 @@ class CaseMapping
unless item.upper == item.title
if item.code == item.title
flags += '|IT'
swap = case item.code
when '01C5' then '0064 017D'
when '01C8' then '006C 004A'
when '01CB' then '006E 004A'
when '01F2' then '0064 005A'
else # Greek
to.split(' ').first + ' 0399'
end
specials << swap
else
flags += '|ST'
specials << item.title

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

@ -162,10 +162,10 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x01bc, {1|F|D, {0x01bd}}},
{0x01c4, {1|F|D|ST|I(8), {0x01c6}}},
{0x01c5, {1|F|D|IT|SU|I(9), {0x01c6}}},
{0x01c7, {1|F|D|ST|I(10), {0x01c9}}},
{0x01c8, {1|F|D|IT|SU|I(11), {0x01c9}}},
{0x01ca, {1|F|D|ST|I(12), {0x01cc}}},
{0x01cb, {1|F|D|IT|SU|I(13), {0x01cc}}},
{0x01c7, {1|F|D|ST|I(12), {0x01c9}}},
{0x01c8, {1|F|D|IT|SU|I(13), {0x01c9}}},
{0x01ca, {1|F|D|ST|I(16), {0x01cc}}},
{0x01cb, {1|F|D|IT|SU|I(17), {0x01cc}}},
{0x01cd, {1|F|D, {0x01ce}}},
{0x01cf, {1|F|D, {0x01d0}}},
{0x01d1, {1|F|D, {0x01d2}}},
@ -183,9 +183,9 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x01ea, {1|F|D, {0x01eb}}},
{0x01ec, {1|F|D, {0x01ed}}},
{0x01ee, {1|F|D, {0x01ef}}},
{0x01f0, {2|F|SU|I(14), {0x006a, 0x030c}}},
{0x01f1, {1|F|D|ST|I(16), {0x01f3}}},
{0x01f2, {1|F|D|IT|SU|I(17), {0x01f3}}},
{0x01f0, {2|F|SU|I(20), {0x006a, 0x030c}}},
{0x01f1, {1|F|D|ST|I(22), {0x01f3}}},
{0x01f2, {1|F|D|IT|SU|I(23), {0x01f3}}},
{0x01f4, {1|F|D, {0x01f5}}},
{0x01f6, {1|F|D, {0x0195}}},
{0x01f7, {1|F|D, {0x01bf}}},
@ -232,7 +232,7 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x024a, {1|F|D, {0x024b}}},
{0x024c, {1|F|D, {0x024d}}},
{0x024e, {1|F|D, {0x024f}}},
{0x0345, {1|F|SU|I(18), {0x03b9}}},
{0x0345, {1|F|SU|I(26), {0x03b9}}},
{0x0370, {1|F|D, {0x0371}}},
{0x0372, {1|F|D, {0x0373}}},
{0x0376, {1|F|D, {0x0377}}},
@ -244,7 +244,7 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x038c, {1|F|D, {0x03cc}}},
{0x038e, {1|F|D, {0x03cd}}},
{0x038f, {1|F|D, {0x03ce}}},
{0x0390, {3|F|SU|I(19), {0x03b9, 0x0308, 0x0301}}},
{0x0390, {3|F|SU|I(27), {0x03b9, 0x0308, 0x0301}}},
{0x0391, {1|F|D, {0x03b1}}},
{0x0392, {1|F|D, {0x03b2}}},
{0x0393, {1|F|D, {0x03b3}}},
@ -271,13 +271,13 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x03a9, {1|F|D, {0x03c9}}},
{0x03aa, {1|F|D, {0x03ca}}},
{0x03ab, {1|F|D, {0x03cb}}},
{0x03b0, {3|F|SU|I(22), {0x03c5, 0x0308, 0x0301}}},
{0x03c2, {1|F|SU|I(25), {0x03c3}}},
{0x03b0, {3|F|SU|I(30), {0x03c5, 0x0308, 0x0301}}},
{0x03c2, {1|F|SU|I(33), {0x03c3}}},
{0x03cf, {1|F|D, {0x03d7}}},
{0x03d0, {1|F|SU|I(26), {0x03b2}}},
{0x03d1, {1|F|SU|I(27), {0x03b8}}},
{0x03d5, {1|F|SU|I(28), {0x03c6}}},
{0x03d6, {1|F|SU|I(29), {0x03c0}}},
{0x03d0, {1|F|SU|I(34), {0x03b2}}},
{0x03d1, {1|F|SU|I(35), {0x03b8}}},
{0x03d5, {1|F|SU|I(36), {0x03c6}}},
{0x03d6, {1|F|SU|I(37), {0x03c0}}},
{0x03d8, {1|F|D, {0x03d9}}},
{0x03da, {1|F|D, {0x03db}}},
{0x03dc, {1|F|D, {0x03dd}}},
@ -290,10 +290,10 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x03ea, {1|F|D, {0x03eb}}},
{0x03ec, {1|F|D, {0x03ed}}},
{0x03ee, {1|F|D, {0x03ef}}},
{0x03f0, {1|F|SU|I(30), {0x03ba}}},
{0x03f1, {1|F|SU|I(31), {0x03c1}}},
{0x03f0, {1|F|SU|I(38), {0x03ba}}},
{0x03f1, {1|F|SU|I(39), {0x03c1}}},
{0x03f4, {1|F|D, {0x03b8}}},
{0x03f5, {1|F|SU|I(32), {0x03b5}}},
{0x03f5, {1|F|SU|I(40), {0x03b5}}},
{0x03f7, {1|F|D, {0x03f8}}},
{0x03f9, {1|F|D, {0x03f2}}},
{0x03fa, {1|F|D, {0x03fb}}},
@ -486,7 +486,7 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x0554, {1|F|D, {0x0584}}},
{0x0555, {1|F|D, {0x0585}}},
{0x0556, {1|F|D, {0x0586}}},
{0x0587, {2|F|ST|SU|I(33), {0x0565, 0x0582}}},
{0x0587, {2|F|ST|SU|I(41), {0x0565, 0x0582}}},
{0x10a0, {1|F|D, {0x2d00}}},
{0x10a1, {1|F|D, {0x2d01}}},
{0x10a2, {1|F|D, {0x2d02}}},
@ -608,13 +608,13 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x1e90, {1|F|D, {0x1e91}}},
{0x1e92, {1|F|D, {0x1e93}}},
{0x1e94, {1|F|D, {0x1e95}}},
{0x1e96, {2|F|SU|I(37), {0x0068, 0x0331}}},
{0x1e97, {2|F|SU|I(39), {0x0074, 0x0308}}},
{0x1e98, {2|F|SU|I(41), {0x0077, 0x030a}}},
{0x1e99, {2|F|SU|I(43), {0x0079, 0x030a}}},
{0x1e9a, {2|F|SU|I(45), {0x0061, 0x02be}}},
{0x1e9b, {1|F|SU|I(47), {0x1e61}}},
{0x1e9e, {2|F|SL|I(48), {0x0073, 0x0073}}},
{0x1e96, {2|F|SU|I(45), {0x0068, 0x0331}}},
{0x1e97, {2|F|SU|I(47), {0x0074, 0x0308}}},
{0x1e98, {2|F|SU|I(49), {0x0077, 0x030a}}},
{0x1e99, {2|F|SU|I(51), {0x0079, 0x030a}}},
{0x1e9a, {2|F|SU|I(53), {0x0061, 0x02be}}},
{0x1e9b, {1|F|SU|I(55), {0x1e61}}},
{0x1e9e, {2|F|SL|I(56), {0x0073, 0x0073}}},
{0x1ea0, {1|F|D, {0x1ea1}}},
{0x1ea2, {1|F|D, {0x1ea3}}},
{0x1ea4, {1|F|D, {0x1ea5}}},
@ -699,10 +699,10 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x1f4b, {1|F|D, {0x1f43}}},
{0x1f4c, {1|F|D, {0x1f44}}},
{0x1f4d, {1|F|D, {0x1f45}}},
{0x1f50, {2|F|SU|I(49), {0x03c5, 0x0313}}},
{0x1f52, {3|F|SU|I(51), {0x03c5, 0x0313, 0x0300}}},
{0x1f54, {3|F|SU|I(54), {0x03c5, 0x0313, 0x0301}}},
{0x1f56, {3|F|SU|I(57), {0x03c5, 0x0313, 0x0342}}},
{0x1f50, {2|F|SU|I(57), {0x03c5, 0x0313}}},
{0x1f52, {3|F|SU|I(59), {0x03c5, 0x0313, 0x0300}}},
{0x1f54, {3|F|SU|I(62), {0x03c5, 0x0313, 0x0301}}},
{0x1f56, {3|F|SU|I(65), {0x03c5, 0x0313, 0x0342}}},
{0x1f59, {1|F|D, {0x1f51}}},
{0x1f5b, {1|F|D, {0x1f53}}},
{0x1f5d, {1|F|D, {0x1f55}}},
@ -715,103 +715,103 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x1f6d, {1|F|D, {0x1f65}}},
{0x1f6e, {1|F|D, {0x1f66}}},
{0x1f6f, {1|F|D, {0x1f67}}},
{0x1f80, {2|F|ST|SU|I(60), {0x1f00, 0x03b9}}},
{0x1f81, {2|F|ST|SU|I(63), {0x1f01, 0x03b9}}},
{0x1f82, {2|F|ST|SU|I(66), {0x1f02, 0x03b9}}},
{0x1f83, {2|F|ST|SU|I(69), {0x1f03, 0x03b9}}},
{0x1f84, {2|F|ST|SU|I(72), {0x1f04, 0x03b9}}},
{0x1f85, {2|F|ST|SU|I(75), {0x1f05, 0x03b9}}},
{0x1f86, {2|F|ST|SU|I(78), {0x1f06, 0x03b9}}},
{0x1f87, {2|F|ST|SU|I(81), {0x1f07, 0x03b9}}},
{0x1f88, {2|F|IT|SL|SU|I(84), {0x1f00, 0x03b9}}},
{0x1f89, {2|F|IT|SL|SU|I(87), {0x1f01, 0x03b9}}},
{0x1f8a, {2|F|IT|SL|SU|I(90), {0x1f02, 0x03b9}}},
{0x1f8b, {2|F|IT|SL|SU|I(93), {0x1f03, 0x03b9}}},
{0x1f8c, {2|F|IT|SL|SU|I(96), {0x1f04, 0x03b9}}},
{0x1f8d, {2|F|IT|SL|SU|I(99), {0x1f05, 0x03b9}}},
{0x1f8e, {2|F|IT|SL|SU|I(102), {0x1f06, 0x03b9}}},
{0x1f8f, {2|F|IT|SL|SU|I(105), {0x1f07, 0x03b9}}},
{0x1f90, {2|F|ST|SU|I(108), {0x1f20, 0x03b9}}},
{0x1f91, {2|F|ST|SU|I(111), {0x1f21, 0x03b9}}},
{0x1f92, {2|F|ST|SU|I(114), {0x1f22, 0x03b9}}},
{0x1f93, {2|F|ST|SU|I(117), {0x1f23, 0x03b9}}},
{0x1f94, {2|F|ST|SU|I(120), {0x1f24, 0x03b9}}},
{0x1f95, {2|F|ST|SU|I(123), {0x1f25, 0x03b9}}},
{0x1f96, {2|F|ST|SU|I(126), {0x1f26, 0x03b9}}},
{0x1f97, {2|F|ST|SU|I(129), {0x1f27, 0x03b9}}},
{0x1f98, {2|F|IT|SL|SU|I(132), {0x1f20, 0x03b9}}},
{0x1f99, {2|F|IT|SL|SU|I(135), {0x1f21, 0x03b9}}},
{0x1f9a, {2|F|IT|SL|SU|I(138), {0x1f22, 0x03b9}}},
{0x1f9b, {2|F|IT|SL|SU|I(141), {0x1f23, 0x03b9}}},
{0x1f9c, {2|F|IT|SL|SU|I(144), {0x1f24, 0x03b9}}},
{0x1f9d, {2|F|IT|SL|SU|I(147), {0x1f25, 0x03b9}}},
{0x1f9e, {2|F|IT|SL|SU|I(150), {0x1f26, 0x03b9}}},
{0x1f9f, {2|F|IT|SL|SU|I(153), {0x1f27, 0x03b9}}},
{0x1fa0, {2|F|ST|SU|I(156), {0x1f60, 0x03b9}}},
{0x1fa1, {2|F|ST|SU|I(159), {0x1f61, 0x03b9}}},
{0x1fa2, {2|F|ST|SU|I(162), {0x1f62, 0x03b9}}},
{0x1fa3, {2|F|ST|SU|I(165), {0x1f63, 0x03b9}}},
{0x1fa4, {2|F|ST|SU|I(168), {0x1f64, 0x03b9}}},
{0x1fa5, {2|F|ST|SU|I(171), {0x1f65, 0x03b9}}},
{0x1fa6, {2|F|ST|SU|I(174), {0x1f66, 0x03b9}}},
{0x1fa7, {2|F|ST|SU|I(177), {0x1f67, 0x03b9}}},
{0x1fa8, {2|F|IT|SL|SU|I(180), {0x1f60, 0x03b9}}},
{0x1fa9, {2|F|IT|SL|SU|I(183), {0x1f61, 0x03b9}}},
{0x1faa, {2|F|IT|SL|SU|I(186), {0x1f62, 0x03b9}}},
{0x1fab, {2|F|IT|SL|SU|I(189), {0x1f63, 0x03b9}}},
{0x1fac, {2|F|IT|SL|SU|I(192), {0x1f64, 0x03b9}}},
{0x1fad, {2|F|IT|SL|SU|I(195), {0x1f65, 0x03b9}}},
{0x1fae, {2|F|IT|SL|SU|I(198), {0x1f66, 0x03b9}}},
{0x1faf, {2|F|IT|SL|SU|I(201), {0x1f67, 0x03b9}}},
{0x1fb2, {2|F|ST|SU|I(204), {0x1f70, 0x03b9}}},
{0x1fb3, {2|F|ST|SU|I(208), {0x03b1, 0x03b9}}},
{0x1fb4, {2|F|ST|SU|I(211), {0x03ac, 0x03b9}}},
{0x1fb6, {2|F|SU|I(215), {0x03b1, 0x0342}}},
{0x1fb7, {3|F|ST|SU|I(217), {0x03b1, 0x0342, 0x03b9}}},
{0x1f80, {2|F|ST|SU|I(68), {0x1f00, 0x03b9}}},
{0x1f81, {2|F|ST|SU|I(71), {0x1f01, 0x03b9}}},
{0x1f82, {2|F|ST|SU|I(74), {0x1f02, 0x03b9}}},
{0x1f83, {2|F|ST|SU|I(77), {0x1f03, 0x03b9}}},
{0x1f84, {2|F|ST|SU|I(80), {0x1f04, 0x03b9}}},
{0x1f85, {2|F|ST|SU|I(83), {0x1f05, 0x03b9}}},
{0x1f86, {2|F|ST|SU|I(86), {0x1f06, 0x03b9}}},
{0x1f87, {2|F|ST|SU|I(89), {0x1f07, 0x03b9}}},
{0x1f88, {2|F|IT|SL|SU|I(92), {0x1f00, 0x03b9}}},
{0x1f89, {2|F|IT|SL|SU|I(97), {0x1f01, 0x03b9}}},
{0x1f8a, {2|F|IT|SL|SU|I(102), {0x1f02, 0x03b9}}},
{0x1f8b, {2|F|IT|SL|SU|I(107), {0x1f03, 0x03b9}}},
{0x1f8c, {2|F|IT|SL|SU|I(112), {0x1f04, 0x03b9}}},
{0x1f8d, {2|F|IT|SL|SU|I(117), {0x1f05, 0x03b9}}},
{0x1f8e, {2|F|IT|SL|SU|I(122), {0x1f06, 0x03b9}}},
{0x1f8f, {2|F|IT|SL|SU|I(127), {0x1f07, 0x03b9}}},
{0x1f90, {2|F|ST|SU|I(132), {0x1f20, 0x03b9}}},
{0x1f91, {2|F|ST|SU|I(135), {0x1f21, 0x03b9}}},
{0x1f92, {2|F|ST|SU|I(138), {0x1f22, 0x03b9}}},
{0x1f93, {2|F|ST|SU|I(141), {0x1f23, 0x03b9}}},
{0x1f94, {2|F|ST|SU|I(144), {0x1f24, 0x03b9}}},
{0x1f95, {2|F|ST|SU|I(147), {0x1f25, 0x03b9}}},
{0x1f96, {2|F|ST|SU|I(150), {0x1f26, 0x03b9}}},
{0x1f97, {2|F|ST|SU|I(153), {0x1f27, 0x03b9}}},
{0x1f98, {2|F|IT|SL|SU|I(156), {0x1f20, 0x03b9}}},
{0x1f99, {2|F|IT|SL|SU|I(161), {0x1f21, 0x03b9}}},
{0x1f9a, {2|F|IT|SL|SU|I(166), {0x1f22, 0x03b9}}},
{0x1f9b, {2|F|IT|SL|SU|I(171), {0x1f23, 0x03b9}}},
{0x1f9c, {2|F|IT|SL|SU|I(176), {0x1f24, 0x03b9}}},
{0x1f9d, {2|F|IT|SL|SU|I(181), {0x1f25, 0x03b9}}},
{0x1f9e, {2|F|IT|SL|SU|I(186), {0x1f26, 0x03b9}}},
{0x1f9f, {2|F|IT|SL|SU|I(191), {0x1f27, 0x03b9}}},
{0x1fa0, {2|F|ST|SU|I(196), {0x1f60, 0x03b9}}},
{0x1fa1, {2|F|ST|SU|I(199), {0x1f61, 0x03b9}}},
{0x1fa2, {2|F|ST|SU|I(202), {0x1f62, 0x03b9}}},
{0x1fa3, {2|F|ST|SU|I(205), {0x1f63, 0x03b9}}},
{0x1fa4, {2|F|ST|SU|I(208), {0x1f64, 0x03b9}}},
{0x1fa5, {2|F|ST|SU|I(211), {0x1f65, 0x03b9}}},
{0x1fa6, {2|F|ST|SU|I(214), {0x1f66, 0x03b9}}},
{0x1fa7, {2|F|ST|SU|I(217), {0x1f67, 0x03b9}}},
{0x1fa8, {2|F|IT|SL|SU|I(220), {0x1f60, 0x03b9}}},
{0x1fa9, {2|F|IT|SL|SU|I(225), {0x1f61, 0x03b9}}},
{0x1faa, {2|F|IT|SL|SU|I(230), {0x1f62, 0x03b9}}},
{0x1fab, {2|F|IT|SL|SU|I(235), {0x1f63, 0x03b9}}},
{0x1fac, {2|F|IT|SL|SU|I(240), {0x1f64, 0x03b9}}},
{0x1fad, {2|F|IT|SL|SU|I(245), {0x1f65, 0x03b9}}},
{0x1fae, {2|F|IT|SL|SU|I(250), {0x1f66, 0x03b9}}},
{0x1faf, {2|F|IT|SL|SU|I(255), {0x1f67, 0x03b9}}},
{0x1fb2, {2|F|ST|SU|I(260), {0x1f70, 0x03b9}}},
{0x1fb3, {2|F|ST|SU|I(264), {0x03b1, 0x03b9}}},
{0x1fb4, {2|F|ST|SU|I(267), {0x03ac, 0x03b9}}},
{0x1fb6, {2|F|SU|I(271), {0x03b1, 0x0342}}},
{0x1fb7, {3|F|ST|SU|I(273), {0x03b1, 0x0342, 0x03b9}}},
{0x1fb8, {1|F|D, {0x1fb0}}},
{0x1fb9, {1|F|D, {0x1fb1}}},
{0x1fba, {1|F|D, {0x1f70}}},
{0x1fbb, {1|F|D, {0x1f71}}},
{0x1fbc, {2|F|IT|SL|SU|I(223), {0x03b1, 0x03b9}}},
{0x1fbe, {1|F|SU|I(226), {0x03b9}}},
{0x1fc2, {2|F|ST|SU|I(227), {0x1f74, 0x03b9}}},
{0x1fc3, {2|F|ST|SU|I(231), {0x03b7, 0x03b9}}},
{0x1fc4, {2|F|ST|SU|I(234), {0x03ae, 0x03b9}}},
{0x1fc6, {2|F|SU|I(238), {0x03b7, 0x0342}}},
{0x1fc7, {3|F|ST|SU|I(240), {0x03b7, 0x0342, 0x03b9}}},
{0x1fbc, {2|F|IT|SL|SU|I(279), {0x03b1, 0x03b9}}},
{0x1fbe, {1|F|SU|I(284), {0x03b9}}},
{0x1fc2, {2|F|ST|SU|I(285), {0x1f74, 0x03b9}}},
{0x1fc3, {2|F|ST|SU|I(289), {0x03b7, 0x03b9}}},
{0x1fc4, {2|F|ST|SU|I(292), {0x03ae, 0x03b9}}},
{0x1fc6, {2|F|SU|I(296), {0x03b7, 0x0342}}},
{0x1fc7, {3|F|ST|SU|I(298), {0x03b7, 0x0342, 0x03b9}}},
{0x1fc8, {1|F|D, {0x1f72}}},
{0x1fc9, {1|F|D, {0x1f73}}},
{0x1fca, {1|F|D, {0x1f74}}},
{0x1fcb, {1|F|D, {0x1f75}}},
{0x1fcc, {2|F|IT|SL|SU|I(246), {0x03b7, 0x03b9}}},
{0x1fd2, {3|F|SU|I(249), {0x03b9, 0x0308, 0x0300}}},
{0x1fd3, {3|F|SU|I(252), {0x03b9, 0x0308, 0x0301}}},
{0x1fd6, {2|F|SU|I(255), {0x03b9, 0x0342}}},
{0x1fd7, {3|F|SU|I(257), {0x03b9, 0x0308, 0x0342}}},
{0x1fcc, {2|F|IT|SL|SU|I(304), {0x03b7, 0x03b9}}},
{0x1fd2, {3|F|SU|I(309), {0x03b9, 0x0308, 0x0300}}},
{0x1fd3, {3|F|SU|I(312), {0x03b9, 0x0308, 0x0301}}},
{0x1fd6, {2|F|SU|I(315), {0x03b9, 0x0342}}},
{0x1fd7, {3|F|SU|I(317), {0x03b9, 0x0308, 0x0342}}},
{0x1fd8, {1|F|D, {0x1fd0}}},
{0x1fd9, {1|F|D, {0x1fd1}}},
{0x1fda, {1|F|D, {0x1f76}}},
{0x1fdb, {1|F|D, {0x1f77}}},
{0x1fe2, {3|F|SU|I(260), {0x03c5, 0x0308, 0x0300}}},
{0x1fe3, {3|F|SU|I(263), {0x03c5, 0x0308, 0x0301}}},
{0x1fe4, {2|F|SU|I(266), {0x03c1, 0x0313}}},
{0x1fe6, {2|F|SU|I(268), {0x03c5, 0x0342}}},
{0x1fe7, {3|F|SU|I(270), {0x03c5, 0x0308, 0x0342}}},
{0x1fe2, {3|F|SU|I(320), {0x03c5, 0x0308, 0x0300}}},
{0x1fe3, {3|F|SU|I(323), {0x03c5, 0x0308, 0x0301}}},
{0x1fe4, {2|F|SU|I(326), {0x03c1, 0x0313}}},
{0x1fe6, {2|F|SU|I(328), {0x03c5, 0x0342}}},
{0x1fe7, {3|F|SU|I(330), {0x03c5, 0x0308, 0x0342}}},
{0x1fe8, {1|F|D, {0x1fe0}}},
{0x1fe9, {1|F|D, {0x1fe1}}},
{0x1fea, {1|F|D, {0x1f7a}}},
{0x1feb, {1|F|D, {0x1f7b}}},
{0x1fec, {1|F|D, {0x1fe5}}},
{0x1ff2, {2|F|ST|SU|I(273), {0x1f7c, 0x03b9}}},
{0x1ff3, {2|F|ST|SU|I(277), {0x03c9, 0x03b9}}},
{0x1ff4, {2|F|ST|SU|I(280), {0x03ce, 0x03b9}}},
{0x1ff6, {2|F|SU|I(284), {0x03c9, 0x0342}}},
{0x1ff7, {3|F|ST|SU|I(286), {0x03c9, 0x0342, 0x03b9}}},
{0x1ff2, {2|F|ST|SU|I(333), {0x1f7c, 0x03b9}}},
{0x1ff3, {2|F|ST|SU|I(337), {0x03c9, 0x03b9}}},
{0x1ff4, {2|F|ST|SU|I(340), {0x03ce, 0x03b9}}},
{0x1ff6, {2|F|SU|I(344), {0x03c9, 0x0342}}},
{0x1ff7, {3|F|ST|SU|I(346), {0x03c9, 0x0342, 0x03b9}}},
{0x1ff8, {1|F|D, {0x1f78}}},
{0x1ff9, {1|F|D, {0x1f79}}},
{0x1ffa, {1|F|D, {0x1f7c}}},
{0x1ffb, {1|F|D, {0x1f7d}}},
{0x1ffc, {2|F|IT|SL|SU|I(292), {0x03c9, 0x03b9}}},
{0x1ffc, {2|F|IT|SL|SU|I(352), {0x03c9, 0x03b9}}},
{0x2126, {1|F|D, {0x03c9}}},
{0x212a, {1|F|D, {0x006b}}},
{0x212b, {1|F|D, {0x00e5}}},
@ -1161,18 +1161,18 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0xabbd, {1|F|U, {0x13ed}}},
{0xabbe, {1|F|U, {0x13ee}}},
{0xabbf, {1|F|U, {0x13ef}}},
{0xfb00, {2|F|ST|SU|I(295), {0x0066, 0x0066}}},
{0xfb01, {2|F|ST|SU|I(299), {0x0066, 0x0069}}},
{0xfb02, {2|F|ST|SU|I(303), {0x0066, 0x006c}}},
{0xfb03, {3|F|ST|SU|I(307), {0x0066, 0x0066, 0x0069}}},
{0xfb04, {3|F|ST|SU|I(313), {0x0066, 0x0066, 0x006c}}},
{0xfb05, {2|F|ST|SU|I(319), {0x0073, 0x0074}}},
{0xfb06, {2|F|ST|SU|I(323), {0x0073, 0x0074}}},
{0xfb13, {2|F|ST|SU|I(327), {0x0574, 0x0576}}},
{0xfb14, {2|F|ST|SU|I(331), {0x0574, 0x0565}}},
{0xfb15, {2|F|ST|SU|I(335), {0x0574, 0x056b}}},
{0xfb16, {2|F|ST|SU|I(339), {0x057e, 0x0576}}},
{0xfb17, {2|F|ST|SU|I(343), {0x0574, 0x056d}}},
{0xfb00, {2|F|ST|SU|I(357), {0x0066, 0x0066}}},
{0xfb01, {2|F|ST|SU|I(361), {0x0066, 0x0069}}},
{0xfb02, {2|F|ST|SU|I(365), {0x0066, 0x006c}}},
{0xfb03, {3|F|ST|SU|I(369), {0x0066, 0x0066, 0x0069}}},
{0xfb04, {3|F|ST|SU|I(375), {0x0066, 0x0066, 0x006c}}},
{0xfb05, {2|F|ST|SU|I(381), {0x0073, 0x0074}}},
{0xfb06, {2|F|ST|SU|I(385), {0x0073, 0x0074}}},
{0xfb13, {2|F|ST|SU|I(389), {0x0574, 0x0576}}},
{0xfb14, {2|F|ST|SU|I(393), {0x0574, 0x0565}}},
{0xfb15, {2|F|ST|SU|I(397), {0x0574, 0x056b}}},
{0xfb16, {2|F|ST|SU|I(401), {0x057e, 0x0576}}},
{0xfb17, {2|F|ST|SU|I(405), {0x0574, 0x056d}}},
{0xff21, {1|F|D, {0xff41}}},
{0xff22, {1|F|D, {0xff42}}},
{0xff23, {1|F|D, {0xff43}}},
@ -6252,14 +6252,14 @@ OnigCodePoint CaseMappingSpecials[] = {
L(2)|0x02BC, 0x004E,
L(1)|0x0053,
L(1)|0x01C5,
L(1)|0x01C4,
L(2)|0x0064, 0x017D, L(1)|0x01C4,
L(1)|0x01C8,
L(1)|0x01C7,
L(2)|0x006C, 0x004A, L(1)|0x01C7,
L(1)|0x01CB,
L(1)|0x01CA,
L(2)|0x006E, 0x004A, L(1)|0x01CA,
L(2)|0x004A, 0x030C,
L(1)|0x01F2,
L(1)|0x01F1,
L(2)|0x0064, 0x005A, L(1)|0x01F1,
L(1)|0x0399,
L(3)|0x0399, 0x0308, 0x0301,
L(3)|0x03A5, 0x0308, 0x0301,
@ -6291,14 +6291,14 @@ OnigCodePoint CaseMappingSpecials[] = {
L(1)|0x1F8D, L(2)|0x1F0D, 0x0399,
L(1)|0x1F8E, L(2)|0x1F0E, 0x0399,
L(1)|0x1F8F, L(2)|0x1F0F, 0x0399,
L(1)|0x1F80, L(2)|0x1F08, 0x0399,
L(1)|0x1F81, L(2)|0x1F09, 0x0399,
L(1)|0x1F82, L(2)|0x1F0A, 0x0399,
L(1)|0x1F83, L(2)|0x1F0B, 0x0399,
L(1)|0x1F84, L(2)|0x1F0C, 0x0399,
L(1)|0x1F85, L(2)|0x1F0D, 0x0399,
L(1)|0x1F86, L(2)|0x1F0E, 0x0399,
L(1)|0x1F87, L(2)|0x1F0F, 0x0399,
L(2)|0x1F00, 0x0399, L(1)|0x1F80, L(2)|0x1F08, 0x0399,
L(2)|0x1F01, 0x0399, L(1)|0x1F81, L(2)|0x1F09, 0x0399,
L(2)|0x1F02, 0x0399, L(1)|0x1F82, L(2)|0x1F0A, 0x0399,
L(2)|0x1F03, 0x0399, L(1)|0x1F83, L(2)|0x1F0B, 0x0399,
L(2)|0x1F04, 0x0399, L(1)|0x1F84, L(2)|0x1F0C, 0x0399,
L(2)|0x1F05, 0x0399, L(1)|0x1F85, L(2)|0x1F0D, 0x0399,
L(2)|0x1F06, 0x0399, L(1)|0x1F86, L(2)|0x1F0E, 0x0399,
L(2)|0x1F07, 0x0399, L(1)|0x1F87, L(2)|0x1F0F, 0x0399,
L(1)|0x1F98, L(2)|0x1F28, 0x0399,
L(1)|0x1F99, L(2)|0x1F29, 0x0399,
L(1)|0x1F9A, L(2)|0x1F2A, 0x0399,
@ -6307,14 +6307,14 @@ OnigCodePoint CaseMappingSpecials[] = {
L(1)|0x1F9D, L(2)|0x1F2D, 0x0399,
L(1)|0x1F9E, L(2)|0x1F2E, 0x0399,
L(1)|0x1F9F, L(2)|0x1F2F, 0x0399,
L(1)|0x1F90, L(2)|0x1F28, 0x0399,
L(1)|0x1F91, L(2)|0x1F29, 0x0399,
L(1)|0x1F92, L(2)|0x1F2A, 0x0399,
L(1)|0x1F93, L(2)|0x1F2B, 0x0399,
L(1)|0x1F94, L(2)|0x1F2C, 0x0399,
L(1)|0x1F95, L(2)|0x1F2D, 0x0399,
L(1)|0x1F96, L(2)|0x1F2E, 0x0399,
L(1)|0x1F97, L(2)|0x1F2F, 0x0399,
L(2)|0x1F20, 0x0399, L(1)|0x1F90, L(2)|0x1F28, 0x0399,
L(2)|0x1F21, 0x0399, L(1)|0x1F91, L(2)|0x1F29, 0x0399,
L(2)|0x1F22, 0x0399, L(1)|0x1F92, L(2)|0x1F2A, 0x0399,
L(2)|0x1F23, 0x0399, L(1)|0x1F93, L(2)|0x1F2B, 0x0399,
L(2)|0x1F24, 0x0399, L(1)|0x1F94, L(2)|0x1F2C, 0x0399,
L(2)|0x1F25, 0x0399, L(1)|0x1F95, L(2)|0x1F2D, 0x0399,
L(2)|0x1F26, 0x0399, L(1)|0x1F96, L(2)|0x1F2E, 0x0399,
L(2)|0x1F27, 0x0399, L(1)|0x1F97, L(2)|0x1F2F, 0x0399,
L(1)|0x1FA8, L(2)|0x1F68, 0x0399,
L(1)|0x1FA9, L(2)|0x1F69, 0x0399,
L(1)|0x1FAA, L(2)|0x1F6A, 0x0399,
@ -6323,27 +6323,27 @@ OnigCodePoint CaseMappingSpecials[] = {
L(1)|0x1FAD, L(2)|0x1F6D, 0x0399,
L(1)|0x1FAE, L(2)|0x1F6E, 0x0399,
L(1)|0x1FAF, L(2)|0x1F6F, 0x0399,
L(1)|0x1FA0, L(2)|0x1F68, 0x0399,
L(1)|0x1FA1, L(2)|0x1F69, 0x0399,
L(1)|0x1FA2, L(2)|0x1F6A, 0x0399,
L(1)|0x1FA3, L(2)|0x1F6B, 0x0399,
L(1)|0x1FA4, L(2)|0x1F6C, 0x0399,
L(1)|0x1FA5, L(2)|0x1F6D, 0x0399,
L(1)|0x1FA6, L(2)|0x1F6E, 0x0399,
L(1)|0x1FA7, L(2)|0x1F6F, 0x0399,
L(2)|0x1F60, 0x0399, L(1)|0x1FA0, L(2)|0x1F68, 0x0399,
L(2)|0x1F61, 0x0399, L(1)|0x1FA1, L(2)|0x1F69, 0x0399,
L(2)|0x1F62, 0x0399, L(1)|0x1FA2, L(2)|0x1F6A, 0x0399,
L(2)|0x1F63, 0x0399, L(1)|0x1FA3, L(2)|0x1F6B, 0x0399,
L(2)|0x1F64, 0x0399, L(1)|0x1FA4, L(2)|0x1F6C, 0x0399,
L(2)|0x1F65, 0x0399, L(1)|0x1FA5, L(2)|0x1F6D, 0x0399,
L(2)|0x1F66, 0x0399, L(1)|0x1FA6, L(2)|0x1F6E, 0x0399,
L(2)|0x1F67, 0x0399, L(1)|0x1FA7, L(2)|0x1F6F, 0x0399,
L(2)|0x1FBA, 0x0345, L(2)|0x1FBA, 0x0399,
L(1)|0x1FBC, L(2)|0x0391, 0x0399,
L(2)|0x0386, 0x0345, L(2)|0x0386, 0x0399,
L(2)|0x0391, 0x0342,
L(3)|0x0391, 0x0342, 0x0345, L(3)|0x0391, 0x0342, 0x0399,
L(1)|0x1FB3, L(2)|0x0391, 0x0399,
L(2)|0x03B1, 0x0399, L(1)|0x1FB3, L(2)|0x0391, 0x0399,
L(1)|0x0399,
L(2)|0x1FCA, 0x0345, L(2)|0x1FCA, 0x0399,
L(1)|0x1FCC, L(2)|0x0397, 0x0399,
L(2)|0x0389, 0x0345, L(2)|0x0389, 0x0399,
L(2)|0x0397, 0x0342,
L(3)|0x0397, 0x0342, 0x0345, L(3)|0x0397, 0x0342, 0x0399,
L(1)|0x1FC3, L(2)|0x0397, 0x0399,
L(2)|0x03B7, 0x0399, L(1)|0x1FC3, L(2)|0x0397, 0x0399,
L(3)|0x0399, 0x0308, 0x0300,
L(3)|0x0399, 0x0308, 0x0301,
L(2)|0x0399, 0x0342,
@ -6358,7 +6358,7 @@ OnigCodePoint CaseMappingSpecials[] = {
L(2)|0x038F, 0x0345, L(2)|0x038F, 0x0399,
L(2)|0x03A9, 0x0342,
L(3)|0x03A9, 0x0342, 0x0345, L(3)|0x03A9, 0x0342, 0x0399,
L(1)|0x1FF3, L(2)|0x03A9, 0x0399,
L(2)|0x03C9, 0x0399, L(1)|0x1FF3, L(2)|0x03A9, 0x0399,
L(2)|0x0046, 0x0066, L(2)|0x0046, 0x0046,
L(2)|0x0046, 0x0069, L(2)|0x0046, 0x0049,
L(2)|0x0046, 0x006C, L(2)|0x0046, 0x004C,

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

@ -93,6 +93,19 @@ class TestCaseMappingPreliminary < Test::Unit::TestCase
check_capitalize_properties 'Nj', 'nj', :lithuanian
end
def test_swapcase
assert_equal 'dZ', 'Dz'.swapcase(:lithuanian)
assert_equal 'dŽ', 'Dž'.swapcase(:lithuanian)
assert_equal 'lJ', 'Lj'.swapcase(:lithuanian)
assert_equal 'nJ', 'Nj'.swapcase(:lithuanian)
assert_equal 'ἀΙ', 'ᾈ'.swapcase(:lithuanian)
assert_equal 'ἣΙ', 'ᾛ'.swapcase(:lithuanian)
assert_equal 'ὧΙ', 'ᾯ'.swapcase(:lithuanian)
assert_equal 'αΙ', 'ᾼ'.swapcase(:lithuanian)
assert_equal 'ηΙ', 'ῌ'.swapcase(:lithuanian)
assert_equal 'ωΙ', 'ῼ'.swapcase(:lithuanian)
end
def test_ascii_option
check_downcase_properties 'yukihiro matsumoto (matz)', 'Yukihiro MATSUMOTO (MATZ)', :ascii
check_upcase_properties 'YUKIHIRO MATSUMOTO (MATZ)', 'yukihiro matsumoto (matz)', :ascii