summaryrefslogtreecommitdiff
path: root/enc/unicode
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-22 12:08:30 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-22 12:08:30 +0000
commit2f455ceca40dcddb0f92c2918796673187cd8ed4 (patch)
tree6e31d87870fbcc51b37b3fab3d9d20aed504ea74 /enc/unicode
parentbf99f859419437c9f5826ada08cd7cdca03c7d7f (diff)
* include/ruby/oniguruma.h: Additional flag for characters that are titlecase.
* enc/unicode/case-folding.rb, casefold.h: Using above flag in data. * enc/unicode.c: Marking capitalized character as unmodified if it is already titlecase. * test/ruby/enc/test_case_mapping.rb: Tests for above functionality. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc/unicode')
-rwxr-xr-xenc/unicode/case-folding.rb12
-rw-r--r--enc/unicode/casefold.h62
2 files changed, 39 insertions, 35 deletions
diff --git a/enc/unicode/case-folding.rb b/enc/unicode/case-folding.rb
index d309dd6..00258cd 100755
--- a/enc/unicode/case-folding.rb
+++ b/enc/unicode/case-folding.rb
@@ -190,7 +190,7 @@ class CaseFolding
end
class MapItem
- attr_accessor :upper, :lower, :title
+ attr_accessor :upper, :lower, :title, :code
def initialize(code, upper, lower, title)
@code = code
@@ -242,15 +242,19 @@ class CaseMapping
specials = []
unless item.upper == item.title
specials << item.title
- flags += "|ST"
+ flags += '|ST'
+ if item.code == item.title
+ flags += '|IT'
+ end
+
end
unless item.lower.nil? or item.lower==from or item.lower==to
specials << item.lower
- flags += "|SL"
+ flags += '|SL'
end
unless item.upper.nil? or item.upper==from or item.upper==to
specials << item.upper
- flags += "|SU"
+ flags += '|SU'
end
if specials.first
flags += "|I(#{@specials_length})"
diff --git a/enc/unicode/casefold.h b/enc/unicode/casefold.h
index fcc9120..c324102 100644
--- a/enc/unicode/casefold.h
+++ b/enc/unicode/casefold.h
@@ -161,11 +161,11 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x01b8, {1|F|D, {0x01b9}}},
{0x01bc, {1|F|D, {0x01bd}}},
{0x01c4, {1|F|D|ST|I(8), {0x01c6}}},
- {0x01c5, {1|F|D|ST|SU|I(9), {0x01c6}}},
+ {0x01c5, {1|F|D|ST|IT|SU|I(9), {0x01c6}}},
{0x01c7, {1|F|D|ST|I(11), {0x01c9}}},
- {0x01c8, {1|F|D|ST|SU|I(12), {0x01c9}}},
+ {0x01c8, {1|F|D|ST|IT|SU|I(12), {0x01c9}}},
{0x01ca, {1|F|D|ST|I(14), {0x01cc}}},
- {0x01cb, {1|F|D|ST|SU|I(15), {0x01cc}}},
+ {0x01cb, {1|F|D|ST|IT|SU|I(15), {0x01cc}}},
{0x01cd, {1|F|D, {0x01ce}}},
{0x01cf, {1|F|D, {0x01d0}}},
{0x01d1, {1|F|D, {0x01d2}}},
@@ -185,7 +185,7 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x01ee, {1|F|D, {0x01ef}}},
{0x01f0, {2|F|SU|I(17), {0x006a, 0x030c}}},
{0x01f1, {1|F|D|ST|I(19), {0x01f3}}},
- {0x01f2, {1|F|D|ST|SU|I(20), {0x01f3}}},
+ {0x01f2, {1|F|D|ST|IT|SU|I(20), {0x01f3}}},
{0x01f4, {1|F|D, {0x01f5}}},
{0x01f6, {1|F|D, {0x0195}}},
{0x01f7, {1|F|D, {0x01bf}}},
@@ -723,14 +723,14 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x1f85, {2|F|ST|SU|I(79), {0x1f05, 0x03b9}}},
{0x1f86, {2|F|ST|SU|I(82), {0x1f06, 0x03b9}}},
{0x1f87, {2|F|ST|SU|I(85), {0x1f07, 0x03b9}}},
- {0x1f88, {2|F|ST|SL|SU|I(88), {0x1f00, 0x03b9}}},
- {0x1f89, {2|F|ST|SL|SU|I(92), {0x1f01, 0x03b9}}},
- {0x1f8a, {2|F|ST|SL|SU|I(96), {0x1f02, 0x03b9}}},
- {0x1f8b, {2|F|ST|SL|SU|I(100), {0x1f03, 0x03b9}}},
- {0x1f8c, {2|F|ST|SL|SU|I(104), {0x1f04, 0x03b9}}},
- {0x1f8d, {2|F|ST|SL|SU|I(108), {0x1f05, 0x03b9}}},
- {0x1f8e, {2|F|ST|SL|SU|I(112), {0x1f06, 0x03b9}}},
- {0x1f8f, {2|F|ST|SL|SU|I(116), {0x1f07, 0x03b9}}},
+ {0x1f88, {2|F|ST|IT|SL|SU|I(88), {0x1f00, 0x03b9}}},
+ {0x1f89, {2|F|ST|IT|SL|SU|I(92), {0x1f01, 0x03b9}}},
+ {0x1f8a, {2|F|ST|IT|SL|SU|I(96), {0x1f02, 0x03b9}}},
+ {0x1f8b, {2|F|ST|IT|SL|SU|I(100), {0x1f03, 0x03b9}}},
+ {0x1f8c, {2|F|ST|IT|SL|SU|I(104), {0x1f04, 0x03b9}}},
+ {0x1f8d, {2|F|ST|IT|SL|SU|I(108), {0x1f05, 0x03b9}}},
+ {0x1f8e, {2|F|ST|IT|SL|SU|I(112), {0x1f06, 0x03b9}}},
+ {0x1f8f, {2|F|ST|IT|SL|SU|I(116), {0x1f07, 0x03b9}}},
{0x1f90, {2|F|ST|SU|I(120), {0x1f20, 0x03b9}}},
{0x1f91, {2|F|ST|SU|I(123), {0x1f21, 0x03b9}}},
{0x1f92, {2|F|ST|SU|I(126), {0x1f22, 0x03b9}}},
@@ -739,14 +739,14 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x1f95, {2|F|ST|SU|I(135), {0x1f25, 0x03b9}}},
{0x1f96, {2|F|ST|SU|I(138), {0x1f26, 0x03b9}}},
{0x1f97, {2|F|ST|SU|I(141), {0x1f27, 0x03b9}}},
- {0x1f98, {2|F|ST|SL|SU|I(144), {0x1f20, 0x03b9}}},
- {0x1f99, {2|F|ST|SL|SU|I(148), {0x1f21, 0x03b9}}},
- {0x1f9a, {2|F|ST|SL|SU|I(152), {0x1f22, 0x03b9}}},
- {0x1f9b, {2|F|ST|SL|SU|I(156), {0x1f23, 0x03b9}}},
- {0x1f9c, {2|F|ST|SL|SU|I(160), {0x1f24, 0x03b9}}},
- {0x1f9d, {2|F|ST|SL|SU|I(164), {0x1f25, 0x03b9}}},
- {0x1f9e, {2|F|ST|SL|SU|I(168), {0x1f26, 0x03b9}}},
- {0x1f9f, {2|F|ST|SL|SU|I(172), {0x1f27, 0x03b9}}},
+ {0x1f98, {2|F|ST|IT|SL|SU|I(144), {0x1f20, 0x03b9}}},
+ {0x1f99, {2|F|ST|IT|SL|SU|I(148), {0x1f21, 0x03b9}}},
+ {0x1f9a, {2|F|ST|IT|SL|SU|I(152), {0x1f22, 0x03b9}}},
+ {0x1f9b, {2|F|ST|IT|SL|SU|I(156), {0x1f23, 0x03b9}}},
+ {0x1f9c, {2|F|ST|IT|SL|SU|I(160), {0x1f24, 0x03b9}}},
+ {0x1f9d, {2|F|ST|IT|SL|SU|I(164), {0x1f25, 0x03b9}}},
+ {0x1f9e, {2|F|ST|IT|SL|SU|I(168), {0x1f26, 0x03b9}}},
+ {0x1f9f, {2|F|ST|IT|SL|SU|I(172), {0x1f27, 0x03b9}}},
{0x1fa0, {2|F|ST|SU|I(176), {0x1f60, 0x03b9}}},
{0x1fa1, {2|F|ST|SU|I(179), {0x1f61, 0x03b9}}},
{0x1fa2, {2|F|ST|SU|I(182), {0x1f62, 0x03b9}}},
@@ -755,14 +755,14 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x1fa5, {2|F|ST|SU|I(191), {0x1f65, 0x03b9}}},
{0x1fa6, {2|F|ST|SU|I(194), {0x1f66, 0x03b9}}},
{0x1fa7, {2|F|ST|SU|I(197), {0x1f67, 0x03b9}}},
- {0x1fa8, {2|F|ST|SL|SU|I(200), {0x1f60, 0x03b9}}},
- {0x1fa9, {2|F|ST|SL|SU|I(204), {0x1f61, 0x03b9}}},
- {0x1faa, {2|F|ST|SL|SU|I(208), {0x1f62, 0x03b9}}},
- {0x1fab, {2|F|ST|SL|SU|I(212), {0x1f63, 0x03b9}}},
- {0x1fac, {2|F|ST|SL|SU|I(216), {0x1f64, 0x03b9}}},
- {0x1fad, {2|F|ST|SL|SU|I(220), {0x1f65, 0x03b9}}},
- {0x1fae, {2|F|ST|SL|SU|I(224), {0x1f66, 0x03b9}}},
- {0x1faf, {2|F|ST|SL|SU|I(228), {0x1f67, 0x03b9}}},
+ {0x1fa8, {2|F|ST|IT|SL|SU|I(200), {0x1f60, 0x03b9}}},
+ {0x1fa9, {2|F|ST|IT|SL|SU|I(204), {0x1f61, 0x03b9}}},
+ {0x1faa, {2|F|ST|IT|SL|SU|I(208), {0x1f62, 0x03b9}}},
+ {0x1fab, {2|F|ST|IT|SL|SU|I(212), {0x1f63, 0x03b9}}},
+ {0x1fac, {2|F|ST|IT|SL|SU|I(216), {0x1f64, 0x03b9}}},
+ {0x1fad, {2|F|ST|IT|SL|SU|I(220), {0x1f65, 0x03b9}}},
+ {0x1fae, {2|F|ST|IT|SL|SU|I(224), {0x1f66, 0x03b9}}},
+ {0x1faf, {2|F|ST|IT|SL|SU|I(228), {0x1f67, 0x03b9}}},
{0x1fb2, {2|F|ST|SU|I(232), {0x1f70, 0x03b9}}},
{0x1fb3, {2|F|ST|SU|I(236), {0x03b1, 0x03b9}}},
{0x1fb4, {2|F|ST|SU|I(239), {0x03ac, 0x03b9}}},
@@ -772,7 +772,7 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x1fb9, {1|F|D, {0x1fb1}}},
{0x1fba, {1|F|D, {0x1f70}}},
{0x1fbb, {1|F|D, {0x1f71}}},
- {0x1fbc, {2|F|ST|SL|SU|I(251), {0x03b1, 0x03b9}}},
+ {0x1fbc, {2|F|ST|IT|SL|SU|I(251), {0x03b1, 0x03b9}}},
{0x1fbe, {1|F|SU|I(255), {0x03b9}}},
{0x1fc2, {2|F|ST|SU|I(256), {0x1f74, 0x03b9}}},
{0x1fc3, {2|F|ST|SU|I(260), {0x03b7, 0x03b9}}},
@@ -783,7 +783,7 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x1fc9, {1|F|D, {0x1f73}}},
{0x1fca, {1|F|D, {0x1f74}}},
{0x1fcb, {1|F|D, {0x1f75}}},
- {0x1fcc, {2|F|ST|SL|SU|I(275), {0x03b7, 0x03b9}}},
+ {0x1fcc, {2|F|ST|IT|SL|SU|I(275), {0x03b7, 0x03b9}}},
{0x1fd2, {3|F|SU|I(279), {0x03b9, 0x0308, 0x0300}}},
{0x1fd3, {3|F|SU|I(282), {0x03b9, 0x0308, 0x0301}}},
{0x1fd6, {2|F|SU|I(285), {0x03b9, 0x0342}}},
@@ -811,7 +811,7 @@ static const CaseFold_11_Type CaseFold_11_Table[] = {
{0x1ff9, {1|F|D, {0x1f79}}},
{0x1ffa, {1|F|D, {0x1f7c}}},
{0x1ffb, {1|F|D, {0x1f7d}}},
- {0x1ffc, {2|F|ST|SL|SU|I(322), {0x03c9, 0x03b9}}},
+ {0x1ffc, {2|F|ST|IT|SL|SU|I(322), {0x03c9, 0x03b9}}},
{0x2126, {1|F|D, {0x03c9}}},
{0x212a, {1|F|D, {0x006b}}},
{0x212b, {1|F|D, {0x00e5}}},