[antlr-interest] [C target] #define clashes: would it be possible to add ANTLR_ prefix to automatically generated macros?
Jim Idle
jimi at temporal-wave.com
Fri Aug 1 17:03:57 PDT 2008
On Fri, 2008-08-01 at 18:25 -0400, Florent Teichteil wrote:
> Hi,
>
> I have been using ANTLR C target with success for several months...
> until I included a file from the BOOST C++ library set.
>
> One of my ANTLR rule is DOMAIN.
> ANTLR lexer (C target) automatically generates the macro "#define DOMAIN 4".
> I include a BOOST header file (for hashtable support) after the lexer
> header file. Then, I am not able to parse the DOMAIN rule because
> BOOST redefines it to 1!
>
> I think BOOST should prefix its macros, but it would be safer if ANTLR
> added some prefix to macros it generates in header files.
>
> What do you think about it?
Tried it and there are complications to do with code generation. Just do
what I do and prefix token names that clash with K:
KDOMAIN : 'DOMAIN' ;
boost should prefix it's #defines like ANTLR does really, but the work
around is trivial.
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080801/34a02ac6/attachment.html
More information about the antlr-interest
mailing list