Functions
commentscan.h File Reference

Interface for the comment block parser. More...

#include "types.h"

Go to the source code of this file.

Functions

bool parseCommentBlock (ParserInterface *parser, Entry *curEntry, const QCString &comment, const QCString &fileName, int &lineNr, bool isBrief, bool isJavaDocStyle, bool isInbody, Protection &prot, int &position, bool &newEntryNeeded)
 
void groupEnterFile (const char *file, int line)
 
void groupLeaveFile (const char *file, int line)
 
void groupLeaveCompound (const char *file, int line, const char *name)
 
void groupEnterCompound (const char *file, int line, const char *name)
 
void openGroup (Entry *e, const char *file, int line)
 
void closeGroup (Entry *, const char *file, int line, bool foundInline=FALSE)
 
void initGroupInfo (Entry *e)
 

Detailed Description

Interface for the comment block parser.

Definition in file commentscan.h.

Function Documentation

void closeGroup ( Entry ,
const char *  file,
int  line,
bool  foundInline = FALSE 
)

Definition at line 8382 of file commentscan.cpp.

8383 {
8384  //printf("==> closeGroup(name=%s,sec=%x,file=%s,line=%d) g_autoGroupStack=%d\n",
8385  // e->name.data(),e->section,fileName,line,g_autoGroupStack.count());
8386  if (g_memberGroupId!=DOX_NOGROUP) // end of member group
8387  {
8389  if (info) // known group
8390  {
8391  info->doc = g_memberGroupDocs;
8392  info->docFile = fileName;
8393  info->docLine = line;
8394  }
8398  if (!foundInline) e->mGrpId=DOX_NOGROUP;
8399  //printf("new group id=%d\n",g_memberGroupId);
8400  }
8401  else if (!g_autoGroupStack.isEmpty()) // end of auto group
8402  {
8403  Grouping *grp = g_autoGroupStack.pop();
8404  // see bug577005: we should not remove the last group for e
8405  if (!foundInline) e->groups->removeLast();
8406  //printf("Removing %s e=%p\n",grp->groupname.data(),e);
8407  delete grp;
8408  if (!foundInline) initGroupInfo(e);
8409  }
8410 }
Definition: types.h:61
bool resize(uint newlen)
Definition: qcstring.h:225
static QCString g_memberGroupRelates
#define DOX_NOGROUP
Definition: membergroup.h:25
static QCString g_memberGroupDocs
const double e
fileName
Definition: dumpTree.py:9
static int g_memberGroupId
static QIntDict< MemberGroupInfo > memGrpInfoDict
Definition: doxygen.h:126
void initGroupInfo(Entry *e)
void line(double t, double *p, double &x, double &y, double &z)
QCString docFile
Definition: membergroup.h:149
static QStack< Grouping > g_autoGroupStack
type * find(long k) const
Definition: qintdict.h:63
void groupEnterCompound ( const char *  file,
int  line,
const char *  name 
)

Definition at line 8299 of file commentscan.cpp.

8300 {
8302  {
8303  warn(fileName,line,"try to put compound %s inside a member group\n",name);
8304  }
8308  g_compoundName = name;
8309  int i = g_compoundName.find('(');
8310  if (i!=-1)
8311  {
8312  g_compoundName=g_compoundName.left(i); // strip category (Obj-C)
8313  }
8314  if (g_compoundName.isEmpty())
8315  {
8317  }
8318  //printf("groupEnterCompound(%s)\n",name);
8319 }
static QCString name
Definition: declinfo.cpp:673
bool resize(uint newlen)
Definition: qcstring.h:225
bool isEmpty() const
Definition: qcstring.h:189
static QCString g_memberGroupRelates
QCString left(uint len) const
Definition: qcstring.cpp:213
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
#define DOX_NOGROUP
Definition: membergroup.h:25
static QCString g_memberGroupDocs
fileName
Definition: dumpTree.py:9
static int g_memberGroupId
static QCString g_compoundName
void warn(const char *file, int line, const char *fmt,...)
Definition: message.cpp:183
void line(double t, double *p, double &x, double &y, double &z)
void groupEnterFile ( const char *  file,
int  line 
)

Definition at line 8274 of file commentscan.cpp.

8275 {
8276  g_autoGroupStack.setAutoDelete(TRUE);
8277  g_autoGroupStack.clear();
8282 }
bool resize(uint newlen)
Definition: qcstring.h:225
static QCString g_memberGroupRelates
#define DOX_NOGROUP
Definition: membergroup.h:25
static QCString g_memberGroupDocs
fileName
Definition: dumpTree.py:9
static int g_memberGroupId
static QCString g_compoundName
static QStack< Grouping > g_autoGroupStack
const bool TRUE
Definition: qglobal.h:371
void groupLeaveCompound ( const char *  file,
int  line,
const char *  name 
)

Definition at line 8321 of file commentscan.cpp.

8322 {
8323  //printf("groupLeaveCompound(%s)\n",name);
8324  //if (g_memberGroupId!=DOX_NOGROUP)
8325  //{
8326  // warn(fileName,line,"end of compound %s while inside a member group\n",name);
8327  //}
8332 }
bool resize(uint newlen)
Definition: qcstring.h:225
static QCString g_memberGroupRelates
#define DOX_NOGROUP
Definition: membergroup.h:25
static QCString g_memberGroupDocs
static int g_memberGroupId
static QCString g_compoundName
void groupLeaveFile ( const char *  file,
int  line 
)

Definition at line 8284 of file commentscan.cpp.

8285 {
8286  //if (g_memberGroupId!=DOX_NOGROUP)
8287  //{
8288  // warn(fileName,line,"end of file while inside a member group\n");
8289  //}
8293  if (!g_autoGroupStack.isEmpty())
8294  {
8295  warn(fileName,line,"end of file while inside a group\n");
8296  }
8297 }
bool resize(uint newlen)
Definition: qcstring.h:225
static QCString g_memberGroupRelates
#define DOX_NOGROUP
Definition: membergroup.h:25
static QCString g_memberGroupDocs
fileName
Definition: dumpTree.py:9
static int g_memberGroupId
void warn(const char *file, int line, const char *fmt,...)
Definition: message.cpp:183
void line(double t, double *p, double &x, double &y, double &z)
static QStack< Grouping > g_autoGroupStack
void initGroupInfo ( Entry e)

Definition at line 8412 of file commentscan.cpp.

8413 {
8414  //printf("==> initGroup(id=%d,related=%s,e=%p)\n",g_memberGroupId,
8415  // g_memberGroupRelates.data(),e);
8416  e->mGrpId = g_memberGroupId;
8418  if (!g_autoGroupStack.isEmpty())
8419  {
8420  //printf("Appending group %s to %s: count=%d entry=%p\n",
8421  // g_autoGroupStack.top()->groupname.data(),
8422  // e->name.data(),e->groups->count(),e);
8423  e->groups->append(new Grouping(*g_autoGroupStack.top()));
8424  }
8425 }
Definition: types.h:61
void append(const type *d)
Definition: qlist.h:73
static QCString g_memberGroupRelates
int mGrpId
member group id
Definition: entry.h:278
QList< Grouping > * groups
list of groups this entry belongs to
Definition: entry.h:280
static int g_memberGroupId
QCString relates
related class (doc block)
Definition: entry.h:269
static QStack< Grouping > g_autoGroupStack
void openGroup ( Entry e,
const char *  file,
int  line 
)

Definition at line 8354 of file commentscan.cpp.

8355 {
8356  //printf("==> openGroup(name=%s,sec=%x) g_autoGroupStack=%d\n",
8357  // e->name.data(),e->section,g_autoGroupStack.count());
8358  if (e->section==Entry::GROUPDOC_SEC) // auto group
8359  {
8360  g_autoGroupStack.push(new Grouping(e->name,e->groupingPri()));
8361  }
8362  else // start of a member group
8363  {
8364  //printf(" membergroup id=%d %s\n",g_memberGroupId,g_memberGroupHeader.data());
8365  if (g_memberGroupId==DOX_NOGROUP) // no group started yet
8366  {
8367  static int curGroupId=0;
8368 
8371  info->compoundName = g_compoundName;
8372  g_memberGroupId = findExistingGroup(curGroupId,info);
8373  //printf(" use membergroup %d\n",g_memberGroupId);
8375 
8377  e->mGrpId = g_memberGroupId;
8378  }
8379  }
8380 }
Definition: types.h:61
QCString stripWhiteSpace() const
Definition: qcstring.cpp:295
static QCString g_memberGroupHeader
static QCString g_memberGroupRelates
static int findExistingGroup(int &groupId, const MemberGroupInfo *info)
QCString name
member name
Definition: entry.h:237
QCString header
Definition: membergroup.h:147
int mGrpId
member group id
Definition: entry.h:278
#define DOX_NOGROUP
Definition: membergroup.h:25
void insert(long k, const type *d)
Definition: qintdict.h:57
static int g_memberGroupId
static QCString g_compoundName
Grouping::GroupPri_t groupingPri() const
Definition: entry.h:306
static QIntDict< MemberGroupInfo > memGrpInfoDict
Definition: doxygen.h:126
QCString relates
related class (doc block)
Definition: entry.h:269
static QStack< Grouping > g_autoGroupStack
QCString compoundName
Definition: membergroup.h:151
int section
entry type (see Sections);
Definition: entry.h:235
bool parseCommentBlock ( ParserInterface parser,
Entry curEntry,
const QCString comment,
const QCString fileName,
int &  lineNr,
bool  isBrief,
bool  isJavaDocStyle,
bool  isInbody,
Protection prot,
int &  position,
bool newEntryNeeded 
)

Invokes the comment block parser with the request to parse a single comment block.

Parameters
[in]parserThe language parse that invoked this function. The comment block parse may invoke ParserInterface::parsePrototype() in order to parse the argument of a @fn command.
[in]curEntryThe Entry to which the comment block belongs. Any information (like documentation) that is found in the comment block will be stored in this entry.
[in]commentA string representing the actual comment block. Note that leading *'s are already stripped from the comment block.
[in]fileNameThe name of the file in which the comment is found. Mainly used for producing warnings.
[in,out]lineNrThe line number at which the comment block was found. When the function returns it will be set to the last line parsed.
[in]isBriefTRUE iff this comment block represents a brief description.
[in]isJavaDocStyleTRUE iff this comment block is in "JavaDoc" style. This means that it starts as a brief description until the end of the sentences is found and then proceeds as a detailed description.
[in]isInbodyTRUE iff this comment block is located in the body of a function.
[in,out]protThe protection level in which this comment block was found. Commands in the comment block may override this.
[in,out]positionThe character position within comment where the comment block starts. Typically used in case the comment block contains multiple structural commands.
[out]newEntryNeededBoolean that is TRUE if the comment block parser finds that a the comment block finishes the entry and a new one needs to be started.
Returns
TRUE if the comment requires further processing. The parameter newEntryNeeded will typically be true in this case and position will indicate the offset inside the comment string where to proceed parsing. FALSE indicates no further processing is needed.

Definition at line 8149 of file commentscan.cpp.

8161 {
8162  //printf("parseCommentBlock() isBrief=%d isAutoBriefOn=%d lineNr=%d\n",
8163  // isBrief,isAutoBriefOn,lineNr);
8164 
8165  initParser();
8166  guards.setAutoDelete(TRUE);
8167  guards.clear();
8168  langParser = parser;
8169  current = curEntry;
8170  if (comment.isEmpty()) return FALSE; // avoid empty strings
8171  inputString = comment;
8172  inputString.append(" ");
8174  yyLineNr = lineNr;
8175  yyFileName = fileName;
8176  protection = prot;
8177  needNewEntry = FALSE;
8178  xrefKind = XRef_None;
8180  insidePre = FALSE;
8181  parseMore = FALSE;
8182  inBody = isInbody;
8183  outputXRef.resize(0);
8184  setOutput( isBrief || isAutoBriefOn ? OutputBrief : OutputDoc );
8185  briefEndsAtDot = isAutoBriefOn;
8186  g_condCount = 0;
8187  g_sectionLevel = 0;
8190 
8191  printlex(commentscanYY_flex_debug, TRUE, __FILE__, fileName ? fileName.data(): NULL);
8192  if (!current->inbodyDocs.isEmpty() && isInbody) // separate in body fragments
8193  {
8194  current->inbodyDocs+="\n\n";
8195  }
8196 
8197  Debug::print(Debug::CommentScan,0,"-----------\nCommentScanner: %s:%d\n"
8198  "input=[\n%s]\n",qPrint(fileName),lineNr,qPrint(comment)
8199  );
8200 
8202  BEGIN( Comment );
8203  commentscanYYlex();
8204  setOutput( OutputDoc );
8205 
8206  if (YY_START==OverloadParam) // comment ended with \overload
8207  {
8209  }
8210 
8211  if (!guards.isEmpty())
8212  {
8213  warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!");
8214  }
8215 
8216  if (g_insideParBlock)
8217  {
8219  "Documentation block ended while inside a \\parblock. Missing \\endparblock");
8220  }
8221 
8223 
8225  {
8226  // to allow a comment block with just a @file command.
8227  current->doc="\n\n";
8228  }
8229 
8231  g_memberGroupId==DOX_NOGROUP) // @name section but no group started yet
8232  {
8234  }
8235 
8237  {
8238  current->brief = processMarkdown(fileName,lineNr,current,current->brief);
8239  current->doc = processMarkdown(fileName,lineNr,current,current->doc);
8241  }
8242 
8244  "brief=[line=%d\n%s]\ndocs=[line=%d\n%s]\ninbody=[line=%d\n%s]\n===========\n",
8248  );
8249 
8250  checkFormula();
8251  prot = protection;
8252 
8253  groupAddDocs(curEntry);
8254 
8255  newEntryNeeded = needNewEntry;
8256 
8257  // if we did not proceed during this call, it does not make
8258  // sense to continue, since we get stuck. See bug 567346 for situations
8259  // were this happens
8261 
8263 
8264  lineNr = yyLineNr;
8265  //printf("position=%d parseMore=%d newEntryNeeded=%d\n",
8266  // position,parseMore,newEntryNeeded);
8267 
8268  printlex(commentscanYY_flex_debug, FALSE, __FILE__, fileName ? fileName.data(): NULL);
8269  return parseMore;
8270 }
static bool markdownSupport
Definition: doxygen.h:153
static void checkFormula()
bool resize(uint newlen)
Definition: qcstring.h:225
static QStack< GuardedSection > guards
static QCString g_spaceBeforeCmd
bool isEmpty() const
Definition: qcstring.h:189
static int inputPosition
void printlex(int dbg, bool enter, const char *lexName, const char *fileName)
Definition: message.cpp:242
static void initParser()
static int g_condCount
static bool needNewEntry
static QCString outputXRef
int briefLine
line number at which the brief desc. was found
Definition: entry.h:264
int docLine
line number at which the documentation was found
Definition: entry.h:261
const bool FALSE
Definition: qglobal.h:370
static bool parseMore
static int yyLineNr
static int g_sectionLevel
static ParserInterface * langParser
QCString getOverloadDocs()
Definition: util.cpp:5859
static void setOutput(OutputContext ctx)
static bool inBody
int comment
void commentscanYYrestart(FILE *input_file)
static QCString inputString
static XRefKind xrefKind
#define YY_START
#define DOX_NOGROUP
Definition: membergroup.h:25
static QCString g_spaceBeforeIf
static Protection protection
fileName
Definition: dumpTree.py:9
QCString brief
brief description (doc block)
Definition: entry.h:263
static int g_memberGroupId
#define OverloadParam
#define BEGIN
static void print(DebugMask mask, int prio, const char *fmt,...)
Definition: debug.cpp:84
int commentscanYY_flex_debug
static bool g_insideParBlock
static Entry * current
void openGroup(Entry *e, const char *file, int line)
const char * data() const
Definition: qcstring.h:207
void warn(const char *file, int line, const char *fmt,...)
Definition: message.cpp:183
static void addOutput(const char *s)
int commentscanYYlex(void)
static bool briefEndsAtDot
QCString inbodyDocs
documentation inside the body of a function
Definition: entry.h:266
QCString doc
documentation block (partly parsed)
Definition: entry.h:260
static void groupAddDocs(Entry *e)
#define Comment
QCString processMarkdown(const QCString &fileName, const int lineNr, Entry *e, const QCString &input)
Definition: markdown.cpp:2298
QCString stripLeadingAndTrailingEmptyLines(const QCString &s, int &docLine)
Definition: util.cpp:6876
int inbodyLine
line number at which the body doc was found
Definition: entry.h:267
static bool insidePre
FILE * commentscanYYin
const char * qPrint(const char *s)
Definition: qcstring.h:797
const bool TRUE
Definition: qglobal.h:371
static bool xrefAppendFlag
static QCString yyFileName
QCString & append(const char *s)
Definition: qcstring.cpp:383
int section
entry type (see Sections);
Definition: entry.h:235