[antlr-interest] How to do "not" in a syntactic predicate?
Kaleb Pederson
kaleb.pederson at gmail.com
Fri Oct 16 12:44:35 PDT 2009
On Fri, Oct 16, 2009 at 4:39 AM, Naveen Chawla
<naveen.chwl at googlemail.com> wrote:
> So, does anybody have a way of doing "Take *a* IF not followed by *b* (both
> syntactic constructs)" ?
>
> i.e.
> q: (a !b)=> a; //("!" or "not" doesn't exist in
> ANTLR)
I think that would be a nice syntax for ANTLR to support.
I would guess that you could generally accomplish the same thing by
placing the "opposite" syntactic predicate on your other
alternative(s) in your production. In other words:
(a b)=> alternative_1
| alternative_2 ...
Rather than:
(a !b)=> alternative_2
| alternative_1
--
Kaleb Pederson
Twitter - http://twitter.com/kalebpederson
Blog - http://kalebpederson.com
More information about the antlr-interest
mailing list