Hi Romano,

Thanks for your post. It is a good demonstration of how a problem can often
be thought about differently and therefore solved. Something important to
keep in mind with creating parse rules.

Something to think about regarding your solution is the ways that it is not
equivalent to mine. You already pointed out
that yours returns true for a void block by design. But yours also returns
true when '| is the first word in the block. Also
by design? :)  It doesn't really matter if was or wasn't by design, but it
might be interesting to work out how you would change your rule to ensure
that '| is not the first word in the block.

However, my purpose wasn't to show how my example block could be parsed.
Peter asked for a rule that matched text NOT including a special pattern.

NOT is a useful operator in logic, I wonder why it is not in Parse as a
dialect keyword. That is, would it not be nice to have the following
statement return true?

    parse [b] [not 'a]

Ladislav orginally solved this problem when I asked about it before. He has
some parse enhancements on his rebsite in the script called parseen.r. Worth
a look. I could have saved some typing by responding to Peter that his
question is answered
in parseen.r by Ladislav - though you may need to look twice or thrice and
learn something new to follow it - as is typical of Ladislav's work ;-)

Regards,
Brett.

----- Original Message -----
From: "Romano Paolo Tenca" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 30, 2001 12:52 PM
Subject: [REBOL] Re: Problems with parsing


> Hi Brett,
>
>  why not:
>
>  rule: [any ['| (print "*******") opt rule | set item word! (print mold
> item)]]
>  parse my-block rule
>
> this, by design, return true also for a void block.
>
> ---
> Ciao
> Romano


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to