]> gitweb.factorcode.org Git - factor.git/commitdiff
unicode.collation: fixes for unicode 13.0.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 14 Oct 2020 00:01:00 +0000 (17:01 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 14 Oct 2020 00:01:00 +0000 (17:01 -0700)
basis/unicode/collation/collation-tests.factor
basis/unicode/collation/collation.factor

index 5f7705ffa396d765fd5050ea125834dca6baa0fc..684d7eb3880e00aefe3d3a7f2032b5f990979eb6 100644 (file)
@@ -46,13 +46,17 @@ IN: unicode.collation.tests
 : xfailed-collation-tests ( -- seq )
     HS{
         { 3958 3953 820 }
+
         { 4018 820 3953 3968 }
         { 4018 820 3968 3953 }
+        { 4018 3953 1 3968 97 }
         { 4018 820 3969 }
+
         { 3960 3953 820 }
         { 4019 820 3953 3968 }
         { 4019 820 3968 3953 }
         { 4019 3953 820 3968 }
+        { 4019 3953 1 3968 97 }
     } ;
 
 : parse-collation-test-weights ( -- weights )
@@ -75,9 +79,12 @@ IN: unicode.collation.tests
 
     ! Remove these two expected-fail Tibetan collation comparison tests
     ! They are bad tests once you fix up the ducet table with { 0x0FB2 0x0F71 } and { 0x0FB3 0x0F71 }
-    { 4018 820 3969 } { 3959 33 } [ >string ] bi@ 2array
-    { 4019 3953 820 3968 } { 3961 33 } [ >string ] bi@ 2array
-    2array >hash-set diff members
+    {
+        { { 4018 820 3969 } { 3959 33 } }
+        { { 4019 3953 820 3968 } { 3961 33 } }
+        { { 4019 98 } { 4019 3953 1 3968 97 } }
+        { { 4028 98 } { 4018 3953 1 3968 97 } }
+    } [ [ >string ] bi@ ] assoc-map >hash-set diff members
 
     [ string<=> { +lt+ +eq+ } member? ] assoc-reject
 ] unit-test
@@ -85,4 +92,4 @@ IN: unicode.collation.tests
 ! XXX: Once again, these tests pass if you don't
 ! fix up the ducet table for { 0x0FB2 0x0F71 } and { 0x0FB3 0x0F71 }
 ! { +lt+ } [ { 4018 820 3969 } { 3959 33 } [ >string ] bi@ string<=> ] unit-test
-! { +lt+ } [ { 4019 3953 820 3968 } { 3961 33 } [ >string ] bi@ string<=> ] unit-test
\ No newline at end of file
+! { +lt+ } [ { 4019 3953 820 3968 } { 3961 33 } [ >string ] bi@ string<=> ] unit-test
index b6c4941b9d7fcb4315d24f338795a6271f83e631..d1da246d2f09511e254e769521cf71e5af1f9da7 100644 (file)
@@ -204,22 +204,31 @@ fixup-ducet-for-tibetan
 
 : tangut-block? ( char -- ? )
     ! Tangut Block, Tangut Components Block
-    { [ 0x17000 0x187FF between? ] [ 0x18800 0x18AFF between? ] } 1|| ; inline
+    {
+        [ 0x17000 0x187FF between? ]
+        [ 0x18800 0x18AFF between? ]
+        [ 0x18D00 0x18D08 between? ]
+    } 1|| ; inline
 
 : nushu-block? ( char -- ? )
     0x1b170 0x1B2FB between? ; inline
 
+: khitan-block? ( char -- ? )
+    0x18b00 0x18cd5 between? ; inline
+
 ! https://wiki.computercraft.cc/Module:Unicode_data
 ! Unicode TR10 - Computing Implicit Weights
 : base ( char -- base )
     {
-        { [ dup 0x03400 0x04DB5 between? ] [ drop 0xFB80 ] } ! Extension A
-        { [ dup 0x20000 0x2A6D6 between? ] [ drop 0xFB80 ] } ! Extension B
+        { [ dup 0x03400 0x04DBF between? ] [ drop 0xFB80 ] } ! Extension A
+        { [ dup 0x20000 0x2A6DD between? ] [ drop 0xFB80 ] } ! Extension B
         { [ dup 0x2A700 0x2B734 between? ] [ drop 0xFB80 ] } ! Extension C
         { [ dup 0x2B740 0x2B81D between? ] [ drop 0xFB80 ] } ! Extension D
         { [ dup 0x2B820 0x2CEA1 between? ] [ drop 0xFB80 ] } ! Extension E
         { [ dup 0x2CEB0 0x2EBE0 between? ] [ drop 0xFB80 ] } ! Extension F
-        { [ dup 0x04E00 0x09FEF between? ] [ drop 0xFB40 ] } ! CJK
+        { [ dup 0x30000 0x3134A between? ] [ drop 0xFB80 ] } ! Extension G
+        { [ dup 0x03400 0x04DBF between? ] [ drop 0xFB40 ] } ! CJK
+        { [ dup 0x04E00 0x09FFC between? ] [ drop 0xFB40 ] } ! CJK
         [ drop 0xFBC0 ] ! Other
     } cond ;
 
@@ -235,6 +244,12 @@ fixup-ducet-for-tibetan
 : nushu-BBBB ( char -- weight-levels )
     0x1B170 - 0x8000 bitor 0 0 <weight-levels> ; inline
 
+: khitan-AAAA ( char -- weight-levels )
+    drop 0xfb02 0x0020 0x0002 <weight-levels> ; inline
+
+: khitan-BBBB ( char -- weight-levels )
+    0x18b00 - 0x8000 bitor 0 0 <weight-levels> ; inline
+
 : AAAA ( char -- weight-levels )
     [ base ] [ -15 shift ] bi + 0x0020 0x0002 <weight-levels> ; inline
 
@@ -246,6 +261,7 @@ fixup-ducet-for-tibetan
     {
         { [ dup tangut-block? ] [ [ tangut-AAAA ] [ tangut-BBBB ] bi 2array ] }
         { [ dup nushu-block? ] [ [ nushu-AAAA ] [ nushu-BBBB ] bi 2array ] }
+        { [ dup khitan-block? ] [ [ khitan-AAAA ] [ khitan-BBBB ] bi 2array ] }
         [ [ AAAA ] [ BBBB ] bi 2array ]
     } cond ;