From 860d17b6876822ef7023fdce70c725d3f8be37b1 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 5 Mar 2021 14:34:46 -0500 Subject: Doc tooling improvements (#1734) * #include an absolute path didn't work - because paths were taken to always be relative. * Split out AST 'printing'. * Replace listener with List
* Section -> Part. * Kind -> Type Flags -> Kind for ASTPrinter::Part * Improve comments around ASTPrinter. * toString -> toText on Val derived types. toText appends to a StringBuilder. * Added toSlice free function. Added operator<< for Val derived types. Use << where appropriate in doing toText. * More work at mark down output. * Fill in sourceloc for enum case. Add more sophisticated location determination for EnumCase. Refactored documentation output into DocMarkdownWriter. * Improvements for sig output. * Split up slang-doc into extractor and writer. * WIP generic support for doc support. * Some refactoring to make DocExtractor have potential to be used without Decls. * Made doc extraction work without Decls. * Output generic parameters. * Add generic parameter extraction. * Added writing variables. * Add an interface test. * Fix toArray. * Support for extensions, and inheritance. * Disable the doc test. Co-authored-by: Tim Foley --- source/slang/slang.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/slang/slang.cpp') diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 21f60c090..1820b24e5 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -30,7 +30,8 @@ #include "slang-serialize-ir.h" #include "slang-serialize-container.h" -#include "slang-doc.h" +#include "slang-doc-extractor.h" +#include "slang-doc-mark-down.h" #include "slang-check-impl.h" @@ -1808,8 +1809,7 @@ SlangResult FrontEndCompileRequest::executeActionsInner() for (TranslationUnitRequest* translationUnit : translationUnits) { RefPtr markup(new DocMarkup); - - markup->extract(translationUnit->getModuleDecl(), getSourceManager(), getSink()); + DocMarkupExtractor::extract(translationUnit->getModuleDecl(), getSourceManager(), getSink(), markup); // Hmm.. we can have multiple sourcefiles. So fir now we just pick the first, so as to come up with // a reasonable name @@ -1822,10 +1822,10 @@ SlangResult FrontEndCompileRequest::executeActionsInner() String fileName = Path::getFileNameWithoutExt(path); fileName.append(".md"); - StringBuilder buf; - DocumentationUtil::writeMarkdown(markup, astBuilder, buf); + DocMarkDownWriter writer(markup, astBuilder); + writer.writeAll(); - File::writeAllText(fileName, buf); + File::writeAllText(fileName, writer.getOutput()); } } } -- cgit v1.2.3