使用javax.lang.model或ANTLR JavaParser获取Java源代码信息的示例/教程 [英] Examples / tutorials for usage of javax.lang.model or ANTLR JavaParser to get information on Java Source Code
问题描述
我想为简单的Java Logic创建一个类似Flowchart的自动化可视化,为此我需要解析Java源代码,我有2个候选者, ANTLR 和 javax.lang.model 。两者都不容易。
I would like to create an automatic Flowchart-like visualization to simple Java Logic, for this I need to parse Java Source code, I have 2 candidates, ANTLR and javax.lang.model of Java 6. Neither are easy.
我还没有找到一个工作示例这将远远接近我想要实现的目标。
I have yet to find a single working example that will be even remotely close to what I want to achieve.
我想找到简单的变量声明,赋值和流程(if,for,switch,boolean conditions等) )
I want to find simple variable declarations, assignments, and flows (if, for, switch, boolean conditions etc)
这些中的任何一个都有简单的示例或教程吗?
我发现很少有ANTLR示例(其中没有一个是开箱即用的,没有重要的作业),绝对没有javax.lang.model
Is there a simple example or tutorial for either of these? I found very few ANTLR examples (non of them are working out of the box without significant "homework") and absolutely none for javax.lang.model
推荐答案
我会尝试使用Eclipse Xtext,它使用ANTLR,它也(相对)易于与Eclipse GMF一起使用以进行可视化。
I would try that with Eclipse Xtext, it uses ANTLR under the hood, it is also (relative) easy to use it together with Eclipse GMF for visualization.
这篇关于使用javax.lang.model或ANTLR JavaParser获取Java源代码信息的示例/教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!