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

brainfart parse problem

 [1/7] from: timewarp:sirius at: 6-Jun-2001 2:15


okay:
>> 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"? thanks in advance. cheerfulness, -----EAT -- Erin A. Thomas --- == --- (707) 463-8578 ---- www.mochinet.com ----

 [2/7] from: gjones05:mail:orion at: 6-Jun-2001 6:59


From: "Erin Thomas"
> okay: > >> rule: [thru "x" copy a [ opt to "y" | to "z"]]
<<quoted lines omitted: 5>>
> now... how do i work the rule so it will stop at "z" > if "z" happens to be before "y"?
Ah, yes, the cerebral flatulance syndome... :-) If I understand what you want, what you will be happier with is using markers and parse/all. rule: [thru "x" start: to "z" ending: (a: copy/part start ending) to end] parse/all "x .... ab z cd y" rule print a Of, course, if I didn't understand what you wanted, and can't figure out the adjustment, give the list another yell. --Scott Jones

 [3/7] from: lmecir:mbox:vol:cz at: 6-Jun-2001 15:43


valid: complement charset "xz" parse "x .... ab z cd y" [thru #"x" copy a [any valid] to end] ; == true a ; == " .... ab "

 [4/7] from: timewarp:sirius at: 6-Jun-2001 14:12


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"? cheerfulness, -----EAT Ladislav Mecir wrote:
> valid: complement charset "xz" > parse "x .... ab z cd y" [thru #"x" copy a [any valid] to end] ; == true
<<quoted lines omitted: 37>>
> [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Erin A. Thomas --- == --- (707) 463-8578 ---- www.mochinet.com ----

 [5/7] from: gjones05:mail:orion at: 6-Jun-2001 16:55


> > From: "Erin Thomas" > > > >> rule: [thru "x" copy a [ opt to "y" | to "z"]]
<<quoted lines omitted: 10>>
> > 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"?
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 --Scott Jones

 [6/7] 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"]]
<<quoted lines omitted: 18>>
> > would i get the same effect given that the "z" > > and "y" were actually "zyx" and "yza"?
From: "Scott Jones"
> How about: > a: copy ""
<<quoted lines omitted: 8>>
> 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

 [7/7] from: lmecir:mbox:vol:cz at: 7-Jun-2001 11:08


Try: invalid: ["zyx" | "yza"] valid: [invalid to end | copy b skip (append a b)] parse/all "x ...ab yza kk zyx" [(a: copy "") thru #"x" [any valid]] ; == true a ; == " ...ab "

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted