Making all the regexp words compile

db4
Daniel Ehrenberg 2009-03-09 17:29:32 -05:00
parent 72c4736936
commit 6ccd58f278
2 changed files with 10 additions and 9 deletions

View File

@ -106,13 +106,15 @@ C: <box> box
transitions>quot ;
: states>code ( words dfa -- )
'[
[ ! with-compilation-unit doesn't compile, so we need call( -- )
[
'[
dup _ word>quot
(( last-match index string -- ? ))
define-declared
] each
] with-compilation-unit ;
] with-compilation-unit
] call( words dfa -- ) ;
: states>words ( dfa -- words dfa )
dup transitions>> keys [ gensym ] H{ } map>assoc

View File

@ -5,9 +5,8 @@ eval strings multiline accessors regexp.matchers ;
IN: regexp-tests
\ <regexp> must-infer
! the following don't compile because [ ] with-compilation-unit doesn't compile
! \ compile-regexp must-infer
! \ matches? must-infer
\ compile-regexp must-infer
\ matches? must-infer
[ f ] [ "b" "a*" <regexp> matches? ] unit-test
[ t ] [ "" "a*" <regexp> matches? ] unit-test