How can I use the java Eclipse Abstract Syntax Tree in a project outside Eclipse? (ie not an eclipse plugin)
All the Eclipse AST examples that I've seen are for eclipse plugins. Is there a way (ie an example) of a project that uses the eclipse AST for a non-eclipse project.
Below is the code I used to do this given a Java 1.5 file. I'm very new to this and spent today browsing around, and trying things out to get the code below working.
This requires the following libraries:
According to this old article, you should be able to call AST parser independently of your application context (eclipse plugin or not).
alt text http://www.ibm.com/developerworks/opensource/library/os-ast/astexplorer.gif
From this bug entry:
ASTParser in 3.0 can be used in another standalone program to create Eclipse ASTs without actually running Eclipse. As the documentation says:
Hence this thread attempts to parse a very short java source: