uncomment unit tests and fix parser.state....

db4
Doug Coleman 2009-03-15 13:27:36 -05:00
parent 0a2038f435
commit 7f0aba9de0
2 changed files with 5 additions and 4 deletions

View File

@ -10,4 +10,5 @@ IN: html.parser.state.tests
[ "hello" ] [ "hello" [ take-rest ] string-parse ] unit-test
[ "hi" " how are you?" ] [ "hi how are you?" [ [ get-char blank? ] take-until take-rest ] string-parse ] unit-test
[ "foo" ";bar" ] [ "foo;bar" [ CHAR: ; take-char take-rest ] string-parse ] unit-test
! [ "foo " " bar" ] [ "foo and bar" [ "and" take-string take-rest ] string-parse ] unit-test
[ "foo " " bar" ]
[ "foo and bar" [ "and" take-string take-rest ] string-parse ] unit-test

View File

@ -29,13 +29,13 @@ TUPLE: state string i ;
] [ drop ] if ; inline recursive
: take-until ( quot: ( -- ? ) -- )
[ get-i ] dip skip-until get-i
get-i [ skip-until ] dip get-i
state get string>> subseq ;
: string-matches? ( string circular -- ? )
get-char over push-circular sequence= ;
get-char over push-growing-circular sequence= ;
: take-string ( match -- string )
dup length <circular-string>
dup length <growing-circular>
[ 2dup string-matches? ] take-until nip
dup length rot length 1- - head next ;