(N)); break; case ASTNodeKind::TextAndInline: printTextAndInline(cast"); } void printTextAndInline(const TextAndInline *T) { for (const auto *IC : T->getChildren()) { printASTNode(IC); } } void printPlainText(const PlainText *PT) { bool HacksEnabled = TheCommentContext.TheReSTContext.LangOpts.TemporaryHacks; if (HacksEnabled) { for (auto Parts = std::make_pair(StringRef(), PT->getLinePart().Text); !Parts.first.empty() || !Parts.second.empty(); Parts = Parts.second.split("\\ ")) { appendWithXMLEscaping(OS, Parts.first); } } else { appendWithXMLEscaping(OS, PT->getLinePart().Text); } } void printEmphasis(const Emphasis *E) { printRawHTML(""); for (const auto *IC : E->getChildren()) { printASTNode(IC); } printRawHTML(""); } void printStrongEmphasis(const StrongEmphasis *SE) { printRawHTML(""); for (const auto *IC : SE->getChildren()) { printASTNode(IC); } printRawHTML(""); } void printInterpretedText(const InterpretedText *IT) { // FIXME: check role. printRawHTML("(N)); break; case ASTNodeKind::PlainText: printPlainText(cast (N)); break; case ASTNodeKind::Emphasis: printEmphasis(cast (N)); break; case ASTNodeKind::StrongEmphasis: printStrongEmphasis(cast (N)); break; case ASTNodeKind::InterpretedText: printInterpretedText(cast (N)); break; case ASTNodeKind::InlineLiteral: printInlineLiteral(cast (N)); break; case ASTNodeKind::HyperlinkReference: printHyperlinkReference(cast (N)); break; case ASTNodeKind::InlineHyperlinkTarget: printInlineHyperlinkTarget(cast (N)); break; case ASTNodeKind::FootnoteReference: printFootnoteReference(cast (N)); break; case ASTNodeKind::CitationReference: printCitationReference(cast (N)); break; case ASTNodeKind::SubstitutionReference: printSubstitutionReference(cast (N)); break; case ASTNodeKind::PrivateExtension: llvm_unreachable("implement"); } } void printParagraph(const Paragraph *P) { printTextAndInline(P->getContent()); } void printBulletList(const BulletList *BL) { printRawHTML(" "); for (unsigned i = 0, e = BL->getNumItems(); i != e; ++i) { printRawHTML("
"); } void printEnumeratedList(const EnumeratedList *EL) { printRawHTML("- "); for (const auto *N : BL->getItemChildren(i)) { printASTNode(N); } printRawHTML("
"); } printRawHTML(""); for (unsigned i = 0, e = EL->getNumItems(); i != e; ++i) { printRawHTML("
"); } void printDefinitionListItem(const DefinitionListItem *DLI) { printRawHTML("- "); for (const auto *N : EL->getItemChildren(i)) { printASTNode(N); } printRawHTML("
"); } printRawHTML(""); printASTNode(DLI->getTerm()); printRawHTML(" "); for (const auto *N : DLI->getClassifiers()) { printASTNode(N); } printRawHTML(""); for (const auto *N : DLI->getDefinitionChildren()) { printASTNode(N); } printRawHTML(" "); } void printDefinitionList(const DefinitionList *DL) { printRawHTML(""); for (const auto *N : DL->getChildren()) { printASTNode(N); } printRawHTML("
"); } void printField(const Field *F) { printRawHTML(""); printASTNode(F->getName()); printRawHTML(" "); printRawHTML(""); for (const auto *N : F->getBodyChildren()) { printASTNode(N); } printRawHTML(" "); } void printFieldList(const FieldList *FL) { printRawHTML(""); for (const auto *F : FL->getChildren()) { printASTNode(F); } printRawHTML("
"); } void printBlockQuote(const BlockQuote *BQ) { bool HacksEnabled = TheCommentContext.TheReSTContext.LangOpts.TemporaryHacks; if (HacksEnabled) OS << ""; else printRawHTML(" "; else printRawHTML(""); for (const auto *N : BQ->getChildren()) { printASTNode(N); } if (HacksEnabled) OS << "
");
for (const auto *IC : IT->getChildren()) {
printASTNode(IC);
}
printRawHTML("");
}
void printInlineLiteral(const InlineLiteral *IL) {
printRawHTML("");
for (const auto *IC : IL->getChildren()) {
printASTNode(IC);
}
printRawHTML("");
}
void printHyperlinkReference(const HyperlinkReference *HR) {
// FIXME: print as a hyperlink.
for (const auto *IC : HR->getChildren()) {
printASTNode(IC);
}
}
void printInlineHyperlinkTarget(const InlineHyperlinkTarget *IHT) {
// FIXME: print link anchor.
for (const auto *IC : IHT->getChildren()) {
printASTNode(IC);
}
}
void printFootnoteReference(const FootnoteReference *FR) {
// FIXME: XML format does not support footnotes. Skip them for now.
}
void printCitationReference(const CitationReference *CR) {
// FIXME: XML format does not support citations. Skip them for now.
}
void printSubstitutionReference(const SubstitutionReference *SR) {
// FIXME: we don't resolve substitutions yet.
}
void printOrphanField(const Field *F) {
printRawHTML("(N); if (!Verbatim) OS << ""; if (const auto *F = dyn_cast "; continue; } printASTNode(N); if (!Verbatim) OS << ""; } OS << "(N)) { printOrphanField(F); OS << "
(N)); break; case ASTNodeKind::TextAndInline: printTextAndInline(cast"); } void printTextAndInline(const TextAndInline *T) { for (const auto *IC : T->getChildren()) { printASTNode(IC); } } void printPlainText(const PlainText *PT) { if (PT->getLinePart().Text == "\n") printNewline(); else { bool HacksEnabled = TheCommentContext.TheReSTContext.LangOpts.TemporaryHacks; if (HacksEnabled) { for (auto Parts = std::make_pair(StringRef(), PT->getLinePart().Text); !Parts.first.empty() || !Parts.second.empty(); Parts = Parts.second.split("\\ ")) { print(Parts.first); } } else { print(PT->getLinePart().Text); } } } void printEmphasis(const Emphasis *E) { print(""); for (const auto *IC : E->getChildren()) { printASTNode(IC); } print(""); } void printStrongEmphasis(const StrongEmphasis *SE) { print(""); for (const auto *IC : SE->getChildren()) { printASTNode(IC); } print(""); } void printInterpretedText(const InterpretedText *IT) { // FIXME: check role. print("(N)); break; case ASTNodeKind::PlainText: printPlainText(cast (N)); break; case ASTNodeKind::Emphasis: printEmphasis(cast (N)); break; case ASTNodeKind::StrongEmphasis: printStrongEmphasis(cast (N)); break; case ASTNodeKind::InterpretedText: printInterpretedText(cast (N)); break; case ASTNodeKind::InlineLiteral: printInlineLiteral(cast (N)); break; case ASTNodeKind::HyperlinkReference: printHyperlinkReference(cast (N)); break; case ASTNodeKind::InlineHyperlinkTarget: printInlineHyperlinkTarget(cast (N)); break; case ASTNodeKind::FootnoteReference: printFootnoteReference(cast (N)); break; case ASTNodeKind::CitationReference: printCitationReference(cast (N)); break; case ASTNodeKind::SubstitutionReference: printSubstitutionReference(cast (N)); break; case ASTNodeKind::PrivateExtension: llvm_unreachable("implement"); } } void printParagraph(const Paragraph *P) { print(" "); printTextAndInline(P->getContent()); print("
"); } void printBulletList(const BulletList *BL) { print(""); for (unsigned i = 0, e = BL->getNumItems(); i != e; ++i) { print("
"); } void printEnumeratedList(const EnumeratedList *EL) { print("- "); for (const auto *N : BL->getItemChildren(i)) { printASTNode(N); } print("
"); } print(""); for (unsigned i = 0, e = EL->getNumItems(); i != e; ++i) { print("
"); } void printDefinitionListItem(const DefinitionListItem *DLI) { print("- "); for (const auto *N : EL->getItemChildren(i)) { printASTNode(N); } print("
"); } print(""); printASTNode(DLI->getTerm()); for (const auto *N : DLI->getClassifiers()) { printASTNode(N); } print(" "); print(""); for (const auto *N : DLI->getDefinitionChildren()) { printASTNode(N); } print(" "); } void printDefinitionList(const DefinitionList *DL) { print(""); for (const auto *N : DL->getChildren()) { printASTNode(N); } print("
"); } void printField(const Field *F) { print(""); printASTNode(F->getName()); print(" "); print(""); for (const auto *N : F->getBodyChildren()) { printASTNode(N); } print(" "); } void printFieldList(const FieldList *FL) { print(""); for (const auto *F : FL->getChildren()) { printASTNode(F); } print("
"); } void printBlockQuote(const BlockQuote *BQ) { bool HacksEnabled = TheCommentContext.TheReSTContext.LangOpts.TemporaryHacks; print(HacksEnabled ? "" : "" : ""); for (const auto *N : BQ->getChildren()) { printASTNode(N); } print(HacksEnabled ? "
");
for (const auto *IC : IT->getChildren()) {
printASTNode(IC);
}
print("");
}
void printInlineLiteral(const InlineLiteral *IL) {
print("");
for (const auto *IC : IL->getChildren()) {
printASTNode(IC);
}
print("");
}
void printHyperlinkReference(const HyperlinkReference *HR) {
// FIXME: print as a hyperlink.
for (const auto *IC : HR->getChildren()) {
printASTNode(IC);
}
}
void printInlineHyperlinkTarget(const InlineHyperlinkTarget *IHT) {
// FIXME: print link anchor.
for (const auto *IC : IHT->getChildren()) {
printASTNode(IC);
}
}
void printFootnoteReference(const FootnoteReference *FR) {
// Doxygen does not support footnotes.
}
void printCitationReference(const CitationReference *CR) {
// Doxygen does not support citations.
}
void printSubstitutionReference(const SubstitutionReference *SR) {
// FIXME: we don't resolve substitutions yet.
}
void printOrphanField(const Field *F) {
print("