[antlr-interest] How to do "not" in a syntactic predicate?
Jim Idle
jimi at temporal-wave.com
Mon Oct 5 10:36:54 PDT 2009
Use a semantic predicate rather than syntactic. You possibly need a bated predicate here too:
{ input.LA(1) == A && input.LA(2) != B}?=>
However, if you need that kind of syntactic predicate, then I suggest you may be approaching your problem incorrectly.
Jim
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Naveen Chawla
Sent: Monday, October 05, 2009 7:02 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] How to do "not" in a syntactic predicate?
If I do
(a ~b)=> a
meaning "take this alternative if you encounter an a when not followed by b"
I get a syntax error: unexpected token b
Is it the right syntax to use '~'?
N
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091005/3470dece/attachment.html
More information about the antlr-interest
mailing list