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

Whitespace used in token pasting #25

Closed TimePath closed 9 years ago

TimePath commented 9 years ago

Input (groovy):

def pp = new Preprocessor();
pp.addInput(new StringLexerSource("""
#define ONE(arg) one_##arg
#define TWO(arg) ONE(two_##arg)

TWO(good)
TWO(     /* evil newline */
    bad)

ONE(good)
ONE(     /* evil newline */
    bad)
""", true))
println new CppReader(pp).text.trim()

Output:

one_two_good
    one_two_ bad

    one_good
    one_
 bad

Expected output:

one_two_good
one_two_bad

one_good
one_bad
shevek commented 9 years ago

Republishing temporarily blocked on https://github.com/bmuschko/gradle-nexus-plugin/issues/41 - working on it.

TimePath commented 9 years ago

Thanks for the update

shevek commented 9 years ago

Found a much simpler and cleaner fix. Can you review please?

TimePath commented 9 years ago

Still works for my use case.

shevek commented 9 years ago

Snapshot released.