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

Parse question

 [1/4] from: kpeters:vu-ware at: 30-Jul-2005 18:03


Hi Parsers ~ =A0 why does parse below not return= true? =A0 Thanks, Kai =A0 =A0 >>=A0st: "Kai was= here" == "Kai was here" >>=A0parse/all st [ thruai copy chunk to "here" ] == false >>=A0probe= chunk " was " == " was " >>

 [2/4] from: kpeters:vu-ware at: 30-Jul-2005 18:14


Arghh -= that was ugly! Let's try this again: Hi Parsers ~ why does parse below not return= true? Thanks, Kai  >> st: "Kai was= here" == "Kai was here" >> parse/all st [ thru "ai"= copy chunkto "here" ] == false >> probe chunk " was " == " was " >>

 [3/4] from: carl:cybercraft at: 31-Jul-2005 14:00


On Saturday, 30-July-2005 at 18:14:39 Kai Peters wrote,
> Arghh -= that was ugly! Let's try this again: Hi Parsers ~ why does >parse below not return= true? Thanks, Kai  >> st: "Kai >was= here" == "Kai was here" >> parse/all st [ thru "ai"= copy >chunkto "here" ] == false >> probe chunk " was " == " was " >>
Which wasn't much better, right? :-) I gather this is what you were attempting... st: "Kai was here" parse/all st [thru "ai" copy chunk to "here"] Change the parse to... parse/all st [thru "ai" copy chunk to "here" to end] and it should work. Also, I don't think /all has any effect when parsing a block. Can others confirm that? -- Carl Read.

 [4/4] from: volker::nitsch::gmail::com at: 31-Jul-2005 3:59


On 7/31/05, Kai Peters <[kpeters--vu-ware--com]> wrote:
> Hi Parsers ~ =A0 why does parse below not return= true? =A0 Thanks, Kai =A0 > =A0 >>=A0st: "Kai was= here" == "Kai was here" >>=A0parse/all st [ thru > "ai" copy chunk to "here" ] == false >>=A0probe= chunk " was > was " >>
str: { Hi Parsers ~ =A0 why does parse below not return= true? =A0 Thanks, Kai =A0 =A0 >>=A0st: "Kai was= here" == "Kai was here" >>=A0parse/all st [ thruai copy chunk to "here" ] == false >>=A0probe= chunk " was " == " was " >> --} letternum: charset[#"A" - #"Z" #"0" - #"9"] parse/all str[ any[to "=" [p: "=" 2 letternum (remove/part p 3) :p ] | skip] ] replace/all str " >>" "^/!>>" replace/all str "= " " " ? str { STR is a string of value: { Hi Parsers ~ why does parse below not return true? Thanks, Kai !>>st: "Kai was here" "Kai was here" !>>parse/all st [ thruai copy chunk to "here" ] false !>>probe chunk " was " " was " !>> --} Ok, now i get it. :) because the string must match upto the end. In your example the parsing goes to the "here", not thru, so not skipping it. you must skip that yourself. Some variants: to "here" to end ;; not exact, stuff can follow after "here" to "here" "here" ;; goes to "here" and then skips to "here" 4 skip ;; "" its somewhat ugly, having something like this would be nice: to "here" skip-last }
> -- > To unsubscribe from the list, just send an email to > lists at rebol.com with unsubscribe as the subject. >
-- -Volker Any problem in computer science can be solved with another layer of indirection. But that usually will create another problem. David Wheeler