Java static source analysis/parsing (possibly with antlr), what is a good tool to do this?
- by Berlin Brown
I need to perform static source analysis on Java code. Ideally, I want the system to work out of the box without much modification from me.
For example, I have used Antlr in the past, but I spent a lot of time building grammar files and still didn't get what I wanted.
I want to be able to parse a java file and have return the character position of say:
Character position start and end of a Java block comment
Character position start and end of a Java class file
Character position start and end of a Java method declaration, signature, and implementation.
It looks like Antlr will do that, but I have yet to finish a grammar that actually gives me the positions of the code I need.
Does anyone have that complete Antlr grammar and Java code to give the character positions of the parts in the Java source.