]> gitweb.factorcode.org Git - factor.git/commitdiff
Making all the regexp words compile
authorDaniel Ehrenberg <littledan@Macintosh-122.local>
Mon, 9 Mar 2009 22:29:32 +0000 (17:29 -0500)
committerDaniel Ehrenberg <littledan@Macintosh-122.local>
Mon, 9 Mar 2009 22:29:32 +0000 (17:29 -0500)
basis/regexp/compiler/compiler.factor
basis/regexp/regexp-tests.factor

index 23171b4636fc3d5b790102ed90ff25c9fc43b99f..eedf05a81e16ef7eb1dbe778f68b48d63199abb6 100644 (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 ;
+            '[
+                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
index 0a448ed2760aeca385eae669ed26311bc62312cf..99cb8dbd22219116176dfd6868b85eba2c395441 100644 (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