如何访问来自java编译器树的注释api生成的ast? [英] How to access comments from the java compiler tree api generated ast?
本文介绍了如何访问来自java编译器树的注释api生成的ast?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用java编译器树api为java源文件生成ast。但是,我无法访问源文件中的注释。
I've used the java compiler tree api to generate the ast for java source files. However, i'm unable to access th comments in the source files.
到目前为止,我一直无法找到一种从源文件中提取注释的方法。有没有办法使用编译器api或其他工具? p>
So far, i've been unable to find a way to extract comments from source file .. is there a way using the compiler api or some other tool ?
推荐答案
通过使用getsourceposition()和一些字符串操作(不需要regex)来管理解决方案
Managed to solve the problem by using the getsourceposition() and some string manipulation (no regex was needed)
这篇关于如何访问来自java编译器树的注释api生成的ast?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文