]> gitweb.factorcode.org Git - factor.git/commitdiff
regexp: don't use execute so the generated code is easier to read
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 10 Aug 2022 00:41:07 +0000 (17:41 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 10 Aug 2022 00:41:07 +0000 (17:41 -0700)
basis/regexp/compiler/compiler.factor
basis/regexp/regexp.factor

index c4b3aa2b6981ebc0743576a6e817f2a5dbb151c9..9102836d68798eeb2ba16af6e9c23c143fe4a60f 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2009 Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs combinators combinators.short-circuit
-kernel kernel.private math namespaces regexp.classes
+kernel kernel.private math namespaces quotations regexp.classes
 regexp.transition-tables sequences sequences.private sets
 strings unicode words ;
 IN: regexp.compiler
@@ -51,7 +51,7 @@ M: word-break question>quot
         [ question>> question>quot ] [ yes>> ] [ no>> ] tri
         [ (execution-quot) ] bi@
         '[ 2dup @ _ _ if ]
-    ] [ '[ _ execute ] ] if ;
+    ] [ 1quotation ] if ;
 
 : execution-quot ( next-state -- quot )
     dup sequence? [ first ] when
index b243f16f588d1fdc2992eeaad51040f5ada91ae0..42138d5c66e7792b109f2b1651837fa6e02e496f 100644 (file)
@@ -1,9 +1,10 @@
 ! Copyright (C) 2008, 2009 Doug Coleman, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays classes compiler.units kernel
-kernel.private lexer make math ranges namespaces regexp.ast
-regexp.compiler regexp.negation regexp.parser sequences
-sequences.private splitting strings vocabs.loader words ;
+kernel.private lexer make math ranges namespaces quotations
+regexp.ast regexp.compiler regexp.negation regexp.parser
+sequences sequences.private splitting strings vocabs.loader
+words ;
 IN: regexp
 
 TUPLE: regexp
@@ -18,7 +19,7 @@ TUPLE: reverse-regexp < regexp ;
 
 M: lookahead question>quot
     ! Returns ( index string -- ? )
-    term>> ast>dfa dfa>shortest-word '[ f _ execute ] ;
+    term>> ast>dfa dfa>shortest-word 1quotation [ f ] prepose ;
 
 : <reversed-option> ( ast -- reversed )
     "r" string>options <with-options> ;
@@ -27,7 +28,7 @@ M: lookbehind question>quot
     ! Returns ( index string -- ? )
     term>> <reversed-option>
     ast>dfa dfa>reverse-shortest-word
-    '[ [ 1 - ] dip f _ execute ] ;
+    1quotation [ [ 1 - ] dip f ] prepose ;
 
 : match-index-from ( i string regexp -- index/f )
     ! This word is unsafe. It assumes that i is a fixnum