[REBOL] Re: Problems with parsing
From: rotenca:telvia:it at: 30-Nov-2001 12:32
> 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? :)
No, of course :-)
> 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.
rule1: [some ['| (print "*******") opt rule1 | set item word! (print mold
rule: [h: opt ['| (h: tail h)] :h rule1]
parse block rule
> 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.
I understand. My idea is that one should match first the special pattern and
take some consequent actions, like to put the input index to the end of block
and then asking at least any-type!.
> 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 ;-)
But there is at least one little problem with Ladislav's not-rule:
>> nr: not-rule 
== [[ (finish: [end skip]) | (finish: )] finish]
>> parse  nr
>> parse  nr