--- gforth/regexp.fs 2010/05/27 09:16:11 1.15 +++ gforth/regexp.fs 2010/09/04 21:34:23 1.16 @@ -269,8 +269,6 @@ Variable >>string : << ( run-addr addr u -- run-addr ) \ regexp-replace \G Replace string from start of replace pattern region with \G @var{addr} @var{u} - <>string @ 0= IF s" " >>string $! THEN <>ptr over - >>string $+! >>string $+! dup to <" -- ) \ regexp-replace @@ -278,16 +276,17 @@ Variable >>string \G @var{string} '" parse postpone SLiteral postpone << ; immediate : >>string@ ( -- addr u ) - >>string $@ >>string off - 0 to >>ptr 0 to <>string $@ ; +: >>string0 ( addr u -- addr u ) s" " >>string $! + 0 to >>ptr over to <>next ( -- addr u ) <>rest ( -- ) >>next >>string $+! ; : s// ( addr u -- ptr ) \G start search/replace loop - ]] (( // >> [[ ; immediate + ]] >>string0 (( // >> [[ ; immediate : //o ( ptr addr u -- addr' u' ) \G end search/replace single loop ]] << )) drop >>rest >>string@ [[ ; immediate : //g ( ptr addr u -- addr' u' ) \G end search/replace all loop - ]] << LEAVE )) drop >>string@ [[ ; immediate + ]] << LEAVE )) drop >>rest >>string@ [[ ; immediate