Пример #1
0
 private Tree buildTree(AstNode node) {
   Tree t = new Tree(node.getType(), Tree.NO_LABEL, Token.typeToName(node.getType()));
   t.setPos(node.getAbsolutePosition());
   t.setLength(node.getLength());
   trees.put(node, t);
   return t;
 }
Пример #2
0
 public boolean visit(AstNode node) {
   int tt = node.getType();
   String name = Token.typeToName(tt);
   buffer.append(node.getAbsolutePosition()).append("\t");
   buffer.append(makeIndent(node.depth()));
   buffer.append(name).append(" ");
   buffer.append(node.getPosition()).append(" ");
   buffer.append(node.getLength());
   if (tt == Token.NAME) {
     buffer.append(" ").append(((Name) node).getIdentifier());
   }
   buffer.append("\n");
   return true; // process kids
 }