[antlr-interest] [C target] #define clashes: would it be possible to add ANTLR_ prefix to automatically generated macros?
jimi at temporal-wave.com
Fri Aug 1 17:06:37 PDT 2008
On Fri, 2008-08-01 at 16:05 -0700, Dinghao Wu wrote:
> It is similar for ANTLR generated code for grammar rules. Once I had rules called "null" and "string". The generated C# code clashes. I think the generated code should add some prefix so that it won't generate a method called null() or string().
Basically you just don't use keywords in the target language. There is
no way to completely guarantee that things won't clash, even
ANTLR_TOKEN_ and so on. But when you prefix them then you lose the
readability of the source code when debugging. It's obvious what is
happening and easier to change your rule and token names IMO.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the antlr-interest