private static void treeToBuffer(Appendable buffer,
                                   ASTNode root,
                                   int indent,
                                   boolean showWhitespaces,
                                   boolean showRanges,
                                   boolean showChildrenRanges,
                                   boolean showClassNames,
                                   boolean usePsi,
                                   boolean useElementType,
                                   @Nullable PairConsumer<? super PsiElement, ? super Consumer<? super PsiElement>> extra) {
    ((TreeElement)root).acceptTree(
      new TreeToBuffer(buffer, indent, showWhitespaces, showRanges, showChildrenRanges, showClassNames, usePsi, useElementType, extra));
  }
private static void treeToBuffer(Appendable buffer,
                                   ASTNode root,
                                   int indent,
                                   boolean showWhitespaces,
                                   boolean showRanges,
                                   boolean showChildrenRanges,
                                   boolean showClassNames,
                                   boolean usePsi,
                                   boolean useElementType,
                                   @Nullable PairConsumer<? super PsiElement, ? super Consumer<? super PsiElement>> extra)