From 7f0aba9de033f35fdc3ef9314bb19aaab146a0b7 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 15 Mar 2009 13:27:36 -0500 Subject: [PATCH] uncomment unit tests and fix parser.state.... --- extra/html/parser/state/state-tests.factor | 3 ++- extra/html/parser/state/state.factor | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/extra/html/parser/state/state-tests.factor b/extra/html/parser/state/state-tests.factor index a9be38c0b5..da70d0fa12 100644 --- a/extra/html/parser/state/state-tests.factor +++ b/extra/html/parser/state/state-tests.factor @@ -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 diff --git a/extra/html/parser/state/state.factor b/extra/html/parser/state/state.factor index 4b1027d338..cda601866e 100644 --- a/extra/html/parser/state/state.factor +++ b/extra/html/parser/state/state.factor @@ -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 + dup length [ 2dup string-matches? ] take-until nip dup length rot length 1- - head next ;