]> gitweb.factorcode.org Git - factor.git/commitdiff
peg: fix (parse) to not compile every time it's called.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 23 Nov 2020 22:23:10 +0000 (14:23 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 23 Nov 2020 22:23:10 +0000 (14:23 -0800)
basis/peg/peg.factor

index 44c04f0f2ef9805a162db801de2bc2d7d501b502..5f644b5e914266ecd42e9481ffef7cb3218adeb0 100644 (file)
@@ -306,19 +306,19 @@ SYMBOL: delayed
 : compile ( parser -- word )
     [
         H{ } clone delayed [
-            compile-parser-quot ( -- result ) define-temp fixup-delayed
+            compile-parser fixup-delayed
         ] with-variable
     ] with-compilation-unit ;
 
 : compiled-parse ( state word -- result )
     swap [
-        execute( -- result )
+        execute-parser
         [ error-stack get ?first [ throw ]
         [ pos get input get f <parse-error> throw ] if* ] unless*
     ] with-packrat ;
 
 : (parse) ( input parser -- result )
-    dup word? [ compile ] unless compiled-parse ;
+    compile compiled-parse ;
 
 : parse ( input parser -- ast )
     (parse) ast>> ;