Unicode categories syntax cleanup

db4
Daniel Ehrenberg 2009-03-21 01:18:25 -05:00
parent 62638fb4d3
commit c6fc88f28f
1 changed files with 8 additions and 4 deletions

View 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