code: public void setParent(AstNode parent) {
          if (parent == this.parent) {
              return;
          }
  
          // Convert position back to absolute.
          if (this.parent != null) {
              setRelative(-this.parent.getAbsolutePosition());
          }
  
          this.parent = parent;
          if (parent != null) {
              setRelative(parent.getAbsolutePosition());
          }
      }
docs: Sets the node parent.  This method automatically adjusts the
  current node's start position to be relative to the new parent.
  @param parent the new parent. Can be {@code null}.