public static @Nullable TreeElement generateTreeElement(@Nullable PsiElement original, @NotNull CharTable table, @NotNull PsiManager manager) {
    if (original == null) return null;
    PsiUtilCore.ensureValid(original);
    if (SourceTreeToPsiMap.hasTreeElement(original)) {
      return copyElement((TreeElement)SourceTreeToPsiMap.psiElementToTree(original), table);
    }
    return TreeGenerator.EP_NAME.getExtensionList().stream()
      .map(generator -> generator.generateTreeFor(original, table, manager))
      .filter(Objects::nonNull).findFirst().orElse(null);
  }
public static @Nullable TreeElement generateTreeElement(@Nullable PsiElement original, @NotNull CharTable table, @NotNull PsiManager manager)