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)
Q_EXPORT int qstrncmp(const char *str1, const char *str2, uint len)
Definition: qcstring.h:101
static QCString str

Definition at line 7040 of file docparser.cpp.

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

Definition at line 59 of file docparser.cpp.

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

Definition at line 68 of file docparser.cpp.

Typedef Documentation

List of ActiveRowSpan classes.

Definition at line 3740 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 386 of file docparser.cpp.

387 {
388  if (!Config_getBool("WARN_IF_DOC_ERROR")) return;
389  if (g_memberDef==0) return; // not a member
394  //printf("isDocsForDefinition()=%d\n",g_memberDef->isDocsForDefinition());
395  if (al==0) return; // no argument list
396 
397  static QRegExp re("$?[a-zA-Z0-9_\\x80-\\xFF]+\\.*");
398  int p=0,i=0,l;
399  while ((i=re.match(name,p,&l))!=-1) // to handle @param x,y
400  {
401  QCString aName=name.mid(i,l);
402  if (lang==SrcLangExt_Fortran) aName=aName.lower();
403  //printf("aName=`%s'\n",aName.data());
404  ArgumentListIterator ali(*al);
405  Argument *a;
406  bool found=FALSE;
407  for (ali.toFirst();(a=ali.current());++ali)
408  {
409  QCString argName = g_memberDef->isDefine() ? a->type : a->name;
410  if (lang==SrcLangExt_Fortran) argName=argName.lower();
411  argName=argName.stripWhiteSpace();
412  //printf("argName=`%s' aName=%s\n",argName.data(),aName.data());
413  if (argName.right(3)=="...") argName=argName.left(argName.length()-3);
414  if (aName==argName)
415  {
416  g_paramsFound.insert(aName,(void *)(0x8));
417  found=TRUE;
418  break;
419  }
420  }
421  if (!found && isParam)
422  {
423  //printf("member type=%d\n",memberDef->memberType());
425  if (!scope.isEmpty()) scope+="::"; else scope="";
426  QCString inheritedFrom = "";
427  QCString docFile = g_memberDef->docFile();
428  int docLine = g_memberDef->docLine();
429  MemberDef *inheritedMd = g_memberDef->inheritsDocsFrom();
430  if (inheritedMd) // documentation was inherited
431  {
432  inheritedFrom.sprintf(" inherited from member %s at line "
433  "%d in file %s",qPrint(inheritedMd->name()),
434  inheritedMd->docLine(),qPrint(inheritedMd->docFile()));
435  docFile = g_memberDef->getDefFileName();
436  docLine = g_memberDef->getDefLine();
437 
438  }
439  QCString alStr = argListToString(al);
440  warn_doc_error(docFile,docLine,
441  "argument '%s' of command @param "
442  "is not found in the argument list of %s%s%s%s",
443  qPrint(aName), qPrint(scope), qPrint(g_memberDef->name()),
444  qPrint(alStr), qPrint(inheritedFrom));
445  }
446  p=i+l;
447  }
448 }
QCString type
Definition: arguments.h:67
QCString docFile() const
bool isDocsForDefinition() const
Definition: memberdef.cpp:4482
This class represents an function or template argument list.
Definition: arguments.h:82
QCString stripWhiteSpace() const
Definition: qcstring.cpp:295
static QCString scope
Definition: declinfo.cpp:668
bool isEmpty() const
Definition: qcstring.h:189
The QRegExp class provides pattern matching using regular expressions or wildcards.
Definition: qregexp.h:46
uint length() const
Definition: qcstring.h:195
QCString argListToString(ArgumentList *al, bool useCanonicalType, bool showDefVals)
Definition: util.cpp:2151
const bool FALSE
Definition: qglobal.h:370
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
QCString left(uint len) const
Definition: qcstring.cpp:213
bool isDefine() const
Definition: memberdef.cpp:4170
SrcLangExt
Definition: types.h:41
static QStrList * l
Definition: config.cpp:1044
ArgumentList * declArgumentList() const
Definition: memberdef.cpp:4517
QCString getDefFileName() const
This class contains the information about the argument of a function or template. ...
Definition: arguments.h:28
const QCString & name() const
Definition: definition.h:114
int getDefLine() const
Definition: definition.h:188
QCString getScopeString() const
Definition: memberdef.cpp:3301
static MemberDef * g_memberDef
Definition: docparser.cpp:101
QCString right(uint len) const
Definition: qcstring.cpp:231
SrcLangExt getLanguage() const
const double a
MemberDef * inheritsDocsFrom() const
Definition: memberdef.cpp:4603
static QCString argName
static QDict< void > g_paramsFound
Definition: docparser.cpp:100
p
Definition: test.py:223
#define Config_getBool(val)
Definition: config.cpp:664
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
QCString & sprintf(const char *format,...)
Definition: qcstring.cpp:27
ArgumentList * argumentList() const
Definition: memberdef.cpp:4512
QCString name
Definition: arguments.h:69
int docLine() const
QCString lower() const
Definition: qcstring.cpp:263
const char * qPrint(const char *s)
Definition: qcstring.h:797
const bool TRUE
Definition: qglobal.h:371
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 455 of file docparser.cpp.

456 {
457  if (g_memberDef && g_hasParamCommand && Config_getBool("WARN_IF_DOC_ERROR"))
458  {
463  if (al!=0)
464  {
465  ArgumentListIterator ali(*al);
466  Argument *a;
467  bool found=FALSE;
468  for (ali.toFirst();(a=ali.current());++ali)
469  {
470  QCString argName = g_memberDef->isDefine() ? a->type : a->name;
471  if (lang==SrcLangExt_Fortran) argName = argName.lower();
472  argName=argName.stripWhiteSpace();
473  if (argName.right(3)=="...") argName=argName.left(argName.length()-3);
474  if (g_memberDef->getLanguage()==SrcLangExt_Python && (argName=="self" || argName=="cls"))
475  {
476  // allow undocumented self / cls parameter for Python
477  }
478  else if (!argName.isEmpty() && g_paramsFound.find(argName)==0 && a->docs.isEmpty())
479  {
480  found = TRUE;
481  break;
482  }
483  }
484  if (found)
485  {
486  bool first=TRUE;
487  QCString errMsg=
488  "The following parameters of "+
491  " are not documented:\n";
492  for (ali.toFirst();(a=ali.current());++ali)
493  {
494  QCString argName = g_memberDef->isDefine() ? a->type : a->name;
495  if (lang==SrcLangExt_Fortran) argName = argName.lower();
496  argName=argName.stripWhiteSpace();
497  if (g_memberDef->getLanguage()==SrcLangExt_Python && (argName=="self" || argName=="cls"))
498  {
499  // allow undocumented self / cls parameter for Python
500  }
501  else if (!argName.isEmpty() && g_paramsFound.find(argName)==0)
502  {
503  if (!first)
504  {
505  errMsg+="\n";
506  }
507  else
508  {
509  first=FALSE;
510  }
511  errMsg+=" parameter '"+argName+"'";
512  }
513  }
516  substitute(errMsg,"%","%%"));
517  }
518  }
519  }
520 }
QCString type
Definition: arguments.h:67
bool isDocsForDefinition() const
Definition: memberdef.cpp:4482
This class represents an function or template argument list.
Definition: arguments.h:82
QCString stripWhiteSpace() const
Definition: qcstring.cpp:295
bool isEmpty() const
Definition: qcstring.h:189
uint length() const
Definition: qcstring.h:195
QCString argListToString(ArgumentList *al, bool useCanonicalType, bool showDefVals)
Definition: util.cpp:2151
const bool FALSE
Definition: qglobal.h:370
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
QCString left(uint len) const
Definition: qcstring.cpp:213
bool isDefine() const
Definition: memberdef.cpp:4170
SrcLangExt
Definition: types.h:41
ArgumentList * declArgumentList() const
Definition: memberdef.cpp:4517
QCString getDefFileName() const
This class contains the information about the argument of a function or template. ...
Definition: arguments.h:28
int getDefLine() const
Definition: definition.h:188
static bool g_hasParamCommand
Definition: docparser.cpp:98
static MemberDef * g_memberDef
Definition: docparser.cpp:101
QCString right(uint len) const
Definition: qcstring.cpp:231
SrcLangExt getLanguage() const
const double a
static QCString argName
static QDict< void > g_paramsFound
Definition: docparser.cpp:100
#define Config_getBool(val)
Definition: config.cpp:664
ArgumentList * argumentList() const
Definition: memberdef.cpp:4512
QCString qualifiedName() const
Definition: memberdef.cpp:3968
QCString name
Definition: arguments.h:69
QCString lower() const
Definition: qcstring.cpp:263
const bool TRUE
Definition: qglobal.h:371
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition: util.cpp:5088
QCString docs
Definition: arguments.h:72
static void defaultHandleTitleAndSize ( const int  cmd,
DocNode parent,
QList< DocNode > &  children,
QCString width,
QCString height 
)
static

Definition at line 1255 of file docparser.cpp.

1256 {
1257  g_nodeStack.push(parent);
1258 
1259  // parse title
1261  int tok;
1262  while ((tok=doctokenizerYYlex()))
1263  {
1264  if (tok==TK_WORD && (g_token->name=="width=" || g_token->name=="height="))
1265  {
1266  // special case: no title, but we do have a size indicator
1268  // strip =
1270  break;
1271  }
1272  if (!defaultHandleToken(parent,tok,children))
1273  {
1274  switch (tok)
1275  {
1276  case TK_COMMAND:
1277  warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\%s",
1279  break;
1280  case TK_SYMBOL:
1281  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
1282  qPrint(g_token->name));
1283  break;
1284  default:
1285  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
1286  tokToString(tok));
1287  break;
1288  }
1289  }
1290  }
1291  // parse size attributes
1292  if (tok == 0)
1293  {
1294  tok=doctokenizerYYlex();
1295  }
1296  while (tok==TK_WORD) // there are values following the title
1297  {
1298  if (g_token->name=="width")
1299  {
1300  width = g_token->chars;
1301  }
1302  else if (g_token->name=="height")
1303  {
1304  height = g_token->chars;
1305  }
1306  else
1307  {
1308  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unknown option '%s' after \\%s command, expected 'width' or 'height'",
1310  }
1311  tok=doctokenizerYYlex();
1312  }
1314 
1315  handlePendingStyleCommands(parent,children);
1316  DocNode *n=g_nodeStack.pop();
1317  ASSERT(n==parent);
1318 }
static QCString g_fileName
Definition: docparser.cpp:95
void doctokenizerYYsetStatePara()
uint length() const
Definition: qcstring.h:195
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
QCString left(uint len) const
Definition: qcstring.cpp:213
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
TokenInfo * g_token
int doctokenizerYYlex(void)
void push(const type *d)
Definition: qstack.h:58
void doctokenizerYYsetStateTitle()
const char * data() const
Definition: qstring.h:542
QCString chars
Definition: doctokenizer.h:107
QString find(const int n)
Definition: cmdmapper.cpp:233
static void handlePendingStyleCommands(DocNode *parent, QList< DocNode > &children)
Definition: docparser.cpp:957
std::void_t< T > n
type * pop()
Definition: qstack.h:59
static bool defaultHandleToken(DocNode *parent, int tok, QList< DocNode > &children, bool handleWord=TRUE)
Definition: docparser.cpp:1331
static Mapper * cmdMapper
Definition: cmdmapper.h:219
QCString name
Definition: doctokenizer.h:77
const char * tokToString(int token)
void doctokenizerYYsetStateTitleAttrValue()
list cmd
Definition: getreco.py:22
const char * qPrint(const char *s)
Definition: qcstring.h:797
#define ASSERT(x)
Definition: qglobal.h:590
static bool defaultHandleToken ( DocNode parent,
int  tok,
QList< DocNode > &  children,
bool  handleWord = TRUE 
)
static

Definition at line 1331 of file docparser.cpp.

1333 {
1334  DBG(("token %s at %d",tokToString(tok),doctokenizerYYlineno));
1335  if (tok==TK_WORD || tok==TK_LNKWORD || tok==TK_SYMBOL || tok==TK_URL ||
1336  tok==TK_COMMAND || tok==TK_HTMLTAG
1337  )
1338  {
1339  DBG((" name=%s",qPrint(g_token->name)));
1340  }
1341  DBG(("\n"));
1342 reparsetoken:
1343  QCString tokenName = g_token->name;
1344  switch (tok)
1345  {
1346  case TK_COMMAND:
1347  switch (Mappers::cmdMapper->map(tokenName))
1348  {
1349  case CMD_BSLASH:
1350  children.append(new DocSymbol(parent,DocSymbol::Sym_BSlash));
1351  break;
1352  case CMD_AT:
1353  children.append(new DocSymbol(parent,DocSymbol::Sym_At));
1354  break;
1355  case CMD_LESS:
1356  children.append(new DocSymbol(parent,DocSymbol::Sym_Less));
1357  break;
1358  case CMD_GREATER:
1359  children.append(new DocSymbol(parent,DocSymbol::Sym_Greater));
1360  break;
1361  case CMD_AMP:
1362  children.append(new DocSymbol(parent,DocSymbol::Sym_Amp));
1363  break;
1364  case CMD_DOLLAR:
1365  children.append(new DocSymbol(parent,DocSymbol::Sym_Dollar));
1366  break;
1367  case CMD_HASH:
1368  children.append(new DocSymbol(parent,DocSymbol::Sym_Hash));
1369  break;
1370  case CMD_DCOLON:
1371  children.append(new DocSymbol(parent,DocSymbol::Sym_DoubleColon));
1372  break;
1373  case CMD_PERCENT:
1374  children.append(new DocSymbol(parent,DocSymbol::Sym_Percent));
1375  break;
1376  case CMD_NDASH:
1377  children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
1378  children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
1379  break;
1380  case CMD_MDASH:
1381  children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
1382  children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
1383  children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
1384  break;
1385  case CMD_QUOTE:
1386  children.append(new DocSymbol(parent,DocSymbol::Sym_Quot));
1387  break;
1388  case CMD_PUNT:
1389  children.append(new DocSymbol(parent,DocSymbol::Sym_Dot));
1390  break;
1391  case CMD_PLUS:
1392  children.append(new DocSymbol(parent,DocSymbol::Sym_Plus));
1393  break;
1394  case CMD_MINUS:
1395  children.append(new DocSymbol(parent,DocSymbol::Sym_Minus));
1396  break;
1397  case CMD_EMPHASIS:
1398  {
1400  tok=handleStyleArgument(parent,children,tokenName);
1402  if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," "));
1403  if (tok==TK_NEWPARA) goto handlepara;
1404  else if (tok==TK_WORD || tok==TK_HTMLTAG)
1405  {
1406  DBG(("CMD_EMPHASIS: reparsing command %s\n",qPrint(g_token->name)));
1407  goto reparsetoken;
1408  }
1409  }
1410  break;
1411  case CMD_BOLD:
1412  {
1414  tok=handleStyleArgument(parent,children,tokenName);
1416  if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," "));
1417  if (tok==TK_NEWPARA) goto handlepara;
1418  else if (tok==TK_WORD || tok==TK_HTMLTAG)
1419  {
1420  DBG(("CMD_BOLD: reparsing command %s\n",qPrint(g_token->name)));
1421  goto reparsetoken;
1422  }
1423  }
1424  break;
1425  case CMD_CODE:
1426  {
1428  tok=handleStyleArgument(parent,children,tokenName);
1430  if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," "));
1431  if (tok==TK_NEWPARA) goto handlepara;
1432  else if (tok==TK_WORD || tok==TK_HTMLTAG)
1433  {
1434  DBG(("CMD_CODE: reparsing command %s\n",qPrint(g_token->name)));
1435  goto reparsetoken;
1436  }
1437  }
1438  break;
1439  case CMD_HTMLONLY:
1440  {
1442  tok = doctokenizerYYlex();
1444  if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"htmlonly section ended without end marker");
1446  }
1447  break;
1448  case CMD_MANONLY:
1449  {
1451  tok = doctokenizerYYlex();
1453  if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"manonly section ended without end marker");
1455  }
1456  break;
1457  case CMD_RTFONLY:
1458  {
1460  tok = doctokenizerYYlex();
1462  if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"rtfonly section ended without end marker");
1464  }
1465  break;
1466  case CMD_LATEXONLY:
1467  {
1469  tok = doctokenizerYYlex();
1471  if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"latexonly section ended without end marker",doctokenizerYYlineno);
1473  }
1474  break;
1475  case CMD_XMLONLY:
1476  {
1478  tok = doctokenizerYYlex();
1480  if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"xmlonly section ended without end marker",doctokenizerYYlineno);
1482  }
1483  break;
1484  case CMD_DBONLY:
1485  {
1487  tok = doctokenizerYYlex();
1489  if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"docbookonly section ended without end marker",doctokenizerYYlineno);
1491  }
1492  break;
1493  case CMD_FORMULA:
1494  {
1495  DocFormula *form=new DocFormula(parent,g_token->id);
1496  children.append(form);
1497  }
1498  break;
1499  case CMD_ANCHOR:
1500  {
1501  DocAnchor *anchor = handleAnchor(parent);
1502  if (anchor)
1503  {
1504  children.append(anchor);
1505  }
1506  }
1507  break;
1508  case CMD_INTERNALREF:
1509  {
1510  DocInternalRef *ref = handleInternalRef(parent);
1511  if (ref)
1512  {
1513  children.append(ref);
1514  ref->parse();
1515  }
1517  }
1518  break;
1519  case CMD_SETSCOPE:
1520  {
1521  QCString scope;
1524  scope = g_token->name;
1525  g_context = scope;
1526  //printf("Found scope='%s'\n",scope.data());
1528  }
1529  break;
1530  default:
1531  return FALSE;
1532  }
1533  break;
1534  case TK_HTMLTAG:
1535  {
1536  switch (Mappers::htmlTagMapper->map(tokenName))
1537  {
1538  case HTML_DIV:
1539  warn_doc_error(g_fileName,doctokenizerYYlineno,"found <div> tag in heading\n");
1540  break;
1541  case HTML_PRE:
1542  warn_doc_error(g_fileName,doctokenizerYYlineno,"found <pre> tag in heading\n");
1543  break;
1544  case HTML_BOLD:
1545  if (!g_token->endTag)
1546  {
1548  }
1549  else
1550  {
1551  handleStyleLeave(parent,children,DocStyleChange::Bold,tokenName);
1552  }
1553  break;
1554  case HTML_CODE:
1555  case XML_C:
1556  if (!g_token->endTag)
1557  {
1559  }
1560  else
1561  {
1562  handleStyleLeave(parent,children,DocStyleChange::Code,tokenName);
1563  }
1564  break;
1565  case HTML_EMPHASIS:
1566  if (!g_token->endTag)
1567  {
1569  }
1570  else
1571  {
1572  handleStyleLeave(parent,children,DocStyleChange::Italic,tokenName);
1573  }
1574  break;
1575  case HTML_SUB:
1576  if (!g_token->endTag)
1577  {
1579  }
1580  else
1581  {
1582  handleStyleLeave(parent,children,DocStyleChange::Subscript,tokenName);
1583  }
1584  break;
1585  case HTML_SUP:
1586  if (!g_token->endTag)
1587  {
1589  }
1590  else
1591  {
1592  handleStyleLeave(parent,children,DocStyleChange::Superscript,tokenName);
1593  }
1594  break;
1595  case HTML_CENTER:
1596  if (!g_token->endTag)
1597  {
1599  }
1600  else
1601  {
1602  handleStyleLeave(parent,children,DocStyleChange::Center,tokenName);
1603  }
1604  break;
1605  case HTML_SMALL:
1606  if (!g_token->endTag)
1607  {
1609  }
1610  else
1611  {
1612  handleStyleLeave(parent,children,DocStyleChange::Small,tokenName);
1613  }
1614  break;
1615  default:
1616  return FALSE;
1617  break;
1618  }
1619  }
1620  break;
1621  case TK_SYMBOL:
1622  {
1624  if (s!=DocSymbol::Sym_Unknown)
1625  {
1626  children.append(new DocSymbol(parent,s));
1627  }
1628  else
1629  {
1630  return FALSE;
1631  }
1632  }
1633  break;
1634  case TK_WHITESPACE:
1635  case TK_NEWPARA:
1636 handlepara:
1637  if (insidePRE(parent) || !children.isEmpty())
1638  {
1639  children.append(new DocWhiteSpace(parent,g_token->chars));
1640  }
1641  break;
1642  case TK_LNKWORD:
1643  if (handleWord)
1644  {
1645  handleLinkedWord(parent,children);
1646  }
1647  else
1648  return FALSE;
1649  break;
1650  case TK_WORD:
1651  if (handleWord)
1652  {
1653  children.append(new DocWord(parent,g_token->name));
1654  }
1655  else
1656  return FALSE;
1657  break;
1658  case TK_URL:
1659  if (g_insideHtmlLink)
1660  {
1661  children.append(new DocWord(parent,g_token->name));
1662  }
1663  else
1664  {
1665  children.append(new DocURL(parent,g_token->name,g_token->isEMailAddr));
1666  }
1667  break;
1668  default:
1669  return FALSE;
1670  }
1671  return TRUE;
1672 }
static QCString g_fileName
Definition: docparser.cpp:95
void doctokenizerYYsetStatePara()
static QCString scope
Definition: declinfo.cpp:668
static bool g_isExample
Definition: docparser.cpp:102
void doctokenizerYYsetStateXmlOnly()
void append(const type *d)
Definition: qlist.h:73
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
static Mapper * htmlTagMapper
Definition: cmdmapper.h:220
static void handleLinkedWord(DocNode *parent, QList< DocNode > &children, bool ignoreAutoLinkFlag=FALSE)
Definition: docparser.cpp:1054
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
void doctokenizerYYsetStateRtfOnly()
static bool insidePRE(DocNode *n)
Definition: docparser.cpp:644
TokenInfo * g_token
int doctokenizerYYlex(void)
void doctokenizerYYsetStateSetScope()
void doctokenizerYYsetStateManOnly()
uint count() const
Definition: qstack.h:56
static int handleStyleArgument(DocNode *parent, QList< DocNode > &children, const QCString &cmdName)
Definition: docparser.cpp:848
QCString chars
Definition: doctokenizer.h:107
static DocAnchor * handleAnchor(DocNode *parent)
Definition: docparser.cpp:1218
bool isEmpty() const
Definition: qlist.h:67
static bool g_insideHtmlLink
Definition: docparser.cpp:90
void doctokenizerYYsetStateHtmlOnly()
static DocInternalRef * handleInternalRef(DocNode *parent)
Definition: docparser.cpp:1196
static void handleStyleEnter(DocNode *parent, QList< DocNode > &children, DocStyleChange::Style s, const HtmlAttribList *attribs)
Definition: docparser.cpp:908
static SymType decodeSymbol(const QCString &symName)
Definition: docparser.cpp:1705
HtmlAttribList attribs
Definition: doctokenizer.h:102
QCString verb
Definition: doctokenizer.h:96
static Mapper * cmdMapper
Definition: cmdmapper.h:219
QCString name
Definition: doctokenizer.h:77
static QCString g_context
Definition: docparser.cpp:87
const char * tokToString(int token)
static QCString g_exampleName
Definition: docparser.cpp:103
void doctokenizerYYsetStateDbOnly()
bool isEMailAddr
Definition: doctokenizer.h:110
void doctokenizerYYsetStateLatexOnly()
static void handleStyleLeave(DocNode *parent, QList< DocNode > &children, DocStyleChange::Style s, const char *tagName)
Definition: docparser.cpp:920
static QCString * s
Definition: config.cpp:1042
const char * qPrint(const char *s)
Definition: qcstring.h:797
const bool TRUE
Definition: qglobal.h:371
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 527 of file docparser.cpp.

528 {
529  if (g_memberDef && Config_getBool("WARN_NO_PARAMDOC"))
530  {
533  QCString returnType = g_memberDef->typeString();
534  bool isPython = g_memberDef->getLanguage()==SrcLangExt_Python;
535 
538  {
539  //printf("%s->setHasDocumentedParams(TRUE);\n",g_memberDef->name().data());
541  }
542  else if (!g_memberDef->hasDocumentedParams())
543  {
544  bool allDoc=TRUE; // no paramater => all parameters are documented
545  if ( // member has parameters
546  al!=0 && // but the member has a parameter list
547  al->count()>0 // with at least one parameter (that is not void)
548  )
549  {
550  ArgumentListIterator ali(*al);
551  Argument *a;
552 
553  // see if all parameters have documentation
554  for (ali.toFirst();(a=ali.current()) && allDoc;++ali)
555  {
556  if (!a->name.isEmpty() && a->type!="void" &&
557  !(isPython && (a->name=="self" || a->name=="cls"))
558  )
559  {
560  allDoc = !a->docs.isEmpty();
561  }
562  //printf("a->type=%s a->name=%s doc=%s\n",
563  // a->type.data(),a->name.data(),a->docs.data());
564  }
565  if (!allDoc && declAl!=0) // try declaration arguments as well
566  {
567  allDoc=TRUE;
568  ArgumentListIterator ali(*declAl);
569  Argument *a;
570  for (ali.toFirst();(a=ali.current()) && allDoc;++ali)
571  {
572  if (!a->name.isEmpty() && a->type!="void" &&
573  !(isPython && (a->name=="self" || a->name=="cls"))
574  )
575  {
576  allDoc = !a->docs.isEmpty();
577  }
578  //printf("a->name=%s doc=%s\n",a->name.data(),a->docs.data());
579  }
580  }
581  }
582  if (allDoc)
583  {
584  //printf("%s->setHasDocumentedParams(TRUE);\n",g_memberDef->name().data());
586  }
587  }
588  //printf("Member %s hadDocumentedReturnType()=%d hasReturnCommand=%d\n",
589  // g_memberDef->name().data(),g_memberDef->hasDocumentedReturnType(),g_hasReturnCommand);
590  if (!g_memberDef->hasDocumentedReturnType() && // docs not yet found
592  {
594  }
595  else if ( // see if return needs to documented
597  returnType.isEmpty() || // empty return type
598  returnType.find("void")!=-1 || // void return type
599  returnType.find("subroutine")!=-1 || // fortran subroutine
600  g_memberDef->isConstructor() || // a constructor
601  g_memberDef->isDestructor() // or destructor
602  )
603  {
605  }
606  else if ( // see if return type is documented in a function w/o return type
608  (returnType.isEmpty() || // empty return type
609  returnType.find("void")!=-1 || // void return type
610  returnType.find("subroutine")!=-1 || // fortran subroutine
611  g_memberDef->isConstructor() || // a constructor
612  g_memberDef->isDestructor() // or destructor
613  )
614  )
615  {
616  warn_doc_error(g_fileName,doctokenizerYYlineno,"documented empty return type");
617  }
618  }
619 }
QCString type
Definition: arguments.h:67
static QCString g_fileName
Definition: docparser.cpp:95
This class represents an function or template argument list.
Definition: arguments.h:82
void setHasDocumentedReturnType(bool b)
Definition: memberdef.cpp:4698
bool isEmpty() const
Definition: qcstring.h:189
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
static bool g_hasReturnCommand
Definition: docparser.cpp:99
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
ArgumentList * declArgumentList() const
Definition: memberdef.cpp:4517
void setHasDocumentedParams(bool b)
Definition: memberdef.cpp:4693
This class contains the information about the argument of a function or template. ...
Definition: arguments.h:28
const char * typeString() const
Definition: memberdef.cpp:4035
uint count() const
Definition: qlist.h:66
static bool g_hasParamCommand
Definition: docparser.cpp:98
static MemberDef * g_memberDef
Definition: docparser.cpp:101
SrcLangExt getLanguage() const
const double a
bool isConstructor() const
Definition: memberdef.cpp:3702
#define Config_getBool(val)
Definition: config.cpp:664
bool hasDocumentedReturnType() const
Definition: memberdef.cpp:4453
bool hasDocumentedParams() const
Definition: memberdef.cpp:4448
ArgumentList * argumentList() const
Definition: memberdef.cpp:4512
QCString name
Definition: arguments.h:69
const bool TRUE
Definition: qglobal.h:371
bool isDestructor() const
Definition: memberdef.cpp:3743
QCString docs
Definition: arguments.h:72
void docFindSections ( const char *  input,
Definition d,
MemberGroup m,
const char *  fileName 
)

Searches for section and anchor commands in the input

Definition at line 7434 of file docparser.cpp.

7438 {
7440 }
void doctokenizerYYFindSections(const char *input, Definition *d, MemberGroup *mg, const char *fileName)
static int input(void)
Definition: code.cpp:15695
fileName
Definition: dumpTree.py:9
static void docParserPopContext ( bool  keepParamInfo = FALSE)
static

Definition at line 191 of file docparser.cpp.

192 {
193  DocParserContext *ctx = g_parserStack.pop();
194  g_scope = ctx->scope;
195  g_context = ctx->context;
196  g_inSeeBlock = ctx->inSeeBlock;
197  g_xmlComment = ctx->xmlComment;
199  g_nodeStack = ctx->nodeStack;
200  g_styleStack = ctx->styleStack;
202  g_copyStack = ctx->copyStack;
203  g_fileName = ctx->fileName;
204  g_relPath = ctx->relPath;
205 
206  if (!keepParamInfo)
207  {
210  g_paramsFound = ctx->paramsFound;
211  }
212  g_memberDef = ctx->memberDef;
213  g_isExample = ctx->isExample;
214  g_exampleName = ctx->exampleName;
215  g_sectionDict = ctx->sectionDict;
216  g_searchUrl = ctx->searchUrl;
217 
221 
222  delete g_token;
223  g_token = ctx->token;
224 
225  delete ctx;
227 
228  //QCString indent;
229  //indent.fill(' ',g_parserStack.count()*2+2);
230  //printf("%sdocParserPopContext() count=%d\n",indent.data(),g_nodeStack.count());
231 }
static QCString g_fileName
Definition: docparser.cpp:95
static SectionDict * g_sectionDict
Definition: docparser.cpp:104
static bool g_isExample
Definition: docparser.cpp:102
QCString fileName
Definition: docparser.cpp:125
static QCString g_includeFileText
Definition: docparser.cpp:107
static Definition * g_scope
Definition: docparser.cpp:86
static QStack< DocStyleChange > g_styleStack
Definition: docparser.cpp:92
QCString context
Definition: docparser.cpp:117
QDict< void > paramsFound
Definition: docparser.cpp:131
SectionDict * sectionDict
Definition: docparser.cpp:134
static QCString g_relPath
Definition: docparser.cpp:96
QList< Definition > copyStack
Definition: docparser.cpp:124
static bool g_hasReturnCommand
Definition: docparser.cpp:99
QCString relPath
Definition: docparser.cpp:126
QStack< DocNode > nodeStack
Definition: docparser.cpp:121
static bool g_xmlComment
Definition: docparser.cpp:89
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
TokenInfo * g_token
static QStack< DocParserContext > g_parserStack
Definition: docparser.cpp:144
QStack< DocStyleChange > styleStack
Definition: docparser.cpp:122
QStack< DocStyleChange > initialStyleStack
Definition: docparser.cpp:123
static bool g_hasParamCommand
Definition: docparser.cpp:98
static uint g_includeFileLength
Definition: docparser.cpp:109
static MemberDef * g_memberDef
Definition: docparser.cpp:101
static bool g_insideHtmlLink
Definition: docparser.cpp:90
MemberDef * memberDef
Definition: docparser.cpp:130
TokenInfo * token
Definition: docparser.cpp:141
static QList< Definition > g_copyStack
Definition: docparser.cpp:94
static QDict< void > g_paramsFound
Definition: docparser.cpp:100
static QCString g_searchUrl
Definition: docparser.cpp:105
Definition * scope
Definition: docparser.cpp:116
static QStack< DocStyleChange > g_initialStyleStack
Definition: docparser.cpp:93
QCString includeFileText
Definition: docparser.cpp:137
QCString exampleName
Definition: docparser.cpp:133
static QCString g_context
Definition: docparser.cpp:87
static QCString g_exampleName
Definition: docparser.cpp:103
QCString searchUrl
Definition: docparser.cpp:135
static bool g_inSeeBlock
Definition: docparser.cpp:88
bool doctokenizerYYpopContext()
static uint g_includeFileOffset
Definition: docparser.cpp:108
static void docParserPushContext ( bool  saveParamInfo = TRUE)
static

Definition at line 148 of file docparser.cpp.

149 {
150  //QCString indent;
151  //indent.fill(' ',g_parserStack.count()*2+2);
152  //printf("%sdocParserPushContext() count=%d\n",indent.data(),g_nodeStack.count());
153 
156  ctx->scope = g_scope;
157  ctx->context = g_context;
158  ctx->inSeeBlock = g_inSeeBlock;
159  ctx->xmlComment = g_xmlComment;
161  ctx->nodeStack = g_nodeStack;
162  ctx->styleStack = g_styleStack;
164  ctx->copyStack = g_copyStack;
165  ctx->fileName = g_fileName;
166  ctx->relPath = g_relPath;
167 
168  if (saveParamInfo)
169  {
172  ctx->paramsFound = g_paramsFound;
173  }
174 
175  ctx->memberDef = g_memberDef;
176  ctx->isExample = g_isExample;
177  ctx->exampleName = g_exampleName;
178  ctx->sectionDict = g_sectionDict;
179  ctx->searchUrl = g_searchUrl;
180 
184 
185  ctx->token = g_token;
186  g_token = new TokenInfo;
187 
188  g_parserStack.push(ctx);
189 }
static QCString g_fileName
Definition: docparser.cpp:95
static SectionDict * g_sectionDict
Definition: docparser.cpp:104
static bool g_isExample
Definition: docparser.cpp:102
QCString fileName
Definition: docparser.cpp:125
static QCString g_includeFileText
Definition: docparser.cpp:107
static Definition * g_scope
Definition: docparser.cpp:86
static QStack< DocStyleChange > g_styleStack
Definition: docparser.cpp:92
QCString context
Definition: docparser.cpp:117
QDict< void > paramsFound
Definition: docparser.cpp:131
SectionDict * sectionDict
Definition: docparser.cpp:134
static QCString g_relPath
Definition: docparser.cpp:96
QList< Definition > copyStack
Definition: docparser.cpp:124
static bool g_hasReturnCommand
Definition: docparser.cpp:99
QCString relPath
Definition: docparser.cpp:126
QStack< DocNode > nodeStack
Definition: docparser.cpp:121
static bool g_xmlComment
Definition: docparser.cpp:89
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
TokenInfo * g_token
static QStack< DocParserContext > g_parserStack
Definition: docparser.cpp:144
QStack< DocStyleChange > styleStack
Definition: docparser.cpp:122
QStack< DocStyleChange > initialStyleStack
Definition: docparser.cpp:123
static bool g_hasParamCommand
Definition: docparser.cpp:98
static uint g_includeFileLength
Definition: docparser.cpp:109
static MemberDef * g_memberDef
Definition: docparser.cpp:101
static bool g_insideHtmlLink
Definition: docparser.cpp:90
MemberDef * memberDef
Definition: docparser.cpp:130
TokenInfo * token
Definition: docparser.cpp:141
static QList< Definition > g_copyStack
Definition: docparser.cpp:94
static QDict< void > g_paramsFound
Definition: docparser.cpp:100
static QCString g_searchUrl
Definition: docparser.cpp:105
Definition * scope
Definition: docparser.cpp:116
void doctokenizerYYpushContext()
static QStack< DocStyleChange > g_initialStyleStack
Definition: docparser.cpp:93
Data associated with a token used by the comment block parser.
Definition: doctokenizer.h:71
QCString includeFileText
Definition: docparser.cpp:137
QCString exampleName
Definition: docparser.cpp:133
static QCString g_context
Definition: docparser.cpp:87
static QCString g_exampleName
Definition: docparser.cpp:103
QCString searchUrl
Definition: docparser.cpp:135
static bool g_inSeeBlock
Definition: docparser.cpp:88
static uint g_includeFileOffset
Definition: docparser.cpp:108
static QCString extractCopyDocId ( const char *  data,
uint j,
uint  len 
)
static

Definition at line 6979 of file docparser.cpp.

6980 {
6981  uint s=j;
6982  uint e=j;
6983  int round=0;
6984  bool insideDQuote=FALSE;
6985  bool insideSQuote=FALSE;
6986  bool found=FALSE;
6987  while (j<len && !found)
6988  {
6989  if (!insideSQuote && !insideDQuote)
6990  {
6991  switch (data[j])
6992  {
6993  case '(': round++; break;
6994  case ')': round--; break;
6995  case '"': insideDQuote=TRUE; break;
6996  case '\'': insideSQuote=TRUE; break;
6997  case ' ': // fall through
6998  case '\t': // fall through
6999  case '\n':
7000  found=(round==0);
7001  break;
7002  }
7003  }
7004  else if (insideSQuote) // look for single quote end
7005  {
7006  if (data[j]=='\'' && (j==0 || data[j]!='\\'))
7007  {
7008  insideSQuote=FALSE;
7009  }
7010  }
7011  else if (insideDQuote) // look for double quote end
7012  {
7013  if (data[j]=='"' && (j==0 || data[j]!='\\'))
7014  {
7015  insideDQuote=FALSE;
7016  }
7017  }
7018  if (!found) j++;
7019  }
7020  if (qstrncmp(data+j," const",6)==0)
7021  {
7022  j+=6;
7023  }
7024  else if (qstrncmp(data+j," volatile",9)==0)
7025  {
7026  j+=9;
7027  }
7028  e=j;
7029  QCString id(e-s+1);
7030  if (e>s) memcpy(id.rawData(),data+s,e-s);
7031  id.at(e-s)='\0';
7032  //printf("extractCopyDocId='%s' input='%s'\n",id.data(),&data[s]);
7033  return id;
7034 }
Q_EXPORT int qstrncmp(const char *str1, const char *str2, uint len)
Definition: qcstring.h:101
const bool FALSE
Definition: qglobal.h:370
const double e
unsigned uint
Definition: qglobal.h:351
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
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 262 of file docparser.cpp.

263 {
265  bool ambig;
266  FileDef *fd;
267  //printf("Search for %s\n",fileName);
269  {
271  QFile inImage(inputFile);
272  if (inImage.open(IO_ReadOnly))
273  {
274  result = fileName;
275  int i;
276  if ((i=result.findRev('/'))!=-1 || (i=result.findRev('\\'))!=-1)
277  {
278  result = result.right(result.length()-i-1);
279  }
280  //printf("fileName=%s result=%s\n",fileName,result.data());
281  QCString outputDir;
282  switch(type)
283  {
284  case DocImage::Html:
285  if (!Config_getBool("GENERATE_HTML")) return result;
286  outputDir = Config_getString("HTML_OUTPUT");
287  break;
288  case DocImage::Latex:
289  if (!Config_getBool("GENERATE_LATEX")) return result;
290  outputDir = Config_getString("LATEX_OUTPUT");
291  break;
292  case DocImage::DocBook:
293  if (!Config_getBool("GENERATE_DOCBOOK")) return result;
294  outputDir = Config_getString("DOCBOOK_OUTPUT");
295  break;
296  case DocImage::Rtf:
297  if (!Config_getBool("GENERATE_RTF")) return result;
298  outputDir = Config_getString("RTF_OUTPUT");
299  break;
300  }
301  QCString outputFile = outputDir+"/"+result;
302  QFileInfo outfi(outputFile);
303  if (outfi.isSymLink())
304  {
305  QFile::remove(outputFile);
307  "destination of image %s is a symlink, replacing with image",
308  qPrint(outputFile));
309  }
310  if (outputFile!=inputFile) // prevent copying to ourself
311  {
312  QFile outImage(outputFile.data());
313  if (outImage.open(IO_WriteOnly)) // copy the image
314  {
315  char *buffer = new char[inImage.size()];
316  inImage.readBlock(buffer,inImage.size());
317  outImage.writeBlock(buffer,inImage.size());
318  outImage.flush();
319  delete[] buffer;
321  }
322  else
323  {
325  "could not write output image %s",qPrint(outputFile));
326  }
327  }
328  else
329  {
330  printf("Source & Destination are the same!\n");
331  }
332  }
333  else
334  {
336  "could not open image %s",qPrint(fileName));
337  }
338 
339  if (type==DocImage::Latex && Config_getBool("USE_PDFLATEX") &&
340  fd->name().right(4)==".eps"
341  )
342  { // we have an .eps image in pdflatex mode => convert it to a pdf.
343  QCString outputDir = Config_getString("LATEX_OUTPUT");
344  QCString baseName = fd->name().left(fd->name().length()-4);
345  QCString epstopdfArgs(4096);
346  epstopdfArgs.sprintf("\"%s/%s.eps\" --outfile=\"%s/%s.pdf\"",
347  outputDir.data(), baseName.data(),
348  outputDir.data(), baseName.data());
350  if (portable_system("epstopdf",epstopdfArgs)!=0)
351  {
352  err("Problems running epstopdf. Check your TeX installation!\n");
353  }
355  return baseName;
356  }
357  }
358  else if (ambig)
359  {
360  QCString text;
361  text.sprintf("image file name %s is ambiguous.\n",qPrint(fileName));
362  text+="Possible candidates:\n";
365  }
366  else
367  {
368  result=fileName;
369  if (result.left(5)!="http:" && result.left(6)!="https:")
370  {
372  "image file %s is not found in IMAGE_PATH: "
373  "assuming external image.",qPrint(fileName)
374  );
375  }
376  }
377  return result;
378 }
static QCString g_fileName
Definition: docparser.cpp:95
void portable_sysTimerStop()
Definition: portable.cpp:415
static QCString result
uint length() const
Definition: qcstring.h:195
#define IO_WriteOnly
Definition: qiodevice.h:62
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
int readBlock(char *data, uint len)
Definition: qfile_unix.cpp:473
QCString left(uint len) const
Definition: qcstring.cpp:213
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition: qcstring.cpp:95
void portable_sysTimerStart()
Definition: portable.cpp:410
#define IO_ReadOnly
Definition: qiodevice.h:61
QCString showFileDefMatches(const FileNameDict *fnDict, const char *n)
Definition: util.cpp:5058
fileName
Definition: dumpTree.py:9
QCString name() const
Definition: filedef.cpp:1193
QCString right(uint len) const
Definition: qcstring.cpp:231
FileDef * findFileDef(const FileNameDict *fnDict, const char *n, bool &ambig)
Definition: util.cpp:4963
const char * data() const
Definition: qcstring.h:207
void addImageFile(const char *name)
Definition: index.h:147
#define Config_getString(val)
Definition: config.cpp:660
#define Config_getBool(val)
Definition: config.cpp:664
static QFile inputFile
void err(const char *fmt,...)
Definition: message.cpp:226
static FileNameDict * imageNameDict
Definition: doxygen.h:110
QCString absFilePath() const
Definition: filedef.h:96
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
QCString & sprintf(const char *format,...)
Definition: qcstring.cpp:27
bool remove()
Definition: qfile.cpp:205
static QCString baseName
Definition: scanner.cpp:10890
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
const char * qPrint(const char *s)
Definition: qcstring.h:797
static IndexList * indexList
Definition: doxygen.h:149
int portable_system(const char *command, const char *args, bool commandHasConsole)
Definition: portable.cpp:33
static bool findAttribute ( const HtmlAttribList tagHtmlAttribs,
const char *  attrName,
QCString result 
)
static

Definition at line 5760 of file docparser.cpp.

5763 {
5764 
5765  HtmlAttribListIterator li(tagHtmlAttribs);
5766  HtmlAttrib *opt;
5767  for (li.toFirst();(opt=li.current());++li)
5768  {
5769  if (opt->name==attrName)
5770  {
5771  *result = opt->value;
5772  return TRUE;
5773  }
5774  }
5775  return FALSE;
5776 }
opt
Definition: train.py:196
const bool FALSE
Definition: qglobal.h:370
QCString value
Definition: htmlattrib.h:25
Html attribute list iterator.
Definition: htmlattrib.h:71
QCString name
Definition: htmlattrib.h:24
const bool TRUE
Definition: qglobal.h:371
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 716 of file docparser.cpp.

720 {
721  //printf("findDocsForMemberOrCompound(%s)\n",commandName);
722  *pDoc="";
723  *pBrief="";
724  *pDef=0;
725  QCString cmdArg=substitute(commandName,"#","::");
726  int l=cmdArg.length();
727  if (l==0) return FALSE;
728 
729  int funcStart=cmdArg.find('(');
730  if (funcStart==-1)
731  {
732  funcStart=l;
733  }
734  else
735  {
736  // Check for the case of operator() and the like.
737  // beware of scenarios like operator()((foo)bar)
738  int secondParen = cmdArg.find('(', funcStart+1);
739  int leftParen = cmdArg.find(')', funcStart+1);
740  if (leftParen!=-1 && secondParen!=-1)
741  {
742  if (leftParen<secondParen)
743  {
744  funcStart=secondParen;
745  }
746  }
747  }
748 
749  QCString name=removeRedundantWhiteSpace(cmdArg.left(funcStart));
750  QCString args=cmdArg.right(l-funcStart);
751 
752  // try if the link is to a member
753  MemberDef *md=0;
754  ClassDef *cd=0;
755  FileDef *fd=0;
756  NamespaceDef *nd=0;
757  GroupDef *gd=0;
758  PageDef *pd=0;
759  bool found = getDefs(
760  g_context.find('.')==-1?g_context.data():"", // `find('.') is a hack to detect files
761  name,
762  args.isEmpty()?0:args.data(),
763  md,cd,fd,nd,gd,FALSE,0,TRUE);
764  //printf("found=%d context=%s name=%s\n",found,g_context.data(),name.data());
765  if (found && md)
766  {
767  *pDoc=md->documentation();
768  *pBrief=md->briefDescription();
769  *pDef=md;
770  return TRUE;
771  }
772 
773 
774  int scopeOffset=g_context.length();
775  do // for each scope
776  {
777  QCString fullName=cmdArg;
778  if (scopeOffset>0)
779  {
780  fullName.prepend(g_context.left(scopeOffset)+"::");
781  }
782  //printf("Trying fullName=`%s'\n",fullName.data());
783 
784  // try class, namespace, group, page, file reference
785  cd = Doxygen::classSDict->find(fullName);
786  if (cd) // class
787  {
788  *pDoc=cd->documentation();
789  *pBrief=cd->briefDescription();
790  *pDef=cd;
791  return TRUE;
792  }
793  nd = Doxygen::namespaceSDict->find(fullName);
794  if (nd) // namespace
795  {
796  *pDoc=nd->documentation();
797  *pBrief=nd->briefDescription();
798  *pDef=nd;
799  return TRUE;
800  }
801  gd = Doxygen::groupSDict->find(cmdArg);
802  if (gd) // group
803  {
804  *pDoc=gd->documentation();
805  *pBrief=gd->briefDescription();
806  *pDef=gd;
807  return TRUE;
808  }
809  pd = Doxygen::pageSDict->find(cmdArg);
810  if (pd) // page
811  {
812  *pDoc=pd->documentation();
813  *pBrief=pd->briefDescription();
814  *pDef=pd;
815  return TRUE;
816  }
817  bool ambig;
818  fd = findFileDef(Doxygen::inputNameDict,cmdArg,ambig);
819  if (fd && !ambig) // file
820  {
821  *pDoc=fd->documentation();
822  *pBrief=fd->briefDescription();
823  *pDef=fd;
824  return TRUE;
825  }
826 
827  if (scopeOffset==0)
828  {
829  scopeOffset=-1;
830  }
831  else
832  {
833  scopeOffset = g_context.findRev("::",scopeOffset-1);
834  if (scopeOffset==-1) scopeOffset=0;
835  }
836  } while (scopeOffset>=0);
837 
838 
839  return FALSE;
840 }
static QCString name
Definition: declinfo.cpp:673
static GroupSDict * groupSDict
Definition: doxygen.h:119
bool isEmpty() const
Definition: qcstring.h:189
uint length() const
Definition: qcstring.h:195
const bool FALSE
Definition: qglobal.h:370
static FileNameDict * inputNameDict
Definition: doxygen.h:108
QCString left(uint len) const
Definition: qcstring.cpp:213
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
static QCString args
Definition: declinfo.cpp:674
static QStrList * l
Definition: config.cpp:1044
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition: qcstring.cpp:95
static NamespaceSDict * namespaceSDict
Definition: doxygen.h:120
bool getDefs(const QCString &scName, const QCString &mbName, const char *args, MemberDef *&md, ClassDef *&cd, FileDef *&fd, NamespaceDef *&nd, GroupDef *&gd, bool forceEmptyScope, FileDef *currentFile, bool checkCV, const char *forceTagFile)
Definition: util.cpp:3932
QCString briefDescription(bool abbr=FALSE) const
Definition: memberdef.cpp:5073
QCString right(uint len) const
Definition: qcstring.cpp:231
FileDef * findFileDef(const FileNameDict *fnDict, const char *n, bool &ambig)
Definition: util.cpp:4963
QCString & prepend(const char *s)
Definition: qcstring.cpp:387
static PageSDict * pageSDict
Definition: doxygen.h:102
const char * data() const
Definition: qcstring.h:207
virtual QCString briefDescription(bool abbreviate=FALSE) const
QCString removeRedundantWhiteSpace(const QCString &s)
Definition: util.cpp:1655
QCString documentation() const
Definition: memberdef.cpp:5085
static QCString g_context
Definition: docparser.cpp:87
A model of a page symbol.
Definition: pagedef.h:29
T * find(const char *key)
Definition: sortdict.h:232
virtual QCString documentation() const
static ClassSDict * classSDict
Definition: doxygen.h:99
const bool TRUE
Definition: qglobal.h:371
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition: util.cpp:5088
static void flattenParagraphs ( DocNode root,
QList< DocNode > &  children 
)
static

Definition at line 2523 of file docparser.cpp.

2524 {
2525  QListIterator<DocNode> li(children);
2526  QList<DocNode> newChildren;
2527  DocNode *dn;
2528  for (li.toFirst();(dn=li.current());++li)
2529  {
2530  if (dn->kind()==DocNode::Kind_Para)
2531  {
2532  DocPara *para = (DocPara*)dn;
2533  QList<DocNode> &paraChildren = para->children();
2534  paraChildren.setAutoDelete(FALSE); // unlink children from paragraph node
2535  QListIterator<DocNode> li2(paraChildren);
2536  DocNode *dn2;
2537  for (li2.toFirst();(dn2=li2.current());++li2)
2538  {
2539  newChildren.append(dn2); // add them to new node
2540  }
2541  }
2542  }
2543  children.clear();
2544  QListIterator<DocNode> li3(newChildren);
2545  for (li3.toFirst();(dn=li3.current());++li3)
2546  {
2547  children.append(dn);
2548  dn->setParent(root);
2549  }
2550 }
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
virtual Kind kind() const =0
void setParent(DocNode *parent)
Definition: docparser.h:150
void clear()
Definition: qlist.h:82
void setAutoDelete(bool enable)
Definition: qlist.h:99
const QList< DocNode > & children() const
Definition: docparser.h:185
static int handleAHref ( DocNode parent,
QList< DocNode > &  children,
const HtmlAttribList tagHtmlAttribs 
)
static

Definition at line 981 of file docparser.cpp.

982 {
983  HtmlAttribListIterator li(tagHtmlAttribs);
984  HtmlAttrib *opt;
985  int index=0;
986  int retval = RetVal_OK;
987  for (li.toFirst();(opt=li.current());++li,++index)
988  {
989  if (opt->name=="name") // <a name=label> tag
990  {
991  if (!opt->value.isEmpty())
992  {
993  DocAnchor *anc = new DocAnchor(parent,opt->value,TRUE);
994  children.append(anc);
995  break; // stop looking for other tag attribs
996  }
997  else
998  {
999  warn_doc_error(g_fileName,doctokenizerYYlineno,"found <a> tag with name option but without value!");
1000  }
1001  }
1002  else if (opt->name=="href") // <a href=url>..</a> tag
1003  {
1004  // copy attributes
1005  HtmlAttribList attrList = tagHtmlAttribs;
1006  // and remove the href attribute
1007  bool result = attrList.remove(index);
1008  ASSERT(result);
1009  DocHRef *href = new DocHRef(parent,attrList,opt->value,g_relPath);
1010  children.append(href);
1012  retval = href->parse();
1014  break;
1015  }
1016  else // unsupported option for tag a
1017  {
1018  }
1019  }
1020  return retval;
1021 }
static QCString g_fileName
Definition: docparser.cpp:95
static QCString result
bool isEmpty() const
Definition: qcstring.h:189
void append(const type *d)
Definition: qlist.h:73
opt
Definition: train.py:196
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
static QCString g_relPath
Definition: docparser.cpp:96
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
QCString value
Definition: htmlattrib.h:25
static bool g_insideHtmlLink
Definition: docparser.cpp:90
Html attribute list iterator.
Definition: htmlattrib.h:71
QCString name
Definition: htmlattrib.h:24
A list of Html attributes.
Definition: htmlattrib.h:32
bool remove(uint i)
Definition: qlist.h:76
const bool TRUE
Definition: qglobal.h:371
int parse()
Definition: docparser.cpp:3055
#define ASSERT(x)
Definition: qglobal.h:590
static DocAnchor* handleAnchor ( DocNode parent)
static

Definition at line 1218 of file docparser.cpp.

1219 {
1220  int tok=doctokenizerYYlex();
1221  if (tok!=TK_WHITESPACE)
1222  {
1223  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
1224  qPrint(g_token->name));
1225  return 0;
1226  }
1228  tok=doctokenizerYYlex();
1229  if (tok==0)
1230  {
1231  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment block while parsing the "
1232  "argument of command %s",qPrint(g_token->name));
1233  return 0;
1234  }
1235  else if (tok!=TK_WORD && tok!=TK_LNKWORD)
1236  {
1237  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
1238  tokToString(tok),qPrint(g_token->name));
1239  return 0;
1240  }
1242  return new DocAnchor(parent,g_token->name,FALSE);
1243 }
static QCString g_fileName
Definition: docparser.cpp:95
void doctokenizerYYsetStatePara()
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
TokenInfo * g_token
int doctokenizerYYlex(void)
void doctokenizerYYsetStateAnchor()
QCString name
Definition: doctokenizer.h:77
const char * tokToString(int token)
const char * qPrint(const char *s)
Definition: qcstring.h:797
static void handleImg ( DocNode parent,
QList< DocNode > &  children,
const HtmlAttribList tagHtmlAttribs 
)
static

Definition at line 1676 of file docparser.cpp.

1677 {
1678  HtmlAttribListIterator li(tagHtmlAttribs);
1679  HtmlAttrib *opt;
1680  bool found=FALSE;
1681  int index=0;
1682  for (li.toFirst();(opt=li.current());++li,++index)
1683  {
1684  //printf("option name=%s value=%s\n",opt->name.data(),opt->value.data());
1685  if (opt->name=="src" && !opt->value.isEmpty())
1686  {
1687  // copy attributes
1688  HtmlAttribList attrList = tagHtmlAttribs;
1689  // and remove the src attribute
1690  bool result = attrList.remove(index);
1691  ASSERT(result);
1692  DocImage *img = new DocImage(parent,attrList,opt->value,DocImage::Html,opt->value);
1693  children.append(img);
1694  found = TRUE;
1695  }
1696  }
1697  if (!found)
1698  {
1699  warn_doc_error(g_fileName,doctokenizerYYlineno,"IMG tag does not have a SRC attribute!\n");
1700  }
1701 }
static QCString g_fileName
Definition: docparser.cpp:95
static QCString result
bool isEmpty() const
Definition: qcstring.h:189
void append(const type *d)
Definition: qlist.h:73
opt
Definition: train.py:196
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
QCString value
Definition: htmlattrib.h:25
Html attribute list iterator.
Definition: htmlattrib.h:71
QCString name
Definition: htmlattrib.h:24
A list of Html attributes.
Definition: htmlattrib.h:32
bool remove(uint i)
Definition: qlist.h:76
const bool TRUE
Definition: qglobal.h:371
#define ASSERT(x)
Definition: qglobal.h:590
static void handleInitialStyleCommands ( DocPara parent,
QList< DocNode > &  children 
)
static

Definition at line 972 of file docparser.cpp.

973 {
974  DocStyleChange *sc;
975  while ((sc=g_initialStyleStack.pop()))
976  {
977  handleStyleEnter(parent,children,sc->style(),&sc->attribs());
978  }
979 }
Style style() const
Definition: docparser.h:329
static void handleStyleEnter(DocNode *parent, QList< DocNode > &children, DocStyleChange::Style s, const HtmlAttribList *attribs)
Definition: docparser.cpp:908
type * pop()
Definition: qstack.h:59
static QStack< DocStyleChange > g_initialStyleStack
Definition: docparser.cpp:93
const HtmlAttribList & attribs() const
Definition: docparser.h:334
static DocInternalRef* handleInternalRef ( DocNode parent)
static

Definition at line 1196 of file docparser.cpp.

1197 {
1198  //printf("CMD_INTERNALREF\n");
1199  int tok=doctokenizerYYlex();
1200  QCString tokenName = g_token->name;
1201  if (tok!=TK_WHITESPACE)
1202  {
1203  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
1204  qPrint(tokenName));
1205  return 0;
1206  }
1208  tok=doctokenizerYYlex(); // get the reference id
1209  if (tok!=TK_WORD && tok!=TK_LNKWORD)
1210  {
1211  warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
1212  tokToString(tok),qPrint(tokenName));
1213  return 0;
1214  }
1215  return new DocInternalRef(parent,g_token->name);
1216 }
static QCString g_fileName
Definition: docparser.cpp:95
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
TokenInfo * g_token
int doctokenizerYYlex(void)
void doctokenizerYYsetStateInternalRef()
QCString name
Definition: doctokenizer.h:77
const char * tokToString(int token)
const char * qPrint(const char *s)
Definition: qcstring.h:797
static void handleLinkedWord ( DocNode parent,
QList< DocNode > &  children,
bool  ignoreAutoLinkFlag = FALSE 
)
static

Definition at line 1054 of file docparser.cpp.

1055 {
1057  static bool autolinkSupport = Config_getBool("AUTOLINK_SUPPORT");
1058  if (!autolinkSupport && !ignoreAutoLinkFlag) // no autolinking -> add as normal word
1059  {
1060  children.append(new DocWord(parent,name));
1061  return;
1062  }
1063 
1064  // ------- try to turn the word 'name' into a link
1065 
1066  Definition *compound=0;
1067  MemberDef *member=0;
1068  int len = g_token->name.length();
1069  ClassDef *cd=0;
1070  bool ambig;
1072  //printf("handleLinkedWord(%s) g_context=%s\n",g_token->name.data(),g_context.data());
1073  if (!g_insideHtmlLink &&
1074  (resolveRef(g_context,g_token->name,g_inSeeBlock,&compound,&member,TRUE,fd,TRUE)
1075  || (!g_context.isEmpty() && // also try with global scope
1076  resolveRef("",g_token->name,g_inSeeBlock,&compound,&member,FALSE,0,TRUE))
1077  )
1078  )
1079  {
1080  //printf("resolveRef %s = %p (linkable?=%d)\n",qPrint(g_token->name),member,member ? member->isLinkable() : FALSE);
1081  if (member && member->isLinkable()) // member link
1082  {
1083  if (member->isObjCMethod())
1084  {
1085  bool localLink = g_memberDef ? member->getClassDef()==g_memberDef->getClassDef() : FALSE;
1086  name = member->objCMethodName(localLink,g_inSeeBlock);
1087  }
1088  children.append(new
1089  DocLinkedWord(parent,name,
1090  member->getReference(),
1091  member->getOutputFileBase(),
1092  member->anchor(),
1093  member->briefDescriptionAsTooltip()
1094  )
1095  );
1096  }
1097  else if (compound->isLinkable()) // compound link
1098  {
1099  QCString anchor = compound->anchor();
1100  if (compound->definitionType()==Definition::TypeFile)
1101  {
1102  name=g_token->name;
1103  }
1104  else if (compound->definitionType()==Definition::TypeGroup)
1105  {
1106  name=((GroupDef*)compound)->groupTitle();
1107  }
1108  children.append(new
1109  DocLinkedWord(parent,name,
1110  compound->getReference(),
1111  compound->getOutputFileBase(),
1112  anchor,
1113  compound->briefDescriptionAsTooltip()
1114  )
1115  );
1116  }
1117  else if (compound->definitionType()==Definition::TypeFile &&
1118  ((FileDef*)compound)->generateSourceFile()
1119  ) // undocumented file that has source code we can link to
1120  {
1121  children.append(new
1122  DocLinkedWord(parent,g_token->name,
1123  compound->getReference(),
1124  compound->getSourceFileBase(),
1125  "",
1126  compound->briefDescriptionAsTooltip()
1127  )
1128  );
1129  }
1130  else // not linkable
1131  {
1132  children.append(new DocWord(parent,name));
1133  }
1134  }
1135  else if (!g_insideHtmlLink && len>1 && g_token->name.at(len-1)==':')
1136  {
1137  // special case, where matching Foo: fails to be an Obj-C reference,
1138  // but Foo itself might be linkable.
1139  g_token->name=g_token->name.left(len-1);
1140  handleLinkedWord(parent,children,ignoreAutoLinkFlag);
1141  children.append(new DocWord(parent,":"));
1142  }
1143  else if (!g_insideHtmlLink && (cd=getClass(g_token->name+"-p")))
1144  {
1145  // special case 2, where the token name is not a class, but could
1146  // be a Obj-C protocol
1147  children.append(new
1148  DocLinkedWord(parent,name,
1149  cd->getReference(),
1150  cd->getOutputFileBase(),
1151  cd->anchor(),
1153  ));
1154  }
1155 // else if (!g_insideHtmlLink && (cd=getClass(g_token->name+"-g")))
1156 // {
1157 // // special case 3, where the token name is not a class, but could
1158 // // be a C# generic
1159 // children.append(new
1160 // DocLinkedWord(parent,name,
1161 // cd->getReference(),
1162 // cd->getOutputFileBase(),
1163 // cd->anchor(),
1164 // cd->briefDescriptionAsTooltip()
1165 // ));
1166 // }
1167  else // normal non-linkable word
1168  {
1169  if (g_token->name.left(1)=="#" || g_token->name.left(2)=="::")
1170  {
1171  warn_doc_error(g_fileName,doctokenizerYYlineno,"explicit link request to '%s' could not be resolved",qPrint(name));
1172  children.append(new DocWord(parent,g_token->name));
1173  }
1174  else
1175  {
1176  children.append(new DocWord(parent,name));
1177  }
1178  }
1179 }
static QCString name
Definition: declinfo.cpp:673
static QCString g_fileName
Definition: docparser.cpp:95
virtual bool isLinkable() const =0
virtual QCString getReference() const
bool isEmpty() const
Definition: qcstring.h:189
QCString getReference() const
Definition: memberdef.cpp:1001
uint length() const
Definition: qcstring.h:195
void append(const type *d)
Definition: qlist.h:73
char & at(uint i) const
Definition: qcstring.h:326
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
static FileNameDict * inputNameDict
Definition: doxygen.h:108
QCString left(uint len) const
Definition: qcstring.cpp:213
static void handleLinkedWord(DocNode *parent, QList< DocNode > &children, bool ignoreAutoLinkFlag=FALSE)
Definition: docparser.cpp:1054
virtual QCString getOutputFileBase() const =0
QCString getReference() const
Definition: classdef.cpp:3814
TokenInfo * g_token
ClassDef * getClass(const char *n)
Definition: util.cpp:472
virtual DefType definitionType() const =0
QCString linkToText(SrcLangExt lang, const char *link, bool isFileName)
Definition: util.cpp:4659
virtual QCString getSourceFileBase() const
Definition: definition.cpp:885
static MemberDef * g_memberDef
Definition: docparser.cpp:101
static bool g_insideHtmlLink
Definition: docparser.cpp:90
QCString anchor() const
Definition: classdef.cpp:4606
FileDef * findFileDef(const FileNameDict *fnDict, const char *n, bool &ambig)
Definition: util.cpp:4963
QCString anchor() const
Definition: memberdef.cpp:1031
#define Config_getBool(val)
Definition: config.cpp:664
ClassDef * getClassDef() const
Definition: memberdef.cpp:4070
bool isObjCMethod() const
Definition: memberdef.cpp:3956
QCString getOutputFileBase() const
Definition: classdef.cpp:3533
QCString name
Definition: doctokenizer.h:77
static QCString g_context
Definition: docparser.cpp:87
QCString objCMethodName(bool localLink, bool showStatic) const
Definition: memberdef.cpp:4003
QCString getOutputFileBase() const
Definition: memberdef.cpp:941
static bool g_inSeeBlock
Definition: docparser.cpp:88
QCString briefDescriptionAsTooltip() const
bool isLinkable() const
Definition: memberdef.cpp:1161
const char * qPrint(const char *s)
Definition: qcstring.h:797
const bool TRUE
Definition: qglobal.h:371
bool resolveRef(const char *scName, const char *name, bool inSeeBlock, Definition **resContext, MemberDef **resMember, bool lookForSpecialization, FileDef *currentFile, bool checkScope)
Definition: util.cpp:4479
virtual QCString anchor() const =0
static void handleParameterType ( DocNode parent,
QList< DocNode > &  children,
const QCString paramTypes 
)
static

Definition at line 1181 of file docparser.cpp.

1182 {
1184  int p=0,i;
1185  while ((i=paramTypes.find('|',p))!=-1)
1186  {
1187  g_token->name = paramTypes.mid(p,i-p);
1188  handleLinkedWord(parent,children);
1189  p=i+1;
1190  }
1191  g_token->name = paramTypes.mid(p);
1192  handleLinkedWord(parent,children);
1193  g_token->name = name;
1194 }
static QCString name
Definition: declinfo.cpp:673
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
static void handleLinkedWord(DocNode *parent, QList< DocNode > &children, bool ignoreAutoLinkFlag=FALSE)
Definition: docparser.cpp:1054
TokenInfo * g_token
p
Definition: test.py:223
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
QCString name
Definition: doctokenizer.h:77
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 957 of file docparser.cpp.

958 {
959  if (!g_styleStack.isEmpty())
960  {
962  while (sc && sc->position()>=g_nodeStack.count())
963  { // there are unclosed style modifiers in the paragraph
964  children.append(new DocStyleChange(parent,g_nodeStack.count(),sc->style(),FALSE));
966  g_styleStack.pop();
967  sc = g_styleStack.top();
968  }
969  }
970 }
void append(const type *d)
Definition: qlist.h:73
static QStack< DocStyleChange > g_styleStack
Definition: docparser.cpp:92
uint position() const
Definition: docparser.h:332
const bool FALSE
Definition: qglobal.h:370
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
void push(const type *d)
Definition: qstack.h:58
uint count() const
Definition: qstack.h:56
bool isEmpty() const
Definition: qstack.h:57
Style style() const
Definition: docparser.h:329
type * pop()
Definition: qstack.h:59
static QStack< DocStyleChange > g_initialStyleStack
Definition: docparser.cpp:93
type * top() const
Definition: qstack.h:63
static int handleStyleArgument ( DocNode parent,
QList< DocNode > &  children,
const QCString cmdName 
)
static

Definition at line 848 of file docparser.cpp.

850 {
851  DBG(("handleStyleArgument(%s)\n",qPrint(cmdName)));
852  int tok=doctokenizerYYlex();
853  if (tok!=TK_WHITESPACE)
854  {
855  warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
856  qPrint(cmdName));
857  return tok;
858  }
859  while ((tok=doctokenizerYYlex()) &&
860  tok!=TK_WHITESPACE &&
861  tok!=TK_NEWPARA &&
862  tok!=TK_LISTITEM &&
863  tok!=TK_ENDLIST
864  )
865  {
866  static QRegExp specialChar("[.,|()\\[\\]:;\\?]");
867  if (tok==TK_WORD && g_token->name.length()==1 &&
868  g_token->name.find(specialChar)!=-1)
869  {
870  // special character that ends the markup command
871  return tok;
872  }
873  if (!defaultHandleToken(parent,tok,children))
874  {
875  switch (tok)
876  {
877  case TK_COMMAND:
878  warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command \\%s as the argument of a \\%s command",
879  qPrint(g_token->name),qPrint(cmdName));
880  break;
881  case TK_SYMBOL:
882  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found while handling command %s",
883  qPrint(g_token->name),qPrint(cmdName));
884  break;
885  case TK_HTMLTAG:
886  if (insideLI(parent) && Mappers::htmlTagMapper->map(g_token->name) && g_token->endTag)
887  { // ignore </li> as the end of a style command
888  continue;
889  }
890  return tok;
891  break;
892  default:
893  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s while handling command %s",
894  tokToString(tok),qPrint(cmdName));
895  break;
896  }
897  break;
898  }
899  }
900  DBG(("handleStyleArgument(%s) end tok=%x\n",qPrint(cmdName),tok));
901  return (tok==TK_NEWPARA || tok==TK_LISTITEM || tok==TK_ENDLIST
902  ) ? tok : RetVal_OK;
903 }
static QCString g_fileName
Definition: docparser.cpp:95
The QRegExp class provides pattern matching using regular expressions or wildcards.
Definition: qregexp.h:46
uint length() const
Definition: qcstring.h:195
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
static Mapper * htmlTagMapper
Definition: cmdmapper.h:220
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
TokenInfo * g_token
int doctokenizerYYlex(void)
static bool defaultHandleToken(DocNode *parent, int tok, QList< DocNode > &children, bool handleWord=TRUE)
Definition: docparser.cpp:1331
QCString name
Definition: doctokenizer.h:77
const char * tokToString(int token)
const char * qPrint(const char *s)
Definition: qcstring.h:797
static bool insideLI(DocNode *n)
Definition: docparser.cpp:657
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 908 of file docparser.cpp.

910 {
911  DBG(("HandleStyleEnter\n"));
912  DocStyleChange *sc= new DocStyleChange(parent,g_nodeStack.count(),s,TRUE,attribs);
913  children.append(sc);
914  g_styleStack.push(sc);
915 }
void append(const type *d)
Definition: qlist.h:73
static QStack< DocStyleChange > g_styleStack
Definition: docparser.cpp:92
#define DBG(x)
Definition: docparser.cpp:59
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
void push(const type *d)
Definition: qstack.h:58
uint count() const
Definition: qstack.h:56
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
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 920 of file docparser.cpp.

922 {
923  DBG(("HandleStyleLeave\n"));
924  if (g_styleStack.isEmpty() || // no style change
925  g_styleStack.top()->style()!=s || // wrong style change
926  g_styleStack.top()->position()!=g_nodeStack.count() // wrong position
927  )
928  {
929  if (g_styleStack.isEmpty())
930  {
931  warn_doc_error(g_fileName,doctokenizerYYlineno,"found </%s> tag without matching <%s>",
932  qPrint(tagName),qPrint(tagName));
933  }
934  else if (g_styleStack.top()->style()!=s)
935  {
936  warn_doc_error(g_fileName,doctokenizerYYlineno,"found </%s> tag while expecting </%s>",
937  qPrint(tagName),qPrint(g_styleStack.top()->styleString()));
938  }
939  else
940  {
941  warn_doc_error(g_fileName,doctokenizerYYlineno,"found </%s> at different nesting level (%d) than expected (%d)",
942  qPrint(tagName),g_nodeStack.count(),g_styleStack.top()->position());
943  }
944  }
945  else // end the section
946  {
948  children.append(sc);
949  g_styleStack.pop();
950  }
951 }
static QCString g_fileName
Definition: docparser.cpp:95
void append(const type *d)
Definition: qlist.h:73
static QStack< DocStyleChange > g_styleStack
Definition: docparser.cpp:92
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
uint position() const
Definition: docparser.h:332
const bool FALSE
Definition: qglobal.h:370
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
uint count() const
Definition: qstack.h:56
bool isEmpty() const
Definition: qstack.h:57
Style style() const
Definition: docparser.h:329
type * pop()
Definition: qstack.h:59
static QCString * s
Definition: config.cpp:1042
const char * qPrint(const char *s)
Definition: qcstring.h:797
type * top() const
Definition: qstack.h:63
const char * styleString() const
Definition: docparser.cpp:1023
static void handleUnclosedStyleCommands ( )
static

Definition at line 1041 of file docparser.cpp.

1042 {
1044  {
1049  "end of comment block while expecting "
1050  "command </%s>",qPrint(sc->styleString()));
1051  }
1052 }
static QCString g_fileName
Definition: docparser.cpp:95
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
bool isEmpty() const
Definition: qstack.h:57
static void handleUnclosedStyleCommands()
Definition: docparser.cpp:1041
type * pop()
Definition: qstack.h:59
static QStack< DocStyleChange > g_initialStyleStack
Definition: docparser.cpp:93
const char * qPrint(const char *s)
Definition: qcstring.h:797
type * top() const
Definition: qstack.h:63
const char * styleString() const
Definition: docparser.cpp:1023
static bool insideLI ( DocNode n)
static

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

Definition at line 657 of file docparser.cpp.

658 {
659  while (n)
660  {
661  if (n->kind()==DocNode::Kind_HtmlListItem) return TRUE;
662  n=n->parent();
663  }
664  return FALSE;
665 }
DocNode * parent() const
Definition: docparser.h:147
const bool FALSE
Definition: qglobal.h:370
virtual Kind kind() const =0
const bool TRUE
Definition: qglobal.h:371
static bool insideOL ( DocNode n)
static

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

Definition at line 684 of file docparser.cpp.

685 {
686  while (n)
687  {
688  if (n->kind()==DocNode::Kind_HtmlList &&
689  ((DocHtmlList *)n)->type()==DocHtmlList::Ordered) return TRUE;
690  n=n->parent();
691  }
692  return FALSE;
693 }
DocNode * parent() const
Definition: docparser.h:147
const bool FALSE
Definition: qglobal.h:370
virtual Kind kind() const =0
const bool TRUE
Definition: qglobal.h:371
static bool insidePRE ( DocNode n)
static

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

Definition at line 644 of file docparser.cpp.

645 {
646  while (n)
647  {
648  if (n->isPreformatted()) return TRUE;
649  n=n->parent();
650  }
651  return FALSE;
652 }
DocNode * parent() const
Definition: docparser.h:147
const bool FALSE
Definition: qglobal.h:370
bool isPreformatted() const
Definition: docparser.h:158
const bool TRUE
Definition: qglobal.h:371
static bool insideTable ( DocNode n)
static

Definition at line 697 of file docparser.cpp.

698 {
699  while (n)
700  {
701  if (n->kind()==DocNode::Kind_HtmlTable) return TRUE;
702  n=n->parent();
703  }
704  return FALSE;
705 }
DocNode * parent() const
Definition: docparser.h:147
const bool FALSE
Definition: qglobal.h:370
virtual Kind kind() const =0
const bool TRUE
Definition: qglobal.h:371
static bool insideUL ( DocNode n)
static

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

Definition at line 670 of file docparser.cpp.

671 {
672  while (n)
673  {
674  if (n->kind()==DocNode::Kind_HtmlList &&
675  ((DocHtmlList *)n)->type()==DocHtmlList::Unordered) return TRUE;
676  n=n->parent();
677  }
678  return FALSE;
679 }
DocNode * parent() const
Definition: docparser.h:147
const bool FALSE
Definition: qglobal.h:370
virtual Kind kind() const =0
const bool TRUE
Definition: qglobal.h:371
static int internalValidatingParseDoc ( DocNode parent,
QList< DocNode > &  children,
const QCString doc 
)
static

Definition at line 1713 of file docparser.cpp.

1715 {
1716  int retval = RetVal_OK;
1717 
1718  if (doc.isEmpty()) return retval;
1719 
1721 
1722  // first parse any number of paragraphs
1723  bool isFirst=TRUE;
1724  DocPara *lastPar=0;
1725  if (!children.isEmpty() && children.getLast()->kind()==DocNode::Kind_Para)
1726  { // last child item was a paragraph
1727  lastPar = (DocPara*)children.getLast();
1728  isFirst=FALSE;
1729  }
1730  do
1731  {
1732  DocPara *par = new DocPara(parent);
1733  if (isFirst) { par->markFirst(); isFirst=FALSE; }
1734  retval=par->parse();
1735  if (!par->isEmpty())
1736  {
1737  children.append(par);
1738  if (lastPar) lastPar->markLast(FALSE);
1739  lastPar=par;
1740  }
1741  else
1742  {
1743  delete par;
1744  }
1745  } while (retval==TK_NEWPARA);
1746  if (lastPar) lastPar->markLast();
1747 
1748  //printf("internalValidateParsingDoc: %p: isFirst=%d isLast=%d\n",
1749  // lastPar,lastPar?lastPar->isFirst():-1,lastPar?lastPar->isLast():-1);
1750 
1751  return retval;
1752 }
static QCString g_fileName
Definition: docparser.cpp:95
void doctokenizerYYinit(const char *input, const char *fileName)
bool isEmpty() const
Definition: qcstring.h:189
void append(const type *d)
Definition: qlist.h:73
const bool FALSE
Definition: qglobal.h:370
void markFirst(bool v=TRUE)
Definition: docparser.h:1122
virtual Kind kind() const =0
type * getLast() const
Definition: qlist.h:96
bool isEmpty() const
Definition: qlist.h:67
void markLast(bool v=TRUE)
Definition: docparser.h:1123
int parse()
Definition: docparser.cpp:6348
bool isEmpty() const
Definition: docparser.h:1120
const bool TRUE
Definition: qglobal.h:371
static uint isCopyBriefOrDetailsCmd ( const char *  data,
uint  i,
uint  len,
bool brief 
)
static

Definition at line 7044 of file docparser.cpp.

7045 {
7046  int j=0;
7047  if (i==0 || (data[i-1]!='@' && data[i-1]!='\\')) // not an escaped command
7048  {
7049  CHECK_FOR_COMMAND("copybrief",brief=TRUE); // @copybrief or \copybrief
7050  CHECK_FOR_COMMAND("copydetails",brief=FALSE); // @copydetails or \copydetails
7051  }
7052  return j;
7053 }
bool brief
const bool FALSE
Definition: qglobal.h:370
#define CHECK_FOR_COMMAND(str, action)
Definition: docparser.cpp:7040
const bool TRUE
Definition: qglobal.h:371
static uint isVerbatimSection ( const char *  data,
uint  i,
uint  len,
QCString endMarker 
)
static

Definition at line 7055 of file docparser.cpp.

7056 {
7057  int j=0;
7058  if (i==0 || (data[i-1]!='@' && data[i-1]!='\\')) // not an escaped command
7059  {
7060  CHECK_FOR_COMMAND("dot",endMarker="enddot");
7061  CHECK_FOR_COMMAND("code",endMarker="endcode");
7062  CHECK_FOR_COMMAND("msc",endMarker="endmsc");
7063  CHECK_FOR_COMMAND("verbatim",endMarker="endverbatim");
7064  CHECK_FOR_COMMAND("latexonly",endMarker="endlatexonly");
7065  CHECK_FOR_COMMAND("htmlonly",endMarker="endhtmlonly");
7066  CHECK_FOR_COMMAND("xmlonly",endMarker="endxmlonly");
7067  CHECK_FOR_COMMAND("rtfonly",endMarker="endrtfonly");
7068  CHECK_FOR_COMMAND("manonly",endMarker="endmanonly");
7069  CHECK_FOR_COMMAND("docbookonly",endMarker="enddocbookonly");
7070  CHECK_FOR_COMMAND("startuml",endMarker="enduml");
7071  }
7072  //printf("isVerbatimSection(%s)=%d)\n",QCString(&data[i]).left(10).data(),j);
7073  return j;
7074 }
#define CHECK_FOR_COMMAND(str, action)
Definition: docparser.cpp:7040
static QCString processCopyDoc ( const char *  data,
uint len 
)
static

Definition at line 7094 of file docparser.cpp.

7095 {
7096  //printf("processCopyDoc start '%s'\n",data);
7097  GrowBuf buf;
7098  uint i=0;
7099  while (i<len)
7100  {
7101  char c = data[i];
7102  if (c=='@' || c=='\\') // look for a command
7103  {
7104  bool isBrief=TRUE;
7105  uint j=isCopyBriefOrDetailsCmd(data,i,len,isBrief);
7106  if (j>0)
7107  {
7108  // skip whitespace
7109  while (j<len && (data[j]==' ' || data[j]=='\t')) j++;
7110  // extract the argument
7111  QCString id = extractCopyDocId(data,j,len);
7112  Definition *def;
7113  QCString doc,brief;
7114  //printf("resolving docs='%s'\n",id.data());
7115  if (findDocsForMemberOrCompound(id,&doc,&brief,&def))
7116  {
7117  //printf("found it def=%p brief='%s' doc='%s' isBrief=%d\n",def,brief.data(),doc.data(),isBrief);
7118  if (g_copyStack.findRef(def)==-1) // definition not parsed earlier
7119  {
7120  g_copyStack.append(def);
7121  if (isBrief)
7122  {
7123  uint l=brief.length();
7124  buf.addStr(processCopyDoc(brief,l));
7125  }
7126  else
7127  {
7128  uint l=doc.length();
7129  buf.addStr(processCopyDoc(doc,l));
7130  }
7131  g_copyStack.remove(def);
7132  }
7133  else
7134  {
7136  "Found recursive @copy%s or @copydoc relation for argument '%s'.\n",
7137  isBrief?"brief":"details",id.data());
7138  }
7139  }
7140  else
7141  {
7143  "@copy%s or @copydoc target '%s' not found", isBrief?"brief":"details",
7144  id.data());
7145  }
7146  // skip over command
7147  i=j;
7148  }
7149  else
7150  {
7151  QCString endMarker;
7152  uint k = isVerbatimSection(data,i,len,endMarker);
7153  if (k>0)
7154  {
7155  int orgPos = i;
7156  i=skipToEndMarker(data,k,len,endMarker);
7157  buf.addStr(data+orgPos,i-orgPos);
7158  }
7159  else
7160  {
7161  buf.addChar(c);
7162  i++;
7163  }
7164  }
7165  }
7166  else // not a command, just copy
7167  {
7168  buf.addChar(c);
7169  i++;
7170  }
7171  }
7172  len = buf.getPos();
7173  buf.addChar(0);
7174  return buf.get();
7175 }
static QCString g_fileName
Definition: docparser.cpp:95
bool brief
void addStr(const char *s)
Definition: growbuf.h:19
uint length() const
Definition: qcstring.h:195
void append(const type *d)
Definition: qlist.h:73
int findRef(const type *d) const
Definition: qlist.h:89
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
static QStrList * l
Definition: config.cpp:1044
static uint isVerbatimSection(const char *data, uint i, uint len, QCString &endMarker)
Definition: docparser.cpp:7055
void addChar(char c)
Definition: growbuf.h:16
static QList< Definition > g_copyStack
Definition: docparser.cpp:94
static QCString extractCopyDocId(const char *data, uint &j, uint len)
Definition: docparser.cpp:6979
const char * get()
Definition: growbuf.h:38
QCString doc
static bool findDocsForMemberOrCompound(const char *commandName, QCString *pDoc, QCString *pBrief, Definition **pDef)
Definition: docparser.cpp:716
static uint skipToEndMarker(const char *data, uint i, uint len, const QCString &endMarker)
Definition: docparser.cpp:7076
static uint isCopyBriefOrDetailsCmd(const char *data, uint i, uint len, bool &brief)
Definition: docparser.cpp:7044
int getPos() const
Definition: growbuf.h:39
UWORD32 buf[4]
Definition: md5.h:42
bool remove(uint i)
Definition: qlist.h:76
unsigned uint
Definition: qglobal.h:351
static QCString processCopyDoc(const char *data, uint &len)
Definition: docparser.cpp:7094
const bool TRUE
Definition: qglobal.h:371
static void readTextFileByName ( const QCString file,
QCString text 
)
static

Definition at line 1756 of file docparser.cpp.

1757 {
1758  if (portable_isAbsolutePath(file.data()))
1759  {
1760  QFileInfo fi(file);
1761  if (fi.exists())
1762  {
1763  text = fileToString(file,Config_getBool("FILTER_SOURCE_FILES"));
1764  return;
1765  }
1766  }
1767  QStrList &examplePathList = Config_getList("EXAMPLE_PATH");
1768  char *s=examplePathList.first();
1769  while (s)
1770  {
1771  QCString absFileName = QCString(s)+portable_pathSeparator()+file;
1772  QFileInfo fi(absFileName);
1773  if (fi.exists())
1774  {
1775  text = fileToString(absFileName,Config_getBool("FILTER_SOURCE_FILES"));
1776  return;
1777  }
1778  s=examplePathList.next();
1779  }
1780 
1781  // as a fallback we also look in the exampleNameDict
1782  bool ambig;
1783  FileDef *fd;
1784  if ((fd=findFileDef(Doxygen::exampleNameDict,file,ambig)))
1785  {
1786  text = fileToString(fd->absFilePath(),Config_getBool("FILTER_SOURCE_FILES"));
1787  }
1788  else if (ambig)
1789  {
1790  warn_doc_error(g_fileName,doctokenizerYYlineno,"included file name %s is ambiguous"
1791  "Possible candidates:\n%s",qPrint(file),
1793  );
1794  }
1795  else
1796  {
1797  warn_doc_error(g_fileName,doctokenizerYYlineno,"included file %s is not found. "
1798  "Check your EXAMPLE_PATH",qPrint(file));
1799  }
1800 }
static QCString g_fileName
Definition: docparser.cpp:95
bool portable_isAbsolutePath(const char *fileName)
Definition: portable.cpp:434
QCString fileToString(const char *name, bool filter, bool isSourceCode)
Definition: util.cpp:2418
type * first()
Definition: qinternallist.h:87
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
#define Config_getList(val)
Definition: config.cpp:662
static FileNameDict * exampleNameDict
Definition: doxygen.h:106
QCString showFileDefMatches(const FileNameDict *fnDict, const char *n)
Definition: util.cpp:5058
FileDef * findFileDef(const FileNameDict *fnDict, const char *n, bool &ambig)
Definition: util.cpp:4963
const char * data() const
Definition: qcstring.h:207
#define Config_getBool(val)
Definition: config.cpp:664
type * next()
Definition: qinternallist.h:89
QCString absFilePath() const
Definition: filedef.h:96
char portable_pathSeparator()
Definition: portable.cpp:355
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
static QCString * s
Definition: config.cpp:1042
const char * qPrint(const char *s)
Definition: qcstring.h:797
static uint skipToEndMarker ( const char *  data,
uint  i,
uint  len,
const QCString endMarker 
)
static

Definition at line 7076 of file docparser.cpp.

7077 {
7078  while (i<len)
7079  {
7080  if ((data[i]=='@' || data[i]=='\\') && // start of command character
7081  (i==0 || (data[i-1]!='@' && data[i-1]!='\\'))) // that is not escaped
7082  {
7083  if (i+endMarker.length()+1<=len && qstrncmp(data+i+1,endMarker,endMarker.length())==0)
7084  {
7085  return i+endMarker.length()+1;
7086  }
7087  }
7088  i++;
7089  }
7090  // oops no endmarker found...
7091  return i<len ? i+1 : len;
7092 }
Q_EXPORT int qstrncmp(const char *str1, const char *str2, uint len)
Definition: qcstring.h:101
uint length() const
Definition: qcstring.h:195
static QCString stripKnownExtensions ( const char *  text)
static

Strips known html and tex extensions from text.

Definition at line 625 of file docparser.cpp.

626 {
627  QCString result=text;
628  if (result.right(4)==".tex")
629  {
630  result=result.left(result.length()-4);
631  }
632  else if (result.right(Doxygen::htmlFileExtension.length())==
634  {
635  result=result.left(result.length()-Doxygen::htmlFileExtension.length());
636  }
637  return result;
638 }
static QCString result
uint length() const
Definition: qcstring.h:195
static QCString htmlFileExtension
Definition: doxygen.h:130
QCString left(uint len) const
Definition: qcstring.cpp:213
QCString right(uint len) const
Definition: qcstring.cpp:231
static void unescapeCRef ( QCString s)
static

Definition at line 237 of file docparser.cpp.

238 {
239  QCString tmp(s);
240  char *p = tmp.rawData();
241  if (p)
242  {
243  char c;
244  while ((c=*p))
245  {
246  if (c=='{') c='<'; else if (c=='}') c='>';
247  *p++=c;
248  }
249  }
250 
251  tmp=substitute(tmp,"&lt;","<");
252  tmp=substitute(tmp,"&gt;",">");
253  s = tmp;
254 }
p
Definition: test.py:223
string tmp
Definition: languages.py:63
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition: util.cpp:5088
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 7179 of file docparser.cpp.

7184 {
7185  //printf("validatingParseDoc(%s,%s)=[%s]\n",ctx?ctx->name().data():"<none>",
7186  // md?md->name().data():"<none>",
7187  // input);
7188  //printf("========== validating %s at line %d\n",fileName,startLine);
7189  //printf("---------------- input --------------------\n%s\n----------- end input -------------------\n",input);
7190  //g_token = new TokenInfo;
7191 
7192  // store parser state so we can re-enter this function if needed
7193  //bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
7195 
7196  if (ctx && ctx!=Doxygen::globalScope &&
7199  )
7200  )
7201  {
7202  g_context = ctx->name();
7203  }
7204  else if (ctx && ctx->definitionType()==Definition::TypePage)
7205  {
7206  Definition *scope = ((PageDef*)ctx)->getPageScope();
7207  if (scope && scope!=Doxygen::globalScope) g_context = scope->name();
7208  }
7209  else if (ctx && ctx->definitionType()==Definition::TypeGroup)
7210  {
7211  Definition *scope = ((GroupDef*)ctx)->getGroupScope();
7212  if (scope && scope!=Doxygen::globalScope) g_context = scope->name();
7213  }
7214  else
7215  {
7216  g_context = "";
7217  }
7218  g_scope = ctx;
7219 
7220  if (indexWords && Doxygen::searchIndex)
7221  {
7222  if (md)
7223  {
7226  }
7227  else if (ctx)
7228  {
7231  }
7232  }
7233 #if 0
7234  if (indexWords && md && Doxygen::searchIndex)
7235  {
7238  (md->getLanguage()==SrcLangExt_Fortran ?
7241  g_searchUrl,
7242  md->anchor());
7243  }
7244  else if (indexWords && ctx && Doxygen::searchIndex)
7245  {
7247  QCString name = ctx->qualifiedName();
7248 
7249  SrcLangExt lang = ctx->getLanguage();
7251  if (sep!="::")
7252  {
7253  name = substitute(name,"::",sep);
7254  }
7255 
7256  switch (ctx->definitionType())
7257  {
7258  case Definition::TypePage:
7259  {
7260  PageDef *pd = (PageDef *)ctx;
7261  if (!pd->title().isEmpty())
7262  {
7263  name = theTranslator->trPage(TRUE,TRUE)+" "+pd->title();
7264  }
7265  else
7266  {
7267  name = theTranslator->trPage(TRUE,TRUE)+" "+pd->name();
7268  }
7269  }
7270  break;
7271  case Definition::TypeClass:
7272  {
7273  ClassDef *cd = (ClassDef *)ctx;
7274  name.prepend(cd->compoundTypeString()+" ");
7275  }
7276  break;
7278  {
7279  if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp)
7280  {
7281  name = theTranslator->trPackage(name);
7282  }
7283  else if (lang==SrcLangExt_Fortran)
7284  {
7285  name.prepend(theTranslator->trModule(TRUE,TRUE)+" ");
7286  }
7287  else
7288  {
7290  }
7291  }
7292  break;
7293  case Definition::TypeGroup:
7294  {
7295  GroupDef *gd = (GroupDef *)ctx;
7296  if (gd->groupTitle())
7297  {
7298  name = theTranslator->trGroup(TRUE,TRUE)+" "+gd->groupTitle();
7299  }
7300  else
7301  {
7302  name.prepend(theTranslator->trGroup(TRUE,TRUE)+" ");
7303  }
7304  }
7305  break;
7306  default:
7307  break;
7308  }
7310  }
7311 #endif
7312  else
7313  {
7314  g_searchUrl="";
7315  }
7316 
7317  g_fileName = fileName;
7318  g_relPath = (!linkFromIndex && ctx) ?
7320  QCString("");
7321  //printf("ctx->name=%s relPath=%s\n",ctx->name().data(),g_relPath.data());
7322  g_memberDef = md;
7323  g_nodeStack.clear();
7324  g_styleStack.clear();
7326  g_inSeeBlock = FALSE;
7327  g_xmlComment = FALSE;
7329  g_includeFileText = "";
7330  g_includeFileOffset = 0;
7331  g_includeFileLength = 0;
7332  g_isExample = isExample;
7333  g_exampleName = exampleName;
7336  g_paramsFound.setAutoDelete(FALSE);
7337  g_paramsFound.clear();
7338  g_sectionDict = 0; //sections;
7339 
7340  //printf("Starting comment block at %s:%d\n",g_fileName.data(),startLine);
7341  doctokenizerYYlineno=startLine;
7342  uint inpLen=qstrlen(input);
7343  QCString inpStr = processCopyDoc(input,inpLen);
7344  if (inpStr.isEmpty() || inpStr.at(inpStr.length()-1)!='\n')
7345  {
7346  inpStr+='\n';
7347  }
7348  //printf("processCopyDoc(in='%s' out='%s')\n",input,inpStr.data());
7350 
7351  // build abstract syntax tree
7352  DocRoot *root = new DocRoot(md!=0,singleLine);
7353  root->parse();
7354 
7355 
7357  {
7358  // pretty print the result
7360  root->accept(v);
7361  delete v;
7362  }
7363 
7366 
7367  // TODO: These should be called at the end of the program.
7368  //doctokenizerYYcleanup();
7369  //Mappers::cmdMapper->freeInstance();
7370  //Mappers::htmlTagMapper->freeInstance();
7371 
7372  // restore original parser state
7374 
7375  //printf(">>>>>> end validatingParseDoc(%s,%s)\n",ctx?ctx->name().data():"<none>",
7376  // md?md->name().data():"<none>");
7377 
7378  return root;
7379 }
static QCString name
Definition: declinfo.cpp:673
static QCString g_fileName
Definition: docparser.cpp:95
static SectionDict * g_sectionDict
Definition: docparser.cpp:104
static QCString scope
Definition: declinfo.cpp:668
void doctokenizerYYinit(const char *input, const char *fileName)
static bool g_isExample
Definition: docparser.cpp:102
static QCString g_includeFileText
Definition: docparser.cpp:107
bool isEmpty() const
Definition: qcstring.h:189
static Definition * g_scope
Definition: docparser.cpp:86
QCString title() const
Definition: pagedef.h:54
uint length() const
Definition: qcstring.h:195
static QStack< DocStyleChange > g_styleStack
Definition: docparser.cpp:92
void accept(DocVisitor *v)
Definition: docparser.h:1405
char & at(uint i) const
Definition: qcstring.h:326
QCString compoundTypeString() const
Definition: classdef.cpp:3499
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
static QCString g_relPath
Definition: docparser.cpp:96
static bool g_hasReturnCommand
Definition: docparser.cpp:99
QCString relativePathToRoot(const char *name)
Definition: util.cpp:5436
static void detectNoDocumentedParams()
Definition: docparser.cpp:527
static bool g_xmlComment
Definition: docparser.cpp:89
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
virtual QCString getOutputFileBase() const =0
const char * groupTitle() const
Definition: groupdef.h:54
SrcLangExt
Definition: types.h:41
virtual QCString trModule(bool first_capital, bool singular)=0
virtual QCString trSubprogram(bool first_capital, bool singular)=0
static NamespaceDef * globalScope
Definition: doxygen.h:128
static void checkUndocumentedParams()
Definition: docparser.cpp:455
virtual DefType definitionType() const =0
QCString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Definition: util.cpp:8065
static SearchIndexIntf * searchIndex
Definition: doxygen.h:133
Q_EXPORT uint qstrlen(const char *str)
Definition: qcstring.h:81
const QCString & name() const
Definition: definition.h:114
static bool g_hasParamCommand
Definition: docparser.cpp:98
static int input(void)
Definition: code.cpp:15695
fileName
Definition: dumpTree.py:9
static uint g_includeFileLength
Definition: docparser.cpp:109
static MemberDef * g_memberDef
Definition: docparser.cpp:101
static bool g_insideHtmlLink
Definition: docparser.cpp:90
SrcLangExt getLanguage() const
static QDict< void > g_paramsFound
Definition: docparser.cpp:100
QCString & prepend(const char *s)
Definition: qcstring.cpp:387
static QCString g_searchUrl
Definition: docparser.cpp:105
QCString anchor() const
Definition: memberdef.cpp:1031
virtual QCString trGroup(bool first_capital, bool singular)=0
virtual QCString qualifiedName() const
static void docParserPopContext(bool keepParamInfo=FALSE)
Definition: docparser.cpp:191
virtual QCString trPage(bool first_capital, bool singular)=0
static QStack< DocStyleChange > g_initialStyleStack
Definition: docparser.cpp:93
static void docParserPushContext(bool saveParamInfo=TRUE)
Definition: docparser.cpp:148
virtual QCString trPackage(const char *name)=0
QCString qualifiedName() const
Definition: memberdef.cpp:3968
static QCString g_context
Definition: docparser.cpp:87
A model of a page symbol.
Definition: pagedef.h:29
virtual QCString trNamespace(bool first_capital, bool singular)=0
static QCString g_exampleName
Definition: docparser.cpp:103
virtual void setCurrentDoc(Definition *ctx, const char *anchor, bool isSourceFile)=0
QCString getOutputFileBase() const
Definition: memberdef.cpp:941
Translator * theTranslator
Definition: language.cpp:157
void parse()
Definition: docparser.cpp:6904
static bool g_inSeeBlock
Definition: docparser.cpp:88
void clear()
Definition: qstack.h:61
static bool isFlagSet(DebugMask mask)
Definition: debug.cpp:119
unsigned uint
Definition: qglobal.h:351
static uint g_includeFileOffset
Definition: docparser.cpp:108
virtual QCString trMember(bool first_capital, bool singular)=0
static QCString processCopyDoc(const char *data, uint &len)
Definition: docparser.cpp:7094
const bool TRUE
Definition: qglobal.h:371
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition: util.cpp:5088
virtual QCString anchor() const =0
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 7381 of file docparser.cpp.

7382 {
7383  // store parser state so we can re-enter this function if needed
7385 
7386  //printf("------------ input ---------\n%s\n"
7387  // "------------ end input -----\n",input);
7388  //g_token = new TokenInfo;
7389  g_context = "";
7390  g_fileName = "<parseText>";
7391  g_relPath = "";
7392  g_memberDef = 0;
7393  g_nodeStack.clear();
7394  g_styleStack.clear();
7396  g_inSeeBlock = FALSE;
7397  g_xmlComment = FALSE;
7399  g_includeFileText = "";
7400  g_includeFileOffset = 0;
7401  g_includeFileLength = 0;
7402  g_isExample = FALSE;
7403  g_exampleName = "";
7406  g_paramsFound.setAutoDelete(FALSE);
7407  g_paramsFound.clear();
7408  g_searchUrl="";
7409 
7410  DocText *txt = new DocText;
7411 
7412  if (input)
7413  {
7416 
7417  // build abstract syntax tree
7418  txt->parse();
7419 
7421  {
7422  // pretty print the result
7424  txt->accept(v);
7425  delete v;
7426  }
7427  }
7428 
7429  // restore original parser state
7431  return txt;
7432 }
static QCString g_fileName
Definition: docparser.cpp:95
void doctokenizerYYinit(const char *input, const char *fileName)
static bool g_isExample
Definition: docparser.cpp:102
static QCString g_includeFileText
Definition: docparser.cpp:107
static QStack< DocStyleChange > g_styleStack
Definition: docparser.cpp:92
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
static QCString g_relPath
Definition: docparser.cpp:96
static bool g_hasReturnCommand
Definition: docparser.cpp:99
static bool g_xmlComment
Definition: docparser.cpp:89
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
static bool g_hasParamCommand
Definition: docparser.cpp:98
static int input(void)
Definition: code.cpp:15695
static uint g_includeFileLength
Definition: docparser.cpp:109
static MemberDef * g_memberDef
Definition: docparser.cpp:101
static bool g_insideHtmlLink
Definition: docparser.cpp:90
static QDict< void > g_paramsFound
Definition: docparser.cpp:100
static QCString g_searchUrl
Definition: docparser.cpp:105
void accept(DocVisitor *v)
Definition: docparser.h:1394
static void docParserPopContext(bool keepParamInfo=FALSE)
Definition: docparser.cpp:191
static QStack< DocStyleChange > g_initialStyleStack
Definition: docparser.cpp:93
static void docParserPushContext(bool saveParamInfo=TRUE)
Definition: docparser.cpp:148
static QCString g_context
Definition: docparser.cpp:87
static QCString g_exampleName
Definition: docparser.cpp:103
void parse()
Definition: docparser.cpp:6799
static bool g_inSeeBlock
Definition: docparser.cpp:88
void clear()
Definition: qstack.h:61
static bool isFlagSet(DebugMask mask)
Definition: debug.cpp:119
static uint g_includeFileOffset
Definition: docparser.cpp:108

Variable Documentation

QCString g_context
static

Definition at line 87 of file docparser.cpp.

QList<Definition> g_copyStack
static

Definition at line 94 of file docparser.cpp.

QCString g_exampleName
static

Definition at line 103 of file docparser.cpp.

QCString g_fileName
static

Definition at line 95 of file docparser.cpp.

bool g_hasParamCommand
static

Definition at line 98 of file docparser.cpp.

bool g_hasReturnCommand
static

Definition at line 99 of file docparser.cpp.

uint g_includeFileLength
static

Definition at line 109 of file docparser.cpp.

uint g_includeFileOffset
static

Definition at line 108 of file docparser.cpp.

QCString g_includeFileText
static

Definition at line 107 of file docparser.cpp.

QStack<DocStyleChange> g_initialStyleStack
static

Definition at line 93 of file docparser.cpp.

bool g_inSeeBlock
static

Definition at line 88 of file docparser.cpp.

bool g_insideHtmlLink
static

Definition at line 90 of file docparser.cpp.

bool g_isExample
static

Definition at line 102 of file docparser.cpp.

MemberDef* g_memberDef
static

Definition at line 101 of file docparser.cpp.

QStack<DocNode> g_nodeStack
static

Definition at line 91 of file docparser.cpp.

QDict<void> g_paramsFound
static

Definition at line 100 of file docparser.cpp.

QStack<DocParserContext> g_parserStack
static

Definition at line 144 of file docparser.cpp.

QCString g_relPath
static

Definition at line 96 of file docparser.cpp.

Definition* g_scope
static

Definition at line 86 of file docparser.cpp.

QCString g_searchUrl
static

Definition at line 105 of file docparser.cpp.

SectionDict* g_sectionDict
static

Definition at line 104 of file docparser.cpp.

QStack<DocStyleChange> g_styleStack
static

Definition at line 92 of file docparser.cpp.

bool g_xmlComment
static

Definition at line 89 of file docparser.cpp.

const char* sectionLevelToName[]
static
Initial value:
=
{
"page",
"section",
"subsection",
"subsubsection",
"paragraph",
"subparagraph"
}

Definition at line 73 of file docparser.cpp.