Making all the regexp words compile
parent
72c4736936
commit
6ccd58f278
|
@ -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 ;
|
||||
'[
|
||||
dup _ word>quot
|
||||
(( last-match index string -- ? ))
|
||||
define-declared
|
||||
] each
|
||||
] with-compilation-unit
|
||||
] call( words dfa -- ) ;
|
||||
|
||||
: states>words ( dfa -- words dfa )
|
||||
dup transitions>> keys [ gensym ] H{ } map>assoc
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue