From 034bda42caede36f3afe415940cabd0331caaef3 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 11 Mar 2009 17:06:45 -0500 Subject: [PATCH] Inline initial state in next-match loop --- basis/regexp/regexp.factor | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/basis/regexp/regexp.factor b/basis/regexp/regexp.factor index 22c7e2474f..29f7e3e84e 100644 --- a/basis/regexp/regexp.factor +++ b/basis/regexp/regexp.factor @@ -51,8 +51,8 @@ PRIVATE> : search-range ( i string reverse? -- seq ) [ drop dup 1+ -1 ] [ length 1 ] if range boa ; inline -:: next-match ( i string regexp word reverse? -- i start end ? ) +:: next-match ( i string regexp quot: ( i string regexp -- j ) reverse? -- i start end ? ) f f f f i string reverse? search-range - [ [ 2drop 2drop ] dip string regexp word reverse? (next-match) dup ] find 2drop ; inline + [ [ 2drop 2drop ] dip string regexp quot reverse? (next-match) dup ] find 2drop ; inline : do-next-match ( i string regexp -- i start end ? ) dup next-match>> @@ -151,7 +151,7 @@ DEFER: compile-next-match : compile-next-match ( regexp -- regexp ) dup '[ dup \ next-initial-word = [ - drop _ [ compile-regexp dfa>> ] [ reverse-regexp? ] bi + drop _ [ compile-regexp dfa>> def>> ] [ reverse-regexp? ] bi '[ { array-capacity string regexp } declare _ _ next-match ] (( i string regexp -- i start end string )) simple-define-temp ] when