[英]Java parser library for NetBeans
I want to make a java application that takes java source codes as input to create and visit their Abstract Syntax Trees, so I can make some statistics out of them. 我想制作一个将Java源代码作为输入来创建和访问其抽象语法树的Java应用程序,因此我可以从中进行一些统计。
I found this java parser: https://github.com/javaparser/javaparser 我找到了这个Java解析器: https : //github.com/javaparser/javaparser
My questions are: 我的问题是:
I am not sure about NetBeans but you can create a project using maven or gradle and specify a dependency to JavaParser and you are done. 我不确定NetBeans,但是您可以使用maven或gradle创建一个项目,并指定对JavaParser的依赖关系,然后就完成了。 It is that easy.
就这么简单。 Alternatively you may want to download the JavaParser jar from Maven central: it should not have any dependency so that would be enough.
另外,您可能想要从Maven Central下载JavaParser jar:它不应具有任何依赖关系,这样就足够了。
Disclaimer: I am a contributor to JavaParser 免责声明:我是JavaParser的贡献者
Some years ago I've done a prototype to analyze Java source. 几年前,我已经完成了一个用于分析Java源代码的原型。 I used this library Recoder (manual) that do the dirty work for me (parsing and building a good designed AST).
我使用了这个库Recoder(手动)来为我做些肮脏的工作(解析并构建一个设计良好的AST)。
It's a jar so you can use it with any kind of IDE. 它是一个罐子,因此您可以将其与任何类型的IDE一起使用。
Usually I use Eclispe as Java IDE. 通常我将Eclispe用作Java IDE。 It has its own AST model and you can consider to use Eclipse JDT Eclipse JDT .
它具有自己的AST模型,您可以考虑使用Eclipse JDT Eclipse JDT 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.