I had wanted to do that but a limitation in the code generation templates (which I no longer remember) meant that I could not. You need to suffix your token names with _ as that is least intrusive. You need only do that for the tokens that clash and you will find it isn't as much work as you think using visual studio. You will not notice. The other way I do it is to prefix with K such as KNULL KTRUE and so on.
Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Justin Murray > Sent: Tuesday, December 14, 2010 7:48 AM > To: [email protected] > Subject: [antlr-interest] #defines in C target > > Hello, > > > > I am building a parser for a C target, and am running into issues with > the generated #defines from the lexer tokens. Essentially, the lexer > names that were chosen in some cases conflict with other #defines in > the code (either from our own code, or from standard libraries like > Windows.h). While I realize that I could just rename the lexer rules to > remove the conflict, this makes the grammar file less readable, and at > this point is a considerable amount of work (our language has hundreds > of keywords). Is it possible to tell the lexer generator to > prefix/postfix all of these defines to make them more unique, while > preserving the nice, readable grammar definition file? > > > > Thank you, > > > > Justin Murray > Software Engineer > [email protected] > > Aerotech, Inc. > 101 Zeta Drive > Pittsburgh, PA 15238 > 412-963-7470 > > > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your- > email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
