regexps return a slice instead of a range now
parent
e110bac51a
commit
09969a5fc2
|
@ -33,9 +33,9 @@ IN: regexp
|
||||||
|
|
||||||
: matches? ( string regexp -- ? )
|
: matches? ( string regexp -- ? )
|
||||||
dupd match
|
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? )
|
: match-at ( string m regexp -- n/f finished? )
|
||||||
[
|
[
|
||||||
|
|
|
@ -144,7 +144,10 @@ M: capture-group-off flag-action ( dfa-traverser flag -- )
|
||||||
[ increment-state do-match ] when*
|
[ increment-state do-match ] when*
|
||||||
] unless ;
|
] unless ;
|
||||||
|
|
||||||
: return-match ( dfa-traverser -- interval/f )
|
: return-match ( dfa-traverser -- slice/f )
|
||||||
dup matches>>
|
dup matches>>
|
||||||
[ drop f ]
|
[ drop f ]
|
||||||
[ [ start-index>> ] [ peek ] bi* 1 <range> ] if-empty ;
|
[
|
||||||
|
[ [ text>> ] [ start-index>> ] bi ]
|
||||||
|
[ peek ] bi* rot <slice>
|
||||||
|
] if-empty ;
|
||||||
|
|
Loading…
Reference in New Issue