fix bug in state-parser, add take-token
parent
947bcc3d33
commit
d64e07af8b
|
@ -79,3 +79,6 @@ IN: html.parser.state.tests
|
|||
[ CHAR: \ CHAR: " take-quoted-string drop ]
|
||||
[ "\"abc" take-sequence ] bi
|
||||
] unit-test
|
||||
|
||||
[ "c" ]
|
||||
[ "c" <state-parser> take-token ] unit-test
|
||||
|
|
|
@ -36,7 +36,7 @@ TUPLE: state-parser sequence n ;
|
|||
state-parser quot call [ state-parser advance quot skip-until ] unless
|
||||
] when ; inline recursive
|
||||
|
||||
: state-parse-end? ( state-parser -- ? ) peek-next not ;
|
||||
: state-parse-end? ( state-parser -- ? ) current not ;
|
||||
|
||||
: take-until ( state-parser quot: ( obj -- ? ) -- sequence/f )
|
||||
over state-parse-end? [
|
||||
|
@ -96,3 +96,6 @@ TUPLE: state-parser sequence n ;
|
|||
] [
|
||||
start-n state-parser (>>n) f
|
||||
] if ;
|
||||
|
||||
: take-token ( state-parser -- string )
|
||||
skip-whitespace [ current { [ blank? ] [ f = ] } 1|| ] take-until ;
|
||||
|
|
Loading…
Reference in New Issue