[antlr-interest] C++ parser usage ideas

Paul Johnson gt54-antlr at cyconix.com
Thu Oct 13 00:57:28 PDT 2005


Jim Crafton wrote:
> It does insert "#line" statements!
> Is that what they are for?

Yes - try using cpp; it's documented.

I've done this with lex (but not Antlr) for C, and it's pretty trivial. 
    You should only attempt to analyse the cpp output. When you've got 
the output, look for any lines starting with '#', (manually!) parse for 
the current file name and line number, and reset your own fname/line 
number variables.

Paul




More information about the antlr-interest mailing list