Doxygen
Loading...
Searching...
No Matches
docparser.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <cassert>
#include <ctype.h>
#include "classlist.h"
#include "cmdmapper.h"
#include "config.h"
#include "debug.h"
#include "dir.h"
#include "docparser.h"
#include "docparser_p.h"
#include "doxygen.h"
#include "filedef.h"
#include "fileinfo.h"
#include "groupdef.h"
#include "namespacedef.h"
#include "message.h"
#include "pagedef.h"
#include "portable.h"
#include "printdocvisitor.h"
#include "util.h"
#include "indexlist.h"
#include "trace.h"
#include "stringutil.h"
Include dependency graph for docparser.cpp:

Go to the source code of this file.

Macros

#define AUTO_TRACE(...)
#define AUTO_TRACE_ADD(...)
#define AUTO_TRACE_EXIT(...)
#define CHECK_FOR_COMMAND(str, action)

Functions

IDocParserPtr createDocParser ()
 factory function to create a parser
static QCString extractCopyDocId (const char *data, size_t &j, size_t len)
static size_t isCopyBriefOrDetailsCmd (const char *data, size_t i, size_t len, bool &brief)
static size_t isVerbatimSection (const char *data, size_t i, size_t len, QCString &endMarker)
static size_t skipToEndMarker (const char *data, size_t i, size_t len, const QCString &endMarker)
IDocNodeASTPtr validatingParseDoc (IDocParser &parserIntf, const QCString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const QCString &input, bool indexWords, bool isExample, const QCString &exampleName, bool singleLine, bool linkFromIndex, bool markdownSupport, bool autolinkSupport)
IDocNodeASTPtr validatingParseTitle (IDocParser &parserIntf, const QCString &fileName, int lineNr, const QCString &input)
IDocNodeASTPtr validatingParseText (IDocParser &parserIntf, const QCString &input)
IDocNodeASTPtr createRef (IDocParser &parserIntf, const QCString &target, const QCString &context, const QCString &srcFile, int srcLine)
void docFindSections (const QCString &input, const Definition *d, const QCString &fileName)

Macro Definition Documentation

◆ AUTO_TRACE

#define AUTO_TRACE ( ...)
Value:
(void)0

Definition at line 47 of file docparser.cpp.

◆ AUTO_TRACE_ADD

#define AUTO_TRACE_ADD ( ...)
Value:
(void)0

Definition at line 48 of file docparser.cpp.

◆ AUTO_TRACE_EXIT

#define AUTO_TRACE_EXIT ( ...)
Value:
(void)0

Definition at line 49 of file docparser.cpp.

◆ CHECK_FOR_COMMAND

#define CHECK_FOR_COMMAND ( str,
action )
Value:
do if ((i+sizeof(str)<len) && literal_at(data+i+1,str)) \
{ j=i+sizeof(str); action; } while(0)
bool literal_at(const char *data, const char(&str)[N])
returns TRUE iff data points to a substring that matches string literal str
Definition stringutil.h:98

Definition at line 1757 of file docparser.cpp.

1757#define CHECK_FOR_COMMAND(str,action) \
1758 do if ((i+sizeof(str)<len) && literal_at(data+i+1,str)) \
1759 { j=i+sizeof(str); action; } while(0)

Referenced by isCopyBriefOrDetailsCmd(), and isVerbatimSection().

Function Documentation

◆ createDocParser()

◆ createRef()

IDocNodeASTPtr createRef ( IDocParser & parserIntf,
const QCString & target,
const QCString & context,
const QCString & srcFile,
int srcLine )

Definition at line 2172 of file docparser.cpp.

2173{
2174 DocParser *parser = dynamic_cast<DocParser*>(&parserIntf);
2175 assert(parser!=nullptr);
2176 if (parser==nullptr) return nullptr;
2177 if (!srcFile.isEmpty())
2178 {
2179 parser->context.fileName = srcFile;
2180 parser->tokenizer.setLineNr(srcLine);
2181 }
2182 return std::make_unique<DocNodeAST>(DocRef(parser,nullptr,target,context));
2183}
DocTokenizer tokenizer
DocParserContext context
Node representing a reference to some item.
Definition docnode.h:778
void setLineNr(int lineno)
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
QCString fileName
Definition docparser_p.h:71

References DocParser::context, DocParserContext::fileName, QCString::isEmpty(), DocTokenizer::setLineNr(), and DocParser::tokenizer.

Referenced by convertMapFile(), replaceRef(), and LayoutNavEntry::url().

◆ docFindSections()

void docFindSections ( const QCString & input,
const Definition * d,
const QCString & fileName )

◆ extractCopyDocId()

QCString extractCopyDocId ( const char * data,
size_t & j,
size_t len )
static

Definition at line 1684 of file docparser.cpp.

1685{
1686 size_t s=j;
1687 int round=0;
1688 bool insideDQuote=FALSE;
1689 bool insideSQuote=FALSE;
1690 bool found=FALSE;
1691 while (j<len && !found)
1692 {
1693 if (!insideSQuote && !insideDQuote)
1694 {
1695 switch (data[j])
1696 {
1697 case '(': round++; break;
1698 case ')': round--; break;
1699 case '"': insideDQuote=TRUE; break;
1700 case '\'': insideSQuote=TRUE; break;
1701 case '\\': // fall through, begin of command
1702 case '@': // fall through, begin of command
1703 case '\t': // fall through
1704 case '\n':
1705 found=(round==0);
1706 break;
1707 case ' ': // allow spaces in cast operator (see issue #11169)
1708 found=(round==0) && (j<8 || !literal_at(data+j-8,"operator"));
1709 break;
1710 }
1711 }
1712 else if (insideSQuote) // look for single quote end
1713 {
1714 if (data[j]=='\'' && (j==0 || data[j]!='\\'))
1715 {
1716 insideSQuote=FALSE;
1717 }
1718 }
1719 else if (insideDQuote) // look for double quote end
1720 {
1721 if (data[j]=='"' && (j==0 || data[j]!='\\'))
1722 {
1723 insideDQuote=FALSE;
1724 }
1725 }
1726 if (!found) j++;
1727 }
1728
1729 // include const and volatile
1730 if (literal_at(data+j," const"))
1731 {
1732 j+=6;
1733 }
1734 else if (literal_at(data+j," volatile"))
1735 {
1736 j+=9;
1737 }
1738
1739 // allow '&' or '&&' or ' &' or ' &&' at the end
1740 size_t k=j;
1741 while (k<len && data[k]==' ') k++;
1742 if (k<len-1 && data[k]=='&' && data[k+1]=='&') j=k+2;
1743 else if (k<len && data[k]=='&' ) j=k+1;
1744
1745 // do not include punctuation added by Definition::_setBriefDescription()
1746 size_t e=j;
1747 if (j>0 && data[j-1]=='.') { e--; }
1748 QCString id(data+s,e-s);
1749 //printf("extractCopyDocId='%s' input='%s'\n",qPrint(id),&data[s]);
1750 return id;
1751}
This is an alternative implementation of QCString.
Definition qcstring.h:101
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34

References FALSE, literal_at(), and TRUE.

Referenced by DocParser::processCopyDoc().

◆ isCopyBriefOrDetailsCmd()

size_t isCopyBriefOrDetailsCmd ( const char * data,
size_t i,
size_t len,
bool & brief )
static

Definition at line 1761 of file docparser.cpp.

1762{
1763 size_t j=0;
1764 if (i==0 || (data[i-1]!='@' && data[i-1]!='\\')) // not an escaped command
1765 {
1766 CHECK_FOR_COMMAND("copybrief",brief=TRUE); // @copybrief or \copybrief
1767 CHECK_FOR_COMMAND("copydetails",brief=FALSE); // @copydetails or \copydetails
1768 }
1769 return j;
1770}
#define CHECK_FOR_COMMAND(str, action)

References CHECK_FOR_COMMAND, FALSE, and TRUE.

Referenced by DocParser::processCopyDoc().

◆ isVerbatimSection()

size_t isVerbatimSection ( const char * data,
size_t i,
size_t len,
QCString & endMarker )
static

Definition at line 1772 of file docparser.cpp.

1773{
1774 size_t j=0;
1775 if (i==0 || (data[i-1]!='@' && data[i-1]!='\\')) // not an escaped command
1776 {
1777 CHECK_FOR_COMMAND("dot",endMarker="enddot");
1778 CHECK_FOR_COMMAND("icode",endMarker="endicode");
1779 CHECK_FOR_COMMAND("code",endMarker="endcode");
1780 CHECK_FOR_COMMAND("msc",endMarker="endmsc");
1781 CHECK_FOR_COMMAND("iverbatim",endMarker="endiverbatim");
1782 CHECK_FOR_COMMAND("verbatim",endMarker="endverbatim");
1783 CHECK_FOR_COMMAND("iliteral",endMarker="endiliteral");
1784 CHECK_FOR_COMMAND("latexonly",endMarker="endlatexonly");
1785 CHECK_FOR_COMMAND("htmlonly",endMarker="endhtmlonly");
1786 CHECK_FOR_COMMAND("xmlonly",endMarker="endxmlonly");
1787 CHECK_FOR_COMMAND("rtfonly",endMarker="endrtfonly");
1788 CHECK_FOR_COMMAND("manonly",endMarker="endmanonly");
1789 CHECK_FOR_COMMAND("docbookonly",endMarker="enddocbookonly");
1790 CHECK_FOR_COMMAND("startuml",endMarker="enduml");
1791 }
1792 //printf("isVerbatimSection(%s)=%d)\n",qPrint(QCString(&data[i]).left(10)),j);
1793 return j;
1794}

References CHECK_FOR_COMMAND.

Referenced by DocParser::processCopyDoc().

◆ skipToEndMarker()

size_t skipToEndMarker ( const char * data,
size_t i,
size_t len,
const QCString & endMarker )
static

Definition at line 1796 of file docparser.cpp.

1797{
1798 while (i<len)
1799 {
1800 if ((data[i]=='@' || data[i]=='\\') && // start of command character
1801 (i==0 || (data[i-1]!='@' && data[i-1]!='\\'))) // that is not escaped
1802 {
1803 if (i+endMarker.length()+1<=len && qstrncmp(data+i+1,endMarker.data(),endMarker.length())==0)
1804 {
1805 return i+endMarker.length()+1;
1806 }
1807 }
1808 i++;
1809 }
1810 // oops no endmarker found...
1811 return i<len ? i+1 : len;
1812}
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159
int qstrncmp(const char *str1, const char *str2, size_t len)
Definition qcstring.h:75

References QCString::data(), QCString::length(), and qstrncmp().

Referenced by DocParser::processCopyDoc().

◆ validatingParseDoc()

IDocNodeASTPtr validatingParseDoc ( IDocParser & parserIntf,
const QCString & fileName,
int startLine,
const Definition * ctx,
const MemberDef * md,
const QCString & input,
bool indexWords,
bool isExample,
const QCString & exampleName,
bool singleLine,
bool linkFromIndex,
bool markdownSupport = Config_getBool(MARKDOWN_SUPPORT),
bool autolinkSupport = Config_getBool(AUTOLINK_SUPPORT) )

Main entry point for the comment block parser.

Parameters
parserIntfThe parser object created via createDocParser()
fileNameFile in which the documentation block is found (or the name of the example file in case isExample is TRUE).
startLineLine at which the documentation block is found.
ctxClass or namespace to which this block belongs.
mdMember definition to which the documentation belongs. Can be 0.
inputString representation of the documentation block.
indexWordsIndicates whether or not words should be put in the search index.
isExampleTRUE if the documentation belongs to an example.
exampleNameBase name of the example file (0 if isExample is FALSE).
singleLineOutput should be presented on a single line, so without starting a new paragraph at the end.
linkFromIndexTRUE if the documentation is generated from an index page. In this case context is not used to determine the relative path when making a link.
markdownSupportTRUE if the input needs to take markdown markup into account.
autolinkSupportTRUE if the input need to perform auto linking of words
Returns
An object representing the abstract syntax tree. Ownership of the pointer is handed over to the caller.

Definition at line 1928 of file docparser.cpp.

1936{
1937 DocParser *parser = dynamic_cast<DocParser*>(&parserIntf);
1938 assert(parser!=nullptr);
1939 if (parser==nullptr) return nullptr;
1940 //printf("validatingParseDoc(%s,%s)=[%s]\n",ctx?qPrint(ctx->name()):"<none>",
1941 // md?qPrint(md->name()):"<none>",
1942 // qPrint(input));
1943 //printf("========== validating %s at line %d\n",qPrint(fileName),startLine);
1944 //printf("---------------- input --------------------\n%s\n----------- end input -------------------\n",qPrint(input));
1945
1946 // set initial token
1947 parser->context.token = parser->tokenizer.resetToken();
1948
1949 if (ctx && ctx!=Doxygen::globalScope &&
1952 )
1953 )
1954 {
1956 }
1957 else if (ctx && ctx->definitionType()==Definition::TypePage)
1958 {
1959 const Definition *scope = (toPageDef(ctx))->getPageScope();
1960 if (scope && scope!=Doxygen::globalScope)
1961 {
1962 parser->context.context = substitute(scope->name(),getLanguageSpecificSeparator(scope->getLanguage(),true),"::");
1963 }
1964 }
1965 else if (ctx && ctx->definitionType()==Definition::TypeGroup)
1966 {
1967 const Definition *scope = (toGroupDef(ctx))->getGroupScope();
1968 if (scope && scope!=Doxygen::globalScope)
1969 {
1970 parser->context.context = substitute(scope->name(),getLanguageSpecificSeparator(scope->getLanguage(),true),"::");
1971 }
1972 }
1973 else
1974 {
1975 parser->context.context = "";
1976 }
1977 parser->context.scope = ctx;
1978 parser->context.lang = getLanguageFromFileName(fileName);
1979
1980 if (indexWords && Doxygen::searchIndex.enabled())
1981 {
1982 if (md)
1983 {
1984 parser->context.searchUrl=md->getOutputFileBase();
1985 Doxygen::searchIndex.setCurrentDoc(md,md->anchor(),false);
1986 }
1987 else if (ctx)
1988 {
1989 parser->context.searchUrl=ctx->getOutputFileBase();
1990 Doxygen::searchIndex.setCurrentDoc(ctx,ctx->anchor(),false);
1991 }
1992 }
1993 else
1994 {
1995 parser->context.searchUrl="";
1996 }
1997
1998 parser->context.fileName = fileName;
1999 parser->context.relPath = (!linkFromIndex && ctx) ?
2001 QCString("");
2002 //printf("ctx->name=%s relPath=%s\n",qPrint(ctx->name()),qPrint(parser->context.relPath));
2003 parser->context.memberDef = md;
2004 while (!parser->context.nodeStack.empty()) parser->context.nodeStack.pop();
2005 while (!parser->context.styleStack.empty()) parser->context.styleStack.pop();
2006 while (!parser->context.initialStyleStack.empty()) parser->context.initialStyleStack.pop();
2007 parser->context.inSeeBlock = FALSE;
2008 parser->context.inCodeStyle = FALSE;
2009 parser->context.xmlComment = FALSE;
2010 parser->context.insideHtmlLink = FALSE;
2011 parser->context.includeFileText = "";
2012 parser->context.includeFileOffset = 0;
2013 parser->context.includeFileLength = 0;
2014 parser->context.isExample = isExample;
2015 parser->context.exampleName = exampleName;
2016 parser->context.hasParamCommand = FALSE;
2017 parser->context.hasReturnCommand = FALSE;
2018 parser->context.retvalsFound.clear();
2019 parser->context.paramsFound.clear();
2020 parser->context.markdownSupport = markdownSupport;
2021 parser->context.autolinkSupport = autolinkSupport;
2022
2023 //printf("Starting comment block at %s:%d\n",qPrint(parser->context.fileName),startLine);
2024 parser->tokenizer.setLineNr(startLine);
2025 size_t ioLen = input.length();
2026 QCString inpStr = parser->processCopyDoc(input.data(),ioLen);
2027 if (inpStr.isEmpty() || inpStr.at(inpStr.length()-1)!='\n')
2028 {
2029 inpStr+='\n';
2030 }
2031 //printf("processCopyDoc(in='%s' out='%s')\n",input,qPrint(inpStr));
2032 parser->tokenizer.init(inpStr.data(),parser->context.fileName,
2034
2035 // build abstract syntax tree
2036 auto ast = std::make_unique<DocNodeAST>(DocRoot(parser,md!=nullptr,singleLine));
2037 std::get<DocRoot>(ast->root).parse();
2038
2040 {
2041 // pretty print the result
2042 std::visit(PrintDocVisitor{},ast->root);
2043 }
2044
2045 if (md && md->isFunction())
2046 {
2048 }
2050
2051 // reset token
2052 parser->tokenizer.resetToken();
2053
2054 //printf(">>>>>> end validatingParseDoc(%s,%s)\n",ctx?qPrint(ctx->name()):"<none>",
2055 // md?qPrint(md->name()):"<none>");
2056
2057 return ast;
2058}
@ PrintTree
Definition debug.h:34
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:132
The common base class of all entity definitions found in the sources.
Definition definition.h:76
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual DefType definitionType() const =0
virtual QCString anchor() const =0
virtual QCString qualifiedName() const =0
virtual QCString getOutputFileBase() const =0
virtual const QCString & name() const =0
QCString processCopyDoc(const char *data, size_t &len)
void checkUnOrMultipleDocumentedParams()
Root node of documentation tree.
Definition docnode.h:1313
void init(const char *input, const QCString &fileName, bool markdownSupport, bool insideHtmlLink)
TokenInfo * resetToken()
static NamespaceDefMutable * globalScope
Definition doxygen.h:121
static SearchIndexIntf searchIndex
Definition doxygen.h:124
virtual bool isFunction() const =0
virtual void detectUndocumentedParams(bool hasParamCommand, bool hasReturnCommand) const =0
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:578
GroupDef * toGroupDef(Definition *d)
PageDef * toPageDef(Definition *d)
Definition pagedef.cpp:490
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:477
StringMultiSet retvalsFound
Definition docparser_p.h:76
DocStyleChangeStack styleStack
Definition docparser_p.h:68
size_t includeFileLength
Definition docparser_p.h:88
DocNodeStack nodeStack
Definition docparser_p.h:67
StringMultiSet paramsFound
Definition docparser_p.h:77
QCString exampleName
Definition docparser_p.h:80
const Definition * scope
Definition docparser_p.h:61
QCString includeFileText
Definition docparser_p.h:86
TokenInfo * token
Definition docparser_p.h:93
DocStyleChangeStack initialStyleStack
Definition docparser_p.h:69
SrcLangExt lang
Definition docparser_p.h:83
QCString searchUrl
Definition docparser_p.h:81
size_t includeFileOffset
Definition docparser_p.h:87
const MemberDef * memberDef
Definition docparser_p.h:78
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5724
QCString relativePathToRoot(const QCString &name)
Definition util.cpp:4095
QCString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Returns the scope separator to use given the programming language lang.
Definition util.cpp:6416

References Definition::anchor(), QCString::at(), DocParserContext::autolinkSupport, DocParser::checkUnOrMultipleDocumentedParams(), DocParser::context, DocParserContext::context, QCString::data(), Definition::definitionType(), MemberDef::detectUndocumentedParams(), DocParserContext::exampleName, FALSE, DocParserContext::fileName, Definition::getLanguage(), getLanguageFromFileName(), getLanguageSpecificSeparator(), Definition::getOutputFileBase(), Doxygen::globalScope, DocParserContext::hasParamCommand, DocParserContext::hasReturnCommand, DocParserContext::includeFileLength, DocParserContext::includeFileOffset, DocParserContext::includeFileText, DocParserContext::inCodeStyle, DocTokenizer::init(), DocParserContext::initialStyleStack, DocParserContext::inSeeBlock, DocParserContext::insideHtmlLink, QCString::isEmpty(), DocParserContext::isExample, Debug::isFlagSet(), MemberDef::isFunction(), DocParserContext::lang, QCString::length(), DocParserContext::markdownSupport, DocParserContext::memberDef, Definition::name(), DocParserContext::nodeStack, DocParserContext::paramsFound, Debug::PrintTree, DocParser::processCopyDoc(), Definition::qualifiedName(), relativePathToRoot(), DocParserContext::relPath, DocTokenizer::resetToken(), DocParserContext::retvalsFound, DocParserContext::scope, Doxygen::searchIndex, DocParserContext::searchUrl, DocTokenizer::setLineNr(), DocParserContext::styleStack, substitute(), toGroupDef(), DocParserContext::token, DocParser::tokenizer, toPageDef(), Definition::TypeClass, Definition::TypeGroup, Definition::TypeNamespace, Definition::TypePage, and DocParserContext::xmlComment.

Referenced by addPerlModDocBlock(), generateBriefDoc(), OutputList::generateDoc(), generateHtmlOutput(), getSQLDocBlock(), parseCommentAsText(), ConceptDefImpl::writeBriefDescription(), DirDefImpl::writeBriefDescription(), FileDefImpl::writeBriefDescription(), GroupDefImpl::writeBriefDescription(), ModuleDefImpl::writeBriefDescription(), NamespaceDefImpl::writeBriefDescription(), MemberDefImpl::writeDeclaration(), ClassDefImpl::writeDeclarationLink(), ConceptDefImpl::writeDeclarationLink(), ModuleDefImpl::writeDeclarationLink(), MemberList::writePlainDeclarations(), and writeXMLDocBlock().

◆ validatingParseText()

IDocNodeASTPtr validatingParseText ( IDocParser & parser,
const QCString & input )

Main entry point for parsing simple text fragments. These fragments are limited to words, whitespace and symbols.

Definition at line 2113 of file docparser.cpp.

2114{
2115 DocParser *parser = dynamic_cast<DocParser*>(&parserIntf);
2116 assert(parser!=nullptr);
2117 if (parser==nullptr) return nullptr;
2118
2119 // set initial token
2120 parser->context.token = parser->tokenizer.resetToken();
2121
2122 //printf("------------ input ---------\n%s\n"
2123 // "------------ end input -----\n",input);
2124 //parser->context.token = new TokenInfo;
2125 parser->context.context = "";
2126 parser->context.fileName = "<parseText>";
2127 parser->context.relPath = "";
2128 parser->context.memberDef = nullptr;
2129 while (!parser->context.nodeStack.empty()) parser->context.nodeStack.pop();
2130 while (!parser->context.styleStack.empty()) parser->context.styleStack.pop();
2131 while (!parser->context.initialStyleStack.empty()) parser->context.initialStyleStack.pop();
2132 parser->context.inSeeBlock = FALSE;
2133 parser->context.inCodeStyle = FALSE;
2134 parser->context.xmlComment = FALSE;
2135 parser->context.insideHtmlLink = FALSE;
2136 parser->context.includeFileText = "";
2137 parser->context.includeFileOffset = 0;
2138 parser->context.includeFileLength = 0;
2139 parser->context.isExample = FALSE;
2140 parser->context.exampleName = "";
2141 parser->context.hasParamCommand = FALSE;
2142 parser->context.hasReturnCommand = FALSE;
2143 parser->context.retvalsFound.clear();
2144 parser->context.paramsFound.clear();
2145 parser->context.searchUrl="";
2146 parser->context.lang = SrcLangExt::Unknown;
2147 parser->context.markdownSupport = Config_getBool(MARKDOWN_SUPPORT);
2148 parser->context.autolinkSupport = FALSE;
2149
2150
2151 auto ast = std::make_unique<DocNodeAST>(DocText(parser));
2152
2153 if (!input.isEmpty())
2154 {
2155 parser->tokenizer.setLineNr(1);
2156 parser->tokenizer.init(input.data(),parser->context.fileName,
2158
2159 // build abstract syntax tree
2160 std::get<DocText>(ast->root).parse();
2161
2163 {
2164 // pretty print the result
2165 std::visit(PrintDocVisitor{},ast->root);
2166 }
2167 }
2168
2169 return ast;
2170}
Root node of a text fragment.
Definition docnode.h:1304
#define Config_getBool(name)
Definition config.h:33

References DocParserContext::autolinkSupport, Config_getBool, DocParser::context, DocParserContext::context, QCString::data(), DocParserContext::exampleName, FALSE, DocParserContext::fileName, DocParserContext::hasParamCommand, DocParserContext::hasReturnCommand, DocParserContext::includeFileLength, DocParserContext::includeFileOffset, DocParserContext::includeFileText, DocParserContext::inCodeStyle, DocTokenizer::init(), DocParserContext::initialStyleStack, DocParserContext::inSeeBlock, DocParserContext::insideHtmlLink, QCString::isEmpty(), DocParserContext::isExample, Debug::isFlagSet(), DocParserContext::lang, DocParserContext::markdownSupport, DocParserContext::memberDef, DocParserContext::nodeStack, DocParserContext::paramsFound, Debug::PrintTree, DocParserContext::relPath, DocTokenizer::resetToken(), DocParserContext::retvalsFound, DocParserContext::searchUrl, DocTokenizer::setLineNr(), DocParserContext::styleStack, DocParserContext::token, DocParser::tokenizer, and DocParserContext::xmlComment.

Referenced by RTFGenerator::endIndexSection(), and OutputList::parseText().

◆ validatingParseTitle()

IDocNodeASTPtr validatingParseTitle ( IDocParser & parserIntf,
const QCString & fileName,
int lineNr,
const QCString & input )

Main entry point for parsing titles. These allow limited markup commands

Definition at line 2060 of file docparser.cpp.

2061{
2062 DocParser *parser = dynamic_cast<DocParser*>(&parserIntf);
2063 assert(parser!=nullptr);
2064 if (parser==nullptr) return nullptr;
2065
2066 // set initial token
2067 parser->context.token = parser->tokenizer.resetToken();
2068
2069 //printf("------------ input ---------\n%s\n"
2070 // "------------ end input -----\n",input);
2071 parser->context.context = "";
2072 parser->context.fileName = fileName;
2073 parser->context.relPath = "";
2074 parser->context.memberDef = nullptr;
2075 while (!parser->context.nodeStack.empty()) parser->context.nodeStack.pop();
2076 while (!parser->context.styleStack.empty()) parser->context.styleStack.pop();
2077 while (!parser->context.initialStyleStack.empty()) parser->context.initialStyleStack.pop();
2078 parser->context.inSeeBlock = FALSE;
2079 parser->context.inCodeStyle = FALSE;
2080 parser->context.xmlComment = FALSE;
2081 parser->context.insideHtmlLink = FALSE;
2082 parser->context.includeFileText = "";
2083 parser->context.includeFileOffset = 0;
2084 parser->context.includeFileLength = 0;
2085 parser->context.isExample = FALSE;
2086 parser->context.exampleName = "";
2087 parser->context.hasParamCommand = FALSE;
2088 parser->context.hasReturnCommand = FALSE;
2089 parser->context.retvalsFound.clear();
2090 parser->context.paramsFound.clear();
2091 parser->context.searchUrl="";
2092 parser->context.lang = SrcLangExt::Unknown;
2093 parser->context.markdownSupport = Config_getBool(MARKDOWN_SUPPORT);
2094 parser->context.autolinkSupport = false;
2095
2096 auto ast = std::make_unique<DocNodeAST>(DocTitle(parser,nullptr));
2097
2098 if (!input.isEmpty())
2099 {
2100 // build abstract syntax tree from title string
2101 std::get<DocTitle>(ast->root).parseFromString(nullptr,input);
2102
2104 {
2105 // pretty print the result
2106 std::visit(PrintDocVisitor{},ast->root);
2107 }
2108 }
2109
2110 return ast;
2111}
Node representing a simple section title.
Definition docnode.h:608

References DocParserContext::autolinkSupport, Config_getBool, DocParser::context, DocParserContext::context, DocParserContext::exampleName, FALSE, DocParserContext::fileName, DocParserContext::hasParamCommand, DocParserContext::hasReturnCommand, DocParserContext::includeFileLength, DocParserContext::includeFileOffset, DocParserContext::includeFileText, DocParserContext::inCodeStyle, DocParserContext::initialStyleStack, DocParserContext::inSeeBlock, DocParserContext::insideHtmlLink, QCString::isEmpty(), DocParserContext::isExample, Debug::isFlagSet(), DocParserContext::lang, DocParserContext::markdownSupport, DocParserContext::memberDef, DocParserContext::nodeStack, DocParserContext::paramsFound, Debug::PrintTree, DocParserContext::relPath, DocTokenizer::resetToken(), DocParserContext::retvalsFound, DocParserContext::searchUrl, DocParserContext::styleStack, DocParserContext::token, DocParser::tokenizer, and DocParserContext::xmlComment.

Referenced by parseCommentAsHtml().