shevek / jcpp

The C Preprocessor as a Java library
http://www.anarres.org/projects/jcpp/
Apache License 2.0
106 stars 36 forks source link

Any tutorials on this project? #31

Open rchlin opened 8 years ago

rchlin commented 8 years ago

There is no wiki either.

rchlin commented 8 years ago

And the Preprocessor seemed to keep comments by default, and can not be disabled!

shevek commented 8 years ago

CppReader behaves as a Java Reader. Preprocessor has its own lexer-like API if you want to use it directly. Keeping comments can be enabled or disabled using Feature.KEEPCOMMENTS or Feature.KEEPALLCOMMENTS. Overall documentation is available here: https://shevek.github.io/jcpp/docs/javadoc/

rchlin commented 8 years ago

If I use Preprocessor directly, Feature.KEEPCOMMENTS or Feature.KEEPALLCOMMENTS will not take effect and pp.token() willl always keep comments. In order to disable comments, I have to use LexerSource or CppReader.

ooxi commented 8 years ago

Please don't reuse issues for new questions. A minimal code sample would be great so reproduce your bug report.

shevek commented 8 years ago

Re: KEEPCOMMENTS: I didn't check again, but that's probably true, but it's fairly easy to filter the returned token stream by type yourself. Filtering comments within the API is only really important if you don't have access to the token stream (and hence types), as in CppReader. I don't think LexerSource has anything to do with comments.