Changes for unicode

db4
Daniel Ehrenberg 2008-01-09 19:34:29 -06:00
parent 1dfabe3b34
commit c8b1db0a3e
3 changed files with 6 additions and 11 deletions

View File

@ -399,7 +399,6 @@ SYMBOL: bootstrap-syntax
"Loading " write <pathname> . flush "Loading " write <pathname> . flush
] if ; ] if ;
<<<<<<< HEAD:core/parser/parser.factor
: no-parse-hook ( quot -- ) : no-parse-hook ( quot -- )
>r f parse-hook r> with-variable do-parse-hook ; inline >r f parse-hook r> with-variable do-parse-hook ; inline

View File

@ -1,4 +1,5 @@
USING: hash2 help.syntax help.markup ; USING: help.syntax help.markup ;
IN: hash2
ARTICLE: { "hash2" "intro" } ARTICLE: { "hash2" "intro" }
"The hash2 vocabulary specifies a simple minimal datastructure for hash tables with two integers as keys. These hash tables are fixed size and do not conform to the associative mapping protocol. Words used in creating and manipulating these hash tables include:" "The hash2 vocabulary specifies a simple minimal datastructure for hash tables with two integers as keys. These hash tables are fixed size and do not conform to the associative mapping protocol. Words used in creating and manipulating these hash tables include:"

View File

@ -1,6 +1,6 @@
USING: assocs math kernel sequences io.files hashtables quotations USING: assocs math kernel sequences io.files hashtables quotations
splitting arrays math.parser combinators.lib hash2 byte-arrays words splitting arrays math.parser combinators.lib hash2 byte-arrays words
namespaces ; namespaces words ;
IN: unicode.data IN: unicode.data
! Convenience functions ! Convenience functions
@ -8,16 +8,11 @@ IN: unicode.data
drop [ 1+ ] [ 0 ] if* ; drop [ 1+ ] [ 0 ] if* ;
: define-value ( value word -- ) : define-value ( value word -- )
swap 1quotation define-compound ; swap 1quotation define ;
: ?between? ( n/f from to -- ? ) : ?between? ( n/f from to -- ? )
pick [ between? ] [ 3drop f ] if ; pick [ between? ] [ 3drop f ] if ;
! Remove this soon
USE: parser
DEFER: >>
: << \ >> parse-until >quotation call ; parsing
! Loading data from UnicodeData.txt ! Loading data from UnicodeData.txt
: data ( filename -- data ) : data ( filename -- data )
@ -27,7 +22,7 @@ DEFER: >>
"extra/unicode/UnicodeData.txt" resource-path data ; "extra/unicode/UnicodeData.txt" resource-path data ;
: (process-data) ( index data -- newdata ) : (process-data) ( index data -- newdata )
[ [ nth ] keep first swap 2array ] curry* map [ [ nth ] keep first swap 2array ] with map
[ second empty? not ] subset [ second empty? not ] subset
[ >r hex> r> ] assoc-map ; [ >r hex> r> ] assoc-map ;
@ -38,7 +33,7 @@ DEFER: >>
[ [
2dup swap at 2dup swap at
[ (chain-decomposed) ] [ 1array nip ] ?if [ (chain-decomposed) ] [ 1array nip ] ?if
] curry* map concat ; ] with map concat ;
: chain-decomposed ( hash -- newhash ) : chain-decomposed ( hash -- newhash )
dup [ swap (chain-decomposed) ] curry assoc-map ; dup [ swap (chain-decomposed) ] curry assoc-map ;