code: public AstNode removeFromParent() {
          AstNode result = this.parent;
          if (this.parent != null) {
              // Remove this node from its current parent ...
              this.parent.children.remove(this);
              this.parent = null;
          }
          return result;
      }
docs: Remove this node from its parent, and return the node that used to be the parent of this node. Note that this method
  removes the entire subgraph under this node.
  
  @return the node that was the parent of this node, or null if this node had no parent
  @see #extractChild(AstNode)
  @see #extractFromParent()