[REBOL] Re: Problems with parsing
From: lmecir:mbox:vol:cz at: 30-Nov-2001 14:12
Hi Romano,
<<Romano>>
But there is at least one little problem with Ladislav's not-rule:
>> nr: not-rule [1]
== [[[1] (finish: [end skip]) | (finish: [])] finish]
>> parse [1] nr
== false
>> parse [2] nr
== false
> Regards,
> Brett.
---
Ciao
Romano
<</Romano>>
This is not a problem with my rule, it is by design. If you want to match a
block that doesn't match the Rule: [integer!] at the start, you have to use
it as follows:
rule: [integer!]
nr: not-rule rule
parse [1 a] [nr to end]
parse [a 1] [nr to end]
If you want to match a block that doesn't match the rule anywhere, you have
to write it as follows:
parse [a b c 1 d] [any [nr skip]]
parse [a b c d e] [any [nr skip]]
HTH
Ladislav