]> gitweb.factorcode.org Git - factor.git/commitdiff
peg: simplify parse-satisfy.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 30 Mar 2016 17:29:43 +0000 (10:29 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 30 Mar 2016 17:30:36 +0000 (10:30 -0700)
basis/peg/peg.factor

index ac1c525de7e9ddbdca80aaa6ce4769b6db2339bd..1ac261494b372218c3b743b9121dae5ce78417e2 100644 (file)
@@ -345,15 +345,15 @@ M: token-parser (compile) ( peg -- quot )
 TUPLE: satisfy-parser quot ;
 
 : parse-satisfy ( input quot -- result )
-    swap dup empty? [
-        2drop f
+    swap [
+        drop f
     ] [
         unclip-slice rot dupd call [
             <parse-result>
         ] [
             2drop f
         ] if
-    ] if ; inline
+    ] if-empty ; inline
 
 M: satisfy-parser (compile)
     quot>> '[ input-slice _ parse-satisfy ] ;