code: public AstRoot getAstRoot() {
          AstNode parent = this;  // this node could be the AstRoot
          while (parent != null && !(parent instanceof AstRoot)) {
              parent = parent.getParent();
          }
          return (AstRoot)parent;
      }
docs: Returns the root of the tree containing this node.
  @return the {@link AstRoot} at the root of this node's parent
  chain, or {@code null} if the topmost parent is not an {@code AstRoot}.