[gforth] / gforth / regexp.fs  

gforth: gforth/regexp.fs

Diff for /gforth/regexp.fs between version 1.15 and 1.16

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


Generate output suitable for use with a patch program
Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help