[REBOL] Re: Parse
From: ryanc:iesco-dms at: 7-Mar-2001 17:15
If you are wandering why...
>> parse str [ copy text to "485-7993"]
works fine, yet...
>> parse str [ copy text to [area-code | none] phone-num]
** Script Error: Invalid argument: area-code | none.
** Where: parse str [copy text to [area-code | none] phone-num]
bombs, this is because the words 'to, 'thru, and 'skip dont seem to work
with blocks. 'Any and 'some will operate with blocks. Myself still
being quite awkward at 'parse, I am still perplexed as to how solve your
particular problem.
--Ryan
bill wrote:
> I've been busting my head for a while now against parse.
> I've been able to get simple rules to work famously and am able
> to get a lot of good results,,, but .
> Could someone please tell me where I'm going wrong here.
> If I run the following script the first parse is happy
> the second is not.. I have not been able to figure out what
> the proper way to do this is and I have spent too long at this.
>
> Thanks
> Bill.
>
> Using REBOL v 2.3.0.3.1
> REBOL [
> Title: "Test"
> Author: "Gyrus"
> Date: 3/02/2001
> Version: 0.1
> File: %test.r
> ]
>
> str: {
> 28/11/00 27.13 28.00 26.81 27.81 +0.93 2668900
> 27/11/00 26.31 27.63 26.25 26.88 +0.75 4346600
> 24/11/00 26.56 27.13 25.88 26.13 unch 810500
> 22/11/00 26.25 26.44 25.88 26.13 -0.12 1757300
> }
>
> digits: charset "0123456789"
> area-code: ["(" 3 digits ")"]
> phone-num: [3 digits "-" 4 digits]
>
> print parse str [ [area-code | none] phone-num]
>
> print parse str [ copy text to [area-code | none] phone-num]
>
> wait 10
>
> --
> To unsubscribe from this list, please send an email to
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Ryan Cole
Programmer Analyst
www.iesco-dms.com
707-468-5400
I am enough of an artist to draw freely upon my imagination.
Imagination is more important than knowledge. Knowledge is
limited. Imagination encircles the world.
-Einstein