I searched high and low and can't seem to find the answer or any examples.
I am using Java ruby DLTK
I want to parse a string that has Ruby source code (.rb file). I am using it this way:
JRubySourceParser jRubyParser = new JRubySourceParser();
ModuleDeclaration result = jRubyParser.parse(getSampleStr());
ASTNode parent = result.getChilds().get(0)
Now I am stuck. I don't know how to traverse the ASTNode using a visitor. I don't want to use getChilds.
The end goal is, to get all Method Names, Classes, require files, include files, and make them into a visible tree (which I already know how to).
Is there any examples that I have missed? It really took me half a day just researching, I can't seem to find one.
Thank you.
ModuleDeclaration.traverse(new ASTVisitor() {
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.