From 09969a5fc2885c240539a357dca2b175abb49d44 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 22 Nov 2008 17:30:16 -0600 Subject: [PATCH] regexps return a slice instead of a range now --- basis/regexp/regexp.factor | 4 ++-- basis/regexp/traversal/traversal.factor | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/basis/regexp/regexp.factor b/basis/regexp/regexp.factor index c9a1d2f47d..4014c4507c 100644 --- a/basis/regexp/regexp.factor +++ b/basis/regexp/regexp.factor @@ -33,9 +33,9 @@ IN: regexp : matches? ( string regexp -- ? ) dupd match - [ [ length ] [ length>> 1- ] bi* = ] [ drop f ] if* ; + [ [ length ] bi@ = ] [ drop f ] if* ; -: match-head ( string regexp -- end/f ) match [ length>> 1- ] [ f ] if* ; +: match-head ( string regexp -- end/f ) match [ length ] [ f ] if* ; : match-at ( string m regexp -- n/f finished? ) [ diff --git a/basis/regexp/traversal/traversal.factor b/basis/regexp/traversal/traversal.factor index c9e8a54348..6bc44c7a99 100644 --- a/basis/regexp/traversal/traversal.factor +++ b/basis/regexp/traversal/traversal.factor @@ -144,7 +144,10 @@ M: capture-group-off flag-action ( dfa-traverser flag -- ) [ increment-state do-match ] when* ] unless ; -: return-match ( dfa-traverser -- interval/f ) +: return-match ( dfa-traverser -- slice/f ) dup matches>> [ drop f ] - [ [ start-index>> ] [ peek ] bi* 1 ] if-empty ; + [ + [ [ text>> ] [ start-index>> ] bi ] + [ peek ] bi* rot + ] if-empty ;