[REBOL] pinging SELMA Re:(2)
From: jeff:rebol at: 20-Sep-2000 11:05
Howdy, Brian:
> There is a long-standing bug in the
> parse native in all versions of REBOL that affects the code
> in SELMA that parses subject lines.
> ; Second, with optional more than one "a"
> y-cnt: 0
> parse a: "y a a y z" [
> some [
> to "y" here: "y"
> 0 2 "a" ; Note more than one "a" optional here
> any " " there:
> (y-cnt: 1 + :y-cnt remove/part :here :there) :here
> ] ; This block should run twice, but doesn't
> ]
> print [mold a y-cnt {(should be "z" 2)}]
Hmmm, I don't believe this is a bug. The 0 2 "a" matches
two instances of "a". Check out:
http://www.rebol.com/users/parspace.html
"The parse function ignores all intervening whitespace
between patterns that it scans."
Try these:
parse "a a a a a b" [0 1 "a" m: (print m)]
parse "a a a a a b" [0 2 "a" m: (print m)]
parse "a a a a a b" [0 3 "a" m: (print m)]
. . .
[0 2 "a"] is like saying [0 1 "a" 0 1 "a"]
-jeff