[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
Fri Jul 9 09:43:05 PDT 2010


Thanks Sam - I had tried the the partial class approach, but the first 
time I tried it I missed the fact that my partial with the attribute on it 
wasn't in the same namespace.  I added the 

@parser::namespace {MyNamespace}

global action to my grammar and it worked like a charm. 

Thanks again,
Tony.

--------------------------------------
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 { }
}



More information about the antlr-interest mailing list