X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=basis%2Fregexp%2Fregexp.factor;h=4318986813d5eeaf3b9eca90b163112e823ac0cd;hp=21439640fe18f6934606946006062c301265ab14;hb=3f3d57032bf29190e9bee12d168a4bce6d74653c;hpb=cd1bb8f4c8afba318249c7b756a45aa1c46ea51e diff --git a/basis/regexp/regexp.factor b/basis/regexp/regexp.factor index 21439640fe..4318986813 100644 --- a/basis/regexp/regexp.factor +++ b/basis/regexp/regexp.factor @@ -25,7 +25,7 @@ M: lookahead question>quot ! Returns ( index string -- ? ) M: lookbehind question>quot ! Returns ( index string -- ? ) term>> ast>dfa dfa>reverse-shortest-word - '[ [ 1- ] dip f _ execute ] ; + '[ [ 1 - ] dip f _ execute ] ; : check-string ( string -- string ) ! Make this configurable @@ -53,12 +53,12 @@ PRIVATE> :: (next-match) ( i string regexp quot: ( i string regexp -- j ) reverse? -- i start end ? ) i string regexp quot call dup [| j | j i j - reverse? [ swap [ 1+ ] bi@ ] when + reverse? [ swap [ 1 + ] bi@ ] when string ] [ drop f f f f ] if ; inline : search-range ( i string reverse? -- seq ) - [ drop dup 1+ -1 ] [ length 1 ] if range boa ; inline + [ drop dup 1 + -1 ] [ length 1 ] if range boa ; inline :: next-match ( i string regexp quot: ( i string regexp -- j ) reverse? -- i start end ? ) f f f f @@ -93,7 +93,7 @@ PRIVATE> [ subseq ] map-matches ; : count-matches ( string regexp -- n ) - [ 0 ] 2dip [ 3drop 1+ ] each-match ; + [ 0 ] 2dip [ 3drop 1 + ] each-match ; dup skip-blank [ [ index-from ] 2keep [ swapd subseq ] - [ 2drop 1+ ] 3bi + [ 2drop 1 + ] 3bi ] change-lexer-column ; : parse-noblank-token ( lexer -- str/f ) @@ -220,4 +220,4 @@ USING: vocabs vocabs.loader ; "prettyprint" vocab [ "regexp.prettyprint" require -] when \ No newline at end of file +] when