Antlr @header declaration for C++ generation
In ANTLR version 2.X you could specify something was to go before or after the ANTLR includes via the code below.
header "pre_include_hpp"
{开发者_运维问答
#pragma warning( push )
#pragma warning( disable : 4511 ) // couldn't generate copy constructor
}
header "post_include_hpp"
{
#pragma warning( pop )
}
With ANTLR v3.X it looks like this has been replaced by one @header block.
Is there a way to do what we previously did with ANTLR v2?
I've found out that I should be using
@lexer::preinclude
@lexer::postinclude
to replace the above definitions when I move from Antlr2 to Antlr3
see: http://www.antlr.org/api/C/atsections.html
for more details.
精彩评论