From a28a80abcfc57b4fb2067d78d551c2334c995f39 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Tue, 3 Mar 2009 12:41:50 -0600 Subject: [PATCH] Regexp uses sequences:map-find now --- basis/regexp/matchers/matchers.factor | 7 +------ basis/regexp/regexp-tests.factor | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/basis/regexp/matchers/matchers.factor b/basis/regexp/matchers/matchers.factor index 4b5f29103d..d06ac4fef1 100644 --- a/basis/regexp/matchers/matchers.factor +++ b/basis/regexp/matchers/matchers.factor @@ -20,11 +20,6 @@ GENERIC: match-index-from ( i string matcher -- index/f ) dupd match-index-head [ swap length = ] [ drop f ] if* ; -: map-find ( seq quot -- result elt ) - [ f ] 2dip - '[ nip @ dup ] find - [ [ drop f ] unless ] dip ; inline - :: match-from ( i string matcher -- slice/f ) i string length [a,b) [ string matcher match-slice ] map-find drop ; @@ -40,7 +35,7 @@ GENERIC: match-index-from ( i string matcher -- index/f ) PRIVATE> :: all-matches ( string matcher -- seq ) - 0 [ dup ] [ string matcher next-match ] [ ] produce nip but-last ; + 0 [ dup ] [ string matcher next-match ] produce nip but-last ; : count-matches ( string matcher -- n ) all-matches length ; diff --git a/basis/regexp/regexp-tests.factor b/basis/regexp/regexp-tests.factor index 9d94c4126b..21653077a8 100644 --- a/basis/regexp/regexp-tests.factor +++ b/basis/regexp/regexp-tests.factor @@ -1,10 +1,9 @@ -USING: regexp tools.test kernel sequences regexp.parser +USING: regexp tools.test kernel sequences regexp.parser regexp.private regexp.traversal eval strings multiline accessors regexp.matchers ; IN: regexp-tests \ must-infer \ compile-regexp must-infer -\ compile-dfa-quot must-infer \ matches? must-infer [ f ] [ "b" "a*" matches? ] unit-test