[前][次][番号順一覧][スレッド一覧]

ruby-changes:41830

From: duerst <ko1@a...>
Date: Tue, 23 Feb 2016 15:21:21 +0900 (JST)
Subject: [ruby-changes:41830] duerst:r53904 (trunk): * enc/unicode/case-folding.rb, casefold.h: Reading casing data from

duerst	2016-02-23 15:21:55 +0900 (Tue, 23 Feb 2016)

  New Revision: 53904

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53904

  Log:
    * enc/unicode/case-folding.rb, casefold.h: Reading casing data from
      SpecialCasing.txt.
      (with Kimihito Matsui)

  Modified files:
    trunk/ChangeLog
    trunk/enc/unicode/case-folding.rb
    trunk/enc/unicode/casefold.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53903)
+++ ChangeLog	(revision 53904)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Feb 23 15:21:14 2016  Martin Duerst  <duerst@i...>
+
+	* 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@i...>
 
 	* enc/unicode/case-folding.rb, casefold.h: Adding flag for title-case,
Index: enc/unicode/case-folding.rb
===================================================================
--- enc/unicode/case-folding.rb	(revision 53903)
+++ enc/unicode/case-folding.rb	(revision 53904)
@@ -187,7 +187,7 @@ class CaseFolding https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L187
 end
 
 class MapItem
-  attr_reader :upper, :lower, :title
+  attr_accessor :upper, :lower, :title
 
   def initialize(code, upper, lower, title)
     @code = code
@@ -212,7 +212,18 @@ class CaseMapping https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L212
       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
 
   def flags(from, type, to)
Index: enc/unicode/casefold.h
===================================================================
--- enc/unicode/casefold.h	(revision 53903)
+++ enc/unicode/casefold.h	(revision 53904)
@@ -59,7 +59,7 @@ static const CaseFold_11_Type CaseFold_1 https://github.com/ruby/ruby/blob/trunk/enc/unicode/casefold.h#L59
   {0x00dc, {1|F|D, {0x00fc}}},
   {0x00dd, {1|F|D, {0x00fd}}},
   {0x00de, {1|F|D, {0x00fe}}},
-  {0x00df, {2|F, {0x0073, 0x0073}}},
+  {0x00df, {2|F|T, {0x0073, 0x0073}}},
   {0x0100, {1|F|D, {0x0101}}},
   {0x0102, {1|F|D, {0x0103}}},
   {0x0104, {1|F|D, {0x0105}}},
@@ -486,7 +486,7 @@ static const CaseFold_11_Type CaseFold_1 https://github.com/ruby/ruby/blob/trunk/enc/unicode/casefold.h#L486
   {0x0554, {1|F|D, {0x0584}}},
   {0x0555, {1|F|D, {0x0585}}},
   {0x0556, {1|F|D, {0x0586}}},
-  {0x0587, {2|F, {0x0565, 0x0582}}},
+  {0x0587, {2|F|T, {0x0565, 0x0582}}},
   {0x10a0, {1|F|D, {0x2d00}}},
   {0x10a1, {1|F|D, {0x2d01}}},
   {0x10a2, {1|F|D, {0x2d02}}},
@@ -715,75 +715,75 @@ static const CaseFold_11_Type CaseFold_1 https://github.com/ruby/ruby/blob/trunk/enc/unicode/casefold.h#L715
   {0x1f6d, {1|F|D, {0x1f65}}},
   {0x1f6e, {1|F|D, {0x1f66}}},
   {0x1f6f, {1|F|D, {0x1f67}}},
-  {0x1f80, {2|F, {0x1f00, 0x03b9}}},
-  {0x1f81, {2|F, {0x1f01, 0x03b9}}},
-  {0x1f82, {2|F, {0x1f02, 0x03b9}}},
-  {0x1f83, {2|F, {0x1f03, 0x03b9}}},
-  {0x1f84, {2|F, {0x1f04, 0x03b9}}},
-  {0x1f85, {2|F, {0x1f05, 0x03b9}}},
-  {0x1f86, {2|F, {0x1f06, 0x03b9}}},
-  {0x1f87, {2|F, {0x1f07, 0x03b9}}},
-  {0x1f88, {2|F, {0x1f00, 0x03b9}}},
-  {0x1f89, {2|F, {0x1f01, 0x03b9}}},
-  {0x1f8a, {2|F, {0x1f02, 0x03b9}}},
-  {0x1f8b, {2|F, {0x1f03, 0x03b9}}},
-  {0x1f8c, {2|F, {0x1f04, 0x03b9}}},
-  {0x1f8d, {2|F, {0x1f05, 0x03b9}}},
-  {0x1f8e, {2|F, {0x1f06, 0x03b9}}},
-  {0x1f8f, {2|F, {0x1f07, 0x03b9}}},
-  {0x1f90, {2|F, {0x1f20, 0x03b9}}},
-  {0x1f91, {2|F, {0x1f21, 0x03b9}}},
-  {0x1f92, {2|F, {0x1f22, 0x03b9}}},
-  {0x1f93, {2|F, {0x1f23, 0x03b9}}},
-  {0x1f94, {2|F, {0x1f24, 0x03b9}}},
-  {0x1f95, {2|F, {0x1f25, 0x03b9}}},
-  {0x1f96, {2|F, {0x1f26, 0x03b9}}},
-  {0x1f97, {2|F, {0x1f27, 0x03b9}}},
-  {0x1f98, {2|F, {0x1f20, 0x03b9}}},
-  {0x1f99, {2|F, {0x1f21, 0x03b9}}},
-  {0x1f9a, {2|F, {0x1f22, 0x03b9}}},
-  {0x1f9b, {2|F, {0x1f23, 0x03b9}}},
-  {0x1f9c, {2|F, {0x1f24, 0x03b9}}},
-  {0x1f9d, {2|F, {0x1f25, 0x03b9}}},
-  {0x1f9e, {2|F, {0x1f26, 0x03b9}}},
-  {0x1f9f, {2|F, {0x1f27, 0x03b9}}},
-  {0x1fa0, {2|F, {0x1f60, 0x03b9}}},
-  {0x1fa1, {2|F, {0x1f61, 0x03b9}}},
-  {0x1fa2, {2|F, {0x1f62, 0x03b9}}},
-  {0x1fa3, {2|F, {0x1f63, 0x03b9}}},
-  {0x1fa4, {2|F, {0x1f64, 0x03b9}}},
-  {0x1fa5, {2|F, {0x1f65, 0x03b9}}},
-  {0x1fa6, {2|F, {0x1f66, 0x03b9}}},
-  {0x1fa7, {2|F, {0x1f67, 0x03b9}}},
-  {0x1fa8, {2|F, {0x1f60, 0x03b9}}},
-  {0x1fa9, {2|F, {0x1f61, 0x03b9}}},
-  {0x1faa, {2|F, {0x1f62, 0x03b9}}},
-  {0x1fab, {2|F, {0x1f63, 0x03b9}}},
-  {0x1fac, {2|F, {0x1f64, 0x03b9}}},
-  {0x1fad, {2|F, {0x1f65, 0x03b9}}},
-  {0x1fae, {2|F, {0x1f66, 0x03b9}}},
-  {0x1faf, {2|F, {0x1f67, 0x03b9}}},
-  {0x1fb2, {2|F, {0x1f70, 0x03b9}}},
-  {0x1fb3, {2|F, {0x03b1, 0x03b9}}},
-  {0x1fb4, {2|F, {0x03ac, 0x03b9}}},
+  {0x1f80, {2|F|T, {0x1f00, 0x03b9}}},
+  {0x1f81, {2|F|T, {0x1f01, 0x03b9}}},
+  {0x1f82, {2|F|T, {0x1f02, 0x03b9}}},
+  {0x1f83, {2|F|T, {0x1f03, 0x03b9}}},
+  {0x1f84, {2|F|T, {0x1f04, 0x03b9}}},
+  {0x1f85, {2|F|T, {0x1f05, 0x03b9}}},
+  {0x1f86, {2|F|T, {0x1f06, 0x03b9}}},
+  {0x1f87, {2|F|T, {0x1f07, 0x03b9}}},
+  {0x1f88, {2|F|T, {0x1f00, 0x03b9}}},
+  {0x1f89, {2|F|T, {0x1f01, 0x03b9}}},
+  {0x1f8a, {2|F|T, {0x1f02, 0x03b9}}},
+  {0x1f8b, {2|F|T, {0x1f03, 0x03b9}}},
+  {0x1f8c, {2|F|T, {0x1f04, 0x03b9}}},
+  {0x1f8d, {2|F|T, {0x1f05, 0x03b9}}},
+  {0x1f8e, {2|F|T, {0x1f06, 0x03b9}}},
+  {0x1f8f, {2|F|T, {0x1f07, 0x03b9}}},
+  {0x1f90, {2|F|T, {0x1f20, 0x03b9}}},
+  {0x1f91, {2|F|T, {0x1f21, 0x03b9}}},
+  {0x1f92, {2|F|T, {0x1f22, 0x03b9}}},
+  {0x1f93, {2|F|T, {0x1f23, 0x03b9}}},
+  {0x1f94, {2|F|T, {0x1f24, 0x03b9}}},
+  {0x1f95, {2|F|T, {0x1f25, 0x03b9}}},
+  {0x1f96, {2|F|T, {0x1f26, 0x03b9}}},
+  {0x1f97, {2|F|T, {0x1f27, 0x03b9}}},
+  {0x1f98, {2|F|T, {0x1f20, 0x03b9}}},
+  {0x1f99, {2|F|T, {0x1f21, 0x03b9}}},
+  {0x1f9a, {2|F|T, {0x1f22, 0x03b9}}},
+  {0x1f9b, {2|F|T, {0x1f23, 0x03b9}}},
+  {0x1f9c, {2|F|T, {0x1f24, 0x03b9}}},
+  {0x1f9d, {2|F|T, {0x1f25, 0x03b9}}},
+  {0x1f9e, {2|F|T, {0x1f26, 0x03b9}}},
+  {0x1f9f, {2|F|T, {0x1f27, 0x03b9}}},
+  {0x1fa0, {2|F|T, {0x1f60, 0x03b9}}},
+  {0x1fa1, {2|F|T, {0x1f61, 0x03b9}}},
+  {0x1fa2, {2|F|T, {0x1f62, 0x03b9}}},
+  {0x1fa3, {2|F|T, {0x1f63, 0x03b9}}},
+  {0x1fa4, {2|F|T, {0x1f64, 0x03b9}}},
+  {0x1fa5, {2|F|T, {0x1f65, 0x03b9}}},
+  {0x1fa6, {2|F|T, {0x1f66, 0x03b9}}},
+  {0x1fa7, {2|F|T, {0x1f67, 0x03b9}}},
+  {0x1fa8, {2|F|T, {0x1f60, 0x03b9}}},
+  {0x1fa9, {2|F|T, {0x1f61, 0x03b9}}},
+  {0x1faa, {2|F|T, {0x1f62, 0x03b9}}},
+  {0x1fab, {2|F|T, {0x1f63, 0x03b9}}},
+  {0x1fac, {2|F|T, {0x1f64, 0x03b9}}},
+  {0x1fad, {2|F|T, {0x1f65, 0x03b9}}},
+  {0x1fae, {2|F|T, {0x1f66, 0x03b9}}},
+  {0x1faf, {2|F|T, {0x1f67, 0x03b9}}},
+  {0x1fb2, {2|F|T, {0x1f70, 0x03b9}}},
+  {0x1fb3, {2|F|T, {0x03b1, 0x03b9}}},
+  {0x1fb4, {2|F|T, {0x03ac, 0x03b9}}},
   {0x1fb6, {2|F, {0x03b1, 0x0342}}},
-  {0x1fb7, {3|F, {0x03b1, 0x0342, 0x03b9}}},
+  {0x1fb7, {3|F|T, {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, {0x03b1, 0x03b9}}},
+  {0x1fbc, {2|F|T, {0x03b1, 0x03b9}}},
   {0x1fbe, {1|F, {0x03b9}}},
-  {0x1fc2, {2|F, {0x1f74, 0x03b9}}},
-  {0x1fc3, {2|F, {0x03b7, 0x03b9}}},
-  {0x1fc4, {2|F, {0x03ae, 0x03b9}}},
+  {0x1fc2, {2|F|T, {0x1f74, 0x03b9}}},
+  {0x1fc3, {2|F|T, {0x03b7, 0x03b9}}},
+  {0x1fc4, {2|F|T, {0x03ae, 0x03b9}}},
   {0x1fc6, {2|F, {0x03b7, 0x0342}}},
-  {0x1fc7, {3|F, {0x03b7, 0x0342, 0x03b9}}},
+  {0x1fc7, {3|F|T, {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, {0x03b7, 0x03b9}}},
+  {0x1fcc, {2|F|T, {0x03b7, 0x03b9}}},
   {0x1fd2, {3|F, {0x03b9, 0x0308, 0x0300}}},
   {0x1fd3, {3|F, {0x03b9, 0x0308, 0x0301}}},
   {0x1fd6, {2|F, {0x03b9, 0x0342}}},
@@ -802,16 +802,16 @@ static const CaseFold_11_Type CaseFold_1 https://github.com/ruby/ruby/blob/trunk/enc/unicode/casefold.h#L802
   {0x1fea, {1|F|D, {0x1f7a}}},
   {0x1feb, {1|F|D, {0x1f7b}}},
   {0x1fec, {1|F|D, {0x1fe5}}},
-  {0x1ff2, {2|F, {0x1f7c, 0x03b9}}},
-  {0x1ff3, {2|F, {0x03c9, 0x03b9}}},
-  {0x1ff4, {2|F, {0x03ce, 0x03b9}}},
+  {0x1ff2, {2|F|T, {0x1f7c, 0x03b9}}},
+  {0x1ff3, {2|F|T, {0x03c9, 0x03b9}}},
+  {0x1ff4, {2|F|T, {0x03ce, 0x03b9}}},
   {0x1ff6, {2|F, {0x03c9, 0x0342}}},
-  {0x1ff7, {3|F, {0x03c9, 0x0342, 0x03b9}}},
+  {0x1ff7, {3|F|T, {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, {0x03c9, 0x03b9}}},
+  {0x1ffc, {2|F|T, {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_1 https://github.com/ruby/ruby/blob/trunk/enc/unicode/casefold.h#L1161
   {0xabbd, {1|F|U, {0x13ed}}},
   {0xabbe, {1|F|U, {0x13ee}}},
   {0xabbf, {1|F|U, {0x13ef}}},
-  {0xfb00, {2|F, {0x0066, 0x0066}}},
-  {0xfb01, {2|F, {0x0066, 0x0069}}},
-  {0xfb02, {2|F, {0x0066, 0x006c}}},
-  {0xfb03, {3|F, {0x0066, 0x0066, 0x0069}}},
-  {0xfb04, {3|F, {0x0066, 0x0066, 0x006c}}},
-  {0xfb05, {2|F, {0x0073, 0x0074}}},
-  {0xfb06, {2|F, {0x0073, 0x0074}}},
-  {0xfb13, {2|F, {0x0574, 0x0576}}},
-  {0xfb14, {2|F, {0x0574, 0x0565}}},
-  {0xfb15, {2|F, {0x0574, 0x056b}}},
-  {0xfb16, {2|F, {0x057e, 0x0576}}},
-  {0xfb17, {2|F, {0x0574, 0x056d}}},
+  {0xfb00, {2|F|T, {0x0066, 0x0066}}},
+  {0xfb01, {2|F|T, {0x0066, 0x0069}}},
+  {0xfb02, {2|F|T, {0x0066, 0x006c}}},
+  {0xfb03, {3|F|T, {0x0066, 0x0066, 0x0069}}},
+  {0xfb04, {3|F|T, {0x0066, 0x0066, 0x006c}}},
+  {0xfb05, {2|F|T, {0x0073, 0x0074}}},
+  {0xfb06, {2|F|T, {0x0073, 0x0074}}},
+  {0xfb13, {2|F|T, {0x0574, 0x0576}}},
+  {0xfb14, {2|F|T, {0x0574, 0x0565}}},
+  {0xfb15, {2|F|T, {0x0574, 0x056b}}},
+  {0xfb16, {2|F|T, {0x057e, 0x0576}}},
+  {0xfb17, {2|F|T, {0x0574, 0x056d}}},
   {0xff21, {1|F|D, {0xff41}}},
   {0xff22, {1|F|D, {0xff42}}},
   {0xff23, {1|F|D, {0xff43}}},
@@ -1324,7 +1324,7 @@ static const CaseFold_11_Type CaseFold_1 https://github.com/ruby/ruby/blob/trunk/enc/unicode/casefold.h#L1324
   {0x118bf, {1|F|D, {0x118df}}},
 #define CaseFold_Locale (*(CaseFold_11_Type (*)[2])(CaseFold_11_Table+1319))
   {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 */

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]