[antlr-interest] C# target header global actions - before ANTLR includes or after?

Tony.Gray at ca.schneider-electric.com Tony.Gray at ca.schneider-electric.com
Thu Jul 8 11:04:44 PDT 2010


In the C# target, global actions in the @parser::header{} block go 
_before_ the ANTLR standard header.

In C#, this section is full of 'using' statements that import namespaces 
of interest. 

The problem I'm having is that I want to adorn the class declaration for 
my parser with some [attributes].  To do that, I need to embed some code 
immediately before the class definition, but I can't do that because the 
ANTLR standard headers are between my header block and the class 
declaration.

If I'm reading this right, other language targets put the @header{} global 
action contents immediately before the class definition and after the 
stock ANTLR headers.

Was this choice in the C# target deliberate?  Is there anything I can do 
to emit code immediately above my generated parser definition?

oh, and as always, ANTLR rocks!

Tony Gray  Schneider Electric 


More information about the antlr-interest mailing list