关于Java解析器 [英] About java parser
问题描述
基本上我想为此开发一个重构工具,我必须做一个Java解析器.我是解析领域的新手,我想知道在Java中是否有任何插件可以解析Java代码,填写数据库中的条目.
例如,如果我有一个项目,其中有两个软件包,则数据库应存储这两个软件包,然后在软件包中有类,在类中有变量和方法,我希望所有这些信息都存储在数据库中.如果类之间存在继承,则存储信息.
请帮助我.我陷入了解析.
Basically i want to develop a re-factoring tool for this i have to make a java parser.I am new in field of parsing,i want to know is there any plug-in available in java that parse the java code and fill entries in the database.
For example if i have project in which there are two packages then database should store these two packages, then in package there are classes and in classes there are variable and methods, i want all these information to be stored in a database.Also i have to store the information if there is inheritance between the classes.
Kindly help me out.I am stuck in parsing.
推荐答案
您可以看看 ANTRL解析器生成器.它根据您的语法生成解析器(Java
代码).如果我没记错的话,还有一些语法示例可以解析Java
构造.
:)
You may have a look at ANTRL Parser Generator. It generates a parser (Java
code) according to your grammar. If I remember well, there are also a few grammar examples about parsingJava
constructs.
:)
我不知道如何填充重构时返回的数据库.这是我解析任何语言的第一个项目,所有事情都在这里弄乱了:(
i am not getting how this will populate database that was in return used by re-factoring. its my first project in parsing any language and every thing is messed up here :(
这篇关于关于Java解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!