[antlr-interest] Antlr v3.0ea8 : @header not taken into accountin automatically generated lexer java code...

Terence Parr parrt at cs.usfca.edu
Wed May 3 11:53:38 PDT 2006


On May 3, 2006, at 10:56 AM, Arnulf Heller wrote:

> I would settle for a different approach: use one header section and  
> include that stuff in the lexer *and* in the parser. Keeps things  
> simple and I suppose that everyone can live with the slight  
> performance penalty.

It turns out this doesn't work...sometimes you have mutually  
exclusive needs...i started as you indicated and had to invent new way.

> That brings me to another point: usage of precompiled headers (for  
> the C++ target). In v2, I used a small trick to get my precompiled  
> headers working:
>
> header "pre_include_hpp" {
>         #ifndef PRECOMPILEDHEADERS
> }
>
> header "post_include_hpp" {
>         #endif // PRECOMPILEDHEADERS
>         #include "BaseParserTokenTypes.hpp"
> }
>
> header "pre_include_cpp" {
>         #include "StdAfx.h"
>         #ifndef PRECOMPILEDHEADERS
> }
>
> header "post_include_cpp" {
>         #endif // PRECOMPILEDHEADERS
>         #include "BaseParser.hpp"
> }
>
> Rather cumbersome, but it worked.
>
> An option would be fine here ...

I will let the C, C++ folks answer here.

Ter


More information about the antlr-interest mailing list