code: public void setParent( AstNode parent ) {
          removeFromParent();
          if (parent != null) {
              this.parent = parent;
              this.parent.children.add(this);
          }
      }
docs: Set the parent for this node. If this node already has a parent, this method will remove this node from the current parent.
  If the supplied parent is not null, then this node will be added to the supplied parent's children.
  
  @param parent the new parent, or null if this node is to have no parent