io.files hashtables quotations splitting grouping arrays
math.parser hash2 math.order byte-arrays words namespaces words
compiler.units parser io.encodings.ascii values interval-maps
-ascii sets combinators locals math.ranges sorting ;
+ascii sets combinators locals math.ranges sorting make ;
IN: unicode.data
VALUE: simple-lower
"Cc" "Cf" "Cs" "Co" } ;
: num-chars HEX: 2FA1E ;
+
! the maximum unicode char in the first 3 planes
: ?set-nth ( val index seq -- )
! Copyright (C) 2008 Daniel Ehrenberg.
! See http://factorcode.org/license.txt for BSD license.
USING: sequences namespaces make unicode.data kernel math arrays
-locals sorting.insertion accessors ;
+locals sorting.insertion accessors assocs ;
IN: unicode.normalize
! Conjoining Jamo behavior
: pass-combining ( -- )
current non-starter? [ current , to pass-combining ] when ;
-: try-compose ( last-class char current-class -- )
- swapd = [ after get push ] [
- char get over combine-chars
- [ nip char set ] [ after get push ] if*
+:: try-compose ( last-class new-char current-class -- new-class )
+ last-class current-class = [ new-char after get push last-class ] [
+ char get new-char combine-chars
+ [ char set last-class ]
+ [ new-char after get push current-class ] if*
] if ;
-: compose-iter ( n -- )
+: compose-iter ( last-class -- )
current [
dup combining-class dup
- [ [ try-compose ] keep to compose-iter ] [ 3drop ] if
+ [ try-compose to compose-iter ] [ 3drop ] if
] [ drop ] if* ;
: ?new-after ( -- )
char set to ?new-after
0 compose-iter
char get , after get %
- to
] if (compose)
] when* ;