Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: parse/recycle bug

From: rotenca:telvia:it at: 13-Sep-2002 16:29

Hi all this is the compose-string function with the references patch: rebol [] delimit: ["$(" | "%(" | "*("] escapes: ["$$" | "%%" | "**"] notpar: complement charset ")" compose-string: function [[catch] String [string!] /trace][ macro escape start end esc comm refs ][ refs: clear [] if trace [print [" +++ Compose-string" mold string]] escape: [esc: escapes opt (esc: remove next esc ) :esc] n: 0 macro: [ some [ start: delimit [ any [ [ (insert tail refs macro macro: use [start][bind/copy macro 'start]) macro ] | escape | notpar ] #")" end: ] opt ( if "" = comm: copy/part skip start 2 back end [comm: {""}] change/part start do comm end if trace [print [" === Eval" comm "=" mold do comm]] ) :start ] ] either parse/all String: copy String [ some [macro | escape | skip] ][string][throw make error! "Invalid string"] ] home: "to2" loop 500 [compose-string "go *(home) *(home)"] halt --- Ciao Romano