]> gitweb.factorcode.org Git - factor.git/commitdiff
Making unicode.categories.syntax use member?, simplifying the code
authorDaniel Ehrenberg <littledan@Macintosh-122.local>
Sat, 21 Mar 2009 08:17:20 +0000 (03:17 -0500)
committerDaniel Ehrenberg <littledan@Macintosh-122.local>
Sat, 21 Mar 2009 08:17:20 +0000 (03:17 -0500)
basis/unicode/categories/syntax/syntax.factor

index 93f7919b6bc7de854bd816a437f67910fed5d957..87f143aadc4afa42398a2c62ae7fe3858f0d8849 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2008, 2009 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: unicode.data kernel math sequences parser
+USING: unicode.data kernel math sequences parser unicode.data.private
 bit-arrays namespaces sequences.private arrays classes.parser
 assocs classes.predicate sets fry splitting accessors ;
 IN: unicode.categories.syntax
@@ -10,12 +10,8 @@ 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
 
 <PRIVATE
 
-: >category-array ( categories -- bitarray )
-    categories [ swap member? ] with map >bit-array ;
-
 : [category] ( categories code -- quot )
-    [ >category-array ] dip
-    '[ dup category# _ nth-unsafe [ drop t ] _ if ] ;
+    '[ dup category# _ member? [ drop t ] _ if ] ;
 
 : integer-predicate-class ( word predicate -- )
     integer swap define-predicate-class ;
@@ -28,7 +24,7 @@ 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
 
 : parse-category ( -- word tokens quot )
     CREATE-CLASS \ ; parse-until { | } split1
-    [ [ name>> ] map ]
+    [ [ name>> categories-map at ] map ]
     [ [ [ ] like ] [ [ drop f ] ] if* ] bi* ;
 
 PRIVATE>