I have downloaded Antlr 3.3 and antlr works, along with Java.g from the Antlr site. I was able to successfully generate the JavaParser, JavaLexer.java and tokens using Antlr works for Java.g. I then mounted the antlr jar in my IDE and was following the following instructions to use it in my code: http://www.antlr.org/wiki/pages/viewpage.action?pageId=789
The first problem arose when the documentation above says to code the following line:
RuleReturnScope result = parser.compilationUnit();
The problem is that parser.compilationUnit() does not return a result.
Then i tried following the example further down under "Parsing a tree", but this is incomplete.
I can't find any good documentation on how to use this library.
Here is what I want to do: -in Java submit a file name, File object or file contents as a String to Antlr and have it return some sort of object that i can navigate in code that will give me things like the imports, methods, class variables, expressions etc.
Basically what the NetBeans IDE 6.9.1 does to for refactoring, like fix imports, go to source, rename variables etc. All i need is the meta data about the class, and i am not sure how to obtain it.
Thanks.