Updating XML and Unicode for recent changes
parent
0ea300ccfa
commit
1ad96ad319
|
@ -18,7 +18,7 @@ IN: assocs.lib
|
|||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
: set-hash-stack ( value key seq -- )
|
||||
dupd [ key? ] curry* find-last nip set-at ;
|
||||
dupd [ key? ] when find-last nip set-at ;
|
||||
|
||||
: at-default ( key assoc -- value/key )
|
||||
dupd at [ nip ] when* ;
|
||||
|
|
|
@ -2,7 +2,7 @@ USING: kernel parser words sequences ;
|
|||
IN: const
|
||||
|
||||
: define-const ( word value -- )
|
||||
[ parsed ] curry dupd define-compound
|
||||
[ parsed ] curry dupd define
|
||||
t "parsing" set-word-prop ;
|
||||
|
||||
: CONST:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
USING: delegate help.syntax help.markup ;
|
||||
USING: help.syntax help.markup ;
|
||||
IN: delegate
|
||||
|
||||
HELP: define-protocol
|
||||
{ $values { "wordlist" "a sequence of words" } { "protocol" "a word for the new protocol" } }
|
||||
|
|
|
@ -30,10 +30,9 @@ CATEGORY: grapheme-control Zl Zp Cc Cf ;
|
|||
concat >set ;
|
||||
|
||||
: other-extend-lines ( -- lines )
|
||||
"extra/unicode/PropList.txt" resource-path <file-reader> lines ;
|
||||
"extra/unicode/PropList.txt" resource-path file-lines ;
|
||||
|
||||
DEFER: other-extend
|
||||
<< other-extend-lines process-other-extend \ other-extend define-value >>
|
||||
|
||||
CATEGORY: (extend) Me Mn ;
|
||||
: extend? ( ch -- ? )
|
||||
|
@ -79,11 +78,6 @@ SYMBOL: table
|
|||
graphemes Extend connect-after ;
|
||||
|
||||
DEFER: grapheme-table
|
||||
<<
|
||||
init-grapheme-table table
|
||||
[ make-grapheme-table finish-table ] with-variable
|
||||
\ grapheme-table define-value
|
||||
>>
|
||||
|
||||
: grapheme-break? ( class1 class2 -- ? )
|
||||
grapheme-table nth nth not ;
|
||||
|
@ -125,3 +119,11 @@ DEFER: grapheme-table
|
|||
|
||||
: prev-grapheme ( i str -- prev-i )
|
||||
prev-grapheme-step (prev-grapheme) ;
|
||||
|
||||
[
|
||||
other-extend-lines process-other-extend \ other-extend define-value
|
||||
|
||||
init-grapheme-table table
|
||||
[ make-grapheme-table finish-table ] with-variable
|
||||
\ grapheme-table define-value
|
||||
] with-compilation-unit
|
||||
|
|
|
@ -3,5 +3,5 @@ USING: tools.test kernel unicode.categories words sequences unicode.syntax ;
|
|||
[ { f f t t f t t f f t } ] [ CHAR: A {
|
||||
blank? letter? LETTER? Letter? digit?
|
||||
printable? alpha? control? uncased? character?
|
||||
} [ execute ] curry* map ] unit-test
|
||||
} [ execute ] with map ] unit-test
|
||||
[ "Nd" ] [ CHAR: 3 category ] unit-test
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
USING: assocs math kernel sequences io.files hashtables quotations
|
||||
splitting arrays math.parser combinators.lib hash2 byte-arrays words
|
||||
namespaces words ;
|
||||
USING: assocs math kernel sequences io.files hashtables
|
||||
quotations splitting arrays math.parser combinators.lib hash2
|
||||
byte-arrays words namespaces words compiler.units ;
|
||||
IN: unicode.data
|
||||
|
||||
! Convenience functions
|
||||
|
@ -116,19 +116,7 @@ DEFER: class-map
|
|||
DEFER: compat-map
|
||||
DEFER: category-map
|
||||
DEFER: name-map
|
||||
|
||||
<<
|
||||
load-data
|
||||
dup process-names \ name-map define-value
|
||||
13 over process-data \ simple-lower define-value
|
||||
12 over process-data tuck \ simple-upper define-value
|
||||
14 over process-data swapd union \ simple-title define-value
|
||||
dup process-combining \ class-map define-value
|
||||
dup process-canonical \ canonical-map define-value
|
||||
\ combine-map define-value
|
||||
dup process-compat \ compat-map define-value
|
||||
process-category \ category-map define-value
|
||||
>>
|
||||
DEFER: special-casing
|
||||
|
||||
: canonical-entry ( char -- seq ) canonical-map at ;
|
||||
: combine-chars ( a b -- char/f ) combine-map hash2 ;
|
||||
|
@ -144,6 +132,16 @@ DEFER: name-map
|
|||
[ length 5 = ] subset
|
||||
[ [ set-code-point ] each ] H{ } make-assoc ;
|
||||
|
||||
DEFER: special-casing
|
||||
|
||||
<< load-special-casing \ special-casing define-value >>
|
||||
[
|
||||
load-data
|
||||
dup process-names \ name-map define-value
|
||||
13 over process-data \ simple-lower define-value
|
||||
12 over process-data tuck \ simple-upper define-value
|
||||
14 over process-data swapd union \ simple-title define-value
|
||||
dup process-combining \ class-map define-value
|
||||
dup process-canonical \ canonical-map define-value
|
||||
\ combine-map define-value
|
||||
dup process-compat \ compat-map define-value
|
||||
process-category \ category-map define-value
|
||||
load-special-casing \ special-casing define-value
|
||||
] with-compilation-unit
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
USING: sequences namespaces unicode.data kernel combinators.lib math
|
||||
unicode arrays ;
|
||||
USING: sequences namespaces unicode.data kernel combinators.lib
|
||||
math arrays ;
|
||||
IN: unicode.normalize
|
||||
|
||||
! Utility word
|
||||
|
@ -89,7 +89,7 @@ IN: unicode.normalize
|
|||
swap [ [
|
||||
dup hangul? [ hangul>jamo % drop ]
|
||||
[ dup rot call [ % ] [ , ] ?if ] if
|
||||
] curry* each ] "" make*
|
||||
] with each ] "" make*
|
||||
dup reorder
|
||||
] if ; inline
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ IN: unicode.syntax
|
|||
category# categories nth ;
|
||||
|
||||
: >category-array ( categories -- bitarray )
|
||||
categories [ swap member? ] curry* map >bit-array ;
|
||||
categories [ swap member? ] with map >bit-array ;
|
||||
|
||||
: as-string ( strings -- bit-array )
|
||||
concat "\"" tuck 3append parse first ;
|
||||
concat "\"" tuck 3append eval ;
|
||||
|
||||
: [category] ( categories -- quot )
|
||||
[
|
||||
|
|
|
@ -23,7 +23,7 @@ M: process-missing error.
|
|||
: PROCESS:
|
||||
CREATE
|
||||
dup H{ } clone "xtable" set-word-prop
|
||||
dup [ run-process ] curry define-compound ; parsing
|
||||
dup [ run-process ] curry define ; parsing
|
||||
|
||||
: TAG:
|
||||
scan scan-word
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
! Copyright (C) 2005, 2006 Daniel Ehrenberg
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: help.markup help.syntax kernel xml xml.data xml.errors
|
||||
USING: help.markup help.syntax kernel xml.data xml.errors
|
||||
xml.writer state-parser xml.tokenize xml.utilities xml.entities
|
||||
strings sequences io ;
|
||||
IN: xml
|
||||
|
||||
HELP: string>xml
|
||||
{ $values { "string" "a string" } { "xml" "an xml document" } }
|
||||
|
|
Loading…
Reference in New Issue