Program(s) for counting tokens in Java and C source files
===

Does anyone know of any software which is able to count the number of tokens in Java and/or C source files, ideally as the grammar for the languages defines tokens.

I have tried searching google for this, but it only spits out a lot of results in parsing tokens with java's StreamTokenizer class, which is not flexible enough (on its own) to measure Java or C tokens correctly.

Thanks :).