Re: [Cpip-develop] #line and #pragma issues
Status: Alpha
Brought to you by:
cpip
From: cpip c. <cp...@gm...> - 2015-02-26 13:31:37
|
Hi Bengt, Sorry for the delay, I have been snowed under recently and neglecting CPIP! These are great ideas, I have already implemented the Pragma one in the SF main branch. You now construct a PpLexer with a (just added) PragmaHandler.PragmaHandlerEcho() like this: myLexer = PpLexer.PpLexer( 'hello.c', CppIncludeStringIO([], [], myStr, {}), pragmaHandler=PragmaHandler.PragmaHandlerEcho(), ) All pragma statments are now preserved in the output. As for the line number/file idea, I have partially implemented and should finish it tonight. or at the weekend. I hope CPIP is being useful! Thanks, Paul. On Thu, Jan 15, 2015 at 3:50 PM, Bengt Gustafsson < Ben...@co...> wrote: > Hi! > > > > I am using the cpip module in a situation where I need to first > preprocess, then massage the preprocessed code a bit and finally send the > resulting source code off to the “real” compiler. > > > > The cpip module was really easy to get working but I have two problems, > listed below. > > > > One is that the original source code contains #pragma directives. I want > these to go right through the preprocessing. While it is possible to > install a pragma handler it does not seem to be possible to avoid an > endless loop if > > I just send the pragma back to the source stream. I would like a > possibility to block further preprocessing of whatever the pragma() > function returns. Alternatively and simpler in my case another callback, > say keep() which if it exists and returns true moves the entire pragma line > to the output stream automatically. > > > > Another problem is that if I get an error in the final compilation step I > won’t know what the original line number is or which include file a > particular line comes from. With other preprocessors the output stream is > usually filled with #line directives which the compiler uses to make sure > error messages are appointed to the right line in the original source even > if the preprocessor is run as a separate step. I would like an option to > generate #line directives in the output file! > > > > Best Regards, > > Bengt Gustafsson > > > > > ------------------------------------------------------------------------------ > New Year. New Location. New Benefits. New Data Center in Ashburn, VA. > GigeNET is offering a free month of service with a new server in Ashburn. > Choose from 2 high performing configs, both with 100TB of bandwidth. > Higher redundancy.Lower latency.Increased capacity.Completely compliant. > http://p.sf.net/sfu/gigenet > _______________________________________________ > Cpip-develop mailing list > Cpi...@li... > https://lists.sourceforge.net/lists/listinfo/cpip-develop > > |