[antlr-interest] Java Keywords and Rule-Naming conflicts
Johannes Luber
jaluber at gmx.de
Sat Aug 25 05:22:25 PDT 2007
Martin Kohl wrote:
> 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
This naming conflict actually extends to names like input in OOP
languages. The solution, name mangling, is still on the todo list. :(
Best regards,
Johannes Luber
More information about the antlr-interest
mailing list