Bug in parse?
[1/4] from: cyphre::volny::cz at: 22-Aug-2001 10:06
Helo guys,
>> parse/all "^/" "^/"
== [""]
>> parse/all "^/ " "^/"
== ["" " "]
>> parse/all " ^/" "^/"
== [" "] ;why is not the result [" " ""] ??? Maybe
bug?
>>
Cyphre
[2/4] from: robert:muench:robertmuench at: 22-Aug-2001 16:55
> -----Original Message-----
> From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]On Behalf
> Of Richard Smolak
> Sent: Wednesday, August 22, 2001 10:07 AM
> To: [rebol-list--rebol--com]
> Subject: [REBOL] Bug in parse?
Hi, well only my personal theory: Parse will filter the separation sequence for
you.
> >> parse/all "^/" "^/"
> == [""]
Here parse doesn't find anything before the separation sequence -> ""
> >> parse/all "^/ " "^/"
> == ["" " "]
Same here and a space later.
> >> parse/all " ^/" "^/"
> == [" "] ;why is not the result [" " ""] ??? Maybe
Here parse finds a space and than the separation sequence AND end-of-string.
Parse stops at end-of-string, that's why you only get the " " sequence as
result. Robert
[3/4] from: cyphre:volny:cz at: 22-Aug-2001 17:42
Hi Robert,
Thanks for your explanation. It sounds logical tome but I think 'parse
should behave a little bit different in case of parsing ends of lines.
Especially when we need to parse blocks like that:
blk: [<bla> 12356 {
abcd
} <bla> 7890 ...]
parse blk [some [set a string! (probe parse a "^/")| skip] to end]
In that case cannot get the right count of lines in the parsed
string...only solution is to add " " after all EOLs or maybe my method is
wrong? Anyone?
regards
Cyphre
[4/4] from: robert:muench:robertmuench at: 22-Aug-2001 19:46
> -----Original Message-----
> From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]On Behalf
<<quoted lines omitted: 12>>
> string...only solution is to add " " after all EOLs or maybe my method is
> wrong? Anyone?
Hi, note I didn't tested this so be careful ;-)
parse blk [ some [ copy mystring to newline (probe mystring) newline]]
Robert
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted