The C# target declares the parser as a partial class. If your parser
MyParser is generated in a file called MyParser.cs, create another file in
your project called MyParserHelper.cs with contents like this:
namespace MyParserNamespace
{
[YourAttributeHere]
partial class MyParser { }
}
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Thursday, July 08, 2010 1:05 PM
To: [email protected]
Subject: [antlr-interest] C# target header global actions - before ANTLR
includes or after?
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
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.