Paraphrasing Kata Thirteen:
Your mission, should you choose to accept it, is to count lines of actual code in Java source-code.
Let us see, the real task is to remove comments from the source code,
anything left after that must be actual code-lines. So, this should
suffice (assuming GNU cpp(1)
):
cpp -fpreprocessed -P - - \
| grep -v '^[[:space:]]*$' \
| wc -l
No need to complicate the task with a real programming language, when we have all the tools available.