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

[REBOL] Re: YAPAQ

From: rlist:techscribe at: 5-Mar-2004 13:21

Hi Hallvard. you wrote: (1)
>I want to parse a string like this: > >{word1 word2 "expression 1" "expression 2" word3 "expression 3"} >and I want the output to be: > >["word1" "word2" "expression 1" "expression 2" "word3" "expression 3"] >
and (2)
>Yes, but: >>> a: parse {e1 e2 "e 3" e4 ee"e 5" e6 ^{e 7^}} none >== ["e1" "e2" "e 3" "e4" {ee"e} {5"} "e6" "{e" "7}"] >>> print third a >e 3 > >So 1) I need a parse rule that will see { } as string delimiters, and preferably > >also divide {ee"e 5"} into ["ee" "e5"] or [{ee"e 5"}] And 2) I want to keep the quotes, > >so that this could be the output: >>> print third >"e 3" >
Comparing your two posts I'm confused as to what you want. In post one the string "expression 3" was supposed to evaluate to "expression 3". Well, print "expression 3" will look like your first "e 3" example, namely minus quotation marks. If, instead, print third a (note the missing a in your example code the second time around) should evaluate to "e 3", then in your first post, you should have asked that "expression 3" evaluate to {"expression 3"}. Now, I don't know where your error is: Is the error in your first post, and "expression 3" should have become {"expression 3"} in your example? Or is the error in your second post, and you do not realize that expression 3 will be displayed as expression 3, whereas what you are looking for is
>> print mold third a
e 3