summaryrefslogtreecommitdiffstats
path: root/src/commentscan.l
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-12-30 18:34:15 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2019-12-30 18:34:15 (GMT)
commite55c2248b46d5580e5b184d2ff9c773f333308b2 (patch)
tree78e375caf67e26d4d2857a94d25a508a67bf64b8 /src/commentscan.l
parentabf1e46f7bc2c31972d36231b4672580704fcc10 (diff)
downloadDoxygen-e55c2248b46d5580e5b184d2ff9c773f333308b2.zip
Doxygen-e55c2248b46d5580e5b184d2ff9c773f333308b2.tar.gz
Doxygen-e55c2248b46d5580e5b184d2ff9c773f333308b2.tar.bz2
Make commentscan.l reentrant
Diffstat (limited to 'src/commentscan.l')
-rw-r--r--src/commentscan.l2765
1 files changed, 1441 insertions, 1324 deletions
diff --git a/src/commentscan.l b/src/commentscan.l
index d7cf3c8..02117c2 100644
--- a/src/commentscan.l
+++ b/src/commentscan.l
@@ -15,6 +15,8 @@
%option never-interactive
%option prefix="commentscanYY"
+%option reentrant
+%option extra-type="struct commentscanYY_state *"
%{
@@ -31,6 +33,7 @@
#include <qregexp.h>
#include <qfile.h>
#include <qcstringlist.h>
+#include "commentscan.h"
#include "scanner.h"
#include "entry.h"
#include "doxygen.h"
@@ -54,88 +57,88 @@
#define YY_NO_UNISTD_H 1
// forward declarations
-static bool handleBrief(const QCString &, const QCStringList &);
-static bool handleFn(const QCString &, const QCStringList &);
-static bool handleDef(const QCString &, const QCStringList &);
-static bool handleOverload(const QCString &, const QCStringList &);
-static bool handleEnum(const QCString &, const QCStringList &);
-static bool handleDefGroup(const QCString &, const QCStringList &);
-static bool handleAddToGroup(const QCString &, const QCStringList &);
-static bool handleWeakGroup(const QCString &, const QCStringList &);
-static bool handleNamespace(const QCString &, const QCStringList &);
-static bool handlePackage(const QCString &, const QCStringList &);
-static bool handleClass(const QCString &, const QCStringList &);
-static bool handleHeaderFile(const QCString &, const QCStringList &);
-static bool handleProtocol(const QCString &, const QCStringList &);
-static bool handleCategory(const QCString &, const QCStringList &);
-static bool handleUnion(const QCString &, const QCStringList &);
-static bool handleStruct(const QCString &, const QCStringList &);
-static bool handleInterface(const QCString &, const QCStringList &);
-static bool handleIdlException(const QCString &, const QCStringList &);
-static bool handlePage(const QCString &, const QCStringList &);
-static bool handleMainpage(const QCString &, const QCStringList &);
-static bool handleFile(const QCString &, const QCStringList &);
-static bool handleDir(const QCString &, const QCStringList &);
-static bool handleExample(const QCString &, const QCStringList &);
-static bool handleDetails(const QCString &, const QCStringList &);
-static bool handleNoop(const QCString &, const QCStringList &);
-static bool handleName(const QCString &, const QCStringList &);
-static bool handleTodo(const QCString &, const QCStringList &);
-static bool handleTest(const QCString &, const QCStringList &);
-static bool handleBug(const QCString &, const QCStringList &);
-static bool handleSubpage(const QCString &s, const QCStringList &);
-static bool handleDeprecated(const QCString &, const QCStringList &);
-static bool handleXRefItem(const QCString &, const QCStringList &);
-static bool handleRelated(const QCString &, const QCStringList &);
-static bool handleRelatedAlso(const QCString &, const QCStringList &);
-static bool handleMemberOf(const QCString &, const QCStringList &);
-static bool handleRefItem(const QCString &, const QCStringList &);
-static bool handleSection(const QCString &, const QCStringList &);
-static bool handleAnchor(const QCString &, const QCStringList &);
-static bool handleCite(const QCString &, const QCStringList &);
-static bool handleFormatBlock(const QCString &, const QCStringList &);
-static bool handleAddIndex(const QCString &, const QCStringList &);
-static bool handleIf(const QCString &, const QCStringList &);
-static bool handleIfNot(const QCString &, const QCStringList &);
-static bool handleElseIf(const QCString &, const QCStringList &);
-static bool handleElse(const QCString &, const QCStringList &);
-static bool handleEndIf(const QCString &, const QCStringList &);
-static bool handleIngroup(const QCString &, const QCStringList &);
-static bool handleNoSubGrouping(const QCString &, const QCStringList &);
-static bool handleShowInitializer(const QCString &, const QCStringList &);
-static bool handleHideInitializer(const QCString &, const QCStringList &);
-static bool handleCallgraph(const QCString &, const QCStringList &);
-static bool handleHideCallgraph(const QCString &, const QCStringList &);
-static bool handleCallergraph(const QCString &, const QCStringList &);
-static bool handleHideCallergraph(const QCString &, const QCStringList &);
-static bool handleReferencedByRelation(const QCString &, const QCStringList &);
-static bool handleHideReferencedByRelation(const QCString &, const QCStringList &);
-static bool handleReferencesRelation(const QCString &, const QCStringList &);
-static bool handleHideReferencesRelation(const QCString &, const QCStringList &);
-static bool handleInternal(const QCString &, const QCStringList &);
-static bool handleLineBr(const QCString &, const QCStringList &);
-static bool handleStatic(const QCString &, const QCStringList &);
-static bool handlePure(const QCString &, const QCStringList &);
-static bool handlePrivate(const QCString &, const QCStringList &);
-static bool handlePrivateSection(const QCString &, const QCStringList &);
-static bool handleProtected(const QCString &, const QCStringList &);
-static bool handleProtectedSection(const QCString &, const QCStringList &);
-static bool handlePublic(const QCString &s, const QCStringList &);
-static bool handlePublicSection(const QCString &s, const QCStringList &);
-static bool handleToc(const QCString &s, const QCStringList &);
-static bool handleInherit(const QCString &, const QCStringList &);
-static bool handleExtends(const QCString &, const QCStringList &);
-static bool handleCopyDoc(const QCString &, const QCStringList &);
-static bool handleCopyBrief(const QCString &, const QCStringList &);
-static bool handleCopyDetails(const QCString &, const QCStringList &);
-static bool handleParBlock(const QCString &, const QCStringList &);
-static bool handleEndParBlock(const QCString &, const QCStringList &);
-static bool handleParam(const QCString &, const QCStringList &);
-static bool handleRetval(const QCString &, const QCStringList &);
+static bool handleBrief(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleFn(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleDef(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleOverload(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleEnum(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleDefGroup(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleAddToGroup(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleWeakGroup(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleNamespace(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handlePackage(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleClass(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleProtocol(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleCategory(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleUnion(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleStruct(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleInterface(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleIdlException(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handlePage(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleMainpage(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleFile(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleDir(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleExample(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleDetails(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleNoop(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleName(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleTodo(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleTest(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleBug(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleSubpage(yyscan_t yyscanner,const QCString &s, const QCStringList &);
+static bool handleDeprecated(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleXRefItem(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleRelated(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleMemberOf(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleRefItem(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleSection(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleAnchor(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleCite(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleFormatBlock(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleAddIndex(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleIf(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleIfNot(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleElseIf(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleElse(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleEndIf(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleIngroup(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleNoSubGrouping(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleShowInitializer(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleHideInitializer(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleCallgraph(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleHideCallgraph(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleCallergraph(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleHideCallergraph(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleReferencedByRelation(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleHideReferencedByRelation(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleReferencesRelation(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleHideReferencesRelation(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleInternal(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleLineBr(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleStatic(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handlePure(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handlePrivate(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handlePrivateSection(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleProtected(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleProtectedSection(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handlePublic(yyscan_t yyscanner,const QCString &s, const QCStringList &);
+static bool handlePublicSection(yyscan_t yyscanner,const QCString &s, const QCStringList &);
+static bool handleToc(yyscan_t yyscanner,const QCString &s, const QCStringList &);
+static bool handleInherit(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleExtends(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleCopyDoc(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleCopyBrief(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleCopyDetails(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleParBlock(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleParam(yyscan_t yyscanner,const QCString &, const QCStringList &);
+static bool handleRetval(yyscan_t yyscanner,const QCString &, const QCStringList &);
static const char *stateToString(int state);
-typedef bool (*DocCmdFunc)(const QCString &name, const QCStringList &optList);
+typedef bool (*DocCmdFunc)(yyscan_t yyscanner,const QCString &name, const QCStringList &optList);
struct DocCmdMap
{
@@ -325,15 +328,15 @@ class DocCmdMapper
DocCmdMap *p = docCmdMap;
while (p->cmdName)
{
- if (m_map.find(p->cmdName)!=0)
- {
- term("DocCmdMapper: command %s already added\n",p->cmdName);
- }
- Cmd *cmd = new Cmd;
- cmd->func = p->handler;
- cmd->endsBrief = p->endsBrief;
- m_map.insert(p->cmdName,cmd);
- p++;
+ if (m_map.find(p->cmdName)!=0)
+ {
+ term("DocCmdMapper: command %s already added\n",p->cmdName);
+ }
+ Cmd *cmd = new Cmd;
+ cmd->func = p->handler;
+ cmd->endsBrief = p->endsBrief;
+ m_map.insert(p->cmdName,cmd);
+ p++;
}
}
@@ -347,7 +350,6 @@ class DocCmdMapper
DocCmdMapper *DocCmdMapper::s_instance=0;
-bool inInternalDocs = FALSE;
#define YY_NEVER_INTERACTIVE 1
@@ -394,505 +396,92 @@ class GuardedSection
* statics
*/
-static OutlineParserInterface *langParser; // the language parser that is calling us
-static QCString inputString; // input string
-static int inputPosition; // read pointer
-static QCString yyFileName; // file name that is read from
-static int yyLineNr; // line number in the input
-static bool inBody; // was the comment found inside the body of a function?
-static OutputContext inContext; // are we inside the brief, details or xref part
-static bool briefEndsAtDot; // does the brief description stop at a dot?
-static QCString formulaText; // Running text of a formula
-static QCString formulaEnv; // environment name
-static int formulaNewLines; // amount of new lines in the formula
-static QCString *pOutputString; // pointer to string to which the output is appended.
-static QCString outputXRef; // temp argument of todo/test/../xrefitem commands
-static QCString blockName; // preformatted block name (e.g. verbatim, latexonly,...)
-static XRefKind xrefKind; // kind of cross-reference command
-static XRefKind newXRefKind; //
-static GuardType guardType; // kind of guard for conditional section
-static bool enabledSectionFound;
-static QCString functionProto; // function prototype
-static QStack<GuardedSection> guards; // tracks nested conditional sections (if,ifnot,..)
-static Entry *current = 0; // working entry
-
-static bool needNewEntry;
-
-static QCString g_sectionLabel;
-static QCString g_sectionTitle;
-static int g_sectionLevel;
-static QCString xrefItemKey;
-static QCString newXRefItemKey;
-static QCString xrefItemTitle;
-static QCString xrefListTitle;
-static Protection protection;
-
-static bool xrefAppendFlag;
-static bool inGroupParamFound;
-static int braceCount;
-static bool insidePre;
-static bool parseMore;
-static int g_condCount;
-
-static int g_commentCount;
-static QCString g_spaceBeforeCmd;
-static QCString g_spaceBeforeIf;
-static QCString g_copyDocArg;
-
-static QCString g_guardExpr;
-static int g_roundCount;
-
-static bool g_insideParBlock;
-
-//-----------------------------------------------------------------------------
-
-static void initParser()
-{
- g_sectionLabel.resize(0);
- g_sectionTitle.resize(0);
- Doxygen::docGroup.clearHeader();
- g_insideParBlock = FALSE;
-}
-
-//-----------------------------------------------------------------------------
-
-static bool getDocSectionName(int s)
-{
- switch(s)
- {
- case Entry::CLASSDOC_SEC:
- case Entry::STRUCTDOC_SEC:
- case Entry::UNIONDOC_SEC:
- case Entry::EXCEPTIONDOC_SEC:
- case Entry::NAMESPACEDOC_SEC:
- case Entry::PROTOCOLDOC_SEC:
- case Entry::CATEGORYDOC_SEC:
- case Entry::ENUMDOC_SEC:
- case Entry::PAGEDOC_SEC:
- case Entry::VARIABLEDOC_SEC:
- case Entry::MEMBERDOC_SEC:
- case Entry::OVERLOADDOC_SEC:
- case Entry::FILEDOC_SEC:
- case Entry::DEFINEDOC_SEC:
- case Entry::GROUPDOC_SEC:
- case Entry::MAINPAGEDOC_SEC:
- case Entry::PACKAGEDOC_SEC:
- case Entry::DIRDOC_SEC:
- case Entry::EXAMPLE_SEC:
- case Entry::MEMBERGRP_SEC:
- return TRUE;
- default:
- return FALSE;
- }
-}
-
-//-----------------------------------------------------------------------------
-
-static bool makeStructuralIndicator(Entry::Sections s)
-{
- //printf("current->section=%x\n",current->section);
- if (getDocSectionName(current->section))
- {
- return TRUE;
- }
- else
- {
- needNewEntry = TRUE;
- current->section = s;
- current->fileName = yyFileName;
- current->startLine = yyLineNr;
- return FALSE;
- }
-}
-
-static void lineCount()
-{
- for( const char* c = yytext ; *c ; ++c )
- yyLineNr += (*c == '\n') ;
-}
-
-
-static QCString stripQuotes(const char *s)
-{
- QCString name;
- if (s==0 || *s==0) return name;
- name=s;
- if (name.at(0)=='"' && name.at(name.length()-1)=='"')
- {
- name=name.mid(1,name.length()-2);
- }
- return name;
-}
-
-//-----------------------------------------------------------------
-
-static void addXRefItem(const char *listName,const char *itemTitle,
- const char *listTitle,bool append)
-{
- if (listName==0) return;
- //printf("addXRefItem(%s,%s,%s,%d)\n",listName,itemTitle,listTitle,append);
-
- const ListItemInfo *lii=0;
- RefList *refList = Doxygen::xrefLists->find(listName);
- if (refList==0) // new list
- {
- refList = new RefList(listName,listTitle,itemTitle);
- Doxygen::xrefLists->insert(listName,refList);
- //printf("new list!\n");
- }
- for (const ListItemInfo &item : current->sli)
- {
- if (qstrcmp(item.type,listName)==0)
- {
- //printf("found %s lii->type=%s\n",listName,lii->type);
- lii = &item;
- break;
- }
- }
- if (lii && append) // already found item of same type just before this one
- {
- //printf("listName=%s item id = %d existing\n",listName,lii->itemId);
- RefItem *item = refList->getRefItem(lii->itemId);
- ASSERT(item!=0);
- item->text += " <p>";
- item->text += outputXRef;
- //printf("%s: text +=%s\n",listName,item->text.data());
- }
- else // new item
- {
- int itemId = refList->addRefItem();
- //printf("listName=%s item id = %d new current=%p\n",listName,itemId,current);
-
- // if we have already an item from the same list type (e.g. a second @todo)
- // in the same Entry (i.e. lii!=0) then we reuse its link anchor.
- char anchorLabel[1024];
- //sprintf(anchorLabel,"_%s%06d",listName,lii ? lii->itemId : itemId);
- sprintf(anchorLabel,"_%s%06d",listName,itemId);
- RefItem *item = refList->getRefItem(itemId);
- ASSERT(item!=0);
- item->text = outputXRef;
- item->listAnchor = anchorLabel;
- current->addSpecialListItem(listName,itemId);
- QCString cmdString;
- cmdString.sprintf(" \\xrefitem %s %d.",listName,itemId);
- if (inBody)
- {
- current->inbodyDocs += cmdString;
- }
- else
- {
- current->doc += cmdString;
- }
- SectionInfo *si = Doxygen::sectionDict->find(anchorLabel);
- if (si)
- {
- if (si->lineNr != -1)
- {
- warn(listName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",anchorLabel,si->fileName.data(),si->lineNr);
- }
- else
- {
- warn(listName,yyLineNr,"multiple use of section label '%s', (first occurrence: %s)",anchorLabel,si->fileName.data());
- }
- }
- else
- {
- si=new SectionInfo(listName,yyLineNr,anchorLabel,
- g_sectionTitle,SectionInfo::Anchor,
- g_sectionLevel);
- Doxygen::sectionDict->append(anchorLabel,si);
- current->anchors.push_back(si);
- }
- }
- outputXRef.resize(0);
-}
-
-//-----------------------------------------------------------------------------
-
-// Adds a formula text to the list/dictionary of formulas if it was
-// not already added. Returns the label of the formula.
-static QCString addFormula()
-{
- QCString formLabel;
- QCString fText=formulaText.simplifyWhiteSpace();
- Formula *f=0;
- if ((f=Doxygen::formulaDict->find(fText))==0)
- {
- f = new Formula(fText);
- Doxygen::formulaList->append(f);
- Doxygen::formulaDict->insert(fText,f);
- formLabel.sprintf("\\_form#%d",f->getId());
- Doxygen::formulaNameDict->insert(formLabel,f);
- }
- else
- {
- formLabel.sprintf("\\_form#%d",f->getId());
- }
- int i;
- for (i=0;i<formulaNewLines;i++) formLabel+="@_fakenl"; // add fake newlines to
- // keep the warnings
- // correctly aligned.
- return formLabel;
-}
-
-//-----------------------------------------------------------------------------
-
-static void checkFormula();
-//-----------------------------------------------------------------------------
-
-static SectionInfo::SectionType sectionLevelToType(int level)
-{
- if (level>=0 && level<5) return (SectionInfo::SectionType)level;
- return SectionInfo::Anchor;
-}
-
-static void addSection()
-{
- SectionInfo *si = Doxygen::sectionDict->find(g_sectionLabel);
- if (si)
- {
- if (si->lineNr != -1)
- {
- warn(yyFileName,yyLineNr,"multiple use of section label '%s' while adding section, (first occurrence: %s, line %d)",g_sectionLabel.data(),si->fileName.data(),si->lineNr);
- }
- else
- {
- warn(yyFileName,yyLineNr,"multiple use of section label '%s' while adding section, (first occurrence: %s)",g_sectionLabel.data(),si->fileName.data());
- }
- }
- else
- {
- // create a new section element
- g_sectionTitle+=yytext;
- g_sectionTitle=g_sectionTitle.stripWhiteSpace();
- si = new SectionInfo(yyFileName,yyLineNr,g_sectionLabel,
- g_sectionTitle,sectionLevelToType(g_sectionLevel),g_sectionLevel);
-
- // add section to this entry
- current->anchors.push_back(si);
-
- // add section to the global dictionary
- Doxygen::sectionDict->append(g_sectionLabel,si);
- }
-}
+struct commentscanYY_state
+{
+ OutlineParserInterface *langParser = 0; // the language parser that is calling us
+ QCString inputString; // input string
+ int inputPosition = 0; // read pointer
+ QCString fileName; // file name that is read from
+ int lineNr = 0; // line number in the input
+ bool inBody = FALSE; // was the comment found inside the body of a function?
+ OutputContext inContext; // are we inside the brief, details or xref part
+ bool briefEndsAtDot = FALSE; // does the brief description stop at a dot?
+ QCString formulaText; // Running text of a formula
+ QCString formulaEnv; // environment name
+ int formulaNewLines = 0; // amount of new lines in the formula
+ QCString *pOutputString = 0; // pointer to string to which the output is appended.
+ QCString outputXRef; // temp argument of todo/test/../xrefitem commands
+ QCString blockName; // preformatted block name (e.g. verbatim, latexonly,...)
+ XRefKind xrefKind = XRef_Item; // kind of cross-reference command
+ XRefKind newXRefKind = XRef_Item; //
+ GuardType guardType = Guard_If; // kind of guards for conditional section
+ bool enabledSectionFound = FALSE;
+ QCString functionProto; // function prototype
+ QStack<GuardedSection> guards; // tracks nested conditional sections (if,ifnot,..)
+ Entry *current = 0; // working entry
+
+ bool needNewEntry = FALSE;
+
+ QCString sectionLabel;
+ QCString sectionTitle;
+ int sectionLevel = 0;
+ QCString xrefItemKey;
+ QCString newXRefItemKey;
+ QCString xrefItemTitle;
+ QCString xrefListTitle;
+ Protection protection = Public;
+
+ bool xrefAppendFlag = FALSE;
+ bool inGroupParamFound = FALSE;
+ int braceCount = 0;
+ bool insidePre = FALSE;
+ bool parseMore = FALSE;
+ int condCount = 0;
+
+ int commentCount = 0;
+ QCString spaceBeforeCmd;
+ QCString spaceBeforeIf;
+ QCString copyDocArg;
+
+ QCString guardExpr;
+ int roundCount = 0;
+
+ bool insideParBlock = FALSE;
+ bool inInternalDocs = FALSE;
+ int prevPosition = 0;
+};
//-----------------------------------------------------------------------------
-static void addCite()
-{
- QCString name=yytext;
- if (yytext[0] =='"')
- {
- name=yytext+1;
- name=name.left(yyleng-2);
- }
- Doxygen::citeDict->insert(name.data());
-}
+static QCString stripQuotes(const char *s);
+static bool getDocSectionName(int s);
+static SectionInfo::SectionType sectionLevelToType(int level);
+static void stripTrailingWhiteSpace(QCString &s);
+
+static void initParser(yyscan_t yyscanner);
+static bool makeStructuralIndicator(yyscan_t yyscanner,Entry::Sections s);
+static void lineCount(yyscan_t yyscanner);
+static QCString stripQuotes(yyscan_t yyscanner,const char *s);
+static void addXRefItem(yyscan_t yyscanner,
+ const char *listName,const char *itemTitle,
+ const char *listTitle,bool append);
+static QCString addFormula(yyscan_t yyscanner);
+static void checkFormula(yyscan_t yyscanner);
+static void addSection(yyscan_t yyscanner);
+static inline void setOutput(yyscan_t yyscanner,OutputContext ctx);
+static void addAnchor(yyscan_t yyscanner,const char *anchor);
+static inline void addOutput(yyscan_t yyscanner,const char *s);
+static inline void addOutput(yyscan_t yyscanner,char c);
+static void endBrief(yyscan_t yyscanner,bool addToOutput=TRUE);
+static void handleGuard(yyscan_t yyscanner,const QCString &expr);
+static int yyread(yyscan_t yyscanner,char *buf,int max_size);
+static void addCite(yyscan_t yyscanner);
//-----------------------------------------------------------------------------
-// strip trailing whitespace (excluding newlines) from string s
-static void stripTrailingWhiteSpace(QCString &s)
-{
- uint len = s.length();
- int i = (int)len-1;
- char c;
- while (i>=0 && ((c = s.at(i))==' ' || c=='\t' || c=='\r')) i--;
- if (i!=(int)len-1)
- {
- s.resize(i+2); // string up to and including char at pos i and \0 terminator
- }
-}
-
-// selects the output to write to
-static inline void setOutput(OutputContext ctx)
-{
- bool xrefAppendToPrev = xrefAppendFlag;
- // determine append flag for the next item (i.e. the end of this item)
- xrefAppendFlag = !inBody &&
- inContext==OutputXRef && ctx==OutputXRef && // two consecutive xref items
- newXRefKind==xrefKind && // of the same kind
- (xrefKind!=XRef_Item ||
- newXRefItemKey==xrefItemKey); // with the same key if \xrefitem
- //printf("%d && %d && %d && (%d || %d)\n",
- // inContext==OutputXRef,
- // ctx==OutputXRef,
- // newXRefKind==xrefKind,
- // xrefKind!=XRef_Item,
- // newXRefItemKey==xrefItemKey);
-
- //printf("refKind=%d newXRefKind=%d xrefAppendToPrev=%d xrefAppendFlag=%d\n",
- // xrefKind,newXRefKind,xrefAppendToPrev,xrefAppendFlag);
-
- //printf("setOutput(inContext=%d ctx=%d)\n",inContext,ctx);
- if (inContext==OutputXRef) // end of XRef section => add the item
- {
- // See if we can append this new xref item to the previous one.
- // We know this at the start of the next item of the same
- // type and need to remember this until the end of that item.
- switch(xrefKind)
- {
- case XRef_Todo:
- addXRefItem("todo",
- theTranslator->trTodo(),
- theTranslator->trTodoList(),
- xrefAppendToPrev
- );
- break;
- case XRef_Test:
- addXRefItem("test",
- theTranslator->trTest(),
- theTranslator->trTestList(),
- xrefAppendToPrev
- );
- break;
- case XRef_Bug:
- addXRefItem("bug",
- theTranslator->trBug(),
- theTranslator->trBugList(),
- xrefAppendToPrev
- );
- break;
- case XRef_Deprecated:
- addXRefItem("deprecated",
- theTranslator->trDeprecated(),
- theTranslator->trDeprecatedList(),
- xrefAppendToPrev
- );
- break;
- case XRef_Item: // user defined list
- addXRefItem(xrefItemKey,
- xrefItemTitle,
- xrefListTitle,
- xrefAppendToPrev
- );
- break;
- case XRef_None:
- ASSERT(0);
- break;
- }
- }
- xrefItemKey = newXRefItemKey;
-
- int oldContext = inContext;
- inContext = ctx;
- if (inContext!=OutputXRef && inBody) inContext=OutputInbody;
- switch(inContext)
- {
- case OutputDoc:
- if (oldContext!=inContext)
- {
- stripTrailingWhiteSpace(current->doc);
- if (current->docFile.isEmpty())
- {
- current->docFile = yyFileName;
- current->docLine = yyLineNr;
- }
- }
- pOutputString = &current->doc;
- break;
- case OutputBrief:
- if (oldContext!=inContext)
- {
- if (current->briefFile.isEmpty())
- {
- current->briefFile = yyFileName;
- current->briefLine = yyLineNr;
- }
- }
- if (current->brief.stripWhiteSpace().isEmpty()) // we only want one brief
- // description even if multiple
- // are given...
- {
- pOutputString = &current->brief;
- }
- else
- {
- if (!current->doc.isEmpty()) // when appending parts add a new line
- {
- current->doc += "\n";
- }
- pOutputString = &current->doc;
- inContext = OutputDoc; // need to switch to detailed docs, see bug 631380
- }
- break;
- case OutputXRef:
- pOutputString = &outputXRef;
- // first item found, so can't append to previous
- //xrefAppendFlag = FALSE;
- break;
- case OutputInbody:
- pOutputString = &current->inbodyDocs;
- break;
- }
-}
-
-
-static void addAnchor(const char *anchor)
-{
- SectionInfo *si = Doxygen::sectionDict->find(anchor);
- if (si)
- {
- if (si->lineNr != -1)
- {
- warn(yyFileName,yyLineNr,"multiple use of section label '%s' while adding anchor, (first occurrence: %s, line %d)",anchor,si->fileName.data(),si->lineNr);
- }
- else
- {
- warn(yyFileName,yyLineNr,"multiple use of section label '%s' while adding anchor, (first occurrence: %s)",anchor,si->fileName.data());
- }
- }
- else
- {
- si = new SectionInfo(yyFileName,yyLineNr,anchor,0,SectionInfo::Anchor,0);
- Doxygen::sectionDict->append(anchor,si);
- current->anchors.push_back(si);
- }
-}
-
-// add a string to the output
-static inline void addOutput(const char *s)
-{
- //printf("addOutput(%s)\n",s);
- *pOutputString+=s;
-}
-
-// add a character to the output
-static inline void addOutput(char c)
-{
- *pOutputString+=c;
-}
-
-static void endBrief(bool addToOutput=TRUE)
-{
- if (!current->brief.stripWhiteSpace().isEmpty())
- { // only go to the detailed description if we have
- // found some brief description and not just whitespace
- briefEndsAtDot=FALSE;
- setOutput(OutputDoc);
- if (addToOutput) addOutput(yytext);
- }
-}
-static void handleGuard(const QCString &expr);
-/* ----------------------------------------------------------------- */
#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
-
-static int prevPosition=0;
-
-static int yyread(char *buf,int max_size)
-{
- prevPosition=inputPosition;
- int c=0;
- while( c < max_size && inputString[inputPosition] )
- {
- *buf = inputString[inputPosition++] ;
- //printf("%d (%c)\n",*buf,*buf);
- c++; buf++;
- }
- return c;
-}
+#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
%}
@@ -1016,50 +605,50 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
*/
<Comment>{CMD}{CMD}[a-z_A-Z]+{B}* { // escaped command
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>{CMD}{CMD}"~"[a-z_A-Z]* { // escaped command
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>{MAILADDR} { // mail address
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>"\""[^"\n]*"\"" { // quoted text
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>("\\"[a-z_A-Z]+)+"\\" { // directory (or chain of commands!)
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>"<"{DETAILEDHTML}{ATTR}">" { // HTML command that ends a brief description
- setOutput(OutputDoc);
+ setOutput(yyscanner,OutputDoc);
// continue with the same input
REJECT;
}
<Comment>"<"{DETAILEDHTMLOPT}{ATTR}">" { // HTML command that ends a brief description
- if (current->lang==SrcLangExt_CSharp)
+ if (yyextra->current->lang==SrcLangExt_CSharp)
{
- setOutput(OutputDoc);
+ setOutput(yyscanner,OutputDoc);
}
// continue with the same input
REJECT;
}
<Comment>"<summary>" { // start of a .NET XML style brief description
- setOutput(OutputBrief);
- addOutput(yytext);
+ setOutput(yyscanner,OutputBrief);
+ addOutput(yyscanner,yytext);
}
<Comment>"<remarks>" { // start of a .NET XML style detailed description
- setOutput(OutputDoc);
- addOutput(yytext);
+ setOutput(yyscanner,OutputDoc);
+ addOutput(yyscanner,yytext);
}
<Comment>"</summary>" { // start of a .NET XML style detailed description
- setOutput(OutputBrief);
- addOutput(yytext);
- setOutput(OutputDoc);
+ setOutput(yyscanner,OutputBrief);
+ addOutput(yyscanner,yytext);
+ setOutput(yyscanner,OutputDoc);
}
<Comment>"</remarks>" { // end of a brief or detailed description
- setOutput(OutputDoc);
- addOutput(yytext);
+ setOutput(yyscanner,OutputDoc);
+ addOutput(yyscanner,yytext);
}
<Comment>"<"{CAPTION}{ATTR}">" {
QCString tag=yytext;
@@ -1073,22 +662,22 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
if (e!=-1) // found matching end
{
QCString id=tag.mid(s+4,e-s-4); // extract id
- addAnchor(id);
+ addAnchor(yyscanner,id);
}
}
}
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>"<"{PRE}{ATTR}">" {
- insidePre=TRUE;
- addOutput(yytext);
+ yyextra->insidePre=TRUE;
+ addOutput(yyscanner,yytext);
}
<Comment>"</"{PRE}">" {
- insidePre=FALSE;
- addOutput(yytext);
+ yyextra->insidePre=FALSE;
+ addOutput(yyscanner,yytext);
}
<Comment>{RCSTAG} { // RCS tag which end a brief description
- setOutput(OutputDoc);
+ setOutput(yyscanner,OutputDoc);
REJECT;
}
<Comment>"<!--" {
@@ -1098,12 +687,12 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
BEGIN(CdataSection);
}
<Comment>{B}*{CMD}"endinternal"{B}* {
- addOutput(" \\endinternal ");
- if (!inInternalDocs)
- warn(yyFileName,yyLineNr,
+ addOutput(yyscanner," \\endinternal ");
+ if (!yyextra->inInternalDocs)
+ warn(yyextra->fileName,yyextra->lineNr,
"found \\endinternal without matching \\internal"
);
- inInternalDocs = FALSE;
+ yyextra->inInternalDocs = FALSE;
}
<Comment>{B}*{CMD}[a-z_A-Z]+"{"[a-zA-Z_,:0-9\. ]*"}"{B}* |
<Comment>{B}*{CMD}[a-z_A-Z]+{B}* { // potentially interesting command
@@ -1130,29 +719,29 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
{
int i=0;
while (yytext[i]==' ' || yytext[i]=='\t') i++;
- g_spaceBeforeCmd = QCString(yytext).left(i);
- if (cmdPtr->endsBrief && !(inContext==OutputXRef && cmdName=="parblock"))
+ yyextra->spaceBeforeCmd = QCString(yytext).left(i);
+ if (cmdPtr->endsBrief && !(yyextra->inContext==OutputXRef && cmdName=="parblock"))
{
- briefEndsAtDot=FALSE;
+ yyextra->briefEndsAtDot=FALSE;
// this command forces the end of brief description
- setOutput(OutputDoc);
+ setOutput(yyscanner,OutputDoc);
}
- //if (i>0) addOutput(QCString(yytext).left(i)); // removed for bug 689341
- if (cmdPtr->func && cmdPtr->func(cmdName, optList))
+ //if (i>0) addOutput(yyscanner,QCString(yytext).left(i)); // removed for bug 689341
+ if (cmdPtr->func && cmdPtr->func(yyscanner, cmdName, optList))
{
// implicit split of the comment block into two
// entries. Restart the next block at the start
// of this command.
- parseMore=TRUE;
+ yyextra->parseMore=TRUE;
// yuk, this is probably not very portable across lex implementations,
// but we need to know the position in the input buffer where this
// rule matched.
// for flex 2.5.33+ we should use YY_CURRENT_BUFFER_LVALUE
#if YY_FLEX_MAJOR_VERSION>=2 && (YY_FLEX_MINOR_VERSION>5 || (YY_FLEX_MINOR_VERSION==5 && YY_FLEX_SUBMINOR_VERSION>=33))
- inputPosition=prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);
+ yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);
#else
- inputPosition=prevPosition + (int)(yy_bp - yy_current_buffer->yy_ch_buf);
+ yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - yy_current_buffer->yy_ch_buf);
#endif
yyterminate();
}
@@ -1160,16 +749,16 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
{
// command without handler, to be processed
// later by parsedoc.cpp
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
}
else // command not relevant
{
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
}
<Comment>{B}*({CMD}{CMD})"f"[$\[{] { // escaped formula command
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>{B}*{CMD}"~"[a-z_A-Z-]* { // language switch command
QCString langId = QCString(yytext).stripWhiteSpace().data()+2;
@@ -1180,54 +769,54 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
}
}
<Comment>{B}*{CMD}"f{"[^}\n]+"}"("{"?) { // start of a formula with custom environment
- setOutput(OutputDoc);
- formulaText="\\begin";
- formulaEnv=QCString(yytext).stripWhiteSpace().data()+2;
- if (formulaEnv.at(formulaEnv.length()-1)=='{')
+ setOutput(yyscanner,OutputDoc);
+ yyextra->formulaText="\\begin";
+ yyextra->formulaEnv=QCString(yytext).stripWhiteSpace().data()+2;
+ if (yyextra->formulaEnv.at(yyextra->formulaEnv.length()-1)=='{')
{
// remove trailing open brace
- formulaEnv=formulaEnv.left(formulaEnv.length()-1);
+ yyextra->formulaEnv=yyextra->formulaEnv.left(yyextra->formulaEnv.length()-1);
}
- formulaText+=formulaEnv;
- formulaNewLines=0;
+ yyextra->formulaText+=yyextra->formulaEnv;
+ yyextra->formulaNewLines=0;
BEGIN(ReadFormulaLong);
}
<Comment>{B}*{CMD}"f$" { // start of a inline formula
- formulaText="$";
- formulaNewLines=0;
+ yyextra->formulaText="$";
+ yyextra->formulaNewLines=0;
BEGIN(ReadFormulaShort);
}
<Comment>{B}*{CMD}"f[" { // start of a block formula
- setOutput(OutputDoc);
- formulaText="\\[";
- formulaNewLines=0;
+ setOutput(yyscanner,OutputDoc);
+ yyextra->formulaText="\\[";
+ yyextra->formulaNewLines=0;
BEGIN(ReadFormulaLong);
}
<Comment>{B}*{CMD}"{" { // begin of a group
- //langParser->handleGroupStartCommand(g_memberGroupHeader);
- Doxygen::docGroup.open(current,yyFileName,yyLineNr);
+ //yyextra->langParser->handleGroupStartCommand(yyextra->memberGroupHeader);
+ Doxygen::docGroup.open(yyextra->current,yyextra->fileName,yyextra->lineNr);
}
<Comment>{B}*{CMD}"}" { // end of a group
- //langParser->handleGroupEndCommand();
- Doxygen::docGroup.close(current,yyFileName,yyLineNr,TRUE);
+ //yyextra->langParser->handleGroupEndCommand();
+ Doxygen::docGroup.close(yyextra->current,yyextra->fileName,yyextra->lineNr,TRUE);
Doxygen::docGroup.clearHeader();
- parseMore=TRUE;
- needNewEntry = TRUE;
+ yyextra->parseMore=TRUE;
+ yyextra->needNewEntry = TRUE;
#if YY_FLEX_MAJOR_VERSION>=2 && (YY_FLEX_MINOR_VERSION>5 || (YY_FLEX_MINOR_VERSION==5 && YY_FLEX_SUBMINOR_VERSION>=33))
- inputPosition=prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) + strlen(yytext);
+ yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) + strlen(yytext);
#else
- inputPosition=prevPosition + (int)(yy_bp - yy_current_buffer->yy_ch_buf) + strlen(yytext);
+ yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - yy_current_buffer->yy_ch_buf) + strlen(yytext);
#endif
yyterminate();
}
<Comment>{B}*{CMD}[$@\\&~<>#%] { // escaped character
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>[a-z_A-Z]+ { // normal word
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>^{B}*"."{B}*/\n { // explicit end autolist: e.g " ."
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>^{B}*[1-9][0-9]*"."{B}+ |
<Comment>^{B}*[*+]{B}+ { // start of autolist
@@ -1237,106 +826,106 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
}
else
{
- if (inContext!=OutputXRef)
+ if (yyextra->inContext!=OutputXRef)
{
- briefEndsAtDot=FALSE;
- setOutput(OutputDoc);
+ yyextra->briefEndsAtDot=FALSE;
+ setOutput(yyscanner,OutputDoc);
}
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
}
<Comment>^{B}*"-"{B}+ { // start of autolist
- if (inContext!=OutputXRef)
+ if (yyextra->inContext!=OutputXRef)
{
- briefEndsAtDot=FALSE;
- setOutput(OutputDoc);
+ yyextra->briefEndsAtDot=FALSE;
+ setOutput(yyscanner,OutputDoc);
}
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>^{B}*([\-:|]{B}*)*("--"|"---")({B}*[\-:|])*{B}*/\n { // horizontal line (dashed)
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>{CMD}"---" { // escaped mdash
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>{CMD}"--" { // escaped mdash
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>"---" { // mdash
- addOutput(insidePre || Doxygen::markdownSupport ? yytext : "&mdash;");
+ addOutput(yyscanner,yyextra->insidePre || Doxygen::markdownSupport ? yytext : "&mdash;");
}
<Comment>"--" { // ndash
- addOutput(insidePre || Doxygen::markdownSupport ? yytext : "&ndash;");
+ addOutput(yyscanner,yyextra->insidePre || Doxygen::markdownSupport ? yytext : "&ndash;");
}
<Comment>"-#"{B}+ { // numbered item
- if (inContext!=OutputXRef)
+ if (yyextra->inContext!=OutputXRef)
{
- briefEndsAtDot=FALSE;
- setOutput(OutputDoc);
+ yyextra->briefEndsAtDot=FALSE;
+ setOutput(yyscanner,OutputDoc);
}
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>("."+)[a-z_A-Z0-9\)] { // . at start or in the middle of a word, or ellipsis
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>".\\"[ \t] { // . with escaped space.
- addOutput(yytext[0]);
- addOutput(yytext[2]);
+ addOutput(yyscanner,yytext[0]);
+ addOutput(yyscanner,yytext[2]);
}
<Comment>".," { // . with comma such as "e.g.,"
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>"...\\"[ \t] { // ellipsis with escaped space.
- addOutput("... ");
+ addOutput(yyscanner,"... ");
}
<Comment>".."[\.]?/[^ \t\n] { // internal ellipsis
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>(\n|\\_linebr)({B}*(\n|\\_linebr))+ { // at least one blank line (or blank line command)
- if (inContext==OutputXRef)
+ if (yyextra->inContext==OutputXRef)
{
// see bug 613024, we need to put the newlines after ending the XRef section.
- if (!g_insideParBlock) setOutput(OutputDoc);
+ if (!yyextra->insideParBlock) setOutput(yyscanner,OutputDoc);
int i;
for (i=0;i<yyleng;)
{
- if (yytext[i]=='\n') addOutput('\n'),i++;
- else if (strcmp(yytext+i,"\\_linebr")==0) addOutput('\n'),i+=8;
+ if (yytext[i]=='\n') addOutput(yyscanner,'\n'),i++;
+ else if (strcmp(yytext+i,"\\_linebr")==0) addOutput(yyscanner,'\n'),i+=8;
else i++;
}
}
- else if (inContext!=OutputBrief)
+ else if (yyextra->inContext!=OutputBrief)
{
int i;
for (i=0;i<yyleng;)
{
- if (yytext[i]=='\n') addOutput('\n'),i++;
- else if (strcmp(yytext+i,"\\_linebr")==0) addOutput('\n'),i+=8;
+ if (yytext[i]=='\n') addOutput(yyscanner,'\n'),i++;
+ else if (strcmp(yytext+i,"\\_linebr")==0) addOutput(yyscanner,'\n'),i+=8;
else i++;
}
- setOutput(OutputDoc);
+ setOutput(yyscanner,OutputDoc);
}
- else // inContext==OutputBrief
+ else // yyextra->inContext==OutputBrief
{ // only go to the detailed description if we have
// found some brief description and not just whitespace
- endBrief(FALSE);
+ endBrief(yyscanner,FALSE);
}
- lineCount();
+ lineCount(yyscanner);
}
<Comment>"." { // potential end of a JavaDoc style comment
- addOutput(*yytext);
- if (briefEndsAtDot)
+ addOutput(yyscanner,*yytext);
+ if (yyextra->briefEndsAtDot)
{
- setOutput(OutputDoc);
- briefEndsAtDot=FALSE;
+ setOutput(yyscanner,OutputDoc);
+ yyextra->briefEndsAtDot=FALSE;
}
}
<Comment>\n { // newline
- addOutput(*yytext);
- yyLineNr++;
+ addOutput(yyscanner,*yytext);
+ yyextra->lineNr++;
}
<Comment>. { // catch-all for anything else
- addOutput(*yytext);
+ addOutput(yyscanner,*yytext);
}
@@ -1344,7 +933,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<HtmlComment>"--"[!]?">"{B}* { BEGIN( Comment ); }
<HtmlComment>{DOCNL} {
- if (*yytext=='\n') yyLineNr++;
+ if (*yytext=='\n') yyextra->lineNr++;
}
<HtmlComment>[^\\\n\-]+ { // ignore unimportant characters
}
@@ -1355,66 +944,66 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
BEGIN( Comment );
}
<CdataSection>{DOCNL} {
- addOutput('\n');
- if (*yytext=='\n') yyLineNr++;
+ addOutput(yyscanner,'\n');
+ if (*yytext=='\n') yyextra->lineNr++;
}
<CdataSection>[<>&] { // the special XML characters for iwhich the CDATA section is especially used
- addOutput('\\');
- addOutput(*yytext);
+ addOutput(yyscanner,'\\');
+ addOutput(yyscanner,*yytext);
}
<CdataSection>[^\\\n\]<>&]+ {
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<CdataSection>. {
- addOutput(*yytext);
+ addOutput(yyscanner,*yytext);
}
/* -------------- Rules for handling formulas ---------------- */
<ReadFormulaShort>{CMD}"f$" { // end of inline formula
- formulaText+="$";
- addOutput(" "+addFormula());
+ yyextra->formulaText+="$";
+ addOutput(yyscanner," "+addFormula(yyscanner));
BEGIN(Comment);
}
<ReadFormulaLong>{CMD}"f]" { // end of block formula
- formulaText+="\\]";
- addOutput(" "+addFormula());
+ yyextra->formulaText+="\\]";
+ addOutput(yyscanner," "+addFormula(yyscanner));
BEGIN(Comment);
}
<ReadFormulaLong>{CMD}"f}" { // end of custom env formula
- formulaText+="\\end";
- formulaText+=formulaEnv;
- addOutput(" "+addFormula());
+ yyextra->formulaText+="\\end";
+ yyextra->formulaText+=yyextra->formulaEnv;
+ addOutput(yyscanner," "+addFormula(yyscanner));
BEGIN(Comment);
}
<ReadFormulaLong,ReadFormulaShort>[^\\@\n]+ { // any non-special character
- formulaText+=yytext;
+ yyextra->formulaText+=yytext;
}
<ReadFormulaLong,ReadFormulaShort>\n { // new line
- formulaNewLines++;
- formulaText+=*yytext;
- yyLineNr++;
+ yyextra->formulaNewLines++;
+ yyextra->formulaText+=*yytext;
+ yyextra->lineNr++;
}
<ReadFormulaLong,ReadFormulaShort>. { // any other character
- formulaText+=*yytext;
+ yyextra->formulaText+=*yytext;
}
/* ------------ handle argument of enum command --------------- */
<EnumDocArg1>{SCOPEID} { // handle argument
- current->name = yytext;
+ yyextra->current->name = yytext;
BEGIN( Comment );
}
<EnumDocArg1>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<EnumDocArg1>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"missing argument after \\enum."
);
- addOutput('\n');
- if (*yytext=='\n') yyLineNr++;
+ addOutput(yyscanner,'\n');
+ if (*yytext=='\n') yyextra->lineNr++;
BEGIN( Comment );
}
<EnumDocArg1>. { // ignore other stuff
@@ -1423,20 +1012,20 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ------------ handle argument of namespace command --------------- */
<NameSpaceDocArg1>{SCOPENAME} { // handle argument
- current->name = substitute(yytext,".","::");
+ yyextra->current->name = substitute(yytext,".","::");
BEGIN( Comment );
}
<NameSpaceDocArg1>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<NameSpaceDocArg1>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"missing argument after "
"\\namespace."
);
- addOutput('\n');
- if (*yytext=='\n') yyLineNr++;
+ addOutput(yyscanner,'\n');
+ if (*yytext=='\n') yyextra->lineNr++;
BEGIN( Comment );
}
<NameSpaceDocArg1>. { // ignore other stuff
@@ -1445,20 +1034,20 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ------------ handle argument of package command --------------- */
<PackageDocArg1>{ID}("."{ID})* { // handle argument
- current->name = yytext;
+ yyextra->current->name = yytext;
BEGIN( Comment );
}
<PackageDocArg1>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<PackageDocArg1>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"missing argument after "
"\\package."
);
- addOutput('\n');
- if (*yytext=='\n') yyLineNr++;
+ addOutput(yyscanner,'\n');
+ if (*yytext=='\n') yyextra->lineNr++;
BEGIN( Comment );
}
<PackageDocArg1>. { // ignore other stuff
@@ -1467,64 +1056,64 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ------ handle argument of class/struct/union command --------------- */
<ClassDocArg1>{SCOPENAME}{TMPLSPEC} {
- current->name = substitute(removeRedundantWhiteSpace(yytext),".","::");
+ yyextra->current->name = substitute(removeRedundantWhiteSpace(yytext),".","::");
BEGIN( ClassDocArg2 );
}
<ClassDocArg1>{SCOPENAME} { // first argument
- current->name = substitute(yytext,".","::");
- if (current->section==Entry::PROTOCOLDOC_SEC)
+ yyextra->current->name = substitute(yytext,".","::");
+ if (yyextra->current->section==Entry::PROTOCOLDOC_SEC)
{
- current->name+="-p";
+ yyextra->current->name+="-p";
}
// prepend outer scope name
BEGIN( ClassDocArg2 );
}
<CategoryDocArg1>{SCOPENAME}{B}*"("[^\)]+")" {
- current->name = substitute(yytext,".","::");
+ yyextra->current->name = substitute(yytext,".","::");
BEGIN( ClassDocArg2 );
}
<ClassDocArg1,CategoryDocArg1>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<ClassDocArg1,CategoryDocArg1>{DOCNL} {
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"missing argument after "
"\\%s.",YY_START==ClassDocArg1?"class":"category"
);
- addOutput('\n');
- if (*yytext=='\n') yyLineNr++;
+ addOutput(yyscanner,'\n');
+ if (*yytext=='\n') yyextra->lineNr++;
BEGIN( Comment );
}
<ClassDocArg1,CategoryDocArg1>. { // ignore other stuff
}
<ClassDocArg2>{FILE}|"<>" { // second argument; include file
- current->includeFile = yytext;
+ yyextra->current->includeFile = yytext;
BEGIN( ClassDocArg3 );
}
<ClassDocArg2>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<ClassDocArg2>{DOCNL} {
- addOutput('\n');
- if (*yytext=='\n') yyLineNr++;
+ addOutput(yyscanner,'\n');
+ if (*yytext=='\n') yyextra->lineNr++;
BEGIN( Comment );
}
<ClassDocArg2>. { // ignore other stuff
}
<ClassDocArg3>[<"]?{FILE}?[">]? { // third argument; include file name
- current->includeName = yytext;
+ yyextra->current->includeName = yytext;
BEGIN( Comment );
}
<ClassDocArg3>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<ClassDocArg3>{DOCNL} {
- if (*yytext=='\n') yyLineNr++;
+ if (*yytext=='\n') yyextra->lineNr++;
BEGIN( Comment );
}
<ClassDocArg3>. { // ignore other stuff
@@ -1533,83 +1122,83 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* --------- handle arguments of {def,add,weak}group commands --------- */
<GroupDocArg1>{LABELID}(".html"?) { // group name
- current->name = yytext;
+ yyextra->current->name = yytext;
//lastDefGroup.groupname = yytext;
- //lastDefGroup.pri = current->groupingPri();
+ //lastDefGroup.pri = yyextra->current->groupingPri();
// the .html stuff is for Qt compatibility
- if (current->name.right(5)==".html")
+ if (yyextra->current->name.right(5)==".html")
{
- current->name=current->name.left(current->name.length()-5);
+ yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-5);
}
- current->type.resize(0);
+ yyextra->current->type.resize(0);
BEGIN(GroupDocArg2);
}
<GroupDocArg1>"\\"{B}*"\n" { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<GroupDocArg1>{DOCNL} { // missing argument!
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"missing group name after %s",
- current->groupDocCmd()
+ yyextra->current->groupDocCmd()
);
- addOutput('\n');
- if (*yytext=='\n') yyLineNr++;
+ addOutput(yyscanner,'\n');
+ if (*yytext=='\n') yyextra->lineNr++;
BEGIN( Comment );
}
<GroupDocArg1>. { // ignore other stuff
}
<GroupDocArg2>"\\"{B}*"\n" { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<GroupDocArg2>[^\n\\]+ { // title (stored in type)
- current->type += yytext;
- current->type = current->type.stripWhiteSpace();
+ yyextra->current->type += yytext;
+ yyextra->current->type = yyextra->current->type.stripWhiteSpace();
}
<GroupDocArg2>{DOCNL} {
- if ( current->groupDocType==Entry::GROUPDOC_NORMAL &&
- current->type.isEmpty()
+ if ( yyextra->current->groupDocType==Entry::GROUPDOC_NORMAL &&
+ yyextra->current->type.isEmpty()
) // defgroup requires second argument
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"missing title after "
- "\\defgroup %s", current->name.data()
+ "\\defgroup %s", yyextra->current->name.data()
);
}
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<GroupDocArg2>. { // title (stored in type)
- current->type += yytext;
- current->type = current->type.stripWhiteSpace();
+ yyextra->current->type += yytext;
+ yyextra->current->type = yyextra->current->type.stripWhiteSpace();
}
/* --------- handle arguments of page/mainpage command ------------------- */
<PageDocArg1>{FILE} { // first argument; page name
- current->name = stripQuotes(yytext);
- current->args = "";
+ yyextra->current->name = stripQuotes(yytext);
+ yyextra->current->args = "";
BEGIN( PageDocArg2 );
}
-<PageDocArg1>{LC} { yyLineNr++;
- addOutput('\n');
+<PageDocArg1>{LC} { yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<PageDocArg1>{DOCNL} {
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"missing argument after "
"\\page."
);
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<PageDocArg1>. { // ignore other stuff
}
<PageDocArg2>{DOCNL} { // second argument; page title
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<PageDocArg2>{CMD}[<>] {
@@ -1617,20 +1206,20 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
QCString tmp = yytext;
tmp = substitute(substitute(tmp,"@<","&lt;"),"@>","&gt;");
tmp = substitute(substitute(tmp,"\\<","&lt;"),"\\>","&gt;");
- current->args += tmp;
+ yyextra->current->args += tmp;
}
<PageDocArg2>. {
- current->args += yytext;
+ yyextra->current->args += yytext;
}
/* --------- handle arguments of the param command ------------ */
<ParamArg1>{ID}/{B}*"," {
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<ParamArg1>"," {
- addOutput(" , ");
+ addOutput(yyscanner," , ");
}
<ParamArg1>{ID} {
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
BEGIN( Comment );
}
<ParamArg1>. {
@@ -1641,16 +1230,16 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* --------- handle arguments of the file/dir/example command ------------ */
<FileDocArg1>{DOCNL} { // no file name specified
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<FileDocArg1>{FILE} { // first argument; name
- current->name = stripQuotes(yytext);
+ yyextra->current->name = stripQuotes(yytext);
BEGIN( Comment );
}
-<FileDocArg1>{LC} { yyLineNr++;
- addOutput('\n');
+<FileDocArg1>{LC} { yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<FileDocArg1>. { // ignore other stuff
}
@@ -1658,62 +1247,62 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* --------- handle arguments of the xrefitem command ------------ */
<XRefItemParam1>{LABELID} { // first argument
- newXRefItemKey=yytext;
- setOutput(OutputXRef);
+ yyextra->newXRefItemKey=yytext;
+ setOutput(yyscanner,OutputXRef);
BEGIN(XRefItemParam2);
}
<XRefItemParam1>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<XRefItemParam1>{DOCNL} { // missing arguments
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"Missing first argument of \\xrefitem"
);
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
- inContext = OutputDoc;
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ yyextra->inContext = OutputDoc;
BEGIN( Comment );
}
<XRefItemParam1>. { // ignore other stuff
}
<XRefItemParam2>"\""[^\n\"]*"\"" { // second argument
- xrefItemTitle = stripQuotes(yytext);
+ yyextra->xrefItemTitle = stripQuotes(yytext);
BEGIN(XRefItemParam3);
}
<XRefItemParam2>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<XRefItemParam2>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"Missing second argument of \\xrefitem"
);
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
- inContext = OutputDoc;
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ yyextra->inContext = OutputDoc;
BEGIN( Comment );
}
<XRefItemParam2>. { // ignore other stuff
}
<XRefItemParam3>"\""[^\n\"]*"\"" { // third argument
- xrefListTitle = stripQuotes(yytext);
- xrefKind = XRef_Item;
+ yyextra->xrefListTitle = stripQuotes(yytext);
+ yyextra->xrefKind = XRef_Item;
BEGIN( Comment );
}
<XRefItemParam2,XRefItemParam3>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<XRefItemParam3>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"Missing third argument of \\xrefitem"
);
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
- inContext = OutputDoc;
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ yyextra->inContext = OutputDoc;
BEGIN( Comment );
}
<XRefItemParam3>. { // ignore other stuff
@@ -1723,23 +1312,23 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle arguments of the relates(also)/memberof command ------- */
<RelatesParam1>({ID}("::"|"."))*{ID} { // argument
- current->relates = yytext;
- //if (current->mGrpId!=DOX_NOGROUP)
+ yyextra->current->relates = yytext;
+ //if (yyextra->current->mGrpId!=DOX_NOGROUP)
//{
// memberGroupRelates = yytext;
//}
BEGIN( Comment );
}
<RelatesParam1>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<RelatesParam1>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"Missing argument of \\relates or \\memberof command"
);
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<RelatesParam1>. { // ignore other stuff
@@ -1749,94 +1338,94 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle arguments of the relates(also)/addindex commands ----- */
<LineParam>{DOCNL} { // end of argument
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<LineParam>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<LineParam>. { // ignore other stuff
- addOutput(*yytext);
+ addOutput(yyscanner,*yytext);
}
/* ----- handle arguments of the section/subsection/.. commands ------- */
<SectionLabel>{LABELID} { // first argument
- g_sectionLabel=yytext;
- addOutput(yytext);
- g_sectionTitle.resize(0);
+ yyextra->sectionLabel=yytext;
+ addOutput(yyscanner,yytext);
+ yyextra->sectionTitle.resize(0);
BEGIN(SectionTitle);
}
<SectionLabel>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"\\section command has no label"
);
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<SectionLabel>. { // invalid character for section label
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"Invalid or missing section label"
);
BEGIN(Comment);
}
<SectionTitle>[^\n@\\*]*/"\n" { // end of section title
- addSection();
- addOutput(yytext);
+ addSection(yyscanner);
+ addOutput(yyscanner,yytext);
BEGIN( Comment );
}
<SectionTitle>[^\n@\\]*/"\\_linebr" { // end of section title
- addSection();
- addOutput(yytext);
+ addSection(yyscanner);
+ addOutput(yyscanner,yytext);
BEGIN( Comment );
}
<SectionTitle>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<SectionTitle>[^\n@\\]* { // any character without special meaning
- g_sectionTitle+=yytext;
- addOutput(yytext);
+ yyextra->sectionTitle+=yytext;
+ addOutput(yyscanner,yytext);
}
<SectionTitle>({CMD}{CMD}){ID} { // unescape escaped command
- g_sectionTitle+=&yytext[1];
- addOutput(yytext);
+ yyextra->sectionTitle+=&yytext[1];
+ addOutput(yyscanner,yytext);
}
<SectionTitle>{CMD}[$@\\&~<>#%] { // unescape escaped character
- g_sectionTitle+=yytext[1];
- addOutput(yytext);
+ yyextra->sectionTitle+=yytext[1];
+ addOutput(yyscanner,yytext);
}
<SectionTitle>. { // anything else
- g_sectionTitle+=yytext;
- addOutput(*yytext);
+ yyextra->sectionTitle+=yytext;
+ addOutput(yyscanner,*yytext);
}
/* ----- handle arguments of the subpage command ------- */
<SubpageLabel>{LABELID} { // first argument
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
// we add subpage labels as a kind of "inheritance" relation to prevent
// needing to add another list to the Entry class.
- current->extends.push_back(BaseInfo(yytext,Public,Normal));
+ yyextra->current->extends.push_back(BaseInfo(yytext,Public,Normal));
BEGIN(SubpageTitle);
}
<SubpageLabel>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"\\subpage command has no label"
);
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<SubpageTitle>{DOCNL} { // no title, end command
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
BEGIN( Comment );
}
<SubpageTitle>[ \t]*"\""[^\"\n]*"\"" { // add title, end of command
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
BEGIN( Comment );
}
<SubpageTitle>. { // no title, end of command
@@ -1847,20 +1436,20 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle arguments of the anchor command ------- */
<AnchorLabel>{LABELID} { // found argument
- addAnchor(yytext);
- addOutput(yytext);
+ addAnchor(yyscanner,yytext);
+ addOutput(yyscanner,yytext);
BEGIN( Comment );
}
<AnchorLabel>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"\\anchor command has no label"
);
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<AnchorLabel>. { // invalid character for anchor label
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"Invalid or missing anchor label"
);
BEGIN(Comment);
@@ -1870,51 +1459,51 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle arguments of the preformatted block commands ------- */
<FormatBlock>{CMD}("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"endmsc"|"endvhdlflow")/{NW} { // possible ends
- addOutput(yytext);
- if (&yytext[4]==blockName) // found end of the block
+ addOutput(yyscanner,yytext);
+ if (&yytext[4]==yyextra->blockName) // found end of the block
{
BEGIN(Comment);
}
}
<FormatBlock>{CMD}"enduml" {
- addOutput(yytext);
- if (blockName=="startuml") // found end of the block
+ addOutput(yyscanner,yytext);
+ if (yyextra->blockName=="startuml") // found end of the block
{
BEGIN(Comment);
}
}
<FormatBlock>[^ \@\*\/\\\n]* { // some word
- addOutput(yytext);
+ addOutput(yyscanner,yytext);
}
<FormatBlock>{DOCNL} { // new line
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<FormatBlock>"/*" { // start of a C-comment
- if (!(blockName=="code" || blockName=="verbatim")) g_commentCount++;
- addOutput(yytext);
+ if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim")) yyextra->commentCount++;
+ addOutput(yyscanner,yytext);
}
<FormatBlock>"*/" { // end of a C-comment
- addOutput(yytext);
- if (!(blockName=="code" || blockName=="verbatim"))
+ addOutput(yyscanner,yytext);
+ if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim"))
{
- g_commentCount--;
- if (g_commentCount<0)
+ yyextra->commentCount--;
+ if (yyextra->commentCount<0)
{
- warn(yyFileName,yyLineNr,
- "found */ without matching /* while inside a \\%s block! Perhaps a missing \\end%s?\n",blockName.data(),blockName.data());
+ warn(yyextra->fileName,yyextra->lineNr,
+ "found */ without matching /* while inside a \\%s block! Perhaps a missing \\end%s?\n",yyextra->blockName.data(),yyextra->blockName.data());
}
}
}
<FormatBlock>. {
- addOutput(*yytext);
+ addOutput(yyscanner,*yytext);
}
<FormatBlock><<EOF>> {
- QCString endTag = "end"+blockName;
- if (blockName=="startuml") endTag="enduml";
- warn(yyFileName,yyLineNr,
+ QCString endTag = "end"+yyextra->blockName;
+ if (yyextra->blockName=="startuml") endTag="enduml";
+ warn(yyextra->fileName,yyextra->lineNr,
"reached end of comment while inside a \\%s block; check for missing \\%s tag!",
- blockName.data(),endTag.data()
+ yyextra->blockName.data(),endTag.data()
);
yyterminate();
}
@@ -1922,58 +1511,58 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle arguments of if/ifnot commands ------- */
<GuardParam>{B}*"(" {
- g_guardExpr=yytext;
- g_roundCount=1;
+ yyextra->guardExpr=yytext;
+ yyextra->roundCount=1;
BEGIN(GuardExpr);
}
<GuardExpr>[^()]* {
- g_guardExpr+=yytext;
+ yyextra->guardExpr+=yytext;
}
<GuardExpr>"(" {
- g_guardExpr+=yytext;
- g_roundCount++;
+ yyextra->guardExpr+=yytext;
+ yyextra->roundCount++;
}
<GuardExpr>")" {
- g_guardExpr+=yytext;
- g_roundCount--;
- if (g_roundCount==0)
+ yyextra->guardExpr+=yytext;
+ yyextra->roundCount--;
+ if (yyextra->roundCount==0)
{
- handleGuard(g_guardExpr);
+ handleGuard(yyscanner,yyextra->guardExpr);
}
}
<GuardExpr>\n {
- warn(yyFileName,yyLineNr,
- "invalid expression '%s' for guard",g_guardExpr.data());
+ warn(yyextra->fileName,yyextra->lineNr,
+ "invalid expression '%s' for yyextra->guards",yyextra->guardExpr.data());
unput(*yytext);
BEGIN(GuardParam);
}
-<GuardParam>{B}*[a-z_A-Z0-9.\-]+ { // parameter of if/ifnot guard
- handleGuard(yytext);
+<GuardParam>{B}*[a-z_A-Z0-9.\-]+ { // parameter of if/ifnot yyextra->guards
+ handleGuard(yyscanner,yytext);
}
<GuardParam>{DOCNL} { // end of argument
- if (*yytext=='\n') yyLineNr++;
+ if (*yytext=='\n') yyextra->lineNr++;
//next line is commented out due to bug620924
- //addOutput('\n');
+ //addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<GuardParam>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<GuardParam>. { // ignore other stuff
- addOutput(*yytext);
+ addOutput(yyscanner,*yytext);
}
<GuardParamEnd>{B}*{DOCNL} {
- lineCount();
- g_spaceBeforeIf.resize(0);
+ lineCount(yyscanner);
+ yyextra->spaceBeforeIf.resize(0);
BEGIN(Comment);
}
<GuardParamEnd>{B}* {
- if (!g_spaceBeforeIf.isEmpty()) // needed for 665313 in combination with bug620924
+ if (!yyextra->spaceBeforeIf.isEmpty()) // needed for 665313 in combination with bug620924
{
- addOutput(g_spaceBeforeIf);
+ addOutput(yyscanner,yyextra->spaceBeforeIf);
}
- g_spaceBeforeIf.resize(0);
+ yyextra->spaceBeforeIf.resize(0);
BEGIN(Comment);
}
<GuardParamEnd>. {
@@ -1984,67 +1573,67 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle skipping of conditional sections ------- */
<SkipGuardedSection>{CMD}"ifnot"/{NW} {
- guardType = Guard_IfNot;
+ yyextra->guardType = Guard_IfNot;
BEGIN( GuardParam );
}
<SkipGuardedSection>{CMD}"if"/{NW} {
- guardType = Guard_If;
+ yyextra->guardType = Guard_If;
BEGIN( GuardParam );
}
<SkipGuardedSection>{CMD}"endif"/{NW} {
- if (guards.isEmpty())
+ if (yyextra->guards.isEmpty())
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found \\endif without matching start command");
}
else
{
- GuardedSection *s = guards.pop();
+ GuardedSection *s = yyextra->guards.pop();
bool parentVisible = s->parentVisible();
delete s;
if (parentVisible)
{
- enabledSectionFound=TRUE;
+ yyextra->enabledSectionFound=TRUE;
BEGIN( GuardParamEnd );
}
}
}
<SkipGuardedSection>{CMD}"else"/{NW} {
- if (guards.isEmpty())
+ if (yyextra->guards.isEmpty())
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found \\else without matching start command");
}
else
{
- if (!enabledSectionFound && guards.top()->parentVisible())
+ if (!yyextra->enabledSectionFound && yyextra->guards.top()->parentVisible())
{
- delete guards.pop();
- guards.push(new GuardedSection(TRUE,TRUE));
- enabledSectionFound=TRUE;
+ delete yyextra->guards.pop();
+ yyextra->guards.push(new GuardedSection(TRUE,TRUE));
+ yyextra->enabledSectionFound=TRUE;
BEGIN( GuardParamEnd );
}
}
}
<SkipGuardedSection>{CMD}"elseif"/{NW} {
- if (guards.isEmpty())
+ if (yyextra->guards.isEmpty())
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found \\elseif without matching start command");
}
else
{
- if (!enabledSectionFound && guards.top()->parentVisible())
+ if (!yyextra->enabledSectionFound && yyextra->guards.top()->parentVisible())
{
- guardType=Guard_If;
- delete guards.pop();
+ yyextra->guardType=Guard_If;
+ delete yyextra->guards.pop();
BEGIN( GuardParam );
}
}
}
<SkipGuardedSection>{DOCNL} { // skip line
- if (*yytext=='\n') yyLineNr++;
- //addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
}
<SkipGuardedSection>[^ \\@\n]+ { // skip non-special characters
}
@@ -2055,46 +1644,46 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle skipping of internal section ------- */
<SkipInternal>{DOCNL} { // skip line
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<SkipInternal>[@\\]"if"/[ \t] {
- g_condCount++;
+ yyextra->condCount++;
}
<SkipInternal>[@\\]"ifnot"/[ \t] {
- g_condCount++;
+ yyextra->condCount++;
}
<SkipInternal>[@\\]/"endif" {
- g_condCount--;
- if (g_condCount<0) // handle conditional section around of \internal, see bug607743
+ yyextra->condCount--;
+ if (yyextra->condCount<0) // handle conditional section around of \internal, see bug607743
{
unput('\\');
BEGIN(Comment);
}
}
<SkipInternal>[@\\]/"section"[ \t] {
- if (g_sectionLevel>0)
+ if (yyextra->sectionLevel>0)
{
unput('\\');
BEGIN(Comment);
}
}
<SkipInternal>[@\\]/"subsection"[ \t] {
- if (g_sectionLevel>1)
+ if (yyextra->sectionLevel>1)
{
unput('\\');
BEGIN(Comment);
}
}
<SkipInternal>[@\\]/"subsubsection"[ \t] {
- if (g_sectionLevel>2)
+ if (yyextra->sectionLevel>2)
{
unput('\\');
BEGIN(Comment);
}
}
<SkipInternal>[@\\]/"paragraph"[ \t] {
- if (g_sectionLevel>3)
+ if (yyextra->sectionLevel>3)
{
unput('\\');
BEGIN(Comment);
@@ -2112,24 +1701,24 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle argument of name command ------- */
<NameParam>{DOCNL} { // end of argument
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<NameParam>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
Doxygen::docGroup.appendHeader(' ');
}
<NameParam>. { // ignore other stuff
Doxygen::docGroup.appendHeader(*yytext);
- current->name+=*yytext;
+ yyextra->current->name+=*yytext;
}
/* ----- handle argument of noop command ------- */
<Noop>{DOCNL} { // end of argument
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<Noop>. { // ignore other stuff
@@ -2137,58 +1726,58 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle argument of ingroup command ------- */
<InGroupParam>{LABELID} { // group id
- current->groups.push_back(
+ yyextra->current->groups.push_back(
Grouping(yytext, Grouping::GROUPING_INGROUP)
);
- inGroupParamFound=TRUE;
+ yyextra->inGroupParamFound=TRUE;
}
<InGroupParam>{DOCNL} { // missing argument
- if (!inGroupParamFound)
+ if (!yyextra->inGroupParamFound)
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"Missing group name for \\ingroup command"
);
}
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<InGroupParam>{LC} { // line continuation
- yyLineNr++;
- addOutput('\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
<InGroupParam>. { // ignore other stuff
- addOutput(*yytext);
+ addOutput(yyscanner,*yytext);
}
/* ----- handle argument of fn command ------- */
<FnParam>{DOCNL} { // end of argument
- if (braceCount==0)
+ if (yyextra->braceCount==0)
{
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
- langParser->parsePrototype(functionProto);
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ yyextra->langParser->parsePrototype(yyextra->functionProto);
BEGIN( Comment );
}
}
<FnParam>{LC} { // line continuation
- yyLineNr++;
- functionProto+=' ';
+ yyextra->lineNr++;
+ yyextra->functionProto+=' ';
}
<FnParam>[^@\\\n()]+ { // non-special characters
- functionProto+=yytext;
+ yyextra->functionProto+=yytext;
}
<FnParam>"(" {
- functionProto+=yytext;
- braceCount++;
+ yyextra->functionProto+=yytext;
+ yyextra->braceCount++;
}
<FnParam>")" {
- functionProto+=yytext;
- braceCount--;
+ yyextra->functionProto+=yytext;
+ yyextra->braceCount--;
}
<FnParam>. { // add other stuff
- functionProto+=*yytext;
+ yyextra->functionProto+=*yytext;
}
@@ -2196,45 +1785,45 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<OverloadParam>{DOCNL} { // end of argument
- if (*yytext=='\n') yyLineNr++;
- if (functionProto.stripWhiteSpace().isEmpty())
+ if (*yytext=='\n') yyextra->lineNr++;
+ if (yyextra->functionProto.stripWhiteSpace().isEmpty())
{ // plain overload command
- addOutput(getOverloadDocs());
- addOutput('\n');
+ addOutput(yyscanner,getOverloadDocs());
+ addOutput(yyscanner,'\n');
}
else // overload declaration
{
- makeStructuralIndicator(Entry::OVERLOADDOC_SEC);
- langParser->parsePrototype(functionProto);
+ makeStructuralIndicator(yyscanner,Entry::OVERLOADDOC_SEC);
+ yyextra->langParser->parsePrototype(yyextra->functionProto);
}
BEGIN( Comment );
}
<OverloadParam>{LC} { // line continuation
- yyLineNr++;
- functionProto+=' ';
+ yyextra->lineNr++;
+ yyextra->functionProto+=' ';
}
<OverloadParam>. { // add other stuff
- functionProto+=*yytext;
+ yyextra->functionProto+=*yytext;
}
/* ----- handle argument of inherit command ------- */
<InheritParam>({ID}("::"|"."))*{ID} { // found argument
- current->extends.push_back(
+ yyextra->current->extends.push_back(
BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal)
);
BEGIN( Comment );
}
<InheritParam>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"\\inherit command has no argument"
);
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<InheritParam>. { // invalid character for anchor label
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"Invalid or missing name for \\inherit command"
);
BEGIN(Comment);
@@ -2243,17 +1832,17 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle argument of extends and implements commands ------- */
<ExtendsParam>({ID}("::"|"."))*{ID} { // found argument
- current->extends.push_back(
+ yyextra->current->extends.push_back(
BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal)
);
BEGIN( Comment );
}
<ExtendsParam>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"\\extends or \\implements command has no argument"
);
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<ExtendsParam>. { // ignore other stuff
@@ -2272,7 +1861,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
}
<SkipLang>{DOCNL} { /* new line in verbatim block */
- if (*yytext=='\n') yyLineNr++;
+ if (*yytext=='\n') yyextra->lineNr++;
}
<SkipLang>. { /* any other character */
}
@@ -2280,20 +1869,20 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* ----- handle arguments of the cite command ------- */
<CiteLabel>{CITEID} { // found argument
- addCite();
- addOutput(yytext);
+ addCite(yyscanner);
+ addOutput(yyscanner,yytext);
BEGIN(Comment);
}
<CiteLabel>{DOCNL} { // missing argument
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"\\cite command has no label"
);
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
BEGIN( Comment );
}
<CiteLabel>. { // invalid character for cite label
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"Invalid or missing cite label"
);
BEGIN(Comment);
@@ -2303,21 +1892,21 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<CopyDoc><<EOF>> |
<CopyDoc>{DOCNL} {
- if (*yytext=='\n') yyLineNr++;
- addOutput('\n');
- setOutput(OutputDoc);
- addOutput(" \\copydetails ");
- addOutput(g_copyDocArg);
- addOutput("\n");
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ setOutput(yyscanner,OutputDoc);
+ addOutput(yyscanner," \\copydetails ");
+ addOutput(yyscanner,yyextra->copyDocArg);
+ addOutput(yyscanner,"\n");
BEGIN(Comment);
}
<CopyDoc>[^\n\\]+ {
- g_copyDocArg+=yytext;
- addOutput(yytext);
+ yyextra->copyDocArg+=yytext;
+ addOutput(yyscanner,yytext);
}
<CopyDoc>. {
- g_copyDocArg+=yytext;
- addOutput(yytext);
+ yyextra->copyDocArg+=yytext;
+ addOutput(yyscanner,yytext);
}
@@ -2325,194 +1914,218 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
//----------------------------------------------------------------------------
-static bool handleBrief(const QCString &, const QCStringList &)
+static bool handleBrief(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
//printf("handleBrief\n");
- setOutput(OutputBrief);
+ setOutput(yyscanner,OutputBrief);
return FALSE;
}
-static bool handleFn(const QCString &, const QCStringList &)
+static bool handleFn(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::MEMBERDOC_SEC);
- functionProto.resize(0);
- braceCount=0;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::MEMBERDOC_SEC);
+ yyextra->functionProto.resize(0);
+ yyextra->braceCount=0;
BEGIN(FnParam);
return stop;
}
-static bool handleDef(const QCString &, const QCStringList &)
+static bool handleDef(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::DEFINEDOC_SEC);
- functionProto.resize(0);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::DEFINEDOC_SEC);
+ yyextra->functionProto.resize(0);
BEGIN(FnParam);
return stop;
}
-static bool handleOverload(const QCString &, const QCStringList &)
+static bool handleOverload(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- functionProto.resize(0);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->functionProto.resize(0);
BEGIN(OverloadParam);
return FALSE;
}
-static bool handleEnum(const QCString &, const QCStringList &)
+static bool handleEnum(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::ENUMDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::ENUMDOC_SEC);
BEGIN(EnumDocArg1);
return stop;
}
-static bool handleDefGroup(const QCString &, const QCStringList &)
+static bool handleDefGroup(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::GROUPDOC_SEC);
- current->groupDocType = Entry::GROUPDOC_NORMAL;
- setOutput(OutputBrief);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::GROUPDOC_SEC);
+ yyextra->current->groupDocType = Entry::GROUPDOC_NORMAL;
+ setOutput(yyscanner,OutputBrief);
BEGIN( GroupDocArg1 );
return stop;
}
-static bool handleAddToGroup(const QCString &, const QCStringList &)
+static bool handleAddToGroup(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::GROUPDOC_SEC);
- current->groupDocType = Entry::GROUPDOC_ADD;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::GROUPDOC_SEC);
+ yyextra->current->groupDocType = Entry::GROUPDOC_ADD;
BEGIN( GroupDocArg1 );
return stop;
}
-static bool handleWeakGroup(const QCString &, const QCStringList &)
+static bool handleWeakGroup(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::GROUPDOC_SEC);
- current->groupDocType = Entry::GROUPDOC_WEAK;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::GROUPDOC_SEC);
+ yyextra->current->groupDocType = Entry::GROUPDOC_WEAK;
BEGIN( GroupDocArg1 );
return stop;
}
-static bool handleNamespace(const QCString &, const QCStringList &)
+static bool handleNamespace(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::NAMESPACEDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::NAMESPACEDOC_SEC);
BEGIN( NameSpaceDocArg1 );
return stop;
}
-static bool handlePackage(const QCString &, const QCStringList &)
+static bool handlePackage(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::PACKAGEDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::PACKAGEDOC_SEC);
BEGIN( PackageDocArg1 );
return stop;
}
-static bool handleClass(const QCString &, const QCStringList &)
+static bool handleClass(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::CLASSDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::CLASSDOC_SEC);
BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleHeaderFile(const QCString &, const QCStringList &)
+static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
BEGIN( ClassDocArg2 );
return FALSE;
}
-static bool handleProtocol(const QCString &, const QCStringList &)
+static bool handleProtocol(yyscan_t yyscanner,const QCString &, const QCStringList &)
{ // Obj-C protocol
- bool stop=makeStructuralIndicator(Entry::PROTOCOLDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::PROTOCOLDOC_SEC);
BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleCategory(const QCString &, const QCStringList &)
+static bool handleCategory(yyscan_t yyscanner,const QCString &, const QCStringList &)
{ // Obj-C category
- bool stop=makeStructuralIndicator(Entry::CATEGORYDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::CATEGORYDOC_SEC);
BEGIN( CategoryDocArg1 );
return stop;
}
-static bool handleUnion(const QCString &, const QCStringList &)
+static bool handleUnion(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::UNIONDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::UNIONDOC_SEC);
BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleStruct(const QCString &, const QCStringList &)
+static bool handleStruct(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::STRUCTDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::STRUCTDOC_SEC);
BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleInterface(const QCString &, const QCStringList &)
+static bool handleInterface(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::INTERFACEDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::INTERFACEDOC_SEC);
BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleIdlException(const QCString &, const QCStringList &)
+static bool handleIdlException(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::EXCEPTIONDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::EXCEPTIONDOC_SEC);
BEGIN( ClassDocArg1 );
return stop;
}
-static bool handlePage(const QCString &, const QCStringList &)
+static bool handlePage(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::PAGEDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::PAGEDOC_SEC);
BEGIN( PageDocArg1 );
return stop;
}
-static bool handleMainpage(const QCString &, const QCStringList &)
+static bool handleMainpage(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::MAINPAGEDOC_SEC);
- current->name = "";
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::MAINPAGEDOC_SEC);
+ yyextra->current->name = "";
if (!stop)
{
- current->name = "mainpage";
+ yyextra->current->name = "mainpage";
}
BEGIN( PageDocArg2 );
return stop;
}
-static bool handleFile(const QCString &, const QCStringList &)
+static bool handleFile(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::FILEDOC_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::FILEDOC_SEC);
if (!stop)
{
- current->name = yyFileName;
+ yyextra->current->name = yyextra->fileName;
}
BEGIN( FileDocArg1 );
return stop;
}
-static bool handleParam(const QCString &, const QCStringList &)
+static bool handleParam(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
// we need process param and retval arguments to escape leading underscores in case of
// markdown processing, see bug775493
- addOutput("@param ");
+ addOutput(yyscanner,"@param ");
BEGIN( ParamArg1 );
return FALSE;
}
-static bool handleRetval(const QCString &, const QCStringList &)
+static bool handleRetval(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- addOutput("@retval ");
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ addOutput(yyscanner,"@retval ");
BEGIN( ParamArg1 );
return FALSE;
}
-static bool handleDir(const QCString &, const QCStringList &)
+static bool handleDir(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::DIRDOC_SEC);
- if (!stop) current->name = yyFileName;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::DIRDOC_SEC);
+ if (!stop) yyextra->current->name = yyextra->fileName;
BEGIN( FileDocArg1 );
return stop;
}
-static bool handleExample(const QCString &cmd, const QCStringList &optList)
+static bool handleExample(yyscan_t yyscanner,const QCString &cmd, const QCStringList &optList)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
Entry::Sections section=Entry::EXAMPLE_SEC;
QCStringList::ConstIterator it;
for ( it = optList.begin(); it != optList.end(); ++it )
@@ -2524,273 +2137,297 @@ static bool handleExample(const QCString &cmd, const QCStringList &optList)
}
else
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"unsupported option '%s' for command '\\%s'",qPrint(opt),qPrint(cmd));
}
}
- bool stop=makeStructuralIndicator(section);
- if (!stop) current->name = yyFileName;
+ bool stop=makeStructuralIndicator(yyscanner,section);
+ if (!stop) yyextra->current->name = yyextra->fileName;
BEGIN( FileDocArg1 );
return stop;
}
-static bool handleDetails(const QCString &, const QCStringList &)
+static bool handleDetails(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- if (inContext!=OutputBrief)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->inContext!=OutputBrief)
{
- addOutput("\n\n"); // treat @details outside brief description
+ addOutput(yyscanner,"\n\n"); // treat @details outside brief description
// as a new paragraph
}
- setOutput(OutputDoc);
+ setOutput(yyscanner,OutputDoc);
return FALSE;
}
-static bool handleNoop(const QCString &, const QCStringList &)
+static bool handleNoop(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
BEGIN( Noop );
return FALSE;
}
-static bool handleName(const QCString &, const QCStringList &)
+static bool handleName(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- bool stop=makeStructuralIndicator(Entry::MEMBERGRP_SEC);
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool stop=makeStructuralIndicator(yyscanner,Entry::MEMBERGRP_SEC);
if (!stop)
{
Doxygen::docGroup.clearHeader();
BEGIN( NameParam );
if (!Doxygen::docGroup.isEmpty()) // end of previous member group
{
- Doxygen::docGroup.close(current,yyFileName,yyLineNr,TRUE,true);
+ Doxygen::docGroup.close(yyextra->current,yyextra->fileName,yyextra->lineNr,TRUE,true);
}
}
return stop;
}
-static bool handleTodo(const QCString &, const QCStringList &)
+static bool handleTodo(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- newXRefKind = XRef_Todo;
- setOutput(OutputXRef);
- xrefKind = XRef_Todo;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->newXRefKind = XRef_Todo;
+ setOutput(yyscanner,OutputXRef);
+ yyextra->xrefKind = XRef_Todo;
return FALSE;
}
-static bool handleTest(const QCString &, const QCStringList &)
+static bool handleTest(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- newXRefKind = XRef_Test;
- setOutput(OutputXRef);
- xrefKind = XRef_Test;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->newXRefKind = XRef_Test;
+ setOutput(yyscanner,OutputXRef);
+ yyextra->xrefKind = XRef_Test;
return FALSE;
}
-static bool handleBug(const QCString &, const QCStringList &)
+static bool handleBug(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- newXRefKind = XRef_Bug;
- setOutput(OutputXRef);
- xrefKind = XRef_Bug;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->newXRefKind = XRef_Bug;
+ setOutput(yyscanner,OutputXRef);
+ yyextra->xrefKind = XRef_Bug;
return FALSE;
}
-static bool handleDeprecated(const QCString &, const QCStringList &)
+static bool handleDeprecated(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- newXRefKind = XRef_Deprecated;
- setOutput(OutputXRef);
- xrefKind = XRef_Deprecated;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->newXRefKind = XRef_Deprecated;
+ setOutput(yyscanner,OutputXRef);
+ yyextra->xrefKind = XRef_Deprecated;
return FALSE;
}
-static bool handleXRefItem(const QCString &, const QCStringList &)
+static bool handleXRefItem(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- newXRefKind = XRef_Item;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->newXRefKind = XRef_Item;
BEGIN(XRefItemParam1);
return FALSE;
}
-static bool handleParBlock(const QCString &, const QCStringList &)
+static bool handleParBlock(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- if (g_insideParBlock)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->insideParBlock)
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found \\parblock command while already in a parblock!");
}
- if (!g_spaceBeforeCmd.isEmpty())
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
- addOutput(g_spaceBeforeCmd);
- g_spaceBeforeCmd.resize(0);
+ addOutput(yyscanner,yyextra->spaceBeforeCmd);
+ yyextra->spaceBeforeCmd.resize(0);
}
- addOutput("@parblock ");
- g_insideParBlock = TRUE;
+ addOutput(yyscanner,"@parblock ");
+ yyextra->insideParBlock = TRUE;
return FALSE;
}
-static bool handleEndParBlock(const QCString &, const QCStringList &)
+static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- if (!g_insideParBlock)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (!yyextra->insideParBlock)
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found \\endparblock command without matching \\parblock!");
}
- addOutput("@endparblock");
- setOutput(OutputDoc); // to end a parblock inside a xrefitem like context
- g_insideParBlock = FALSE;
+ addOutput(yyscanner,"@endparblock");
+ setOutput(yyscanner,OutputDoc); // to end a parblock inside a xrefitem like context
+ yyextra->insideParBlock = FALSE;
return FALSE;
}
-static bool handleRelated(const QCString &, const QCStringList &)
+static bool handleRelated(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- if (!current->relates.isEmpty())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (!yyextra->current->relates.isEmpty())
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
}
- current->relatesType = Simple;
+ yyextra->current->relatesType = Simple;
BEGIN(RelatesParam1);
return FALSE;
}
-static bool handleRelatedAlso(const QCString &, const QCStringList &)
+static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- if (!current->relates.isEmpty())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (!yyextra->current->relates.isEmpty())
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
}
- current->relatesType = Duplicate;
+ yyextra->current->relatesType = Duplicate;
BEGIN(RelatesParam1);
return FALSE;
}
-static bool handleMemberOf(const QCString &, const QCStringList &)
+static bool handleMemberOf(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- if (!current->relates.isEmpty())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (!yyextra->current->relates.isEmpty())
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
}
- current->relatesType = MemberOf;
+ yyextra->current->relatesType = MemberOf;
BEGIN(RelatesParam1);
return FALSE;
}
-static bool handleRefItem(const QCString &, const QCStringList &)
+static bool handleRefItem(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- addOutput("@refitem ");
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ addOutput(yyscanner,"@refitem ");
BEGIN(LineParam);
return FALSE;
}
-static bool handleSection(const QCString &s, const QCStringList &)
+static bool handleSection(yyscan_t yyscanner,const QCString &s, const QCStringList &)
{
- setOutput(OutputDoc);
- addOutput("@"+s+" ");
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ setOutput(yyscanner,OutputDoc);
+ addOutput(yyscanner,"@"+s+" ");
BEGIN(SectionLabel);
- if (s=="section") g_sectionLevel=1;
- else if (s=="subsection") g_sectionLevel=2;
- else if (s=="subsubsection") g_sectionLevel=3;
- else if (s=="paragraph") g_sectionLevel=4;
+ if (s=="section") yyextra->sectionLevel=1;
+ else if (s=="subsection") yyextra->sectionLevel=2;
+ else if (s=="subsubsection") yyextra->sectionLevel=3;
+ else if (s=="paragraph") yyextra->sectionLevel=4;
return FALSE;
}
-static bool handleSubpage(const QCString &s, const QCStringList &)
+static bool handleSubpage(yyscan_t yyscanner,const QCString &s, const QCStringList &)
{
- if (current->section!=Entry::EMPTY_SEC &&
- current->section!=Entry::PAGEDOC_SEC &&
- current->section!=Entry::MAINPAGEDOC_SEC
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->current->section!=Entry::EMPTY_SEC &&
+ yyextra->current->section!=Entry::PAGEDOC_SEC &&
+ yyextra->current->section!=Entry::MAINPAGEDOC_SEC
)
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found \\subpage command in a comment block that is not marked as a page!");
}
- if (!g_spaceBeforeCmd.isEmpty())
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
- addOutput(g_spaceBeforeCmd);
- g_spaceBeforeCmd.resize(0);
+ addOutput(yyscanner,yyextra->spaceBeforeCmd);
+ yyextra->spaceBeforeCmd.resize(0);
}
- addOutput("@"+s+" ");
+ addOutput(yyscanner,"@"+s+" ");
BEGIN(SubpageLabel);
return FALSE;
}
-static bool handleAnchor(const QCString &s, const QCStringList &)
+static bool handleAnchor(yyscan_t yyscanner,const QCString &s, const QCStringList &)
{
- addOutput("@"+s+" ");
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ addOutput(yyscanner,"@"+s+" ");
BEGIN(AnchorLabel);
return FALSE;
}
-static bool handleCite(const QCString &s, const QCStringList &)
+static bool handleCite(yyscan_t yyscanner,const QCString &s, const QCStringList &)
{
- if (!g_spaceBeforeCmd.isEmpty())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
- addOutput(g_spaceBeforeCmd);
- g_spaceBeforeCmd.resize(0);
+ addOutput(yyscanner,yyextra->spaceBeforeCmd);
+ yyextra->spaceBeforeCmd.resize(0);
}
- addOutput("@"+s+" ");
+ addOutput(yyscanner,"@"+s+" ");
BEGIN(CiteLabel);
return FALSE;
}
-static bool handleFormatBlock(const QCString &s, const QCStringList &optList)
+static bool handleFormatBlock(yyscan_t yyscanner,const QCString &s, const QCStringList &optList)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (optList.isEmpty())
{
- addOutput("@"+s+" ");
+ addOutput(yyscanner,"@"+s+" ");
}
else
{
- addOutput("@"+s+"{"+optList.join(",")+"} ");
+ addOutput(yyscanner,"@"+s+"{"+optList.join(",")+"} ");
}
//printf("handleFormatBlock(%s) with option(%s)\n",s.data(),opt.data());
- blockName=s;
- g_commentCount=0;
+ yyextra->blockName=s;
+ yyextra->commentCount=0;
BEGIN(FormatBlock);
return FALSE;
}
-static bool handleAddIndex(const QCString &, const QCStringList &)
+static bool handleAddIndex(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- addOutput("@addindex ");
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ addOutput(yyscanner,"@addindex ");
BEGIN(LineParam);
return FALSE;
}
-static bool handleIf(const QCString &, const QCStringList &)
+static bool handleIf(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- enabledSectionFound=FALSE;
- guardType = Guard_If;
- g_spaceBeforeIf = g_spaceBeforeCmd;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->enabledSectionFound=FALSE;
+ yyextra->guardType = Guard_If;
+ yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
BEGIN(GuardParam);
return FALSE;
}
-static bool handleIfNot(const QCString &, const QCStringList &)
+static bool handleIfNot(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- enabledSectionFound=FALSE;
- guardType = Guard_IfNot;
- g_spaceBeforeIf = g_spaceBeforeCmd;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->enabledSectionFound=FALSE;
+ yyextra->guardType = Guard_IfNot;
+ yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
BEGIN(GuardParam);
return FALSE;
}
-static bool handleElseIf(const QCString &, const QCStringList &)
+static bool handleElseIf(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- if (guards.isEmpty())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->guards.isEmpty())
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found \\else without matching start command");
}
else
{
- guardType = enabledSectionFound ? Guard_Skip : Guard_If;
+ yyextra->guardType = yyextra->enabledSectionFound ? Guard_Skip : Guard_If;
BEGIN(GuardParam);
}
return FALSE;
}
-static bool handleElse(const QCString &, const QCStringList &)
+static bool handleElse(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- if (guards.isEmpty())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->guards.isEmpty())
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found \\else without matching start command");
}
else
@@ -2800,182 +2437,206 @@ static bool handleElse(const QCString &, const QCStringList &)
return FALSE;
}
-static bool handleEndIf(const QCString &, const QCStringList &)
+static bool handleEndIf(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- if (guards.isEmpty())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->guards.isEmpty())
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found \\endif without matching start command");
}
else
{
- delete guards.pop();
+ delete yyextra->guards.pop();
}
- enabledSectionFound=FALSE;
- if (!g_spaceBeforeCmd.isEmpty())
+ yyextra->enabledSectionFound=FALSE;
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
- addOutput(g_spaceBeforeCmd);
- g_spaceBeforeCmd.resize(0);
+ addOutput(yyscanner,yyextra->spaceBeforeCmd);
+ yyextra->spaceBeforeCmd.resize(0);
}
BEGIN( GuardParamEnd );
return FALSE;
}
-static bool handleIngroup(const QCString &, const QCStringList &)
+static bool handleIngroup(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- inGroupParamFound=FALSE;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->inGroupParamFound=FALSE;
BEGIN( InGroupParam );
return FALSE;
}
-static bool handleNoSubGrouping(const QCString &, const QCStringList &)
+static bool handleNoSubGrouping(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->subGrouping = FALSE;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->subGrouping = FALSE;
return FALSE;
}
-static bool handleShowInitializer(const QCString &, const QCStringList &)
+static bool handleShowInitializer(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->initLines = 100000; // ON
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->initLines = 100000; // ON
return FALSE;
}
-static bool handleHideInitializer(const QCString &, const QCStringList &)
+static bool handleHideInitializer(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->initLines = 0; // OFF
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->initLines = 0; // OFF
return FALSE;
}
-static bool handleCallgraph(const QCString &, const QCStringList &)
+static bool handleCallgraph(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->callGraph = TRUE; // ON
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->callGraph = TRUE; // ON
return FALSE;
}
-static bool handleHideCallgraph(const QCString &, const QCStringList &)
+static bool handleHideCallgraph(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->callGraph = FALSE; // OFF
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->callGraph = FALSE; // OFF
return FALSE;
}
-static bool handleCallergraph(const QCString &, const QCStringList &)
+static bool handleCallergraph(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->callerGraph = TRUE; // ON
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->callerGraph = TRUE; // ON
return FALSE;
}
-static bool handleHideCallergraph(const QCString &, const QCStringList &)
+static bool handleHideCallergraph(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->callerGraph = FALSE; // OFF
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->callerGraph = FALSE; // OFF
return FALSE;
}
-static bool handleReferencedByRelation(const QCString &, const QCStringList &)
+static bool handleReferencedByRelation(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->referencedByRelation = TRUE; // ON
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->referencedByRelation = TRUE; // ON
return FALSE;
}
-static bool handleHideReferencedByRelation(const QCString &, const QCStringList &)
+static bool handleHideReferencedByRelation(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->referencedByRelation = FALSE; // OFF
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->referencedByRelation = FALSE; // OFF
return FALSE;
}
-static bool handleReferencesRelation(const QCString &, const QCStringList &)
+static bool handleReferencesRelation(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->referencesRelation = TRUE; // ON
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->referencesRelation = TRUE; // ON
return FALSE;
}
-static bool handleHideReferencesRelation(const QCString &, const QCStringList &)
+static bool handleHideReferencesRelation(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->referencesRelation = FALSE; // OFF
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->referencesRelation = FALSE; // OFF
return FALSE;
}
-static bool handleInternal(const QCString &, const QCStringList &)
+static bool handleInternal(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (!Config_getBool(INTERNAL_DOCS))
{
// make sure some whitespace before a \internal command
// is not treated as "documentation"
- if (current->doc.stripWhiteSpace().isEmpty())
+ if (yyextra->current->doc.stripWhiteSpace().isEmpty())
{
- current->doc.resize(0);
+ yyextra->current->doc.resize(0);
}
- g_condCount=0;
+ yyextra->condCount=0;
BEGIN( SkipInternal );
}
else
{
// re-enabled for bug640828
- addOutput(" \\internal ");
- inInternalDocs = TRUE;
+ addOutput(yyscanner," \\internal ");
+ yyextra->inInternalDocs = TRUE;
}
return FALSE;
}
-static bool handleLineBr(const QCString &, const QCStringList &)
+static bool handleLineBr(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- addOutput('\n');
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ addOutput(yyscanner,'\n');
return FALSE;
}
-static bool handleStatic(const QCString &, const QCStringList &)
+static bool handleStatic(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- endBrief();
- current->stat = TRUE;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ endBrief(yyscanner);
+ yyextra->current->stat = TRUE;
return FALSE;
}
-static bool handlePure(const QCString &, const QCStringList &)
+static bool handlePure(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- endBrief();
- current->virt = Pure;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ endBrief(yyscanner);
+ yyextra->current->virt = Pure;
return FALSE;
}
-static bool handlePrivate(const QCString &, const QCStringList &)
+static bool handlePrivate(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->protection = Private;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->protection = Private;
return FALSE;
}
-static bool handlePrivateSection(const QCString &, const QCStringList &)
+static bool handlePrivateSection(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->protection = protection = Private;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->protection = yyextra->protection = Private;
return FALSE;
}
-static bool handleProtected(const QCString &, const QCStringList &)
+static bool handleProtected(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->protection = Protected;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->protection = Protected;
return FALSE;
}
-static bool handleProtectedSection(const QCString &, const QCStringList &)
+static bool handleProtectedSection(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->protection = protection = Protected ;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->protection = yyextra->protection = Protected ;
return FALSE;
}
-static bool handlePublic(const QCString &, const QCStringList &)
+static bool handlePublic(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->protection = Public;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->protection = Public;
return FALSE;
}
-static bool handlePublicSection(const QCString &, const QCStringList &)
+static bool handlePublicSection(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- current->protection = protection = Public;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->current->protection = yyextra->protection = Public;
return FALSE;
}
-static bool handleToc(const QCString &, const QCStringList &optList)
+static bool handleToc(yyscan_t yyscanner,const QCString &, const QCStringList &optList)
{
- if (current->section==Entry::PAGEDOC_SEC ||
- current->section==Entry::MAINPAGEDOC_SEC)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->current->section==Entry::PAGEDOC_SEC ||
+ yyextra->current->section==Entry::MAINPAGEDOC_SEC)
{
QCStringList::ConstIterator it;
for ( it = optList.begin(); it != optList.end(); ++it )
@@ -2988,7 +2649,7 @@ static bool handleToc(const QCString &, const QCStringList &optList)
{
if (sscanf(opt.right(opt.length() - i - 1).data(),"%d%c",&level,&dum) != 1)
{
- warn(yyFileName,yyLineNr,"Unknown option:level specified with \\tableofcontents: '%s'", (*it).stripWhiteSpace().data());
+ warn(yyextra->fileName,yyextra->lineNr,"Unknown option:level specified with \\tableofcontents: '%s'", (*it).stripWhiteSpace().data());
opt = "";
}
else
@@ -3002,131 +2663,584 @@ static bool handleToc(const QCString &, const QCStringList &optList)
{
if (opt == "html")
{
- current->localToc.enableHtml(level);
+ yyextra->current->localToc.enableHtml(level);
}
else if (opt == "latex")
{
- current->localToc.enableLatex(level);
+ yyextra->current->localToc.enableLatex(level);
}
else if (opt == "xml")
{
- current->localToc.enableXml(level);
+ yyextra->current->localToc.enableXml(level);
}
else if (opt == "docbook")
{
- current->localToc.enableDocbook(level);
+ yyextra->current->localToc.enableDocbook(level);
}
else
{
- warn(yyFileName,yyLineNr,"Unknown option specified with \\tableofcontents: '%s'", (*it).stripWhiteSpace().data());
+ warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\tableofcontents: '%s'", (*it).stripWhiteSpace().data());
}
}
}
- if (current->localToc.nothingEnabled())
+ if (yyextra->current->localToc.nothingEnabled())
{
// for backward compatibility
- current->localToc.enableHtml(5);
- current->localToc.enableXml(5);
+ yyextra->current->localToc.enableHtml(5);
+ yyextra->current->localToc.enableXml(5);
}
}
return FALSE;
}
-static bool handleInherit(const QCString &, const QCStringList &)
+static bool handleInherit(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
BEGIN(InheritParam);
return FALSE;
}
-static bool handleExtends(const QCString &, const QCStringList &)
+static bool handleExtends(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
BEGIN(ExtendsParam);
return FALSE;
}
-static bool handleCopyBrief(const QCString &, const QCStringList &)
+static bool handleCopyBrief(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- if (current->brief.isEmpty() && current->doc.isEmpty())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (yyextra->current->brief.isEmpty() && yyextra->current->doc.isEmpty())
{ // if we don't have a brief or detailed description yet,
// then the @copybrief should end up in the brief description.
// otherwise it will be copied inline (see bug691315 & bug700788)
- setOutput(OutputBrief);
+ setOutput(yyscanner,OutputBrief);
}
- if (!g_spaceBeforeCmd.isEmpty())
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
- addOutput(g_spaceBeforeCmd);
- g_spaceBeforeCmd.resize(0);
+ addOutput(yyscanner,yyextra->spaceBeforeCmd);
+ yyextra->spaceBeforeCmd.resize(0);
}
- addOutput("\\copybrief ");
+ addOutput(yyscanner,"\\copybrief ");
return FALSE;
}
-static bool handleCopyDetails(const QCString &, const QCStringList &)
+static bool handleCopyDetails(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- setOutput(OutputDoc);
- if (!g_spaceBeforeCmd.isEmpty())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ setOutput(yyscanner,OutputDoc);
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
- addOutput(g_spaceBeforeCmd);
- g_spaceBeforeCmd.resize(0);
+ addOutput(yyscanner,yyextra->spaceBeforeCmd);
+ yyextra->spaceBeforeCmd.resize(0);
}
- addOutput("\\copydetails ");
+ addOutput(yyscanner,"\\copydetails ");
return FALSE;
}
-static bool handleCopyDoc(const QCString &, const QCStringList &)
+static bool handleCopyDoc(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
- setOutput(OutputBrief);
- if (!g_spaceBeforeCmd.isEmpty())
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ setOutput(yyscanner,OutputBrief);
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
- addOutput(g_spaceBeforeCmd);
- g_spaceBeforeCmd.resize(0);
+ addOutput(yyscanner,yyextra->spaceBeforeCmd);
+ yyextra->spaceBeforeCmd.resize(0);
}
- addOutput("\\copybrief ");
- g_copyDocArg.resize(0);
+ addOutput(yyscanner,"\\copybrief ");
+ yyextra->copyDocArg.resize(0);
BEGIN(CopyDoc);
return FALSE;
}
-//----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------
-static void checkFormula()
+static void initParser(yyscan_t yyscanner)
{
- if (YY_START==ReadFormulaShort || YY_START==ReadFormulaLong)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->sectionLabel.resize(0);
+ yyextra->sectionTitle.resize(0);
+ Doxygen::docGroup.clearHeader();
+ yyextra->insideParBlock = FALSE;
+}
+
+
+static bool getDocSectionName(int s)
+{
+ switch(s)
{
- warn(yyFileName,yyLineNr,"End of comment block while inside formula.");
+ case Entry::CLASSDOC_SEC:
+ case Entry::STRUCTDOC_SEC:
+ case Entry::UNIONDOC_SEC:
+ case Entry::EXCEPTIONDOC_SEC:
+ case Entry::NAMESPACEDOC_SEC:
+ case Entry::PROTOCOLDOC_SEC:
+ case Entry::CATEGORYDOC_SEC:
+ case Entry::ENUMDOC_SEC:
+ case Entry::PAGEDOC_SEC:
+ case Entry::VARIABLEDOC_SEC:
+ case Entry::MEMBERDOC_SEC:
+ case Entry::OVERLOADDOC_SEC:
+ case Entry::FILEDOC_SEC:
+ case Entry::DEFINEDOC_SEC:
+ case Entry::GROUPDOC_SEC:
+ case Entry::MAINPAGEDOC_SEC:
+ case Entry::PACKAGEDOC_SEC:
+ case Entry::DIRDOC_SEC:
+ case Entry::EXAMPLE_SEC:
+ case Entry::MEMBERGRP_SEC:
+ return TRUE;
+ default:
+ return FALSE;
}
}
-//----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+static bool makeStructuralIndicator(yyscan_t yyscanner,Entry::Sections s)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ //printf("yyextra->current->section=%x\n",yyextra->current->section);
+ if (getDocSectionName(yyextra->current->section))
+ {
+ return TRUE;
+ }
+ else
+ {
+ yyextra->needNewEntry = TRUE;
+ yyextra->current->section = s;
+ yyextra->current->fileName = yyextra->fileName;
+ yyextra->current->startLine = yyextra->lineNr;
+ return FALSE;
+ }
+}
+
+//-----------------------------------------------------------------
+
+static void lineCount(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ for( const char* c = yytext ; *c ; ++c )
+ yyextra->lineNr += (*c == '\n') ;
+}
+
+//-----------------------------------------------------------------
+
+static QCString stripQuotes(const char *s)
+{
+ QCString name;
+ if (s==0 || *s==0) return name;
+ name=s;
+ if (name.at(0)=='"' && name.at(name.length()-1)=='"')
+ {
+ name=name.mid(1,name.length()-2);
+ }
+ return name;
+}
+
+//-----------------------------------------------------------------
-QCString preprocessCommentBlock(const QCString &comment,
- const QCString &fileName,
- int lineNr)
+static void addXRefItem(yyscan_t yyscanner,
+ const char *listName,const char *itemTitle,
+ const char *listTitle,bool append)
{
- if (!comment.isEmpty() && Doxygen::markdownSupport)
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (listName==0) return;
+ //printf("addXRefItem(%s,%s,%s,%d)\n",listName,itemTitle,listTitle,append);
+
+ const ListItemInfo *lii=0;
+ RefList *refList = Doxygen::xrefLists->find(listName);
+ if (refList==0) // new list
+ {
+ refList = new RefList(listName,listTitle,itemTitle);
+ Doxygen::xrefLists->insert(listName,refList);
+ //printf("new list!\n");
+ }
+ for (const ListItemInfo &item : yyextra->current->sli)
+ {
+ if (qstrcmp(item.type,listName)==0)
+ {
+ //printf("found %s lii->type=%s\n",listName,lii->type);
+ lii = &item;
+ break;
+ }
+ }
+ if (lii && append) // already found item of same type just before this one
{
- QCString result = processMarkdown(fileName,lineNr,0,comment);
- const char *p = result.data();
- if (p)
+ //printf("listName=%s item id = %d existing\n",listName,lii->itemId);
+ RefItem *item = refList->getRefItem(lii->itemId);
+ ASSERT(item!=0);
+ item->text += " <p>";
+ item->text += yyextra->outputXRef;
+ //printf("%s: text +=%s\n",listName,item->text.data());
+ }
+ else // new item
+ {
+ int itemId = refList->addRefItem();
+ //printf("listName=%s item id = %d new yyextra->current=%p\n",listName,itemId,yyextra->current);
+
+ // if we have already an item from the same list type (e.g. a second @todo)
+ // in the same Entry (i.e. lii!=0) then we reuse its link anchor.
+ char anchorLabel[1024];
+ //sprintf(anchorLabel,"_%s%06d",listName,lii ? lii->itemId : itemId);
+ sprintf(anchorLabel,"_%s%06d",listName,itemId);
+ RefItem *item = refList->getRefItem(itemId);
+ ASSERT(item!=0);
+ item->text = yyextra->outputXRef;
+ item->listAnchor = anchorLabel;
+ yyextra->current->addSpecialListItem(listName,itemId);
+ QCString cmdString;
+ cmdString.sprintf(" \\xrefitem %s %d.",listName,itemId);
+ if (yyextra->inBody)
{
- while (*p==' ') p++; // skip over spaces
- while (*p=='\n') p++; // skip over newlines
- if (qstrncmp(p,"<br>",4)==0) p+=4; // skip over <br>
+ yyextra->current->inbodyDocs += cmdString;
+ }
+ else
+ {
+ yyextra->current->doc += cmdString;
+ }
+ SectionInfo *si = Doxygen::sectionDict->find(anchorLabel);
+ if (si)
+ {
+ if (si->lineNr != -1)
+ {
+ warn(listName,yyextra->lineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",anchorLabel,si->fileName.data(),si->lineNr);
+ }
+ else
+ {
+ warn(listName,yyextra->lineNr,"multiple use of section label '%s', (first occurrence: %s)",anchorLabel,si->fileName.data());
+ }
}
- if (p>result.data())
+ else
{
- // strip part of the input
- result = result.mid(p-result.data());
+ si=new SectionInfo(listName,yyextra->lineNr,anchorLabel,
+ yyextra->sectionTitle,SectionInfo::Anchor,
+ yyextra->sectionLevel);
+ Doxygen::sectionDict->append(anchorLabel,si);
+ yyextra->current->anchors.push_back(si);
}
- return result;
+ }
+ yyextra->outputXRef.resize(0);
+}
+
+//-----------------------------------------------------------------------------
+
+// Adds a formula text to the list/dictionary of formulas if it was
+// not already added. Returns the label of the formula.
+static QCString addFormula(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ QCString formLabel;
+ QCString fText=yyextra->formulaText.simplifyWhiteSpace();
+ Formula *f=0;
+ if ((f=Doxygen::formulaDict->find(fText))==0)
+ {
+ f = new Formula(fText);
+ Doxygen::formulaList->append(f);
+ Doxygen::formulaDict->insert(fText,f);
+ formLabel.sprintf("\\_form#%d",f->getId());
+ Doxygen::formulaNameDict->insert(formLabel,f);
}
else
{
- return comment;
+ formLabel.sprintf("\\_form#%d",f->getId());
}
+ int i;
+ for (i=0;i<yyextra->formulaNewLines;i++) formLabel+="@_fakenl"; // add fake newlines to
+ // keep the warnings
+ // correctly aligned.
+ return formLabel;
+}
+
+//-----------------------------------------------------------------------------
+
+static SectionInfo::SectionType sectionLevelToType(int level)
+{
+ if (level>=0 && level<5) return (SectionInfo::SectionType)level;
+ return SectionInfo::Anchor;
+}
+
+static void addSection(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ SectionInfo *si = Doxygen::sectionDict->find(yyextra->sectionLabel);
+ if (si)
+ {
+ if (si->lineNr != -1)
+ {
+ warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding section, (first occurrence: %s, line %d)",yyextra->sectionLabel.data(),si->fileName.data(),si->lineNr);
+ }
+ else
+ {
+ warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding section, (first occurrence: %s)",yyextra->sectionLabel.data(),si->fileName.data());
+ }
+ }
+ else
+ {
+ // create a new section element
+ yyextra->sectionTitle+=yytext;
+ yyextra->sectionTitle=yyextra->sectionTitle.stripWhiteSpace();
+ si = new SectionInfo(yyextra->fileName,yyextra->lineNr,yyextra->sectionLabel,
+ yyextra->sectionTitle,sectionLevelToType(yyextra->sectionLevel),yyextra->sectionLevel);
+
+ // add section to this entry
+ yyextra->current->anchors.push_back(si);
+
+ // add section to the global dictionary
+ Doxygen::sectionDict->append(yyextra->sectionLabel,si);
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+static void addCite(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ QCString name=yytext;
+ if (yytext[0] =='"')
+ {
+ name=yytext+1;
+ name=name.left(yyleng-2);
+ }
+ Doxygen::citeDict->insert(name.data());
+}
+
+//-----------------------------------------------------------------------------
+
+// strip trailing whitespace (excluding newlines) from string s
+static void stripTrailingWhiteSpace(QCString &s)
+{
+ uint len = s.length();
+ int i = (int)len-1;
+ char c;
+ while (i>=0 && ((c = s.at(i))==' ' || c=='\t' || c=='\r')) i--;
+ if (i!=(int)len-1)
+ {
+ s.resize(i+2); // string up to and including char at pos i and \0 terminator
+ }
+}
+
+// selects the output to write to
+static inline void setOutput(yyscan_t yyscanner,OutputContext ctx)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ bool xrefAppendToPrev = yyextra->xrefAppendFlag;
+ // determine append flag for the next item (i.e. the end of this item)
+ yyextra->xrefAppendFlag = !yyextra->inBody &&
+ yyextra->inContext==OutputXRef && ctx==OutputXRef && // two consecutive xref items
+ yyextra->newXRefKind==yyextra->xrefKind && // of the same kind
+ (yyextra->xrefKind!=XRef_Item ||
+ yyextra->newXRefItemKey==yyextra->xrefItemKey); // with the same key if \xrefitem
+ //printf("%d && %d && %d && (%d || %d)\n",
+ // yyextra->inContext==OutputXRef,
+ // ctx==OutputXRef,
+ // yyextra->newXRefKind==yyextra->xrefKind,
+ // yyextra->xrefKind!=XRef_Item,
+ // yyextra->newXRefItemKey==yyextra->xrefItemKey);
+ //printf("refKind=%d yyextra->newXRefKind=%d xrefAppendToPrev=%d yyextra->xrefAppendFlag=%d\n",
+ // yyextra->xrefKind,yyextra->newXRefKind,xrefAppendToPrev,yyextra->xrefAppendFlag);
+
+ //printf("setOutput(yyscanner,yyextra->inContext=%d ctx=%d)\n",yyextra->inContext,ctx);
+ if (yyextra->inContext==OutputXRef) // end of XRef section => add the item
+ {
+ // See if we can append this new xref item to the previous one.
+ // We know this at the start of the next item of the same
+ // type and need to remember this until the end of that item.
+ switch(yyextra->xrefKind)
+ {
+ case XRef_Todo:
+ addXRefItem(yyscanner,"todo",
+ theTranslator->trTodo(),
+ theTranslator->trTodoList(),
+ xrefAppendToPrev
+ );
+ break;
+ case XRef_Test:
+ addXRefItem(yyscanner,"test",
+ theTranslator->trTest(),
+ theTranslator->trTestList(),
+ xrefAppendToPrev
+ );
+ break;
+ case XRef_Bug:
+ addXRefItem(yyscanner,"bug",
+ theTranslator->trBug(),
+ theTranslator->trBugList(),
+ xrefAppendToPrev
+ );
+ break;
+ case XRef_Deprecated:
+ addXRefItem(yyscanner,"deprecated",
+ theTranslator->trDeprecated(),
+ theTranslator->trDeprecatedList(),
+ xrefAppendToPrev
+ );
+ break;
+ case XRef_Item: // user defined list
+ addXRefItem(yyscanner,yyextra->xrefItemKey,
+ yyextra->xrefItemTitle,
+ yyextra->xrefListTitle,
+ xrefAppendToPrev
+ );
+ break;
+ case XRef_None:
+ ASSERT(0);
+ break;
+ }
+ }
+ yyextra->xrefItemKey = yyextra->newXRefItemKey;
+
+ int oldContext = yyextra->inContext;
+ yyextra->inContext = ctx;
+ if (yyextra->inContext!=OutputXRef && yyextra->inBody) yyextra->inContext=OutputInbody;
+ switch(yyextra->inContext)
+ {
+ case OutputDoc:
+ if (oldContext!=yyextra->inContext)
+ {
+ stripTrailingWhiteSpace(yyextra->current->doc);
+ if (yyextra->current->docFile.isEmpty())
+ {
+ yyextra->current->docFile = yyextra->fileName;
+ yyextra->current->docLine = yyextra->lineNr;
+ }
+ }
+ yyextra->pOutputString = &yyextra->current->doc;
+ break;
+ case OutputBrief:
+ if (oldContext!=yyextra->inContext)
+ {
+ if (yyextra->current->briefFile.isEmpty())
+ {
+ yyextra->current->briefFile = yyextra->fileName;
+ yyextra->current->briefLine = yyextra->lineNr;
+ }
+ }
+ if (yyextra->current->brief.stripWhiteSpace().isEmpty()) // we only want one brief
+ // description even if multiple
+ // are given...
+ {
+ yyextra->pOutputString = &yyextra->current->brief;
+ }
+ else
+ {
+ if (!yyextra->current->doc.isEmpty()) // when appending parts add a new line
+ {
+ yyextra->current->doc += "\n";
+ }
+ yyextra->pOutputString = &yyextra->current->doc;
+ yyextra->inContext = OutputDoc; // need to switch to detailed docs, see bug 631380
+ }
+ break;
+ case OutputXRef:
+ yyextra->pOutputString = &yyextra->outputXRef;
+ // first item found, so can't append to previous
+ //yyextra->xrefAppendFlag = FALSE;
+ break;
+ case OutputInbody:
+ yyextra->pOutputString = &yyextra->current->inbodyDocs;
+ break;
+ }
+}
+
+
+static void addAnchor(yyscan_t yyscanner,const char *anchor)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ SectionInfo *si = Doxygen::sectionDict->find(anchor);
+ if (si)
+ {
+ if (si->lineNr != -1)
+ {
+ warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding anchor, (first occurrence: %s, line %d)",anchor,si->fileName.data(),si->lineNr);
+ }
+ else
+ {
+ warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding anchor, (first occurrence: %s)",anchor,si->fileName.data());
+ }
+ }
+ else
+ {
+ si = new SectionInfo(yyextra->fileName,yyextra->lineNr,anchor,0,SectionInfo::Anchor,0);
+ Doxygen::sectionDict->append(anchor,si);
+ yyextra->current->anchors.push_back(si);
+ }
+}
+
+// add a string to the output
+static inline void addOutput(yyscan_t yyscanner,const char *s)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ //printf("addOutput(yyscanner,%s)\n",s);
+ *yyextra->pOutputString+=s;
+}
+
+// add a character to the output
+static inline void addOutput(yyscan_t yyscanner,char c)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ *yyextra->pOutputString+=c;
+}
+
+static void endBrief(yyscan_t yyscanner,bool addToOutput)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (!yyextra->current->brief.stripWhiteSpace().isEmpty())
+ { // only go to the detailed description if we have
+ // found some brief description and not just whitespace
+ yyextra->briefEndsAtDot=FALSE;
+ setOutput(yyscanner,OutputDoc);
+ if (addToOutput) addOutput(yyscanner,yytext);
+ }
+}
+
+static int yyread(yyscan_t yyscanner,char *buf,int max_size)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->prevPosition=yyextra->inputPosition;
+ int c=0;
+ while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
+ {
+ *buf = yyextra->inputString[yyextra->inputPosition++] ;
+ //printf("%d (%c)\n",*buf,*buf);
+ c++; buf++;
+ }
+ return c;
+}
+
+//----------------------------------------------------------------------------
+
+static void checkFormula(yyscan_t yyscanner)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ if (YY_START==ReadFormulaShort || YY_START==ReadFormulaLong)
+ {
+ warn(yyextra->fileName,yyextra->lineNr,"End of comment block while inside formula.");
+ }
+}
+
+//----------------------------------------------------------------------------
+
+struct CommentScanner::Private
+{
+ yyscan_t yyscanner;
+ commentscanYY_state extra;
+};
+
+CommentScanner::CommentScanner() : p(std::make_unique<Private>())
+{
+ commentscanYYlex_init_extra(&p->extra,&p->yyscanner);
+#ifdef FLEX_DEBUG
+ commentscanYYset_debug(1,p->yyscanner);
+#endif
+}
+
+CommentScanner::~CommentScanner()
+{
+ commentscanYYlex_destroy(p->yyscanner);
}
-bool parseCommentBlock(/* in */ OutlineParserInterface *parser,
+bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *parser,
/* in */ Entry *curEntry,
/* in */ const QCString &comment,
/* in */ const QCString &fileName,
@@ -3139,143 +3253,146 @@ bool parseCommentBlock(/* in */ OutlineParserInterface *parser,
/* out */ bool &newEntryNeeded
)
{
+ yyscan_t yyscanner = p->yyscanner;
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
//printf("parseCommentBlock() isBrief=%d isAutoBriefOn=%d lineNr=%d\n",
// isBrief,isAutoBriefOn,lineNr);
- initParser();
- guards.setAutoDelete(TRUE);
- guards.clear();
- langParser = parser;
- current = curEntry;
+ initParser(yyscanner);
+ yyextra->guards.setAutoDelete(TRUE);
+ yyextra->guards.clear();
+ yyextra->langParser = parser;
+ yyextra->current = curEntry;
if (comment.isEmpty()) return FALSE; // avoid empty strings
- inputString = comment;
- inputString.append(" ");
- inputPosition = position;
- yyLineNr = lineNr;
- yyFileName = fileName;
- protection = prot;
- needNewEntry = FALSE;
- xrefKind = XRef_None;
- xrefAppendFlag = FALSE;
- insidePre = FALSE;
- parseMore = FALSE;
- inBody = isInbody;
- outputXRef.resize(0);
- if (!isBrief && !isAutoBriefOn && !current->doc.isEmpty())
+ yyextra->inputString = comment;
+ yyextra->inputString.append(" ");
+ yyextra->inputPosition = position;
+ yyextra->lineNr = lineNr;
+ yyextra->fileName = fileName;
+ yyextra->protection = prot;
+ yyextra->needNewEntry = FALSE;
+ yyextra->xrefKind = XRef_None;
+ yyextra->xrefAppendFlag = FALSE;
+ yyextra->insidePre = FALSE;
+ yyextra->parseMore = FALSE;
+ yyextra->inBody = isInbody;
+ yyextra->outputXRef.resize(0);
+ if (!isBrief && !isAutoBriefOn && !yyextra->current->doc.isEmpty())
{ // add newline separator between detailed comment blocks
- current->doc += '\n';
+ yyextra->current->doc += '\n';
}
- setOutput( isBrief || isAutoBriefOn ? OutputBrief : OutputDoc );
- briefEndsAtDot = isAutoBriefOn;
- g_condCount = 0;
- g_sectionLevel = 0;
- g_spaceBeforeCmd.resize(0);
- g_spaceBeforeIf.resize(0);
+ setOutput(yyscanner, isBrief || isAutoBriefOn ? OutputBrief : OutputDoc );
+ yyextra->briefEndsAtDot = isAutoBriefOn;
+ yyextra->condCount = 0;
+ yyextra->sectionLevel = 0;
+ yyextra->spaceBeforeCmd.resize(0);
+ yyextra->spaceBeforeIf.resize(0);
printlex(yy_flex_debug, TRUE, __FILE__, fileName ? fileName.data(): NULL);
- if (!current->inbodyDocs.isEmpty() && isInbody) // separate in body fragments
+ if (!yyextra->current->inbodyDocs.isEmpty() && isInbody) // separate in body fragments
{
- current->inbodyDocs+="\n\n";
+ yyextra->current->inbodyDocs+="\n\n";
}
Debug::print(Debug::CommentScan,0,"-----------\nCommentScanner: %s:%d\n"
- "input=[\n%s]\n",qPrint(fileName),lineNr,qPrint(inputString)
+ "input=[\n%s]\n",qPrint(fileName),lineNr,qPrint(yyextra->inputString)
);
- commentscanYYrestart( commentscanYYin );
+ commentscanYYrestart( 0, yyscanner );
BEGIN( Comment );
- commentscanYYlex();
- setOutput( OutputDoc );
+ commentscanYYlex(yyscanner);
+ setOutput(yyscanner, OutputDoc );
if (YY_START==OverloadParam) // comment ended with \overload
{
- addOutput(getOverloadDocs());
+ addOutput(yyscanner,getOverloadDocs());
}
- if (!guards.isEmpty())
+ if (!yyextra->guards.isEmpty())
{
- warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!");
+ warn(yyextra->fileName,yyextra->lineNr,"Documentation block ended in the middle of a conditional section!");
}
- if (g_insideParBlock)
+ if (yyextra->insideParBlock)
{
- warn(yyFileName,yyLineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"Documentation block ended while inside a \\parblock. Missing \\endparblock");
}
- current->doc=stripLeadingAndTrailingEmptyLines(current->doc,current->docLine);
+ yyextra->current->doc=stripLeadingAndTrailingEmptyLines(yyextra->current->doc,yyextra->current->docLine);
- if (current->section==Entry::FILEDOC_SEC && current->doc.isEmpty())
+ if (yyextra->current->section==Entry::FILEDOC_SEC && yyextra->current->doc.isEmpty())
{
// to allow a comment block with just a @file command.
- current->doc="\n\n";
+ yyextra->current->doc="\n\n";
}
- if (current->section==Entry::MEMBERGRP_SEC &&
+ if (yyextra->current->section==Entry::MEMBERGRP_SEC &&
Doxygen::docGroup.isEmpty()) // @name section but no group started yet
{
- Doxygen::docGroup.open(current,yyFileName,yyLineNr,true);
+ Doxygen::docGroup.open(yyextra->current,yyextra->fileName,yyextra->lineNr,true);
}
Debug::print(Debug::CommentScan,0,"-----------\nCommentScanner: %s:%d\noutput=[\n"
"brief=[line=%d\n%s]\ndocs=[line=%d\n%s]\ninbody=[line=%d\n%s]\n]\n===========\n",
qPrint(fileName),lineNr,
- current->briefLine,qPrint(current->brief),
- current->docLine,qPrint(current->doc),
- current->inbodyLine,qPrint(current->inbodyDocs)
+ yyextra->current->briefLine,qPrint(yyextra->current->brief),
+ yyextra->current->docLine,qPrint(yyextra->current->doc),
+ yyextra->current->inbodyLine,qPrint(yyextra->current->inbodyDocs)
);
- checkFormula();
- prot = protection;
+ checkFormula(yyscanner);
+ prot = yyextra->protection;
Doxygen::docGroup.addDocs(curEntry);
- newEntryNeeded = needNewEntry;
+ newEntryNeeded = yyextra->needNewEntry;
// if we did not proceed during this call, it does not make
// sense to continue, since we get stuck. See bug 567346 for situations
// were this happens
- if (parseMore && position==inputPosition) parseMore=FALSE;
+ if (yyextra->parseMore && position==yyextra->inputPosition) yyextra->parseMore=FALSE;
- if (parseMore) position=inputPosition; else position=0;
+ if (yyextra->parseMore) position=yyextra->inputPosition; else position=0;
- lineNr = yyLineNr;
- //printf("position=%d parseMore=%d newEntryNeeded=%d\n",
- // position,parseMore,newEntryNeeded);
+ lineNr = yyextra->lineNr;
+ //printf("position=%d yyextra->parseMore=%d newEntryNeeded=%d\n",
+ // position,yyextra->parseMore,newEntryNeeded);
printlex(yy_flex_debug, FALSE, __FILE__, fileName ? fileName.data(): NULL);
- return parseMore;
+ return yyextra->parseMore;
}
-static void handleGuard(const QCString &expr)
+static void handleGuard(yyscan_t yyscanner,const QCString &expr)
{
+ struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
CondParser prs;
- bool sectionEnabled=prs.parse(yyFileName,yyLineNr,expr.stripWhiteSpace());
+ bool sectionEnabled=prs.parse(yyextra->fileName,yyextra->lineNr,expr.stripWhiteSpace());
bool parentEnabled = TRUE;
- if (!guards.isEmpty()) parentEnabled = guards.top()->isEnabled();
+ if (!yyextra->guards.isEmpty()) parentEnabled = yyextra->guards.top()->isEnabled();
if (parentEnabled)
{
if (
- (sectionEnabled && guardType==Guard_If) ||
- (!sectionEnabled && guardType==Guard_IfNot)
+ (sectionEnabled && yyextra->guardType==Guard_If) ||
+ (!sectionEnabled && yyextra->guardType==Guard_IfNot)
) // section is visible
{
- guards.push(new GuardedSection(TRUE,TRUE));
- enabledSectionFound=TRUE;
+ yyextra->guards.push(new GuardedSection(TRUE,TRUE));
+ yyextra->enabledSectionFound=TRUE;
BEGIN( GuardParamEnd );
}
else // section is invisible
{
- if (guardType!=Guard_Skip)
+ if (yyextra->guardType!=Guard_Skip)
{
- guards.push(new GuardedSection(FALSE,TRUE));
+ yyextra->guards.push(new GuardedSection(FALSE,TRUE));
}
BEGIN( SkipGuardedSection );
}
}
else // invisible because of parent
{
- guards.push(new GuardedSection(FALSE,FALSE));
+ yyextra->guards.push(new GuardedSection(FALSE,FALSE));
BEGIN( SkipGuardedSection );
}
}