| [news.eclipse.technology.dltk] Re: Tips about building AST |
Hi Kevin,
So, your classes should look like:
public class RubyIfStatement extends ASTNode {
private ASTNode fCondition;
private ASTNode fThenStatement;
private ASTNode fElseStatement; public void traverse(ASTVisitor pVisitor) throws Exception {
if (pVisitor.visit(this)) {
if (fCondition != null) {
fCondition.traverse(pVisitor);
}
if (fThenStatement != null) {
fThenStatement.traverse(pVisitor);
}
if (fElseStatement != null) {
fElseStatement.traverse(pVisitor);
}
pVisitor.endvisit(this);
}
}
....
}Regards, Alex
Hi,
I'm trying to build a DLTK compliant AST and I'm facing an issue building the parser. I've noticed that there is a "getChilds()" method on every ASTNode, but you cant add any child node. Reading the code of the Python IDE example, I discovered that ModuleDeclaration objects accept child nodes with the "addStatement()" method. So, there is My question.
Is it possible to have several ModuleDeclaration objects in one single AST? If no, what is the proper way to link ASTNode objects together ?
Regards