]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/unicode/unicode.factor
factor: trim some using lists
[factor.git] / basis / unicode / unicode.factor
index abeacc52000dab391101fa66016231bbf52a0f76..e67b3a5366d3199fc797e7d81b62e818fa2ef3e8 100644 (file)
@@ -3,7 +3,7 @@ hints interval-maps kernel math math.order sequences sorting
 strings unicode.breaks.private unicode.case.private
 unicode.categories unicode.collation unicode.collation.private
 unicode.data unicode.data.private unicode.normalize.private
-unicode.script locals math.ranges ;
+unicode.script ranges ;
 IN: unicode
 
 CATEGORY: blank Zs Zl Zp | "\r\n\t" member? ;
@@ -46,7 +46,7 @@ CATEGORY: math Sm | "Other_Math" property? ;
     entire-str length :> str-len
     0 pos 1 + entire-str <slice> grapheme-class
     pos 1 + str-len 1 - min pos!
-    pos str-len 1 - [a,b] [
+    pos str-len 1 - [a..b] [
         1 + 0 swap entire-str <slice> grapheme-class
         dup rot swap grapheme-break?
     ] find drop nip
@@ -60,7 +60,7 @@ CATEGORY: math Sm | "Other_Math" property? ;
     pos 0 = [ 0 ] [
         str grapheme-class
         pos 1 - 0 max pos!
-        0 pos [a,b] [
+        0 pos [a..b] [
             0 swap 1 + str <slice> grapheme-class
             dup rot grapheme-break?
         ] find-last drop ?1+ nip
@@ -217,6 +217,10 @@ PRIVATE>
 : string<=> ( str1 str2 -- <=> )
     [ collation-key/nfd 2array ] compare ;
 
+: upper-surrogate? ( ch -- ? ) 0xD800 0xDBFF between? ; inline
+
+: under-surrogate? ( ch -- ? ) 0xDC00 0xDFFF between? ; inline
+
 CONSTANT: unicode-supported {
     "collation"
 }
@@ -225,4 +229,4 @@ CONSTANT: unicode-unsupported {
     "bidi"
 }
 
-CONSTANT: unicode-version "10.0"
+CONSTANT: unicode-version "14.0.0"