[antlr-interest] Java Keywords and Rule-Naming conflicts

Martin Kohl martin.kohl at gmail.com
Sat Aug 25 03:50:24 PDT 2007


Hi again :)

Not sure that this is an actual bug, I had a parser rule called goto in my
grammar. Now the ExprParser.java has a method called goto(), however as goto
is a java keyword it cannot be used to name methods or instances, which
turns up as an error when trying to compile the java source.

Obviously, the problem can be resolved by renaming the rule goto to
something less controversial. I was thinking it might be an idea to compare
rule names with keywords of the target language prior to generating the java
files, alternatively, just leave it up to the user to figure out ;)

Greetz,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070825/d388b4b9/attachment.html 


More information about the antlr-interest mailing list