[REBOL] Re: Help with parsing
From: al:bri:xtra at: 22-Feb-2002 22:23
Richard wrote:
> It is unclear to me why the following statements fail. Any help in
understanding what is wrong with the following statements would be
appreciated.
> >> digits: [["0"] | ["1"] | ["2"] | ["3"] | ["4"] | ["5"] | ["6"] | ["7"]
| ["8"] | ["9"] ]
> == [["0"] | ["1"] | ["2"] | ["3"] | ["4"] | ["5"] | ["6"] | ["7"] | ["8"]
| ["9"]]
> >> parse {xx7xx9} [to digits copy answer to end]
> ** Script Error: Invalid argument: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
> ** Where: halt-view
> ** Near: parse "xx7xx9" [to digits copy answer to end]
> >>
'to in the 'parse rule doesn't work with "|". It requires a single value
only, not a block of values. It's a deficiency in Rebol. A better way of
describing 'digits is:
Digit: charset "0123456789"
Digits: [some Digit]
I hope that helps!
Andrew Martin
ICQ: 26227169 http://valley.150m.com/