Classes | Functions
docparser.h File Reference
#include <stdio.h>
#include <qlist.h>
#include <qcstring.h>
#include "docvisitor.h"
#include "htmlattrib.h"

Go to the source code of this file.

Classes

class  DocNode
 
class  CompAccept< T >
 
class  DocWord
 
class  DocLinkedWord
 
class  DocURL
 
class  DocLineBreak
 
class  DocHorRuler
 
class  DocAnchor
 
class  DocCite
 
class  DocStyleChange
 
class  DocSymbol
 
struct  DocSymbol::PerlSymb
 
class  DocWhiteSpace
 
class  DocVerbatim
 
class  DocInclude
 
class  DocIncOperator
 
class  DocFormula
 
class  DocIndexEntry
 
class  DocCopy
 
class  DocAutoList
 
class  DocAutoListItem
 
class  DocTitle
 
class  DocXRefItem
 
class  DocImage
 
class  DocDotFile
 
class  DocMscFile
 
class  DocDiaFile
 
class  DocVhdlFlow
 
class  DocLink
 
class  DocRef
 
class  DocInternalRef
 
class  DocHRef
 
class  DocHtmlHeader
 
class  DocHtmlDescTitle
 
class  DocHtmlDescList
 
class  DocSection
 
class  DocSecRefItem
 
class  DocSecRefList
 
class  DocInternal
 
class  DocParBlock
 
class  DocSimpleList
 
class  DocHtmlList
 
class  DocSimpleSect
 
class  DocSimpleSectSep
 
class  DocParamSect
 
class  DocPara
 
class  DocParamList
 
class  DocSimpleListItem
 
class  DocHtmlListItem
 
class  DocHtmlDescData
 
class  DocHtmlCell
 
class  DocHtmlCaption
 
class  DocHtmlRow
 
class  DocHtmlTable
 
class  DocHtmlBlockQuote
 
class  DocText
 
class  DocRoot
 

Functions

DocRootvalidatingParseDoc (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)
 
DocTextvalidatingParseText (const char *input)
 
void docFindSections (const char *input, Definition *d, MemberGroup *m, const char *fileName)
 

Function Documentation

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 }
static constexpr double mg
Definition: Units.h:145
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
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 &&
7197  (ctx->definitionType()==Definition::TypeClass ||
7198  ctx->definitionType()==Definition::TypeNamespace
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  {
7229  g_searchUrl=ctx->getOutputFileBase();
7230  Doxygen::searchIndex->setCurrentDoc(ctx,ctx->anchor(),FALSE);
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  {
7246  g_searchUrl=ctx->getOutputFileBase();
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) ?
7319  QCString(relativePathToRoot(ctx->getOutputFileBase())) :
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
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
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
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
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