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

[REBOL] Re: brainfart parse problem

From: gjones05:mail:orion at: 6-Jun-2001 16:59

Whoops forgot second example...
> > > From: "Erin Thomas" > > > > >> rule: [thru "x" copy a [ opt to "y" | to "z"]] > > > > == [thru "x" copy a [opt to "y" | to "z"]] > > > > >> parse "x .... ab z cd y" rule > > > > == false > > > > >> a > > > > == " .... ab z cd " > > > > > > > > now... how do i work the rule so it will stop at "z" > > > > if "z" happens to be before "y"? > > > Ladislav Mecir wrote: > > > > > > valid: complement charset "xz" > > > parse "x .... ab z cd y" [thru #"x" copy a [any valid] to end] ; > true > > > a ; == " .... ab " > > From: "Erin Thomas" > > this is kind of what i want, but the "valid"s > > aren't individual characters, they are a series > > of characters, so doing a charset is out. how > > would i get the same effect given that the "z" > > and "y" were actually "zyx" and "yza"?
From: "Scott Jones"
> How about: > > a: copy "" > rule: [ > thru "x" > start: > [to "z" | to "y"] > ending: > (a: copy/part start ending) > to end > ] > parse/all "x .... ab zyx cd yza" rule > print a ; yields: .... ab
Or also ;-): a: copy "" rule: [ thru "x" copy a [to "z" | to "y"] to end ] parse/all "x .... ab zyx cd yza" rule print a --Scott Jones