Parsing a bunch of files

Hello all,

For a personal project, I have to parse some Java source files. Looking around at the availablel APIs, IntelliJ's open API seems far more superior for various reasons.

I was wondering (actually could not find how to via the API nor the community) if it is possible to use the parsing API (lexer and PSI) out of the context of a project and application. Or what would be the easiest way to make a thin implementeation of the interfaces to get it all to work.

Any ideas more than welcome! Thanks beforehand ....
-wim

2 comments
Comment actions Permalink

Hi,

I think this is possible, but you may end up with a lot of jars in your classpath. You may want to take a look at com.intellij.testFramework.ParsingTestCase which allows parsing files from a JUnit test class.
You will need at least openapi.jar and idea.jar

Bastien

0
Comment actions Permalink

Hey Bastien,

thanks for the answer. As a matter of fact, the test framework already gave me some inspiration how to setup the full blown application and a ad hoc project to the parsing. That might not be the leniest, but it works for now.

I might write some small blogpost about it.

Thanks anyway! Keep up the good work on a great product!
-wim

0

Please sign in to leave a comment.