// Flatten this level of the tree if it has no children
boolean flatten = /*true*/ false;
AST node2;
for (node2 = node; node2 != null; node2 = node2.getNextSibling()) {
if (node2.getFirstChild() != null) {
flatten = false;
break;
}
}
for (node2 = node; node2 != null; node2 = node2.getNextSibling()) {
if (!flatten || node2 == node) {
tabs();
}
if (node2.getText() == null) {
System.out.print("nil");
}
else {
System.out.print(node2.getText());
}
System.out.print(" [" + node2.getType() + "] ");
if (flatten) {
System.out.print(" ");
}
else {
System.out.println("");
}
if (node2.getFirstChild() != null) {
level++;
visit(node2.getFirstChild());
level--;
}
}
if (flatten) {
System.out.println("");
}