[antlr-interest] ANTLR generating invalid Java

Jim Idle jimi at temporal-wave.com
Fri Aug 8 13:51:09 PDT 2008


On Fri, 2008-08-08 at 13:32 -0700, Oren Ben-Kiki wrote:

> It _almost_ works.
> 
> The problem is that even with @synpredicate { true }, ANTLR ignores
> @init/@after actions for rules inside syntactic predicates; it inlines
> ("hoists"?) the rule without them. It does preserve the semantic
> predicates in such rules, but in my case these semantic predicates can
> not function without the supporting @init action :-(
> 
> Is there a way to force @init/@after actions to be executed even when
> backtracking>0 ?
> 
> On an unrelated note - is it possible to completely disable WS?


Not sure what yo umean here. If you mean you just want the lexer to eat
WS then just use:

WS : (' ' | '\t')+ { skip(); }

But your yaml language seems to be using space indent for structural
meaning (not a good idea if you ask me), so if you just throw it away
you won't have context. Having looked at the specs for Yaml, I am not
convinced that ANTLR is the correct tool for you to use to be honest.

Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080808/5055fd6a/attachment.html 


More information about the antlr-interest mailing list