My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Typedefs | Functions | Variables
docparser.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qcstring.h>
#include <qstack.h>
#include <qdict.h>
#include <qregexp.h>
#include <ctype.h>
#include "doxygen.h"
#include "debug.h"
#include "util.h"
#include "pagedef.h"
#include "docparser.h"
#include "doctokenizer.h"
#include "cmdmapper.h"
#include "printdocvisitor.h"
#include "message.h"
#include "section.h"
#include "searchindex.h"
#include "language.h"
#include "portable.h"
#include "cite.h"
#include "arguments.h"
#include "vhdldocgen.h"
#include "groupdef.h"
#include "classlist.h"
#include "filedef.h"
#include "memberdef.h"
#include "namespacedef.h"
#include "reflist.h"
#include "formula.h"
#include "config.h"
#include "growbuf.h"
#include "markdown.h"
#include "htmlentity.h"

Go to the source code of this file.

Classes

struct  DocParserContext
 
struct  ActiveRowSpan
 

Macros

#define DBG(x)   do {} while(0)
 
#define INTERNAL_ASSERT(x)   do {} while(0)
 
#define CHECK_FOR_COMMAND(str, action)
 

Typedefs

typedef QList< ActiveRowSpanRowSpanList
 

Functions

static void docParserPushContext (bool saveParamInfo=TRUE)
 
static void docParserPopContext (bool keepParamInfo=FALSE)
 
static void unescapeCRef (QCString &s)
 
static QCString findAndCopyImage (const char *fileName, DocImage::Type type)
 
static void checkArgumentName (const QCString &name, bool isParam)
 
static void checkUndocumentedParams ()
 
static void detectNoDocumentedParams ()
 
static QCString stripKnownExtensions (const char *text)
 
static bool insidePRE (DocNode *n)
 
static bool insideLI (DocNode *n)
 
static bool insideUL (DocNode *n)
 
static bool insideOL (DocNode *n)
 
static bool insideTable (DocNode *n)
 
static bool findDocsForMemberOrCompound (const char *commandName, QCString *pDoc, QCString *pBrief, Definition **pDef)
 
static bool defaultHandleToken (DocNode *parent, int tok, QList< DocNode > &children, bool handleWord=TRUE)
 
static int handleStyleArgument (DocNode *parent, QList< DocNode > &children, const QCString &cmdName)
 
static void handleStyleEnter (DocNode *parent, QList< DocNode > &children, DocStyleChange::Style s, const HtmlAttribList *attribs)
 
static void handleStyleLeave (DocNode *parent, QList< DocNode > &children, DocStyleChange::Style s, const char *tagName)
 
static void handlePendingStyleCommands (DocNode *parent, QList< DocNode > &children)
 
static void handleInitialStyleCommands (DocPara *parent, QList< DocNode > &children)
 
static int handleAHref (DocNode *parent, QList< DocNode > &children, const HtmlAttribList &tagHtmlAttribs)
 
static void handleUnclosedStyleCommands ()
 
static void handleLinkedWord (DocNode *parent, QList< DocNode > &children, bool ignoreAutoLinkFlag=FALSE)
 
static void handleParameterType (DocNode *parent, QList< DocNode > &children, const QCString &paramTypes)
 
static DocInternalRefhandleInternalRef (DocNode *parent)
 
static DocAnchorhandleAnchor (DocNode *parent)
 
static void defaultHandleTitleAndSize (const int cmd, DocNode *parent, QList< DocNode > &children, QCString &width, QCString &height)
 
static void handleImg (DocNode *parent, QList< DocNode > &children, const HtmlAttribList &tagHtmlAttribs)
 
static int internalValidatingParseDoc (DocNode *parent, QList< DocNode > &children, const QCString &doc)
 
static void readTextFileByName (const QCString &file, QCString &text)
 
static void flattenParagraphs (DocNode *root, QList< DocNode > &children)
 
static bool findAttribute (const HtmlAttribList &tagHtmlAttribs, const char *attrName, QCString *result)
 
static QCString extractCopyDocId (const char *data, uint &j, uint len)
 
static uint isCopyBriefOrDetailsCmd (const char *data, uint i, uint len, bool &brief)
 
static uint isVerbatimSection (const char *data, uint i, uint len, QCString &endMarker)
 
static uint skipToEndMarker (const char *data, uint i, uint len, const QCString &endMarker)
 
static QCString processCopyDoc (const char *data, uint &len)
 
DocRootvalidatingParseDoc (const char *fileName, int startLine, Definition *ctx, MemberDef *md, const char *input, bool indexWords, bool isExample, const char *exampleName, bool singleLine, bool linkFromIndex)
 
DocTextvalidatingParseText (const char *input)
 
void docFindSections (const char *input, Definition *d, MemberGroup *mg, const char *fileName)
 

Variables

static const char * sectionLevelToName []
 
static Definitiong_scope
 
static QCString g_context
 
static bool g_inSeeBlock
 
static bool g_xmlComment
 
static bool g_insideHtmlLink
 
static QStack< DocNodeg_nodeStack
 
static QStack< DocStyleChangeg_styleStack
 
static QStack< DocStyleChangeg_initialStyleStack
 
static QList< Definitiong_copyStack
 
static QCString g_fileName
 
static QCString g_relPath
 
static bool g_hasParamCommand
 
static bool g_hasReturnCommand
 
static QDict< void > g_paramsFound
 
static MemberDefg_memberDef
 
static bool g_isExample
 
static QCString g_exampleName
 
static SectionDictg_sectionDict
 
static QCString g_searchUrl
 
static QCString g_includeFileText
 
static uint g_includeFileOffset
 
static uint g_includeFileLength
 
static QStack< DocParserContextg_parserStack
 

Macro Definition Documentation

#define CHECK_FOR_COMMAND (   str,
  action 
)
Value:
do if ((i+sizeof(str)<len) && qstrncmp(data+i+1,str,sizeof(str)-1)==0) \
{ j=i+sizeof(str); action; } while(0)

Definition at line 7081 of file docparser.cpp.

Referenced by isCopyBriefOrDetailsCmd(), and isVerbatimSection().

#define DBG (   x)    do {} while(0)
#define INTERNAL_ASSERT (   x)    do {} while(0)

Definition at line 68 of file docparser.cpp.

Referenced by DocPara::handleCommand(), DocSection::parse(), and DocPara::parse().

Typedef Documentation

typedef QList<ActiveRowSpan> RowSpanList

List of ActiveRowSpan classes.

Definition at line 3755 of file docparser.cpp.

Function Documentation

static void checkArgumentName ( const QCString &  name,
bool  isParam 
)
static

Collects the parameters found with @param or @retval commands in a global list g_paramsFound. If isParam is set to TRUE and the parameter is not an actual parameter of the current member g_memberDef, then a warning is raised (unless warnings are disabled altogether).

Definition at line 388 of file docparser.cpp.

References argListToString(), MemberDef::argumentList(), Config_getBool, MemberDef::declArgumentList(), Definition::docFile(), Definition::docLine(), g_paramsFound, Definition::getDefFileName(), Definition::getDefLine(), Definition::getLanguage(), MemberDef::getScopeString(), MemberDef::inheritsDocsFrom(), MemberDef::isDefine(), MemberDef::isDocsForDefinition(), Argument::name, Definition::name(), SrcLangExt_Fortran, Argument::type, and warn_doc_error().

Referenced by DocParamList::parse(), and DocParamList::parseXml().

{
if (!Config_getBool(WARN_IF_DOC_ERROR)) return;
if (g_memberDef==0) return; // not a member
//printf("isDocsForDefinition()=%d\n",g_memberDef->isDocsForDefinition());
if (al==0) return; // no argument list
static QRegExp re("$?[a-zA-Z0-9_\\x80-\\xFF]+\\.*");
int p=0,i=0,l;
while ((i=re.match(name,p,&l))!=-1) // to handle @param x,y
{
QCString aName=name.mid(i,l);
if (lang==SrcLangExt_Fortran) aName=aName.lower();
//printf("aName=`%s'\n",aName.data());
bool found=FALSE;
for (ali.toFirst();(a=ali.current());++ali)
{
QCString argName = g_memberDef->isDefine() ? a->type : a->name;
if (lang==SrcLangExt_Fortran) argName=argName.lower();
argName=argName.stripWhiteSpace();
//printf("argName=`%s' aName=%s\n",argName.data(),aName.data());
if (argName.right(3)=="...") argName=argName.left(argName.length()-3);
if (aName==argName)
{
g_paramsFound.insert(aName,(void *)(0x8));
found=TRUE;
break;
}
}
if (!found && isParam)
{
//printf("member type=%d\n",memberDef->memberType());
QCString scope=g_memberDef->getScopeString();
if (!scope.isEmpty()) scope+="::"; else scope="";
QCString inheritedFrom = "";
QCString docFile = g_memberDef->docFile();
int docLine = g_memberDef->docLine();
if (inheritedMd) // documentation was inherited
{
inheritedFrom.sprintf(" inherited from member %s at line "
"%d in file %s",qPrint(inheritedMd->name()),
inheritedMd->docLine(),qPrint(inheritedMd->docFile()));
docLine = g_memberDef->getDefLine();
}
QCString alStr = argListToString(al);
warn_doc_error(docFile,docLine,
"argument '%s' of command @param "
"is not found in the argument list of %s%s%s%s",
qPrint(aName), qPrint(scope), qPrint(g_memberDef->name()),
qPrint(alStr), qPrint(inheritedFrom));
}
p=i+l;
}
}
static void checkUndocumentedParams ( )
static

Checks if the parameters that have been specified using @param are indeed all parameters. Must be called after checkArgumentName() has been called for each argument.

Definition at line 457 of file docparser.cpp.

References argListToString(), MemberDef::argumentList(), Config_getBool, MemberDef::declArgumentList(), Argument::docs, g_hasParamCommand, g_paramsFound, Definition::getDefFileName(), Definition::getDefLine(), Definition::getLanguage(), MemberDef::isDefine(), MemberDef::isDocsForDefinition(), Argument::name, MemberDef::qualifiedName(), SrcLangExt_Fortran, SrcLangExt_Python, substitute(), Argument::type, and warn_doc_error().

Referenced by validatingParseDoc().

{
if (g_memberDef && g_hasParamCommand && Config_getBool(WARN_IF_DOC_ERROR))
{
if (al!=0)
{
bool found=FALSE;
for (ali.toFirst();(a=ali.current());++ali)
{
QCString argName = g_memberDef->isDefine() ? a->type : a->name;
if (lang==SrcLangExt_Fortran) argName = argName.lower();
argName=argName.stripWhiteSpace();
if (argName.right(3)=="...") argName=argName.left(argName.length()-3);
if (g_memberDef->getLanguage()==SrcLangExt_Python && (argName=="self" || argName=="cls"))
{
// allow undocumented self / cls parameter for Python
}
else if (!argName.isEmpty() && g_paramsFound.find(argName)==0 && a->docs.isEmpty())
{
found = TRUE;
break;
}
}
if (found)
{
bool first=TRUE;
QCString errMsg=
"The following parameters of "+
QCString(g_memberDef->qualifiedName()) +
QCString(argListToString(al)) +
" are not documented:\n";
for (ali.toFirst();(a=ali.current());++ali)
{
QCString argName = g_memberDef->isDefine() ? a->type : a->name;
if (lang==SrcLangExt_Fortran) argName = argName.lower();
argName=argName.stripWhiteSpace();
if (g_memberDef->getLanguage()==SrcLangExt_Python && (argName=="self" || argName=="cls"))
{
// allow undocumented self / cls parameter for Python
}
else if (!argName.isEmpty() && g_paramsFound.find(argName)==0)
{
if (!first)
{
errMsg+="\n";
}
else
{
first=FALSE;
}
errMsg+=" parameter '"+argName+"'";
}
}
substitute(errMsg,"%","%%"));
}
}
}
}
static void defaultHandleTitleAndSize ( const int  cmd,
DocNode parent,
QList< DocNode > &  children,
QCString &  width,
QCString &  height 
)
static

Definition at line 1257 of file docparser.cpp.

References TokenInfo::chars, Mappers::cmdMapper, defaultHandleToken(), doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStatePara(), doctokenizerYYsetStateTitle(), doctokenizerYYsetStateTitleAttrValue(), Mapper::find(), g_fileName, g_nodeStack, g_token, handlePendingStyleCommands(), TokenInfo::name, TK_COMMAND, TK_SYMBOL, TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by DocPara::handleCommand(), DocImage::parse(), DocDotFile::parse(), DocMscFile::parse(), and DocDiaFile::parse().

{
g_nodeStack.push(parent);
// parse title
int tok;
while ((tok=doctokenizerYYlex()))
{
if (tok==TK_WORD && (g_token->name=="width=" || g_token->name=="height="))
{
// special case: no title, but we do have a size indicator
break;
}
if (!defaultHandleToken(parent,tok,children))
{
switch (tok)
{
case TK_COMMAND:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\%s",
qPrint(g_token->name), Mappers::cmdMapper->find(cmd).data());
break;
case TK_SYMBOL:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
qPrint(g_token->name));
break;
default:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
tokToString(tok));
break;
}
}
}
// parse size attributes
if (tok == 0)
{
}
while (tok==TK_WHITESPACE || tok==TK_WORD) // there are values following the title
{
if(tok == TK_WORD)
{
if (g_token->name=="width=" || g_token->name=="height=")
{
g_token->name = g_token->name.left(g_token->name.length()-1);
}
if (g_token->name=="width")
{
width = g_token->chars;
}
else if (g_token->name=="height")
{
height = g_token->chars;
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unknown option '%s' after \\%s command, expected 'width' or 'height'",
qPrint(g_token->name), Mappers::cmdMapper->find(cmd).data());
break;
}
}
}
handlePendingStyleCommands(parent,children);
DocNode *n=g_nodeStack.pop();
ASSERT(n==parent);
}
static bool defaultHandleToken ( DocNode parent,
int  tok,
QList< DocNode > &  children,
bool  handleWord = TRUE 
)
static

Definition at line 1341 of file docparser.cpp.

References TokenInfo::attribs, DocStyleChange::Bold, DocStyleChange::Center, TokenInfo::chars, CMD_AMP, CMD_ANCHOR, CMD_AT, CMD_BOLD, CMD_BSLASH, CMD_CODE, CMD_DBONLY, CMD_DCOLON, CMD_DOLLAR, CMD_EMPHASIS, CMD_FORMULA, CMD_GREATER, CMD_HASH, CMD_HTMLONLY, CMD_INTERNALREF, CMD_LATEXONLY, CMD_LESS, CMD_MANONLY, CMD_MDASH, CMD_MINUS, CMD_NDASH, CMD_PERCENT, CMD_PLUS, CMD_PUNT, CMD_QUOTE, CMD_RTFONLY, CMD_SETSCOPE, CMD_XMLONLY, Mappers::cmdMapper, DocStyleChange::Code, DBG, DocSymbol::decodeSymbol(), DocVerbatim::DocbookOnly, doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStateDbOnly(), doctokenizerYYsetStateHtmlOnly(), doctokenizerYYsetStateLatexOnly(), doctokenizerYYsetStateManOnly(), doctokenizerYYsetStatePara(), doctokenizerYYsetStateRtfOnly(), doctokenizerYYsetStateSetScope(), doctokenizerYYsetStateXmlOnly(), TokenInfo::endTag, g_context, g_exampleName, g_fileName, g_insideHtmlLink, g_isExample, g_nodeStack, g_token, handleAnchor(), handleInternalRef(), handleLinkedWord(), handleStyleArgument(), handleStyleEnter(), handleStyleLeave(), HTML_BOLD, HTML_CENTER, HTML_CODE, HTML_DIV, HTML_EMPHASIS, HTML_PRE, HTML_SMALL, HTML_SUB, HTML_SUP, DocVerbatim::HtmlOnly, Mappers::htmlTagMapper, TokenInfo::id, insidePRE(), TokenInfo::isEMailAddr, DocStyleChange::Italic, DocVerbatim::LatexOnly, DocVerbatim::ManOnly, TokenInfo::name, DocInternalRef::parse(), DocVerbatim::RtfOnly, DocStyleChange::Small, DocStyleChange::Subscript, DocStyleChange::Superscript, DocSymbol::Sym_Amp, DocSymbol::Sym_At, DocSymbol::Sym_BSlash, DocSymbol::Sym_Dollar, DocSymbol::Sym_Dot, DocSymbol::Sym_DoubleColon, DocSymbol::Sym_Greater, DocSymbol::Sym_Hash, DocSymbol::Sym_Less, DocSymbol::Sym_Minus, DocSymbol::Sym_Percent, DocSymbol::Sym_Plus, DocSymbol::Sym_Quot, DocSymbol::Sym_Unknown, TK_COMMAND, TK_HTMLTAG, TK_LNKWORD, TK_NEWPARA, TK_SYMBOL, TK_URL, TK_WHITESPACE, TK_WORD, tokToString(), TokenInfo::verb, warn_doc_error(), XML_C, and DocVerbatim::XmlOnly.

Referenced by defaultHandleTitleAndSize(), handleStyleArgument(), DocPara::injectToken(), DocTitle::parse(), DocVhdlFlow::parse(), DocLink::parse(), DocRef::parse(), DocInternalRef::parse(), DocHRef::parse(), DocHtmlHeader::parse(), DocHtmlDescTitle::parse(), DocSecRefItem::parse(), and DocHtmlCaption::parse().

{
DBG(("token %s at %d",tokToString(tok),doctokenizerYYlineno));
if (tok==TK_WORD || tok==TK_LNKWORD || tok==TK_SYMBOL || tok==TK_URL ||
tok==TK_COMMAND || tok==TK_HTMLTAG
)
{
DBG((" name=%s",qPrint(g_token->name)));
}
DBG(("\n"));
reparsetoken:
QCString tokenName = g_token->name;
switch (tok)
{
case TK_COMMAND:
switch (Mappers::cmdMapper->map(tokenName))
{
case CMD_BSLASH:
children.append(new DocSymbol(parent,DocSymbol::Sym_BSlash));
break;
case CMD_AT:
children.append(new DocSymbol(parent,DocSymbol::Sym_At));
break;
case CMD_LESS:
children.append(new DocSymbol(parent,DocSymbol::Sym_Less));
break;
children.append(new DocSymbol(parent,DocSymbol::Sym_Greater));
break;
case CMD_AMP:
children.append(new DocSymbol(parent,DocSymbol::Sym_Amp));
break;
case CMD_DOLLAR:
children.append(new DocSymbol(parent,DocSymbol::Sym_Dollar));
break;
case CMD_HASH:
children.append(new DocSymbol(parent,DocSymbol::Sym_Hash));
break;
case CMD_DCOLON:
children.append(new DocSymbol(parent,DocSymbol::Sym_DoubleColon));
break;
children.append(new DocSymbol(parent,DocSymbol::Sym_Percent));
break;
case CMD_NDASH:
children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
break;
case CMD_MDASH:
children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
break;
case CMD_QUOTE:
children.append(new DocSymbol(parent,DocSymbol::Sym_Quot));
break;
case CMD_PUNT:
children.append(new DocSymbol(parent,DocSymbol::Sym_Dot));
break;
case CMD_PLUS:
children.append(new DocSymbol(parent,DocSymbol::Sym_Plus));
break;
case CMD_MINUS:
children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
break;
{
children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Italic,TRUE));
tok=handleStyleArgument(parent,children,tokenName);
children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Italic,FALSE));
if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," "));
if (tok==TK_NEWPARA) goto handlepara;
else if (tok==TK_WORD || tok==TK_HTMLTAG)
{
DBG(("CMD_EMPHASIS: reparsing command %s\n",qPrint(g_token->name)));
goto reparsetoken;
}
}
break;
case CMD_BOLD:
{
children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Bold,TRUE));
tok=handleStyleArgument(parent,children,tokenName);
children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Bold,FALSE));
if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," "));
if (tok==TK_NEWPARA) goto handlepara;
else if (tok==TK_WORD || tok==TK_HTMLTAG)
{
DBG(("CMD_BOLD: reparsing command %s\n",qPrint(g_token->name)));
goto reparsetoken;
}
}
break;
case CMD_CODE:
{
children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Code,TRUE));
tok=handleStyleArgument(parent,children,tokenName);
children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Code,FALSE));
if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," "));
if (tok==TK_NEWPARA) goto handlepara;
else if (tok==TK_WORD || tok==TK_HTMLTAG)
{
DBG(("CMD_CODE: reparsing command %s\n",qPrint(g_token->name)));
goto reparsetoken;
}
}
break;
{
if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"htmlonly section ended without end marker");
}
break;
{
if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"manonly section ended without end marker");
}
break;
{
if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"rtfonly section ended without end marker");
}
break;
{
if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"latexonly section ended without end marker",doctokenizerYYlineno);
}
break;
{
if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"xmlonly section ended without end marker",doctokenizerYYlineno);
}
break;
case CMD_DBONLY:
{
if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"docbookonly section ended without end marker",doctokenizerYYlineno);
}
break;
{
DocFormula *form=new DocFormula(parent,g_token->id);
children.append(form);
}
break;
case CMD_ANCHOR:
{
DocAnchor *anchor = handleAnchor(parent);
if (anchor)
{
children.append(anchor);
}
}
break;
{
if (ref)
{
children.append(ref);
ref->parse();
}
}
break;
{
QCString scope;
scope = g_token->name;
g_context = scope;
//printf("Found scope='%s'\n",scope.data());
}
break;
default:
return FALSE;
}
break;
case TK_HTMLTAG:
{
switch (Mappers::htmlTagMapper->map(tokenName))
{
case HTML_DIV:
warn_doc_error(g_fileName,doctokenizerYYlineno,"found <div> tag in heading\n");
break;
case HTML_PRE:
warn_doc_error(g_fileName,doctokenizerYYlineno,"found <pre> tag in heading\n");
break;
case HTML_BOLD:
if (!g_token->endTag)
{
}
else
{
handleStyleLeave(parent,children,DocStyleChange::Bold,tokenName);
}
break;
case HTML_CODE:
case XML_C:
if (!g_token->endTag)
{
}
else
{
handleStyleLeave(parent,children,DocStyleChange::Code,tokenName);
}
break;
if (!g_token->endTag)
{
}
else
{
handleStyleLeave(parent,children,DocStyleChange::Italic,tokenName);
}
break;
case HTML_SUB:
if (!g_token->endTag)
{
}
else
{
handleStyleLeave(parent,children,DocStyleChange::Subscript,tokenName);
}
break;
case HTML_SUP:
if (!g_token->endTag)
{
}
else
{
handleStyleLeave(parent,children,DocStyleChange::Superscript,tokenName);
}
break;
if (!g_token->endTag)
{
}
else
{
handleStyleLeave(parent,children,DocStyleChange::Center,tokenName);
}
break;
case HTML_SMALL:
if (!g_token->endTag)
{
}
else
{
handleStyleLeave(parent,children,DocStyleChange::Small,tokenName);
}
break;
default:
return FALSE;
break;
}
}
break;
case TK_SYMBOL:
{
{
children.append(new DocSymbol(parent,s));
}
else
{
return FALSE;
}
}
break;
case TK_NEWPARA:
handlepara:
if (insidePRE(parent) || !children.isEmpty())
{
children.append(new DocWhiteSpace(parent,g_token->chars));
}
break;
case TK_LNKWORD:
if (handleWord)
{
handleLinkedWord(parent,children);
}
else
return FALSE;
break;
case TK_WORD:
if (handleWord)
{
children.append(new DocWord(parent,g_token->name));
}
else
return FALSE;
break;
case TK_URL:
{
children.append(new DocWord(parent,g_token->name));
}
else
{
children.append(new DocURL(parent,g_token->name,g_token->isEMailAddr));
}
break;
default:
return FALSE;
}
return TRUE;
}
static void detectNoDocumentedParams ( )
static

Check if a member has documentation for its parameter and or return type, if applicable. If found this will be stored in the member, this is needed as a member can have brief and detailed documentation, while only one of these needs to document the parameters.

Definition at line 529 of file docparser.cpp.

References MemberDef::argumentList(), Config_getBool, MemberDef::declArgumentList(), Argument::docs, doctokenizerYYlineno, g_fileName, g_hasParamCommand, g_hasReturnCommand, Definition::getLanguage(), MemberDef::hasDocumentedParams(), MemberDef::hasDocumentedReturnType(), MemberDef::isConstructor(), MemberDef::isDestructor(), Argument::name, MemberDef::setHasDocumentedParams(), MemberDef::setHasDocumentedReturnType(), SrcLangExt_Python, Argument::type, MemberDef::typeString(), and warn_doc_error().

Referenced by validatingParseDoc().

{
if (g_memberDef && Config_getBool(WARN_NO_PARAMDOC))
{
QCString returnType = g_memberDef->typeString();
{
//printf("%s->setHasDocumentedParams(TRUE);\n",g_memberDef->name().data());
}
{
bool allDoc=TRUE; // no paramater => all parameters are documented
if ( // member has parameters
al!=0 && // but the member has a parameter list
al->count()>0 // with at least one parameter (that is not void)
)
{
// see if all parameters have documentation
for (ali.toFirst();(a=ali.current()) && allDoc;++ali)
{
if (!a->name.isEmpty() && a->type!="void" &&
!(isPython && (a->name=="self" || a->name=="cls"))
)
{
allDoc = !a->docs.isEmpty();
}
//printf("a->type=%s a->name=%s doc=%s\n",
// a->type.data(),a->name.data(),a->docs.data());
}
if (!allDoc && declAl!=0) // try declaration arguments as well
{
allDoc=TRUE;
ArgumentListIterator ali(*declAl);
for (ali.toFirst();(a=ali.current()) && allDoc;++ali)
{
if (!a->name.isEmpty() && a->type!="void" &&
!(isPython && (a->name=="self" || a->name=="cls"))
)
{
allDoc = !a->docs.isEmpty();
}
//printf("a->name=%s doc=%s\n",a->name.data(),a->docs.data());
}
}
}
if (allDoc)
{
//printf("%s->setHasDocumentedParams(TRUE);\n",g_memberDef->name().data());
}
}
//printf("Member %s hadDocumentedReturnType()=%d hasReturnCommand=%d\n",
// g_memberDef->name().data(),g_memberDef->hasDocumentedReturnType(),g_hasReturnCommand);
if (!g_memberDef->hasDocumentedReturnType() && // docs not yet found
{
}
else if ( // see if return needs to documented
returnType.isEmpty() || // empty return type
returnType.find("void")!=-1 || // void return type
returnType.find("subroutine")!=-1 || // fortran subroutine
g_memberDef->isConstructor() || // a constructor
g_memberDef->isDestructor() // or destructor
)
{
}
else if ( // see if return type is documented in a function w/o return type
(returnType.isEmpty() || // empty return type
returnType.find("void")!=-1 || // void return type
returnType.find("subroutine")!=-1 || // fortran subroutine
g_memberDef->isConstructor() || // a constructor
g_memberDef->isDestructor() // or destructor
)
)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"documented empty return type");
}
}
}
void docFindSections ( const char *  input,
Definition d,
MemberGroup m,
const char *  fileName 
)
static void docParserPopContext ( bool  keepParamInfo = FALSE)
static

Definition at line 192 of file docparser.cpp.

References DocParserContext::context, DocParserContext::copyStack, doctokenizerYYlineno, doctokenizerYYpopContext(), DocParserContext::exampleName, DocParserContext::fileName, g_context, g_copyStack, g_exampleName, g_fileName, g_hasParamCommand, g_hasReturnCommand, g_includeFileLength, g_includeFileOffset, g_includeFileText, g_initialStyleStack, g_inSeeBlock, g_insideHtmlLink, g_isExample, g_nodeStack, g_paramsFound, g_parserStack, g_relPath, g_searchUrl, g_styleStack, g_token, g_xmlComment, DocParserContext::hasParamCommand, DocParserContext::hasReturnCommand, DocParserContext::includeFileLength, DocParserContext::includeFileOffset, DocParserContext::includeFileText, DocParserContext::initialStyleStack, DocParserContext::inSeeBlock, DocParserContext::insideHtmlLink, DocParserContext::isExample, DocParserContext::lineNo, DocParserContext::memberDef, DocParserContext::nodeStack, DocParserContext::paramsFound, DocParserContext::relPath, DocParserContext::scope, DocParserContext::searchUrl, DocParserContext::sectionDict, DocParserContext::styleStack, DocParserContext::token, and DocParserContext::xmlComment.

Referenced by DocPara::handleInclude(), DocPara::handleInheritDoc(), DocCopy::parse(), DocXRefItem::parse(), DocRef::parse(), DocSimpleSect::parseRcs(), validatingParseDoc(), and validatingParseText().

{
g_scope = ctx->scope;
if (!keepParamInfo)
{
}
delete g_token;
g_token = ctx->token;
delete ctx;
//QCString indent;
//indent.fill(' ',g_parserStack.count()*2+2);
//printf("%sdocParserPopContext() count=%d\n",indent.data(),g_nodeStack.count());
}
static void docParserPushContext ( bool  saveParamInfo = TRUE)
static

Definition at line 148 of file docparser.cpp.

References DocParserContext::context, DocParserContext::copyStack, doctokenizerYYlineno, doctokenizerYYpushContext(), DocParserContext::exampleName, DocParserContext::fileName, g_context, g_copyStack, g_exampleName, g_fileName, g_hasParamCommand, g_hasReturnCommand, g_includeFileLength, g_includeFileOffset, g_includeFileText, g_initialStyleStack, g_inSeeBlock, g_insideHtmlLink, g_isExample, g_memberDef, g_nodeStack, g_paramsFound, g_parserStack, g_relPath, g_scope, g_searchUrl, g_sectionDict, g_styleStack, g_token, g_xmlComment, DocParserContext::hasParamCommand, DocParserContext::hasReturnCommand, DocParserContext::includeFileLength, DocParserContext::includeFileOffset, DocParserContext::includeFileText, DocParserContext::initialStyleStack, DocParserContext::inSeeBlock, DocParserContext::insideHtmlLink, DocParserContext::isExample, DocParserContext::lineNo, DocParserContext::memberDef, DocParserContext::nodeStack, DocParserContext::paramsFound, DocParserContext::relPath, DocParserContext::scope, DocParserContext::searchUrl, DocParserContext::sectionDict, DocParserContext::styleStack, DocParserContext::token, and DocParserContext::xmlComment.

Referenced by DocPara::handleInclude(), DocPara::handleInheritDoc(), DocCopy::parse(), DocXRefItem::parse(), DocRef::parse(), DocSimpleSect::parseRcs(), validatingParseDoc(), and validatingParseText().

{
//QCString indent;
//indent.fill(' ',g_parserStack.count()*2+2);
//printf("%sdocParserPushContext() count=%d\n",indent.data(),g_nodeStack.count());
ctx->scope = g_scope;
if (saveParamInfo)
{
}
ctx->token = g_token;
g_parserStack.push(ctx);
}
static QCString extractCopyDocId ( const char *  data,
uint &  j,
uint  len 
)
static

Definition at line 7020 of file docparser.cpp.

Referenced by processCopyDoc().

{
uint s=j;
uint e=j;
int round=0;
bool insideDQuote=FALSE;
bool insideSQuote=FALSE;
bool found=FALSE;
while (j<len && !found)
{
if (!insideSQuote && !insideDQuote)
{
switch (data[j])
{
case '(': round++; break;
case ')': round--; break;
case '"': insideDQuote=TRUE; break;
case '\'': insideSQuote=TRUE; break;
case ' ': // fall through
case '\t': // fall through
case '\n':
found=(round==0);
break;
}
}
else if (insideSQuote) // look for single quote end
{
if (data[j]=='\'' && (j==0 || data[j]!='\\'))
{
insideSQuote=FALSE;
}
}
else if (insideDQuote) // look for double quote end
{
if (data[j]=='"' && (j==0 || data[j]!='\\'))
{
insideDQuote=FALSE;
}
}
if (!found) j++;
}
if (qstrncmp(data+j," const",6)==0)
{
j+=6;
}
else if (qstrncmp(data+j," volatile",9)==0)
{
j+=9;
}
e=j;
QCString id(e-s+1);
if (e>s) memcpy(id.rawData(),data+s,e-s);
id.at(e-s)='\0';
//printf("extractCopyDocId='%s' input='%s'\n",id.data(),&data[s]);
return id;
}
static QCString findAndCopyImage ( const char *  fileName,
DocImage::Type  type 
)
static

search for an image in the imageNameDict and if found copies the image to the output directory (which depends on the type parameter).

Definition at line 264 of file docparser.cpp.

References FileDef::absFilePath(), IndexList::addImageFile(), Config_getBool, Config_getString, DocImage::DocBook, doctokenizerYYlineno, err(), findFileDef(), g_fileName, DocImage::Html, Doxygen::imageNameDict, Doxygen::indexList, DocImage::Latex, FileDef::name(), portable_system(), portable_sysTimerStart(), portable_sysTimerStop(), DocImage::Rtf, showFileDefMatches(), and warn_doc_error().

Referenced by DocPara::handleImage().

{
QCString result;
bool ambig;
FileDef *fd;
//printf("Search for %s\n",fileName);
if ((fd=findFileDef(Doxygen::imageNameDict,fileName,ambig)))
{
QCString inputFile = fd->absFilePath();
QFile inImage(inputFile);
if (inImage.open(IO_ReadOnly))
{
result = fileName;
int i;
if ((i=result.findRev('/'))!=-1 || (i=result.findRev('\\'))!=-1)
{
result = result.right(result.length()-i-1);
}
//printf("fileName=%s result=%s\n",fileName,result.data());
QCString outputDir;
switch(type)
{
if (!Config_getBool(GENERATE_HTML)) return result;
outputDir = Config_getString(HTML_OUTPUT);
break;
if (!Config_getBool(GENERATE_LATEX)) return result;
outputDir = Config_getString(LATEX_OUTPUT);
break;
if (!Config_getBool(GENERATE_DOCBOOK)) return result;
outputDir = Config_getString(DOCBOOK_OUTPUT);
break;
if (!Config_getBool(GENERATE_RTF)) return result;
outputDir = Config_getString(RTF_OUTPUT);
break;
}
QCString outputFile = outputDir+"/"+result;
QFileInfo outfi(outputFile);
if (outfi.isSymLink())
{
QFile::remove(outputFile);
warn_doc_error(g_fileName,doctokenizerYYlineno,
"destination of image %s is a symlink, replacing with image",
qPrint(outputFile));
}
if (outputFile!=inputFile) // prevent copying to ourself
{
QFile outImage(outputFile.data());
if (outImage.open(IO_WriteOnly)) // copy the image
{
char *buffer = new char[inImage.size()];
inImage.readBlock(buffer,inImage.size());
outImage.writeBlock(buffer,inImage.size());
outImage.flush();
delete[] buffer;
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,
"could not write output image %s",qPrint(outputFile));
}
}
else
{
printf("Source & Destination are the same!\n");
}
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,
"could not open image %s",qPrint(fileName));
}
if (type==DocImage::Latex && Config_getBool(USE_PDFLATEX) &&
fd->name().right(4)==".eps"
)
{ // we have an .eps image in pdflatex mode => convert it to a pdf.
QCString outputDir = Config_getString(LATEX_OUTPUT);
QCString baseName = fd->name().left(fd->name().length()-4);
QCString epstopdfArgs(4096);
epstopdfArgs.sprintf("\"%s/%s.eps\" --outfile=\"%s/%s.pdf\"",
outputDir.data(), baseName.data(),
outputDir.data(), baseName.data());
if (portable_system("epstopdf",epstopdfArgs)!=0)
{
err("Problems running epstopdf. Check your TeX installation!\n");
}
return baseName;
}
}
else if (ambig)
{
QCString text;
text.sprintf("image file name %s is ambiguous.\n",qPrint(fileName));
text+="Possible candidates:\n";
warn_doc_error(g_fileName,doctokenizerYYlineno,text);
}
else
{
result=fileName;
if (result.left(5)!="http:" && result.left(6)!="https:")
{
warn_doc_error(g_fileName,doctokenizerYYlineno,
"image file %s is not found in IMAGE_PATH: "
"assuming external image.",qPrint(fileName)
);
}
}
return result;
}
static bool findAttribute ( const HtmlAttribList tagHtmlAttribs,
const char *  attrName,
QCString *  result 
)
static

Definition at line 5802 of file docparser.cpp.

References HtmlAttrib::name, and HtmlAttrib::value.

Referenced by DocPara::handleHtmlStartTag().

{
HtmlAttribListIterator li(tagHtmlAttribs);
HtmlAttrib *opt;
for (li.toFirst();(opt=li.current());++li)
{
if (opt->name==attrName)
{
*result = opt->value;
return TRUE;
}
}
return FALSE;
}
static bool findDocsForMemberOrCompound ( const char *  commandName,
QCString *  pDoc,
QCString *  pBrief,
Definition **  pDef 
)
static

Looks for a documentation block with name commandName in the current context (g_context). The resulting documentation string is put in pDoc, the definition in which the documentation was found is put in pDef.

Return values
TRUEif name was found.
FALSEif name was not found.

Definition at line 718 of file docparser.cpp.

References Definition::briefDescription(), MemberDef::briefDescription(), Doxygen::classSDict, Definition::documentation(), MemberDef::documentation(), SDict< T >::find(), findFileDef(), g_context, getDefs(), Doxygen::groupSDict, Doxygen::inputNameDict, Doxygen::namespaceSDict, Doxygen::pageSDict, removeRedundantWhiteSpace(), and substitute().

Referenced by DocCopy::parse(), and processCopyDoc().

{
//printf("findDocsForMemberOrCompound(%s)\n",commandName);
*pDoc="";
*pBrief="";
*pDef=0;
QCString cmdArg=substitute(commandName,"#","::");
int l=cmdArg.length();
if (l==0) return FALSE;
int funcStart=cmdArg.find('(');
if (funcStart==-1)
{
funcStart=l;
}
else
{
// Check for the case of operator() and the like.
// beware of scenarios like operator()((foo)bar)
int secondParen = cmdArg.find('(', funcStart+1);
int leftParen = cmdArg.find(')', funcStart+1);
if (leftParen!=-1 && secondParen!=-1)
{
if (leftParen<secondParen)
{
funcStart=secondParen;
}
}
}
QCString name=removeRedundantWhiteSpace(cmdArg.left(funcStart));
QCString args=cmdArg.right(l-funcStart);
// try if the link is to a member
MemberDef *md=0;
ClassDef *cd=0;
FileDef *fd=0;
NamespaceDef *nd=0;
GroupDef *gd=0;
PageDef *pd=0;
bool found = getDefs(
g_context.find('.')==-1?g_context.data():"", // `find('.') is a hack to detect files
name,
args.isEmpty()?0:args.data(),
md,cd,fd,nd,gd,FALSE,0,TRUE);
//printf("found=%d context=%s name=%s\n",found,g_context.data(),name.data());
if (found && md)
{
*pDoc=md->documentation();
*pBrief=md->briefDescription();
*pDef=md;
return TRUE;
}
int scopeOffset=g_context.length();
do // for each scope
{
QCString fullName=cmdArg;
if (scopeOffset>0)
{
fullName.prepend(g_context.left(scopeOffset)+"::");
}
//printf("Trying fullName=`%s'\n",fullName.data());
// try class, namespace, group, page, file reference
cd = Doxygen::classSDict->find(fullName);
if (cd) // class
{
*pDoc=cd->documentation();
*pBrief=cd->briefDescription();
*pDef=cd;
return TRUE;
}
nd = Doxygen::namespaceSDict->find(fullName);
if (nd) // namespace
{
*pDoc=nd->documentation();
*pBrief=nd->briefDescription();
*pDef=nd;
return TRUE;
}
gd = Doxygen::groupSDict->find(cmdArg);
if (gd) // group
{
*pDoc=gd->documentation();
*pBrief=gd->briefDescription();
*pDef=gd;
return TRUE;
}
pd = Doxygen::pageSDict->find(cmdArg);
if (pd) // page
{
*pDoc=pd->documentation();
*pBrief=pd->briefDescription();
*pDef=pd;
return TRUE;
}
bool ambig;
fd = findFileDef(Doxygen::inputNameDict,cmdArg,ambig);
if (fd && !ambig) // file
{
*pDoc=fd->documentation();
*pBrief=fd->briefDescription();
*pDef=fd;
return TRUE;
}
if (scopeOffset==0)
{
scopeOffset=-1;
}
else
{
scopeOffset = g_context.findRev("::",scopeOffset-1);
if (scopeOffset==-1) scopeOffset=0;
}
} while (scopeOffset>=0);
return FALSE;
}
static void flattenParagraphs ( DocNode root,
QList< DocNode > &  children 
)
static

Definition at line 2538 of file docparser.cpp.

References CompAccept< T >::children(), DocNode::kind(), DocNode::Kind_Para, and DocNode::setParent().

Referenced by DocRef::parse().

{
QListIterator<DocNode> li(children);
QList<DocNode> newChildren;
DocNode *dn;
for (li.toFirst();(dn=li.current());++li)
{
{
DocPara *para = (DocPara*)dn;
QList<DocNode> &paraChildren = para->children();
paraChildren.setAutoDelete(FALSE); // unlink children from paragraph node
QListIterator<DocNode> li2(paraChildren);
DocNode *dn2;
for (li2.toFirst();(dn2=li2.current());++li2)
{
newChildren.append(dn2); // add them to new node
}
}
}
children.clear();
QListIterator<DocNode> li3(newChildren);
for (li3.toFirst();(dn=li3.current());++li3)
{
children.append(dn);
dn->setParent(root);
}
}
static int handleAHref ( DocNode parent,
QList< DocNode > &  children,
const HtmlAttribList tagHtmlAttribs 
)
static

Definition at line 983 of file docparser.cpp.

References doctokenizerYYlineno, g_fileName, g_insideHtmlLink, g_relPath, HtmlAttrib::name, DocHRef::parse(), RetVal_OK, HtmlAttrib::value, and warn_doc_error().

Referenced by DocPara::handleHtmlStartTag(), DocHtmlHeader::parse(), and DocHtmlDescTitle::parse().

{
HtmlAttribListIterator li(tagHtmlAttribs);
HtmlAttrib *opt;
int index=0;
int retval = RetVal_OK;
for (li.toFirst();(opt=li.current());++li,++index)
{
if (opt->name=="name") // <a name=label> tag
{
if (!opt->value.isEmpty())
{
DocAnchor *anc = new DocAnchor(parent,opt->value,TRUE);
children.append(anc);
break; // stop looking for other tag attribs
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"found <a> tag with name option but without value!");
}
}
else if (opt->name=="href") // <a href=url>..</a> tag
{
// copy attributes
HtmlAttribList attrList = tagHtmlAttribs;
// and remove the href attribute
bool result = attrList.remove(index);
ASSERT(result);
DocHRef *href = new DocHRef(parent,attrList,opt->value,g_relPath);
children.append(href);
retval = href->parse();
break;
}
else // unsupported option for tag a
{
}
}
return retval;
}
static DocAnchor* handleAnchor ( DocNode parent)
static

Definition at line 1220 of file docparser.cpp.

References doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStateAnchor(), doctokenizerYYsetStatePara(), g_fileName, g_token, TokenInfo::name, TK_LNKWORD, TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by defaultHandleToken(), and DocPara::handleCommand().

{
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint(g_token->name));
return 0;
}
if (tok==0)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment block while parsing the "
"argument of command %s",qPrint(g_token->name));
return 0;
}
else if (tok!=TK_WORD && tok!=TK_LNKWORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
tokToString(tok),qPrint(g_token->name));
return 0;
}
return new DocAnchor(parent,g_token->name,FALSE);
}
static void handleImg ( DocNode parent,
QList< DocNode > &  children,
const HtmlAttribList tagHtmlAttribs 
)
static

Definition at line 1686 of file docparser.cpp.

References doctokenizerYYlineno, g_fileName, DocImage::Html, HtmlAttrib::name, HtmlAttrib::value, and warn_doc_error().

Referenced by DocPara::handleHtmlStartTag().

{
HtmlAttribListIterator li(tagHtmlAttribs);
HtmlAttrib *opt;
bool found=FALSE;
int index=0;
for (li.toFirst();(opt=li.current());++li,++index)
{
//printf("option name=%s value=%s\n",opt->name.data(),opt->value.data());
if (opt->name=="src" && !opt->value.isEmpty())
{
// copy attributes
HtmlAttribList attrList = tagHtmlAttribs;
// and remove the src attribute
bool result = attrList.remove(index);
ASSERT(result);
DocImage *img = new DocImage(parent,attrList,opt->value,DocImage::Html,opt->value);
children.append(img);
found = TRUE;
}
}
if (!found)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"IMG tag does not have a SRC attribute!\n");
}
}
static void handleInitialStyleCommands ( DocPara parent,
QList< DocNode > &  children 
)
static

Definition at line 974 of file docparser.cpp.

References DocStyleChange::attribs(), g_initialStyleStack, handleStyleEnter(), and DocStyleChange::style().

Referenced by DocPara::parse().

{
while ((sc=g_initialStyleStack.pop()))
{
handleStyleEnter(parent,children,sc->style(),&sc->attribs());
}
}
static DocInternalRef* handleInternalRef ( DocNode parent)
static

Definition at line 1198 of file docparser.cpp.

References doctokenizerYYlex(), doctokenizerYYlineno, doctokenizerYYsetStateInternalRef(), g_fileName, g_token, TokenInfo::name, TK_LNKWORD, TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by defaultHandleToken(), and DocPara::handleCommand().

{
//printf("CMD_INTERNALREF\n");
int tok=doctokenizerYYlex();
QCString tokenName = g_token->name;
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint(tokenName));
return 0;
}
tok=doctokenizerYYlex(); // get the reference id
if (tok!=TK_WORD && tok!=TK_LNKWORD)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
tokToString(tok),qPrint(tokenName));
return 0;
}
return new DocInternalRef(parent,g_token->name);
}
static void handleLinkedWord ( DocNode parent,
QList< DocNode > &  children,
bool  ignoreAutoLinkFlag = FALSE 
)
static

Definition at line 1056 of file docparser.cpp.

References MemberDef::anchor(), Definition::anchor(), ClassDef::anchor(), Definition::briefDescriptionAsTooltip(), Config_getBool, DefinitionIntf::definitionType(), doctokenizerYYlineno, findFileDef(), g_context, g_fileName, g_inSeeBlock, g_insideHtmlLink, g_token, getClass(), MemberDef::getClassDef(), MemberDef::getOutputFileBase(), ClassDef::getOutputFileBase(), Definition::getOutputFileBase(), MemberDef::getReference(), ClassDef::getReference(), Definition::getReference(), Doxygen::inputNameDict, MemberDef::isLinkable(), Definition::isLinkable(), MemberDef::isObjCMethod(), linkToText(), TokenInfo::name, MemberDef::objCMethodName(), resolveRef(), SrcLangExt_Unknown, DefinitionIntf::TypeFile, DefinitionIntf::TypeGroup, and warn_doc_error().

Referenced by defaultHandleToken(), DocPara::handleHtmlStartTag(), handleParameterType(), DocPara::parse(), DocParamList::parse(), and DocParamList::parseXml().

{
QCString name = linkToText(SrcLangExt_Unknown,g_token->name,TRUE);
static bool autolinkSupport = Config_getBool(AUTOLINK_SUPPORT);
if (!autolinkSupport && !ignoreAutoLinkFlag) // no autolinking -> add as normal word
{
children.append(new DocWord(parent,name));
return;
}
// ------- try to turn the word 'name' into a link
Definition *compound=0;
MemberDef *member=0;
int len = g_token->name.length();
ClassDef *cd=0;
bool ambig;
//printf("handleLinkedWord(%s) g_context=%s\n",g_token->name.data(),g_context.data());
(resolveRef(g_context,g_token->name,g_inSeeBlock,&compound,&member,TRUE,fd,TRUE)
|| (!g_context.isEmpty() && // also try with global scope
resolveRef("",g_token->name,g_inSeeBlock,&compound,&member,FALSE,0,TRUE))
)
)
{
//printf("resolveRef %s = %p (linkable?=%d)\n",qPrint(g_token->name),member,member ? member->isLinkable() : FALSE);
if (member && member->isLinkable()) // member link
{
if (member->isObjCMethod())
{
bool localLink = g_memberDef ? member->getClassDef()==g_memberDef->getClassDef() : FALSE;
name = member->objCMethodName(localLink,g_inSeeBlock);
}
children.append(new
DocLinkedWord(parent,name,
member->getReference(),
member->getOutputFileBase(),
member->anchor(),
)
);
}
else if (compound->isLinkable()) // compound link
{
QCString anchor = compound->anchor();
{
name=g_token->name;
}
else if (compound->definitionType()==Definition::TypeGroup)
{
name=((GroupDef*)compound)->groupTitle();
}
children.append(new
DocLinkedWord(parent,name,
compound->getReference(),
compound->getOutputFileBase(),
anchor,
)
);
}
else if (compound->definitionType()==Definition::TypeFile &&
((FileDef*)compound)->generateSourceFile()
) // undocumented file that has source code we can link to
{
children.append(new
compound->getReference(),
compound->getSourceFileBase(),
"",
)
);
}
else // not linkable
{
children.append(new DocWord(parent,name));
}
}
else if (!g_insideHtmlLink && len>1 && g_token->name.at(len-1)==':')
{
// special case, where matching Foo: fails to be an Obj-C reference,
// but Foo itself might be linkable.
g_token->name=g_token->name.left(len-1);
handleLinkedWord(parent,children,ignoreAutoLinkFlag);
children.append(new DocWord(parent,":"));
}
else if (!g_insideHtmlLink && (cd=getClass(g_token->name+"-p")))
{
// special case 2, where the token name is not a class, but could
// be a Obj-C protocol
children.append(new
DocLinkedWord(parent,name,
cd->getReference(),
cd->anchor(),
));
}
// else if (!g_insideHtmlLink && (cd=getClass(g_token->name+"-g")))
// {
// // special case 3, where the token name is not a class, but could
// // be a C# generic
// children.append(new
// DocLinkedWord(parent,name,
// cd->getReference(),
// cd->getOutputFileBase(),
// cd->anchor(),
// cd->briefDescriptionAsTooltip()
// ));
// }
else // normal non-linkable word
{
if (g_token->name.left(1)=="#" || g_token->name.left(2)=="::")
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"explicit link request to '%s' could not be resolved",qPrint(name));
children.append(new DocWord(parent,g_token->name));
}
else
{
children.append(new DocWord(parent,name));
}
}
}
static void handleParameterType ( DocNode parent,
QList< DocNode > &  children,
const QCString &  paramTypes 
)
static

Definition at line 1183 of file docparser.cpp.

References g_token, handleLinkedWord(), and TokenInfo::name.

Referenced by DocParamList::parse().

{
QCString name = g_token->name;
int p=0,i;
while ((i=paramTypes.find('|',p))!=-1)
{
g_token->name = paramTypes.mid(p,i-p);
handleLinkedWord(parent,children);
p=i+1;
}
g_token->name = paramTypes.mid(p);
handleLinkedWord(parent,children);
g_token->name = name;
}
static void handlePendingStyleCommands ( DocNode parent,
QList< DocNode > &  children 
)
static

Called at the end of a paragraph to close all open style changes (e.g. a without a ). The closed styles are pushed onto a stack and entered again at the start of a new paragraph.

Definition at line 959 of file docparser.cpp.

References g_initialStyleStack, g_nodeStack, g_styleStack, DocStyleChange::position(), and DocStyleChange::style().

Referenced by defaultHandleTitleAndSize(), DocTitle::parse(), DocVhdlFlow::parse(), DocLink::parse(), DocRef::parse(), DocInternalRef::parse(), DocHRef::parse(), DocHtmlHeader::parse(), DocHtmlDescTitle::parse(), DocSecRefItem::parse(), DocPara::parse(), and DocHtmlCaption::parse().

{
if (!g_styleStack.isEmpty())
{
while (sc && sc->position()>=g_nodeStack.count())
{ // there are unclosed style modifiers in the paragraph
children.append(new DocStyleChange(parent,g_nodeStack.count(),sc->style(),FALSE));
g_styleStack.pop();
sc = g_styleStack.top();
}
}
}
static int handleStyleArgument ( DocNode parent,
QList< DocNode > &  children,
const QCString &  cmdName 
)
static

Definition at line 850 of file docparser.cpp.

References DBG, defaultHandleToken(), doctokenizerYYlex(), doctokenizerYYlineno, TokenInfo::endTag, g_fileName, g_token, Mappers::htmlTagMapper, insideLI(), TokenInfo::name, RetVal_OK, TK_COMMAND, TK_ENDLIST, TK_HTMLTAG, TK_LISTITEM, TK_NEWPARA, TK_SYMBOL, TK_WHITESPACE, TK_WORD, tokToString(), and warn_doc_error().

Referenced by defaultHandleToken(), and DocPara::handleCommand().

{
DBG(("handleStyleArgument(%s)\n",qPrint(cmdName)));
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
qPrint(cmdName));
return tok;
}
while ((tok=doctokenizerYYlex()) &&
tok!=TK_WHITESPACE &&
tok!=TK_NEWPARA &&
tok!=TK_LISTITEM &&
)
{
static QRegExp specialChar("[.,|()\\[\\]:;\\?]");
if (tok==TK_WORD && g_token->name.length()==1 &&
g_token->name.find(specialChar)!=-1)
{
// special character that ends the markup command
return tok;
}
if (!defaultHandleToken(parent,tok,children))
{
switch (tok)
{
case TK_COMMAND:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command \\%s as the argument of a \\%s command",
qPrint(g_token->name),qPrint(cmdName));
break;
case TK_SYMBOL:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found while handling command %s",
qPrint(g_token->name),qPrint(cmdName));
break;
case TK_HTMLTAG:
{ // ignore </li> as the end of a style command
continue;
}
return tok;
break;
default:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s while handling command %s",
tokToString(tok),qPrint(cmdName));
break;
}
break;
}
}
DBG(("handleStyleArgument(%s) end tok=%x\n",qPrint(cmdName),tok));
return (tok==TK_NEWPARA || tok==TK_LISTITEM || tok==TK_ENDLIST
) ? tok : RetVal_OK;
}
static void handleStyleEnter ( DocNode parent,
QList< DocNode > &  children,
DocStyleChange::Style  s,
const HtmlAttribList attribs 
)
static

Called when a style change starts. For instance a <b> command is encountered.

Definition at line 910 of file docparser.cpp.

References DBG, g_nodeStack, and g_styleStack.

Referenced by defaultHandleToken(), DocPara::handleHtmlStartTag(), and handleInitialStyleCommands().

{
DBG(("HandleStyleEnter\n"));
DocStyleChange *sc= new DocStyleChange(parent,g_nodeStack.count(),s,TRUE,attribs);
children.append(sc);
g_styleStack.push(sc);
}
static void handleStyleLeave ( DocNode parent,
QList< DocNode > &  children,
DocStyleChange::Style  s,
const char *  tagName 
)
static

Called when a style change ends. For instance a </b> command is encountered.

Definition at line 922 of file docparser.cpp.

References DBG, doctokenizerYYlineno, g_fileName, g_nodeStack, g_styleStack, and warn_doc_error().

Referenced by defaultHandleToken(), and DocPara::handleHtmlEndTag().

{
DBG(("HandleStyleLeave\n"));
if (g_styleStack.isEmpty() || // no style change
g_styleStack.top()->style()!=s || // wrong style change
g_styleStack.top()->position()!=g_nodeStack.count() // wrong position
)
{
if (g_styleStack.isEmpty())
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"found </%s> tag without matching <%s>",
qPrint(tagName),qPrint(tagName));
}
else if (g_styleStack.top()->style()!=s)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"found </%s> tag while expecting </%s>",
qPrint(tagName),qPrint(g_styleStack.top()->styleString()));
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"found </%s> at different nesting level (%d) than expected (%d)",
qPrint(tagName),g_nodeStack.count(),g_styleStack.top()->position());
}
}
else // end the section
{
DocStyleChange *sc= new DocStyleChange(parent,g_nodeStack.count(),s,FALSE);
children.append(sc);
g_styleStack.pop();
}
}
static void handleUnclosedStyleCommands ( )
static

Definition at line 1043 of file docparser.cpp.

References doctokenizerYYlineno, g_fileName, g_initialStyleStack, DocStyleChange::styleString(), and warn_doc_error().

Referenced by DocText::parse(), and DocRoot::parse().

{
if (!g_initialStyleStack.isEmpty())
{
warn_doc_error(g_fileName,doctokenizerYYlineno,
"end of comment block while expecting "
"command </%s>",qPrint(sc->styleString()));
}
}
static bool insideLI ( DocNode n)
static

Returns TRUE iff node n is a child of a html list item node

Definition at line 659 of file docparser.cpp.

References DocNode::kind(), DocNode::Kind_HtmlListItem, and DocNode::parent().

Referenced by DocPara::handleHtmlEndTag(), and handleStyleArgument().

{
while (n)
{
if (n->kind()==DocNode::Kind_HtmlListItem) return TRUE;
n=n->parent();
}
return FALSE;
}
static bool insideOL ( DocNode n)
static

Returns TRUE iff node n is a child of a ordered html list node

Definition at line 686 of file docparser.cpp.

References DocNode::kind(), DocNode::Kind_HtmlList, and DocHtmlList::Ordered.

Referenced by DocPara::handleHtmlEndTag(), and DocPara::handleHtmlStartTag().

{
while (n)
{
((DocHtmlList *)n)->type()==DocHtmlList::Ordered) return TRUE;
n=n->parent();
}
return FALSE;
}
static bool insidePRE ( DocNode n)
static

Returns TRUE iff node n is a child of a preformatted node

Definition at line 646 of file docparser.cpp.

References DocNode::isPreformatted(), and DocNode::parent().

Referenced by defaultHandleToken(), and DocPara::parse().

{
while (n)
{
if (n->isPreformatted()) return TRUE;
n=n->parent();
}
return FALSE;
}
static bool insideTable ( DocNode n)
static

Definition at line 699 of file docparser.cpp.

References DocNode::kind(), DocNode::Kind_HtmlTable, and DocNode::parent().

Referenced by DocPara::handleHtmlStartTag().

{
while (n)
{
if (n->kind()==DocNode::Kind_HtmlTable) return TRUE;
n=n->parent();
}
return FALSE;
}
static bool insideUL ( DocNode n)
static

Returns TRUE iff node n is a child of a unordered html list node

Definition at line 672 of file docparser.cpp.

References DocNode::kind(), DocNode::Kind_HtmlList, and DocHtmlList::Unordered.

Referenced by DocPara::handleHtmlEndTag(), and DocPara::handleHtmlStartTag().

{
while (n)
{
((DocHtmlList *)n)->type()==DocHtmlList::Unordered) return TRUE;
n=n->parent();
}
return FALSE;
}
static int internalValidatingParseDoc ( DocNode parent,
QList< DocNode > &  children,
const QCString &  doc 
)
static

Definition at line 1723 of file docparser.cpp.

References doctokenizerYYinit(), g_fileName, DocPara::isEmpty(), DocNode::Kind_Para, DocPara::markFirst(), DocPara::markLast(), DocPara::parse(), RetVal_OK, and TK_NEWPARA.

Referenced by DocPara::handleInclude(), DocPara::handleInheritDoc(), DocCopy::parse(), DocXRefItem::parse(), DocRef::parse(), and DocSimpleSect::parseRcs().

{
int retval = RetVal_OK;
if (doc.isEmpty()) return retval;
// first parse any number of paragraphs
bool isFirst=TRUE;
DocPara *lastPar=0;
if (!children.isEmpty() && children.getLast()->kind()==DocNode::Kind_Para)
{ // last child item was a paragraph
lastPar = (DocPara*)children.getLast();
isFirst=FALSE;
}
do
{
DocPara *par = new DocPara(parent);
if (isFirst) { par->markFirst(); isFirst=FALSE; }
retval=par->parse();
if (!par->isEmpty())
{
children.append(par);
if (lastPar) lastPar->markLast(FALSE);
lastPar=par;
}
else
{
delete par;
}
} while (retval==TK_NEWPARA);
if (lastPar) lastPar->markLast();
//printf("internalValidateParsingDoc: %p: isFirst=%d isLast=%d\n",
// lastPar,lastPar?lastPar->isFirst():-1,lastPar?lastPar->isLast():-1);
return retval;
}
static uint isCopyBriefOrDetailsCmd ( const char *  data,
uint  i,
uint  len,
bool &  brief 
)
static

Definition at line 7085 of file docparser.cpp.

References CHECK_FOR_COMMAND.

Referenced by processCopyDoc().

{
int j=0;
if (i==0 || (data[i-1]!='@' && data[i-1]!='\\')) // not an escaped command
{
CHECK_FOR_COMMAND("copybrief",brief=TRUE); // @copybrief or \copybrief
CHECK_FOR_COMMAND("copydetails",brief=FALSE); // @copydetails or \copydetails
}
return j;
}
static uint isVerbatimSection ( const char *  data,
uint  i,
uint  len,
QCString &  endMarker 
)
static

Definition at line 7096 of file docparser.cpp.

References CHECK_FOR_COMMAND.

Referenced by processCopyDoc().

{
int j=0;
if (i==0 || (data[i-1]!='@' && data[i-1]!='\\')) // not an escaped command
{
CHECK_FOR_COMMAND("dot",endMarker="enddot");
CHECK_FOR_COMMAND("code",endMarker="endcode");
CHECK_FOR_COMMAND("msc",endMarker="endmsc");
CHECK_FOR_COMMAND("verbatim",endMarker="endverbatim");
CHECK_FOR_COMMAND("latexonly",endMarker="endlatexonly");
CHECK_FOR_COMMAND("htmlonly",endMarker="endhtmlonly");
CHECK_FOR_COMMAND("xmlonly",endMarker="endxmlonly");
CHECK_FOR_COMMAND("rtfonly",endMarker="endrtfonly");
CHECK_FOR_COMMAND("manonly",endMarker="endmanonly");
CHECK_FOR_COMMAND("docbookonly",endMarker="enddocbookonly");
CHECK_FOR_COMMAND("startuml",endMarker="enduml");
}
//printf("isVerbatimSection(%s)=%d)\n",QCString(&data[i]).left(10).data(),j);
return j;
}
static QCString processCopyDoc ( const char *  data,
uint &  len 
)
static

Definition at line 7135 of file docparser.cpp.

References GrowBuf::addChar(), GrowBuf::addStr(), brief, doc, doctokenizerYYlineno, extractCopyDocId(), findDocsForMemberOrCompound(), g_copyStack, g_fileName, GrowBuf::get(), GrowBuf::getPos(), isCopyBriefOrDetailsCmd(), isVerbatimSection(), skipToEndMarker(), and warn_doc_error().

Referenced by validatingParseDoc().

{
//printf("processCopyDoc start '%s'\n",data);
GrowBuf buf;
uint i=0;
while (i<len)
{
char c = data[i];
if (c=='@' || c=='\\') // look for a command
{
bool isBrief=TRUE;
uint j=isCopyBriefOrDetailsCmd(data,i,len,isBrief);
if (j>0)
{
// skip whitespace
while (j<len && (data[j]==' ' || data[j]=='\t')) j++;
// extract the argument
QCString id = extractCopyDocId(data,j,len);
Definition *def;
QCString doc,brief;
//printf("resolving docs='%s'\n",id.data());
if (findDocsForMemberOrCompound(id,&doc,&brief,&def))
{
//printf("found it def=%p brief='%s' doc='%s' isBrief=%d\n",def,brief.data(),doc.data(),isBrief);
if (g_copyStack.findRef(def)==-1) // definition not parsed earlier
{
g_copyStack.append(def);
if (isBrief)
{
uint l=brief.length();
buf.addStr(processCopyDoc(brief,l));
}
else
{
uint l=doc.length();
buf.addStr(processCopyDoc(doc,l));
}
g_copyStack.remove(def);
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,
"Found recursive @copy%s or @copydoc relation for argument '%s'.\n",
isBrief?"brief":"details",id.data());
}
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,
"@copy%s or @copydoc target '%s' not found", isBrief?"brief":"details",
id.data());
}
// skip over command
i=j;
}
else
{
QCString endMarker;
uint k = isVerbatimSection(data,i,len,endMarker);
if (k>0)
{
int orgPos = i;
i=skipToEndMarker(data,k,len,endMarker);
buf.addStr(data+orgPos,i-orgPos);
}
else
{
buf.addChar(c);
i++;
}
}
}
else // not a command, just copy
{
buf.addChar(c);
i++;
}
}
len = buf.getPos();
buf.addChar(0);
return buf.get();
}
static void readTextFileByName ( const QCString &  file,
QCString &  text 
)
static

Definition at line 1766 of file docparser.cpp.

References FileDef::absFilePath(), Config_getBool, Config_getList, doctokenizerYYlineno, Doxygen::exampleNameDict, fileToString(), findFileDef(), g_fileName, portable_isAbsolutePath(), portable_pathSeparator(), showFileDefMatches(), and warn_doc_error().

Referenced by DocPara::handleInclude(), and DocInclude::parse().

{
if (portable_isAbsolutePath(file.data()))
{
QFileInfo fi(file);
if (fi.exists())
{
text = fileToString(file,Config_getBool(FILTER_SOURCE_FILES));
return;
}
}
QStrList &examplePathList = Config_getList(EXAMPLE_PATH);
char *s=examplePathList.first();
while (s)
{
QCString absFileName = QCString(s)+portable_pathSeparator()+file;
QFileInfo fi(absFileName);
if (fi.exists())
{
text = fileToString(absFileName,Config_getBool(FILTER_SOURCE_FILES));
return;
}
s=examplePathList.next();
}
// as a fallback we also look in the exampleNameDict
bool ambig;
FileDef *fd;
if ((fd=findFileDef(Doxygen::exampleNameDict,file,ambig)))
{
text = fileToString(fd->absFilePath(),Config_getBool(FILTER_SOURCE_FILES));
}
else if (ambig)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"included file name %s is ambiguous"
"Possible candidates:\n%s",qPrint(file),
);
}
else
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"included file %s is not found. "
"Check your EXAMPLE_PATH",qPrint(file));
}
}
static uint skipToEndMarker ( const char *  data,
uint  i,
uint  len,
const QCString &  endMarker 
)
static

Definition at line 7117 of file docparser.cpp.

Referenced by processCopyDoc().

{
while (i<len)
{
if ((data[i]=='@' || data[i]=='\\') && // start of command character
(i==0 || (data[i-1]!='@' && data[i-1]!='\\'))) // that is not escaped
{
if (i+endMarker.length()+1<=len && qstrncmp(data+i+1,endMarker,endMarker.length())==0)
{
return i+endMarker.length()+1;
}
}
i++;
}
// oops no endmarker found...
return i<len ? i+1 : len;
}
static QCString stripKnownExtensions ( const char *  text)
static

Strips known html and tex extensions from text.

Definition at line 627 of file docparser.cpp.

References Doxygen::htmlFileExtension.

Referenced by DocLink::DocLink(), and DocRef::DocRef().

{
QCString result=text;
if (result.right(4)==".tex")
{
result=result.left(result.length()-4);
}
else if (result.right(Doxygen::htmlFileExtension.length())==
{
result=result.left(result.length()-Doxygen::htmlFileExtension.length());
}
return result;
}
static void unescapeCRef ( QCString &  s)
static

Definition at line 239 of file docparser.cpp.

References substitute(), and languages::tmp.

Referenced by DocPara::handleHtmlStartTag().

{
QCString tmp(s);
char *p = tmp.rawData();
if (p)
{
char c;
while ((c=*p))
{
if (c=='{') c='<'; else if (c=='}') c='>';
*p++=c;
}
}
tmp=substitute(tmp,"&lt;","<");
tmp=substitute(tmp,"&gt;",">");
s = tmp;
}
DocRoot* validatingParseDoc ( const char *  fileName,
int  startLine,
Definition context,
MemberDef md,
const char *  input,
bool  indexWords,
bool  isExample,
const char *  exampleName = 0,
bool  singleLine = FALSE,
bool  linkFromIndex = FALSE 
)

Main entry point for the documentation parser.

Parameters
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.
contextClass 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.
Returns
Root node of the abstract syntax tree. Ownership of the pointer is handed over to the caller.

Definition at line 7220 of file docparser.cpp.

References DocRoot::accept(), MemberDef::anchor(), Definition::anchor(), checkUndocumentedParams(), ClassDef::compoundTypeString(), DefinitionIntf::definitionType(), detectNoDocumentedParams(), docParserPopContext(), docParserPushContext(), doctokenizerYYinit(), doctokenizerYYlineno, g_context, g_exampleName, g_fileName, g_hasParamCommand, g_hasReturnCommand, g_includeFileLength, g_includeFileOffset, g_includeFileText, g_initialStyleStack, g_inSeeBlock, g_insideHtmlLink, g_isExample, g_nodeStack, g_paramsFound, g_relPath, g_searchUrl, g_styleStack, g_xmlComment, Definition::getLanguage(), getLanguageSpecificSeparator(), MemberDef::getOutputFileBase(), Definition::getOutputFileBase(), Doxygen::globalScope, GroupDef::groupTitle(), Debug::isFlagSet(), Definition::name(), DocRoot::parse(), Debug::PrintTree, processCopyDoc(), MemberDef::qualifiedName(), Definition::qualifiedName(), relativePathToRoot(), Doxygen::searchIndex, SearchIndexIntf::setCurrentDoc(), SrcLangExt_CSharp, SrcLangExt_Fortran, SrcLangExt_Java, substitute(), theTranslator, PageDef::title(), Translator::trGroup(), Translator::trMember(), Translator::trModule(), Translator::trNamespace(), Translator::trPackage(), Translator::trPage(), Translator::trSubprogram(), DefinitionIntf::TypeClass, DefinitionIntf::TypeGroup, DefinitionIntf::TypeNamespace, and DefinitionIntf::TypePage.

Referenced by addPerlModDocBlock(), generateBriefDoc(), OutputList::generateDoc(), parseCommentAsText(), parseDoc(), DirDef::writeBriefDescription(), NamespaceDef::writeBriefDescription(), GroupDef::writeBriefDescription(), FileDef::writeBriefDescription(), MemberDef::writeDeclaration(), ClassDef::writeDeclarationLink(), writeDocbookDocBlock(), MemberList::writePlainDeclarations(), and writeXMLDocBlock().

{
//printf("validatingParseDoc(%s,%s)=[%s]\n",ctx?ctx->name().data():"<none>",
// md?md->name().data():"<none>",
// input);
//printf("========== validating %s at line %d\n",fileName,startLine);
//printf("---------------- input --------------------\n%s\n----------- end input -------------------\n",input);
//g_token = new TokenInfo;
// store parser state so we can re-enter this function if needed
//bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN);
if (ctx && ctx!=Doxygen::globalScope &&
)
)
{
g_context = ctx->name();
}
else if (ctx && ctx->definitionType()==Definition::TypePage)
{
Definition *scope = ((PageDef*)ctx)->getPageScope();
if (scope && scope!=Doxygen::globalScope) g_context = scope->name();
}
else if (ctx && ctx->definitionType()==Definition::TypeGroup)
{
Definition *scope = ((GroupDef*)ctx)->getGroupScope();
if (scope && scope!=Doxygen::globalScope) g_context = scope->name();
}
else
{
g_context = "";
}
g_scope = ctx;
if (indexWords && Doxygen::searchIndex)
{
if (md)
{
}
else if (ctx)
{
}
}
#if 0
if (indexWords && md && Doxygen::searchIndex)
{
theTranslator->trMember(TRUE,TRUE))+" "+md->qualifiedName(),
md->anchor());
}
else if (indexWords && ctx && Doxygen::searchIndex)
{
QCString name = ctx->qualifiedName();
SrcLangExt lang = ctx->getLanguage();
QCString sep = getLanguageSpecificSeparator(lang);
if (sep!="::")
{
name = substitute(name,"::",sep);
}
switch (ctx->definitionType())
{
{
PageDef *pd = (PageDef *)ctx;
if (!pd->title().isEmpty())
{
name = theTranslator->trPage(TRUE,TRUE)+" "+pd->title();
}
else
{
name = theTranslator->trPage(TRUE,TRUE)+" "+pd->name();
}
}
break;
{
ClassDef *cd = (ClassDef *)ctx;
name.prepend(cd->compoundTypeString()+" ");
}
break;
{
if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp)
{
name = theTranslator->trPackage(name);
}
else if (lang==SrcLangExt_Fortran)
{
name.prepend(theTranslator->trModule(TRUE,TRUE)+" ");
}
else
{
name.prepend(theTranslator->trNamespace(TRUE,TRUE)+" ");
}
}
break;
{
GroupDef *gd = (GroupDef *)ctx;
if (gd->groupTitle())
{
name = theTranslator->trGroup(TRUE,TRUE)+" "+gd->groupTitle();
}
else
{
name.prepend(theTranslator->trGroup(TRUE,TRUE)+" ");
}
}
break;
default:
break;
}
}
#endif
else
{
}
g_fileName = fileName;
g_relPath = (!linkFromIndex && ctx) ?
QCString("");
//printf("ctx->name=%s relPath=%s\n",ctx->name().data(),g_relPath.data());
g_nodeStack.clear();
g_styleStack.clear();
g_inSeeBlock = FALSE;
g_xmlComment = FALSE;
g_isExample = isExample;
g_exampleName = exampleName;
g_paramsFound.setAutoDelete(FALSE);
g_paramsFound.clear();
g_sectionDict = 0; //sections;
//printf("Starting comment block at %s:%d\n",g_fileName.data(),startLine);
uint inpLen=qstrlen(input);
QCString inpStr = processCopyDoc(input,inpLen);
if (inpStr.isEmpty() || inpStr.at(inpStr.length()-1)!='\n')
{
inpStr+='\n';
}
//printf("processCopyDoc(in='%s' out='%s')\n",input,inpStr.data());
// build abstract syntax tree
DocRoot *root = new DocRoot(md!=0,singleLine);
root->parse();
{
// pretty print the result
root->accept(v);
delete v;
}
// TODO: These should be called at the end of the program.
//doctokenizerYYcleanup();
//Mappers::cmdMapper->freeInstance();
//Mappers::htmlTagMapper->freeInstance();
// restore original parser state
//printf(">>>>>> end validatingParseDoc(%s,%s)\n",ctx?ctx->name().data():"<none>",
// md?md->name().data():"<none>");
return root;
}
DocText* validatingParseText ( const char *  input)

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

Definition at line 7422 of file docparser.cpp.

References DocText::accept(), docParserPopContext(), docParserPushContext(), doctokenizerYYinit(), doctokenizerYYlineno, g_context, g_exampleName, g_fileName, g_hasParamCommand, g_hasReturnCommand, g_includeFileLength, g_includeFileOffset, g_includeFileText, g_initialStyleStack, g_inSeeBlock, g_insideHtmlLink, g_isExample, g_nodeStack, g_paramsFound, g_relPath, g_searchUrl, g_styleStack, g_xmlComment, Debug::isFlagSet(), DocText::parse(), and Debug::PrintTree.

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

{
// store parser state so we can re-enter this function if needed
//printf("------------ input ---------\n%s\n"
// "------------ end input -----\n",input);
//g_token = new TokenInfo;
g_context = "";
g_fileName = "<parseText>";
g_relPath = "";
g_nodeStack.clear();
g_styleStack.clear();
g_inSeeBlock = FALSE;
g_xmlComment = FALSE;
g_isExample = FALSE;
g_paramsFound.setAutoDelete(FALSE);
g_paramsFound.clear();
DocText *txt = new DocText;
if (input)
{
// build abstract syntax tree
txt->parse();
{
// pretty print the result
txt->accept(v);
delete v;
}
}
// restore original parser state
return txt;
}

Variable Documentation

QCString g_context
static
QList<Definition> g_copyStack
static
QCString g_exampleName
static
QCString g_fileName
static

Definition at line 95 of file docparser.cpp.

Referenced by defaultHandleTitleAndSize(), defaultHandleToken(), detectNoDocumentedParams(), DocAnchor::DocAnchor(), DocCite::DocCite(), DocFormula::DocFormula(), DocHtmlCaption::DocHtmlCaption(), DocLink::DocLink(), docParserPopContext(), docParserPushContext(), DocRef::DocRef(), findAndCopyImage(), handleAHref(), handleAnchor(), DocPara::handleCite(), DocPara::handleCommand(), DocPara::handleFile(), DocPara::handleHtmlEndTag(), DocPara::handleHtmlStartTag(), DocPara::handleImage(), handleImg(), DocPara::handleInclude(), DocPara::handleIncludeOperator(), handleInternalRef(), DocPara::handleLink(), handleLinkedWord(), DocPara::handleRef(), DocPara::handleSection(), DocPara::handleStartCode(), handleStyleArgument(), handleStyleLeave(), handleUnclosedStyleCommands(), internalValidatingParseDoc(), DocInclude::parse(), DocIndexEntry::parse(), DocCopy::parse(), DocTitle::parse(), DocDotFile::parse(), DocMscFile::parse(), DocDiaFile::parse(), DocVhdlFlow::parse(), DocLink::parse(), DocRef::parse(), DocInternalRef::parse(), DocHRef::parse(), DocHtmlHeader::parse(), DocHtmlDescTitle::parse(), DocHtmlDescList::parse(), DocSection::parse(), DocSecRefItem::parse(), DocSecRefList::parse(), DocInternal::parse(), DocHtmlList::parse(), DocPara::parse(), DocParamList::parse(), DocHtmlCaption::parse(), DocHtmlRow::parse(), DocHtmlTable::parse(), DocText::parse(), DocRoot::parse(), DocHtmlList::parseXml(), DocParamList::parseXml(), DocHtmlRow::parseXml(), processCopyDoc(), readTextFileByName(), validatingParseDoc(), and validatingParseText().

bool g_hasParamCommand
static
bool g_hasReturnCommand
static
uint g_includeFileLength
static
uint g_includeFileOffset
static
QCString g_includeFileText
static
QStack<DocStyleChange> g_initialStyleStack
static
bool g_inSeeBlock
static
bool g_insideHtmlLink
static
bool g_isExample
static
MemberDef* g_memberDef
static

Definition at line 101 of file docparser.cpp.

Referenced by docParserPushContext(), and DocPara::handleInheritDoc().

QStack<DocNode> g_nodeStack
static
QDict<void> g_paramsFound
static
QStack<DocParserContext> g_parserStack
static

Definition at line 145 of file docparser.cpp.

Referenced by docParserPopContext(), and docParserPushContext().

QCString g_relPath
static
Definition* g_scope
static

Definition at line 86 of file docparser.cpp.

Referenced by docParserPushContext().

QCString g_searchUrl
static
SectionDict* g_sectionDict
static

Definition at line 104 of file docparser.cpp.

Referenced by docParserPushContext().

QStack<DocStyleChange> g_styleStack
static
bool g_xmlComment
static
const char* sectionLevelToName[]
static
Initial value:
=
{
"page",
"section",
"subsection",
"subsubsection",
"paragraph",
"subparagraph"
}

Definition at line 73 of file docparser.cpp.

Referenced by DocSection::parse().