Closed p2k closed 6 years ago
Many thanks for the bug report. I've got the unit tests correctly failing with your sample inputs. I'll look into the bug fix tomorrow night.
I rewrote it and did a bit more refactoring. Thanks for the bug report and fix!
(Getting to the point straight away:)
Sample input 1:
Output of
$ pcpp --passthru-comments test1.h
before patch:Sample input 2:
Output of
$ pcpp --passthru-comments test2.h
before patch:After patching, it correctly outputs the same output as the respective input. While the result of the second example is non-fatal, the first example shifts the line numbers illegally.
The fix addresses the problem with a rather simple trick of adjusting the last line number while iterating over the final token list. I also took the liberty of removing the blankacc list that wasn't used.