sunil kaja
unread,Feb 25, 2013, 1:58:44 AM2/25/13You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I am using Rhino 1.7R4 to parse JS files to retrieve function names.
Using the following snippet to parse JS file. I have got this code from some of the posts in this group.
Reader reader = null;
try {
String file = "foo.js";
reader = new FileReader(file);
AstNode node = new Parser().parse(reader, file, 1);
node.visit(new Printer());
} finally {
reader.close();
}
class Printer implements NodeVisitor {
public boolean visit(AstNode node) {
if (node instanceof FunctionNode) {
FunctionNode function = (FunctionNode) node;
//Need this functionality to do some custom processing
System.out.println("Has children" + function.getParent().hasChildren()); // Always returning false.
}
return true;
}
}
My issue is why function.getParent().hasChildren() always returning false. It should return me true every time in my case. I am not able to access siblings of fucntion node as well.
Am I doing any mistake while parsing, new Parser().parse(reader, file, 1) ?? or is it a bug in Rhino??