]> gitweb.factorcode.org Git - factor.git/commitdiff
Unicode categories syntax cleanup
authorDaniel Ehrenberg <littledan@Macintosh-122.local>
Sat, 21 Mar 2009 06:18:25 +0000 (01:18 -0500)
committerDaniel Ehrenberg <littledan@Macintosh-122.local>
Sat, 21 Mar 2009 06:18:25 +0000 (01:18 -0500)
basis/unicode/categories/syntax/syntax.factor

index 593bb0bbdd1719633a9c2cba93407958b0d6edf0..93f7919b6bc7de854bd816a437f67910fed5d957 100644 (file)
@@ -17,8 +17,14 @@ SYMBOLS: Cn Lu Ll Lt Lm Lo Mn Mc Me Nd Nl No Pc Pd Ps Pe Pi Pf Po Sm Sc Sk So Zs
     [ >category-array ] dip
     '[ dup category# _ nth-unsafe [ drop t ] _ if ] ;
 
+: integer-predicate-class ( word predicate -- )
+    integer swap define-predicate-class ;
+
 : define-category ( word categories code -- )
-    [category] integer swap define-predicate-class ;
+    [category] integer-predicate-class ;
+
+: define-not-category ( word categories code -- )
+    [category] [ not ] compose integer-predicate-class ;
 
 : parse-category ( -- word tokens quot )
     CREATE-CLASS \ ; parse-until { | } split1
@@ -31,6 +37,4 @@ PRIVATE>
     parse-category define-category ; parsing
 
 : CATEGORY-NOT:
-    parse-category
-    [ categories swap diff ] dip
-    define-category ; parsing
+    parse-category define-not-category ; parsing