regexps return a slice instead of a range now
parent
e110bac51a
commit
09969a5fc2
|
@ -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? )
|
||||
[
|
||||
|
|
|
@ -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 <range> ] if-empty ;
|
||||
[
|
||||
[ [ text>> ] [ start-index>> ] bi ]
|
||||
[ peek ] bi* rot <slice>
|
||||
] if-empty ;
|
||||
|
|
Loading…
Reference in New Issue