summaryrefslogtreecommitdiffstats
path: root/src/commentscan.l
diff options
context:
space:
mode:
Diffstat (limited to 'src/commentscan.l')
-rw-r--r--src/commentscan.l2897
1 files changed, 1462 insertions, 1435 deletions
diff --git a/src/commentscan.l b/src/commentscan.l
index 02117c2..767b964 100644
--- a/src/commentscan.l
+++ b/src/commentscan.l
@@ -1,10 +1,10 @@
/*****************************************************************************
*
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -17,44 +17,47 @@
%option prefix="commentscanYY"
%option reentrant
%option extra-type="struct commentscanYY_state *"
+%top{
+#include <stdint.h>
+}
%{
/*
- * includes
+ * includes
*/
+
+#include <map>
+#include <stack>
+#include <string>
+#include <mutex>
+
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <ctype.h>
-#include <qarray.h>
-#include <qstack.h>
-#include <qregexp.h>
-#include <qfile.h>
+#include <qcstring.h>
#include <qcstringlist.h>
+
+#include "cite.h"
#include "commentscan.h"
-#include "scanner.h"
-#include "entry.h"
+#include "condparser.h"
+#include "config.h"
+#include "debug.h"
+#include "docgroup.h"
#include "doxygen.h"
+#include "entry.h"
+#include "formula.h"
+#include "language.h"
#include "message.h"
-#include "config.h"
+#include "parserintf.h"
+#include "reflist.h"
+#include "section.h"
#include "util.h"
-#include "index.h"
-#include "defargs.h"
-#include "language.h"
-#include "outputlist.h"
-#include "membergroup.h"
#include "reflist.h"
-#include "debug.h"
-#include "parserintf.h"
-#include "cite.h"
-#include "markdown.h"
-#include "condparser.h"
-#include "formula.h"
-#define YY_NO_INPUT 1
-#define YY_NO_UNISTD_H 1
+#define USE_STATE2STRING 0
// forward declarations
static bool handleBrief(yyscan_t yyscanner,const QCString &, const QCStringList &);
@@ -116,7 +119,6 @@ static bool handleHideReferencedByRelation(yyscan_t yyscanner,const QCString &,
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 &);
@@ -136,223 +138,176 @@ static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStrin
static bool handleParam(yyscan_t yyscanner,const QCString &, const QCStringList &);
static bool handleRetval(yyscan_t yyscanner,const QCString &, const QCStringList &);
+#if USE_STATE2STRING
static const char *stateToString(int state);
+#endif
typedef bool (*DocCmdFunc)(yyscan_t yyscanner,const QCString &name, const QCStringList &optList);
+enum class CommandSpacing
+{
+ Invisible, // command sets some property but does not appear in the output.
+ Inline, // command appears inline in the output which can be a brief description.
+ Block, // command starts a new paragraphs / ends a brief description.
+ XRef // command is a cross reference (todo, bug, test, xrefitem).
+};
+
struct DocCmdMap
{
- const char *cmdName;
+ DocCmdMap(DocCmdFunc h,CommandSpacing s) : handler(h), spacing(s) {}
DocCmdFunc handler;
- bool endsBrief;
+ CommandSpacing spacing;
};
// map of command to handler function
-static DocCmdMap docCmdMap[] =
-{
- // command name handler function ends brief description
- { "brief", &handleBrief, FALSE },
- { "short", &handleBrief, FALSE },
- { "fn", &handleFn, TRUE },
- { "var", &handleFn, TRUE },
- { "typedef", &handleFn, TRUE },
- { "property", &handleFn, TRUE },
- { "def", &handleDef, TRUE },
- { "overload", &handleOverload, FALSE },
- { "enum", &handleEnum, TRUE },
- { "defgroup", &handleDefGroup, TRUE },
- { "addtogroup", &handleAddToGroup, TRUE },
- { "weakgroup", &handleWeakGroup, TRUE },
- { "namespace", &handleNamespace, TRUE },
- { "package", &handlePackage, TRUE },
- { "class", &handleClass, TRUE },
- { "headerfile", &handleHeaderFile, FALSE },
- { "protocol", &handleProtocol, TRUE },
- { "category", &handleCategory, TRUE },
- { "union", &handleUnion, TRUE },
- { "struct", &handleStruct, TRUE },
- { "interface", &handleInterface, TRUE },
- { "idlexcept", &handleIdlException, TRUE },
- { "page", &handlePage, TRUE },
- { "mainpage", &handleMainpage, TRUE },
- { "file", &handleFile, TRUE },
- { "dir", &handleDir, TRUE },
- { "example", &handleExample, FALSE },
- { "details", &handleDetails, TRUE },
- { "name", &handleName, FALSE },
- { "todo", &handleTodo, FALSE }, // end brief will be done differently
- { "test", &handleTest, FALSE }, // end brief will be done differently
- { "bug", &handleBug, FALSE }, // end brief will be done differently
- { "deprecated", &handleDeprecated, FALSE }, // end brief will be done differently
- { "xrefitem", &handleXRefItem, FALSE }, // end brief will be done differently
- { "related", &handleRelated, TRUE },
- { "relates", &handleRelated, TRUE },
- { "relatedalso", &handleRelatedAlso, TRUE },
- { "relatesalso", &handleRelatedAlso, TRUE },
- { "parblock", &handleParBlock, TRUE },
- { "endparblock", &handleEndParBlock, TRUE },
- { "refitem", &handleRefItem, TRUE },
- { "cite", &handleCite, FALSE },
- { "subpage", &handleSubpage, TRUE },
- { "section", &handleSection, TRUE },
- { "subsection", &handleSection, TRUE },
- { "subsubsection", &handleSection, TRUE },
- { "paragraph", &handleSection, TRUE },
- { "anchor", &handleAnchor, TRUE },
- { "verbatim", &handleFormatBlock, TRUE },
- { "latexonly", &handleFormatBlock, FALSE },
- { "htmlonly", &handleFormatBlock, FALSE },
- { "xmlonly", &handleFormatBlock, FALSE },
- { "docbookonly", &handleFormatBlock, FALSE },
- { "rtfonly", &handleFormatBlock, FALSE },
- { "manonly", &handleFormatBlock, FALSE },
- { "dot", &handleFormatBlock, TRUE },
- { "msc", &handleFormatBlock, TRUE },
- { "startuml", &handleFormatBlock, TRUE },
- { "code", &handleFormatBlock, TRUE },
- { "addindex", &handleAddIndex, FALSE },
- { "if", &handleIf, FALSE },
- { "ifnot", &handleIfNot, FALSE },
- { "elseif", &handleElseIf, FALSE },
- { "else", &handleElse, FALSE },
- { "endif", &handleEndIf, FALSE },
- { "ingroup", &handleIngroup, TRUE },
- { "nosubgrouping", &handleNoSubGrouping, FALSE },
- { "showinitializer", &handleShowInitializer, FALSE },
- { "hideinitializer", &handleHideInitializer, FALSE },
- { "callgraph", &handleCallgraph, FALSE },
- { "hidecallgraph", &handleHideCallgraph, FALSE },
- { "callergraph", &handleCallergraph, FALSE },
- { "hidecallergraph", &handleHideCallergraph, FALSE },
- { "showrefby", &handleReferencedByRelation, FALSE },
- { "hiderefby", &handleHideReferencedByRelation, FALSE },
- { "showrefs", &handleReferencesRelation, FALSE },
- { "hiderefs", &handleHideReferencesRelation, FALSE },
- { "internal", &handleInternal, TRUE },
- { "_linebr", &handleLineBr, FALSE },
- { "static", &handleStatic, FALSE },
- { "pure", &handlePure, FALSE },
- { "private", &handlePrivate, FALSE },
- { "privatesection", &handlePrivateSection, FALSE },
- { "protected", &handleProtected, FALSE },
- { "protectedsection",&handleProtectedSection, FALSE },
- { "public", &handlePublic, FALSE },
- { "publicsection", &handlePublicSection, FALSE },
- { "tableofcontents", &handleToc, FALSE },
- { "inherit", &handleInherit, TRUE },
- { "extends", &handleExtends, TRUE },
- { "implements", &handleExtends, TRUE },
- { "memberof", &handleMemberOf, TRUE },
- { "arg", 0, TRUE },
- { "attention", 0, TRUE },
- { "author", 0, TRUE },
- { "authors", 0, TRUE },
- { "copydoc", &handleCopyDoc, TRUE },
- { "copybrief", &handleCopyBrief, FALSE },
- { "copydetails", &handleCopyDetails, TRUE },
- { "copyright", 0, TRUE },
- { "date", 0, TRUE },
- { "dotfile", 0, TRUE },
- { "htmlinclude", 0, FALSE },
- { "image", 0, TRUE },
- { "include", 0, TRUE },
- { "includelineno", 0, TRUE },
- { "invariant", 0, TRUE },
- { "latexinclude", 0, FALSE },
- { "li", 0, TRUE },
- { "line", 0, TRUE },
- { "note", 0, TRUE },
- { "par", 0, TRUE },
- { "param", &handleParam, TRUE },
- { "tparam", 0, TRUE },
- { "post", 0, TRUE },
- { "pre", 0, TRUE },
- { "remark", 0, TRUE },
- { "remarks", 0, TRUE },
- { "result", 0, TRUE },
- { "return", 0, TRUE },
- { "returns", 0, TRUE },
- { "exception", 0, TRUE },
- { "retval", &handleRetval, TRUE },
- { "sa", 0, TRUE },
- { "see", 0, TRUE },
- { "since", 0, TRUE },
- { "throw", 0, TRUE },
- { "throws", 0, TRUE },
- { "until", 0, TRUE },
- { "verbinclude", 0, FALSE },
- { "version", 0, TRUE },
- { "warning", 0, TRUE },
- { "snippet", 0, TRUE },
- { "snippetlineno", 0, TRUE },
- { "noop", &handleNoop, TRUE },
- { 0, 0, FALSE }
+static const std::map< std::string, DocCmdMap > docCmdMap =
+{
+ // command name handler function command spacing
+ { "addindex", { &handleAddIndex, CommandSpacing::Invisible }},
+ { "addtogroup", { &handleAddToGroup, CommandSpacing::Invisible }},
+ { "anchor", { &handleAnchor, CommandSpacing::Invisible }},
+ { "arg", { 0, CommandSpacing::Block }},
+ { "attention", { 0, CommandSpacing::Block }},
+ { "author", { 0, CommandSpacing::Block }},
+ { "authors", { 0, CommandSpacing::Block }},
+ { "brief", { &handleBrief, CommandSpacing::Invisible }},
+ { "bug", { &handleBug, CommandSpacing::XRef }},
+ { "callergraph", { &handleCallergraph, CommandSpacing::Invisible }},
+ { "callgraph", { &handleCallgraph, CommandSpacing::Invisible }},
+ { "category", { &handleCategory, CommandSpacing::Invisible }},
+ { "cite", { &handleCite, CommandSpacing::Inline }},
+ { "class", { &handleClass, CommandSpacing::Invisible }},
+ { "code", { &handleFormatBlock, CommandSpacing::Block }},
+ { "copybrief", { &handleCopyBrief, CommandSpacing::Invisible }},
+ { "copydetails", { &handleCopyDetails, CommandSpacing::Block }},
+ { "copydoc", { &handleCopyDoc, CommandSpacing::Block }},
+ { "copyright", { 0, CommandSpacing::Block }},
+ { "date", { 0, CommandSpacing::Block }},
+ { "def", { &handleDef, CommandSpacing::Invisible }},
+ { "defgroup", { &handleDefGroup, CommandSpacing::Invisible }},
+ { "deprecated", { &handleDeprecated, CommandSpacing::XRef }},
+ { "details", { &handleDetails, CommandSpacing::Block }},
+ { "dir", { &handleDir, CommandSpacing::Invisible }},
+ { "docbookinclude", { 0, CommandSpacing::Inline }},
+ { "docbookonly", { &handleFormatBlock, CommandSpacing::Invisible }},
+ { "dot", { &handleFormatBlock, CommandSpacing::Block }},
+ { "dotfile", { 0, CommandSpacing::Block }},
+ { "else", { &handleElse, CommandSpacing::Inline }},
+ { "elseif", { &handleElseIf, CommandSpacing::Inline }},
+ { "endif", { &handleEndIf, CommandSpacing::Inline }},
+ { "endparblock", { &handleEndParBlock, CommandSpacing::Block }},
+ { "enum", { &handleEnum, CommandSpacing::Invisible }},
+ { "example", { &handleExample, CommandSpacing::Invisible }},
+ { "exception", { 0, CommandSpacing::Block }},
+ { "extends", { &handleExtends, CommandSpacing::Invisible }},
+ { "file", { &handleFile, CommandSpacing::Invisible }},
+ { "fn", { &handleFn, CommandSpacing::Invisible }},
+ { "headerfile", { &handleHeaderFile, CommandSpacing::Invisible }},
+ { "hidecallergraph", { &handleHideCallergraph, CommandSpacing::Invisible }},
+ { "hidecallgraph", { &handleHideCallgraph, CommandSpacing::Invisible }},
+ { "hideinitializer", { &handleHideInitializer, CommandSpacing::Invisible }},
+ { "hiderefby", { &handleHideReferencedByRelation, CommandSpacing::Invisible }},
+ { "hiderefs", { &handleHideReferencesRelation, CommandSpacing::Invisible }},
+ { "htmlinclude", { 0, CommandSpacing::Inline }},
+ { "htmlonly", { &handleFormatBlock, CommandSpacing::Invisible }},
+ { "idlexcept", { &handleIdlException, CommandSpacing::Invisible }},
+ { "if", { &handleIf, CommandSpacing::Inline }},
+ { "ifnot", { &handleIfNot, CommandSpacing::Inline }},
+ { "image", { 0, CommandSpacing::Block }},
+ { "implements", { &handleExtends, CommandSpacing::Invisible }},
+ { "include", { 0, CommandSpacing::Block }},
+ { "includelineno", { 0, CommandSpacing::Block }},
+ { "ingroup", { &handleIngroup, CommandSpacing::Invisible }},
+ { "inherit", { &handleInherit, CommandSpacing::Invisible }},
+ { "interface", { &handleInterface, CommandSpacing::Invisible }},
+ { "internal", { &handleInternal, CommandSpacing::Block }},
+ { "invariant", { 0, CommandSpacing::Block }},
+ { "latexinclude", { 0, CommandSpacing::Inline }},
+ { "latexonly", { &handleFormatBlock, CommandSpacing::Invisible }},
+ { "li", { 0, CommandSpacing::Block }},
+ { "line", { 0, CommandSpacing::Invisible }},
+ { "mainpage", { &handleMainpage, CommandSpacing::Invisible }},
+ { "maninclude", { 0, CommandSpacing::Inline }},
+ { "manonly", { &handleFormatBlock, CommandSpacing::Invisible }},
+ { "memberof", { &handleMemberOf, CommandSpacing::Invisible }},
+ { "msc", { &handleFormatBlock, CommandSpacing::Block }},
+ { "name", { &handleName, CommandSpacing::Invisible }},
+ { "namespace", { &handleNamespace, CommandSpacing::Invisible }},
+ { "noop", { &handleNoop, CommandSpacing::Invisible }},
+ { "nosubgrouping", { &handleNoSubGrouping, CommandSpacing::Invisible }},
+ { "note", { 0, CommandSpacing::Block }},
+ { "overload", { &handleOverload, CommandSpacing::Invisible }},
+ { "package", { &handlePackage, CommandSpacing::Invisible }},
+ { "page", { &handlePage, CommandSpacing::Invisible }},
+ { "par", { 0, CommandSpacing::Block }},
+ { "paragraph", { &handleSection, CommandSpacing::Block }},
+ { "param", { &handleParam, CommandSpacing::Block }},
+ { "parblock", { &handleParBlock, CommandSpacing::Block }},
+ { "post", { 0, CommandSpacing::Block }},
+ { "pre", { 0, CommandSpacing::Block }},
+ { "private", { &handlePrivate, CommandSpacing::Invisible }},
+ { "privatesection", { &handlePrivateSection, CommandSpacing::Invisible }},
+ { "property", { &handleFn, CommandSpacing::Invisible }},
+ { "protected", { &handleProtected, CommandSpacing::Invisible }},
+ { "protectedsection",{ &handleProtectedSection, CommandSpacing::Invisible }},
+ { "protocol", { &handleProtocol, CommandSpacing::Invisible }},
+ { "public", { &handlePublic, CommandSpacing::Invisible }},
+ { "publicsection", { &handlePublicSection, CommandSpacing::Invisible }},
+ { "pure", { &handlePure, CommandSpacing::Invisible }},
+ { "refitem", { &handleRefItem, CommandSpacing::Inline }},
+ { "related", { &handleRelated, CommandSpacing::Invisible }},
+ { "relatedalso", { &handleRelatedAlso, CommandSpacing::Invisible }},
+ { "relates", { &handleRelated, CommandSpacing::Invisible }},
+ { "relatesalso", { &handleRelatedAlso, CommandSpacing::Invisible }},
+ { "remark", { 0, CommandSpacing::Block }},
+ { "remarks", { 0, CommandSpacing::Block }},
+ { "result", { 0, CommandSpacing::Block }},
+ { "return", { 0, CommandSpacing::Block }},
+ { "returns", { 0, CommandSpacing::Block }},
+ { "retval", { &handleRetval, CommandSpacing::Block }},
+ { "rtfinclude", { 0, CommandSpacing::Inline }},
+ { "rtfonly", { &handleFormatBlock, CommandSpacing::Invisible }},
+ { "sa", { 0, CommandSpacing::Block }},
+ { "section", { &handleSection, CommandSpacing::Block }},
+ { "see", { 0, CommandSpacing::Block }},
+ { "short", { &handleBrief, CommandSpacing::Invisible }},
+ { "showinitializer", { &handleShowInitializer, CommandSpacing::Invisible }},
+ { "showrefby", { &handleReferencedByRelation, CommandSpacing::Invisible }},
+ { "showrefs", { &handleReferencesRelation, CommandSpacing::Invisible }},
+ { "since", { 0, CommandSpacing::Block }},
+ { "snippet", { 0, CommandSpacing::Block }},
+ { "snippetlineno", { 0, CommandSpacing::Block }},
+ { "startuml", { &handleFormatBlock, CommandSpacing::Block }},
+ { "static", { &handleStatic, CommandSpacing::Invisible }},
+ { "struct", { &handleStruct, CommandSpacing::Invisible }},
+ { "subpage", { &handleSubpage, CommandSpacing::Inline }},
+ { "subsection", { &handleSection, CommandSpacing::Block }},
+ { "subsubsection", { &handleSection, CommandSpacing::Block }},
+ { "tableofcontents", { &handleToc, CommandSpacing::Invisible }},
+ { "test", { &handleTest, CommandSpacing::XRef }},
+ { "throw", { 0, CommandSpacing::Block }},
+ { "throws", { 0, CommandSpacing::Block }},
+ { "todo", { &handleTodo, CommandSpacing::XRef }},
+ { "tparam", { 0, CommandSpacing::Block }},
+ { "typedef", { &handleFn, CommandSpacing::Invisible }},
+ { "union", { &handleUnion, CommandSpacing::Invisible }},
+ { "until", { 0, CommandSpacing::Block }},
+ { "var", { &handleFn, CommandSpacing::Invisible }},
+ { "verbatim", { &handleFormatBlock, CommandSpacing::Block }},
+ { "verbinclude", { 0, CommandSpacing::Inline }},
+ { "version", { 0, CommandSpacing::Block }},
+ { "warning", { 0, CommandSpacing::Block }},
+ { "weakgroup", { &handleWeakGroup, CommandSpacing::Invisible }},
+ { "xmlinclude", { 0, CommandSpacing::Inline }},
+ { "xmlonly", { &handleFormatBlock, CommandSpacing::Invisible }},
+ { "xrefitem", { &handleXRefItem, CommandSpacing::XRef }}
};
-/** @brief Command mapper.
- *
- * Maps a command name (as found in a comment block) onto a
- * specific handler function.
- */
-class DocCmdMapper
-{
- public:
- struct Cmd
- {
- DocCmdFunc func;
- bool endsBrief;
- };
-
- /** maps a command name to a handler function */
- static Cmd *map(const char *name)
- {
- return instance()->find(name);
- }
-
- /** release the singleton */
- static void freeInstance()
- {
- delete s_instance; s_instance=0;
- }
-
- private:
- static DocCmdMapper *instance()
- {
- if (s_instance==0) s_instance = new DocCmdMapper;
- return s_instance;
- }
-
- DocCmdMapper() : m_map(113)
- {
- m_map.setAutoDelete(TRUE);
- 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++;
- }
- }
-
- Cmd *find(const char *name)
- {
- return m_map.find(name);
- }
- QDict<Cmd> m_map;
- static DocCmdMapper *s_instance;
-};
-
-DocCmdMapper *DocCmdMapper::s_instance=0;
-
-
+#define YY_NO_INPUT 1
+#define YY_NO_UNISTD_H 1
#define YY_NEVER_INTERACTIVE 1
+
enum XRefKind
{
XRef_Item,
@@ -381,11 +336,11 @@ enum GuardType
class GuardedSection
{
public:
- GuardedSection(bool enabled,bool parentVisible)
+ GuardedSection(bool enabled,bool parentVisible)
: m_enabled(enabled),m_parentVisible(parentVisible) {}
bool isEnabled() const { return m_enabled; }
bool parentVisible() const { return m_parentVisible; }
-
+
private:
bool m_enabled;
bool m_parentVisible;
@@ -393,13 +348,14 @@ class GuardedSection
/* -----------------------------------------------------------------
*
- * statics
+ * statics
*/
struct commentscanYY_state
{
OutlineParserInterface *langParser = 0; // the language parser that is calling us
QCString inputString; // input string
+ QCString currentCmd; // the command used
int inputPosition = 0; // read pointer
QCString fileName; // file name that is read from
int lineNr = 0; // line number in the input
@@ -417,7 +373,7 @@ struct commentscanYY_state
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,..)
+ std::stack<GuardedSection> guards; // tracks nested conditional sections (if,ifnot,..)
Entry *current = 0; // working entry
bool needNewEntry = FALSE;
@@ -449,19 +405,25 @@ struct commentscanYY_state
bool insideParBlock = FALSE;
bool inInternalDocs = FALSE;
int prevPosition = 0;
+ DocGroup docGroup;
+ bool markdownSupport = TRUE;
};
+
+static std::mutex g_sectionMutex;
+static std::mutex g_formulaMutex;
+static std::mutex g_citeMutex;
+
//-----------------------------------------------------------------------------
static QCString stripQuotes(const char *s);
static bool getDocSectionName(int s);
-static SectionInfo::SectionType sectionLevelToType(int level);
+static 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);
@@ -474,38 +436,27 @@ 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 yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
static void addCite(yyscan_t yyscanner);
-//-----------------------------------------------------------------------------
+#define unput_string(yytext,yyleng) do { for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]); } while(0)
+//-----------------------------------------------------------------------------
-#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
%}
/* start command character */
-CMD ("\\"|"@")
-DCMD1 ("arg"|"attention"|"author"|"cite"|"code")
-DCMD2 ("date"|"dot"|"msc"|"dotfile"|"example"|"startuml")
-DCMD3 ("htmlinclude"|"htmlonly"|"image"|"include")
-DCMD4 ("includelineno"|"internal"|"invariant")
-DCMD5 ("latexinclude"|"latexonly"|"li"|"line"|"manonly"|"name")
-DCMD6 ("note"|"par"|"paragraph"|"param"|"post")
-DCMD7 ("pre"|"remarks"|(("relate"[sd])("also")?))
-DCMD8 ("remarks"|("return"[s]?)|"retval"|"sa"|"section")
-DCMD9 ("see"|"since"|"subsection"|"subsubsection")
-DCMD10 ("throw"|"until"|"verbatim")
-DCMD11 ("verbinclude"|"version"|"warning")
-DETAILEDCMD {CMD}({DCMD1}|{DCMD2}|{DCMD3}|{DCMD4}|{DCMD5}|{DCMD6}|{DCMD7}|{DCMD8}|{DCMD9}|{DCMD10}|{DCMD11})
-XREFCMD {CMD}("bug"|"deprecated"|"test"|"todo"|"xrefitem")
+CMD ("\\"|"@")
+XREFCMD {CMD}("bug"|"deprecated"|"test"|"todo"|"xrefitem")
PRE [pP][rR][eE]
-TABLE [tT][aA][bB][lL][eE]
-P [pP]
+TABLE [tT][aA][bB][lL][eE]
+P [pP]
UL [uU][lL]
-OL [oO][lL]
-DL [dD][lL]
+OL [oO][lL]
+DL [dD][lL]
IMG [iI][mM][gG]
HR [hH][rR]
PARA [pP][aA][rR][aA]
@@ -516,13 +467,13 @@ DIV [dD][iI][vV]
DETAILEDHTML {CENTER}|{DIV}|{PRE}|{UL}|{TABLE}|{OL}|{DL}|{P}|[Hh][1-6]|{IMG}|{HR}|{PARA}
DETAILEDHTMLOPT {CODE}
BN [ \t\n\r]
-BL [ \t\r]*"\n"
+BL [ \t\r]*"\n"
B [ \t]
BS ^(({B}*"//")?)(({B}*"*"+)?){B}*
ATTR ({B}+[^>\n]*)?
-DOCNL "\n"|"\\_linebr"
+DOCNL "\n"|"\\ilinebr"
LC "\\"{B}*"\n"
-NW [^a-z_A-Z0-9]
+NW [^a-z_A-Z0-9]
FILESCHAR [a-z_A-Z0-9\x80-\xFF\\:\\\/\-\+@&#]
FILEECHAR [a-z_A-Z0-9\x80-\xFF\-\+@&#]
FILE ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|("\""[^\n\"]*"\"")
@@ -534,7 +485,7 @@ CITEID {CITESCHAR}{CITEECHAR}*("."{CITESCHAR}{CITEECHAR}*)*|"\""{CITESCHAR}{C
SCOPEID {ID}({ID}*{BN}*"::"{BN}*)*({ID}?)
SCOPENAME "$"?(({ID}?{BN}*("::"|"."){BN}*)*)((~{BN}*)?{ID})
TMPLSPEC "<"{BN}*[^>]+{BN}*">"
-MAILADDR [a-z_A-Z0-9.+\-]+"@"[a-z_A-Z0-9\-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+
+MAILADDR [a-z_A-Z0-9.+\-]+"@"[a-z_A-Z0-9\-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+
RCSTAG "$"{ID}":"[^\n$]+"$"
%option noyywrap
@@ -553,34 +504,34 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
%x XRefItemParam3
%x FileDocArg1
%x ParamArg1
-%x EnumDocArg1
-%x NameSpaceDocArg1
-%x PackageDocArg1
-%x GroupDocArg1
-%x GroupDocArg2
-%x SectionLabel
-%x SectionTitle
-%x SubpageLabel
-%x SubpageTitle
-%x FormatBlock
-%x LineParam
-%x GuardParam
-%x GuardParamEnd
-%x SkipGuardedSection
-%x SkipInternal
+%x EnumDocArg1
+%x NameSpaceDocArg1
+%x PackageDocArg1
+%x GroupDocArg1
+%x GroupDocArg2
+%x SectionLabel
+%x SectionTitle
+%x SubpageLabel
+%x SubpageTitle
+%x FormatBlock
+%x LineParam
+%x GuardParam
+%x GuardParamEnd
+%x SkipGuardedSection
+%x SkipInternal
%x NameParam
-%x InGroupParam
-%x FnParam
-%x OverloadParam
-%x InheritParam
-%x ExtendsParam
+%x InGroupParam
+%x FnParam
+%x OverloadParam
+%x InheritParam
+%x ExtendsParam
%x ReadFormulaShort
-%x ReadFormulaLong
-%x AnchorLabel
+%x ReadFormulaLong
+%x AnchorLabel
%x HtmlComment
%x SkipLang
-%x CiteLabel
-%x CopyDoc
+%x CiteLabel
+%x CopyDoc
%x GuardExpr
%x CdataSection
%x Noop
@@ -604,52 +555,52 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
* XML commands, <summary></summary><remarks></remarks>
*/
-<Comment>{CMD}{CMD}[a-z_A-Z]+{B}* { // escaped command
- addOutput(yyscanner,yytext);
- }
-<Comment>{CMD}{CMD}"~"[a-z_A-Z]* { // escaped command
- addOutput(yyscanner,yytext);
- }
-<Comment>{MAILADDR} { // mail address
- addOutput(yyscanner,yytext);
- }
-<Comment>"\""[^"\n]*"\"" { // quoted text
+<Comment>{CMD}{CMD}[a-z_A-Z]+{B}* { // escaped command
+ addOutput(yyscanner,yytext);
+ }
+<Comment>{CMD}{CMD}"~"[a-z_A-Z]* { // escaped command
addOutput(yyscanner,yytext);
- }
-<Comment>("\\"[a-z_A-Z]+)+"\\" { // directory (or chain of commands!)
- addOutput(yyscanner,yytext);
- }
-<Comment>"<"{DETAILEDHTML}{ATTR}">" { // HTML command that ends a brief description
- setOutput(yyscanner,OutputDoc);
- // continue with the same input
+ }
+<Comment>{MAILADDR} { // mail address
+ addOutput(yyscanner,yytext);
+ }
+<Comment>"\""[^"\n]*"\"" { // quoted text
+ addOutput(yyscanner,yytext);
+ }
+<Comment>("\\"[a-z_A-Z]+)+"\\" { // directory (or chain of commands!)
+ addOutput(yyscanner,yytext);
+ }
+<Comment>"<"{DETAILEDHTML}{ATTR}">" { // HTML command that ends a brief description
+ setOutput(yyscanner,OutputDoc);
+ // continue with the same input
REJECT;
- }
-<Comment>"<"{DETAILEDHTMLOPT}{ATTR}">" { // HTML command that ends a brief description
- if (yyextra->current->lang==SrcLangExt_CSharp)
+ }
+<Comment>"<"{DETAILEDHTMLOPT}{ATTR}">" { // HTML command that ends a brief description
+ if (yyextra->current->lang==SrcLangExt_CSharp)
{
setOutput(yyscanner,OutputDoc);
}
- // continue with the same input
+ // continue with the same input
REJECT;
- }
-<Comment>"<summary>" { // start of a .NET XML style brief description
- setOutput(yyscanner,OutputBrief);
+ }
+<Comment>"<summary>" { // start of a .NET XML style brief description
+ setOutput(yyscanner,OutputBrief);
addOutput(yyscanner,yytext);
- }
-<Comment>"<remarks>" { // start of a .NET XML style detailed description
- setOutput(yyscanner,OutputDoc);
+ }
+<Comment>"<remarks>" { // start of a .NET XML style detailed description
+ setOutput(yyscanner,OutputDoc);
addOutput(yyscanner,yytext);
- }
-<Comment>"</summary>" { // start of a .NET XML style detailed description
- setOutput(yyscanner,OutputBrief);
+ }
+<Comment>"</summary>" { // start of a .NET XML style detailed description
+ setOutput(yyscanner,OutputBrief);
addOutput(yyscanner,yytext);
- setOutput(yyscanner,OutputDoc);
- }
-<Comment>"</remarks>" { // end of a brief or detailed description
-
- setOutput(yyscanner,OutputDoc);
+ setOutput(yyscanner,OutputDoc);
+ }
+<Comment>"</remarks>" { // end of a brief or detailed description
+
+ setOutput(yyscanner,OutputDoc);
addOutput(yyscanner,yytext);
- }
+ }
<Comment>"<"{CAPTION}{ATTR}">" {
QCString tag=yytext;
int s=tag.find("id=");
@@ -680,22 +631,25 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
setOutput(yyscanner,OutputDoc);
REJECT;
}
-<Comment>"<!--" {
+<Comment>"<!--" {
BEGIN(HtmlComment);
}
<Comment>"<!\[CDATA\[" {
BEGIN(CdataSection);
}
-<Comment>{B}*{CMD}"endinternal"{B}* {
- addOutput(yyscanner," \\endinternal ");
+<Comment>{B}*{CMD}"endinternal"{B}* {
+ addOutput(yyscanner," \\endinternal ");
if (!yyextra->inInternalDocs)
- warn(yyextra->fileName,yyextra->lineNr,
+ warn(yyextra->fileName,yyextra->lineNr,
"found \\endinternal without matching \\internal"
);
yyextra->inInternalDocs = FALSE;
- }
+ }
+<Comment>{B}*"\\ilinebr"{B}* { // preserve spacing around \\ilinebr
+ addOutput(yyscanner,yytext);
+ }
<Comment>{B}*{CMD}[a-z_A-Z]+"{"[a-zA-Z_,:0-9\. ]*"}"{B}* |
-<Comment>{B}*{CMD}[a-z_A-Z]+{B}* { // potentially interesting command
+<Comment>{B}*{CMD}[a-z_A-Z]+{B}* { // potentially interesting command
// the {B}* in the front was added for bug620924
QCString fullMatch = QCString(yytext);
int idx = fullMatch.find('{');
@@ -714,136 +668,137 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
QCString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace();
optList = QCStringList::split(',',optStr);
}
- DocCmdMapper::Cmd *cmdPtr = DocCmdMapper::map(cmdName);
- if (cmdPtr) // special action is required
- {
+ auto it = docCmdMap.find(cmdName.data());
+ //printf("lookup command '%s' found=%d\n",cmdName.data(),it!=docCmdMap.end());
+ if (it!=docCmdMap.end()) // special action is required
+ {
int i=0;
while (yytext[i]==' ' || yytext[i]=='\t') i++;
- yyextra->spaceBeforeCmd = QCString(yytext).left(i);
- if (cmdPtr->endsBrief && !(yyextra->inContext==OutputXRef && cmdName=="parblock"))
- {
- yyextra->briefEndsAtDot=FALSE;
- // this command forces the end of brief description
- setOutput(yyscanner,OutputDoc);
- }
+ yyextra->spaceBeforeCmd = QCString(yytext).left(i);
+ if (it->second.spacing==CommandSpacing::Block && !(yyextra->inContext==OutputXRef && cmdName=="parblock"))
+ {
+ yyextra->briefEndsAtDot=FALSE;
+ // this command forces the end of brief description
+ setOutput(yyscanner,OutputDoc);
+ }
//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.
- 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 (it->second.handler && it->second.handler(yyscanner, cmdName, optList))
+ {
+ // implicit split of the comment block into two
+ // entries. Restart the next block at the start
+ // of this command.
+ 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))
- yyextra->inputPosition=yyextra->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
- yyextra->inputPosition=yyextra->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();
- }
- else if (cmdPtr->func==0)
- {
- // command without handler, to be processed
- // later by parsedoc.cpp
- addOutput(yyscanner,yytext);
- }
- }
- else // command not relevant
- {
- addOutput(yyscanner,yytext);
- }
- }
-<Comment>{B}*({CMD}{CMD})"f"[$\[{] { // escaped formula command
- addOutput(yyscanner,yytext);
- }
-<Comment>{B}*{CMD}"~"[a-z_A-Z-]* { // language switch command
+ yyterminate();
+ }
+ else if (it->second.handler==0)
+ {
+ // command without handler, to be processed
+ // later by parsedoc.cpp
+ addOutput(yyscanner,yytext);
+ }
+ }
+ else // command not relevant
+ {
+ addOutput(yyscanner,yytext);
+ }
+ }
+<Comment>{B}*({CMD}{CMD})"f"[$\[{] { // escaped formula command
+ addOutput(yyscanner,yytext);
+ }
+<Comment>{B}*{CMD}"~"[a-z_A-Z-]* { // language switch command
QCString langId = QCString(yytext).stripWhiteSpace().data()+2;
- if (!langId.isEmpty() &&
- qstricmp(Config_getEnum(OUTPUT_LANGUAGE),langId)!=0)
- { // enable language specific section
- BEGIN(SkipLang);
- }
- }
+ if (!langId.isEmpty() &&
+ qstricmp(Config_getEnum(OUTPUT_LANGUAGE),langId)!=0)
+ { // enable language specific section
+ BEGIN(SkipLang);
+ }
+ }
<Comment>{B}*{CMD}"f{"[^}\n]+"}"("{"?) { // start of a formula with custom environment
- 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
- yyextra->formulaEnv=yyextra->formulaEnv.left(yyextra->formulaEnv.length()-1);
- }
- yyextra->formulaText+=yyextra->formulaEnv;
- yyextra->formulaNewLines=0;
- BEGIN(ReadFormulaLong);
- }
-<Comment>{B}*{CMD}"f$" { // start of a inline formula
- yyextra->formulaText="$";
- yyextra->formulaNewLines=0;
- BEGIN(ReadFormulaShort);
- }
-<Comment>{B}*{CMD}"f[" { // start of a block formula
- setOutput(yyscanner,OutputDoc);
- yyextra->formulaText="\\[";
- yyextra->formulaNewLines=0;
- BEGIN(ReadFormulaLong);
- }
+ 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
+ yyextra->formulaEnv=yyextra->formulaEnv.left(yyextra->formulaEnv.length()-1);
+ }
+ yyextra->formulaText+=yyextra->formulaEnv;
+ yyextra->formulaNewLines=0;
+ BEGIN(ReadFormulaLong);
+ }
+<Comment>{B}*{CMD}"f$" { // start of a inline formula
+ yyextra->formulaText="$";
+ yyextra->formulaNewLines=0;
+ BEGIN(ReadFormulaShort);
+ }
+<Comment>{B}*{CMD}"f[" { // start of a block formula
+ setOutput(yyscanner,OutputDoc);
+ yyextra->formulaText="\\[";
+ yyextra->formulaNewLines=0;
+ BEGIN(ReadFormulaLong);
+ }
<Comment>{B}*{CMD}"{" { // begin of a group
//yyextra->langParser->handleGroupStartCommand(yyextra->memberGroupHeader);
- Doxygen::docGroup.open(yyextra->current,yyextra->fileName,yyextra->lineNr);
+ yyextra->docGroup.open(yyextra->current,yyextra->fileName,yyextra->lineNr);
}
<Comment>{B}*{CMD}"}" { // end of a group
//yyextra->langParser->handleGroupEndCommand();
- Doxygen::docGroup.close(yyextra->current,yyextra->fileName,yyextra->lineNr,TRUE);
- Doxygen::docGroup.clearHeader();
- yyextra->parseMore=TRUE;
+ yyextra->docGroup.close(yyextra->current,yyextra->fileName,yyextra->lineNr,TRUE);
+ yyextra->docGroup.clearHeader();
+ 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))
- yyextra->inputPosition=yyextra->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) + (int)strlen(yytext);
#else
- yyextra->inputPosition=yyextra->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) + (int)strlen(yytext);
#endif
- yyterminate();
- }
-<Comment>{B}*{CMD}[$@\\&~<>#%] { // escaped character
- addOutput(yyscanner,yytext);
- }
-<Comment>[a-z_A-Z]+ { // normal word
- addOutput(yyscanner,yytext);
- }
+ yyterminate();
+ }
+<Comment>{B}*{CMD}[$@\\&~<>#%] { // escaped character
+ addOutput(yyscanner,yytext);
+ }
+<Comment>[a-z_A-Z]+ { // normal word
+ addOutput(yyscanner,yytext);
+ }
<Comment>^{B}*"."{B}*/\n { // explicit end autolist: e.g " ."
- addOutput(yyscanner,yytext);
- }
+ addOutput(yyscanner,yytext);
+ }
<Comment>^{B}*[1-9][0-9]*"."{B}+ |
-<Comment>^{B}*[*+]{B}+ { // start of autolist
- if (!Doxygen::markdownSupport)
+<Comment>^{B}*[*+]{B}+ { // start of autolist
+ if (!yyextra->markdownSupport)
{
REJECT;
}
else
{
- if (yyextra->inContext!=OutputXRef)
+ if (yyextra->inContext!=OutputXRef)
{
yyextra->briefEndsAtDot=FALSE;
setOutput(yyscanner,OutputDoc);
}
- addOutput(yyscanner,yytext);
+ addOutput(yyscanner,yytext);
+ }
+ }
+<Comment>^{B}*"-"{B}+ { // start of autolist
+ if (yyextra->inContext!=OutputXRef)
+ {
+ yyextra->briefEndsAtDot=FALSE;
+ setOutput(yyscanner,OutputDoc);
}
- }
-<Comment>^{B}*"-"{B}+ { // start of autolist
- if (yyextra->inContext!=OutputXRef)
- {
- yyextra->briefEndsAtDot=FALSE;
- setOutput(yyscanner,OutputDoc);
- }
- addOutput(yyscanner,yytext);
- }
+ addOutput(yyscanner,yytext);
+ }
<Comment>^{B}*([\-:|]{B}*)*("--"|"---")({B}*[\-:|])*{B}*/\n { // horizontal line (dashed)
- addOutput(yyscanner,yytext);
+ addOutput(yyscanner,yytext);
}
<Comment>{CMD}"---" { // escaped mdash
addOutput(yyscanner,yytext);
@@ -852,10 +807,10 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
addOutput(yyscanner,yytext);
}
<Comment>"---" { // mdash
- addOutput(yyscanner,yyextra->insidePre || Doxygen::markdownSupport ? yytext : "&mdash;");
+ addOutput(yyscanner,yyextra->insidePre || yyextra->markdownSupport ? yytext : "&mdash;");
}
<Comment>"--" { // ndash
- addOutput(yyscanner,yyextra->insidePre || Doxygen::markdownSupport ? yytext : "&ndash;");
+ addOutput(yyscanner,yyextra->insidePre || yyextra->markdownSupport ? yytext : "&ndash;");
}
<Comment>"-#"{B}+ { // numbered item
if (yyextra->inContext!=OutputXRef)
@@ -865,85 +820,89 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
}
addOutput(yyscanner,yytext);
}
-<Comment>("."+)[a-z_A-Z0-9\)] { // . at start or in the middle of a word, or ellipsis
- addOutput(yyscanner,yytext);
- }
-<Comment>".\\"[ \t] { // . with escaped space.
- addOutput(yyscanner,yytext[0]);
- addOutput(yyscanner,yytext[2]);
- }
-<Comment>".," { // . with comma such as "e.g.,"
- addOutput(yyscanner,yytext);
- }
-<Comment>"...\\"[ \t] { // ellipsis with escaped space.
- addOutput(yyscanner,"... ");
- }
-<Comment>".."[\.]?/[^ \t\n] { // internal ellipsis
- addOutput(yyscanner,yytext);
- }
-<Comment>(\n|\\_linebr)({B}*(\n|\\_linebr))+ { // at least one blank line (or blank line command)
- if (yyextra->inContext==OutputXRef)
- {
- // see bug 613024, we need to put the newlines after ending the XRef section.
- if (!yyextra->insideParBlock) setOutput(yyscanner,OutputDoc);
- int i;
- for (i=0;i<yyleng;)
+<Comment>("."+)[a-z_A-Z0-9\)] { // . at start or in the middle of a word, or ellipsis
+ addOutput(yyscanner,yytext);
+ }
+<Comment>".\\"[ \t] { // . with escaped space.
+ addOutput(yyscanner,yytext[0]);
+ addOutput(yyscanner,yytext[2]);
+ }
+<Comment>".," { // . with comma such as "e.g.,"
+ addOutput(yyscanner,yytext);
+ }
+<Comment>"...\\"[ \t] { // ellipsis with escaped space.
+ addOutput(yyscanner,"... ");
+ }
+<Comment>".."[\.]?/[^ \t\n] { // internal ellipsis
+ addOutput(yyscanner,yytext);
+ }
+<Comment>(\n|\\ilinebr)({B}*(\n|\\ilinebr))+ { // at least one blank line (or blank line command)
+ if (yyextra->inContext==OutputXRef)
+ {
+ // see bug 613024, we need to put the newlines after ending the XRef section.
+ if (!yyextra->insideParBlock) setOutput(yyscanner,OutputDoc);
+ yy_size_t i;
+ for (i=0;i<(yy_size_t)yyleng;)
{
if (yytext[i]=='\n') addOutput(yyscanner,'\n'),i++;
- else if (strcmp(yytext+i,"\\_linebr")==0) addOutput(yyscanner,'\n'),i+=8;
+ else if (strcmp(yytext+i,"\\ilinebr")==0) addOutput(yyscanner,"\\ilinebr"),i+=8;
else i++;
}
- }
- else if (yyextra->inContext!=OutputBrief)
- {
- int i;
- for (i=0;i<yyleng;)
+ }
+ else if (yyextra->inContext!=OutputBrief)
+ {
+ yy_size_t i;
+ for (i=0;i<(yy_size_t)yyleng;)
{
if (yytext[i]=='\n') addOutput(yyscanner,'\n'),i++;
- else if (strcmp(yytext+i,"\\_linebr")==0) addOutput(yyscanner,'\n'),i+=8;
+ else if (strcmp(yytext+i,"\\ilinebr")==0) addOutput(yyscanner,"\\ilinebr"),i+=8;
else i++;
}
- setOutput(yyscanner,OutputDoc);
- }
- else // yyextra->inContext==OutputBrief
- { // only go to the detailed description if we have
- // found some brief description and not just whitespace
- endBrief(yyscanner,FALSE);
- }
- lineCount(yyscanner);
- }
-<Comment>"." { // potential end of a JavaDoc style comment
- addOutput(yyscanner,*yytext);
- if (yyextra->briefEndsAtDot)
- {
- setOutput(yyscanner,OutputDoc);
- yyextra->briefEndsAtDot=FALSE;
- }
- }
-<Comment>\n { // newline
- addOutput(yyscanner,*yytext);
- yyextra->lineNr++;
- }
-<Comment>. { // catch-all for anything else
- addOutput(yyscanner,*yytext);
- }
+ setOutput(yyscanner,OutputDoc);
+ }
+ else // yyextra->inContext==OutputBrief
+ { // only go to the detailed description if we have
+ // found some brief description and not just whitespace
+ endBrief(yyscanner,TRUE);
+ }
+ lineCount(yyscanner);
+ }
+<Comment>"." { // potential end of a JavaDoc style comment
+ addOutput(yyscanner,*yytext);
+ if (yyextra->briefEndsAtDot)
+ {
+ setOutput(yyscanner,OutputDoc);
+ yyextra->briefEndsAtDot=FALSE;
+ }
+ }
+<Comment>{DOCNL} { // newline
+ addOutput(yyscanner,yytext);
+ if (*yytext == '\n') yyextra->lineNr++;
+ }
+<Comment>. { // catch-all for anything else
+ addOutput(yyscanner,*yytext);
+ }
/* -------------- Rules for handling HTML comments ----------- */
-<HtmlComment>"--"[!]?">"{B}* { BEGIN( Comment ); }
-<HtmlComment>{DOCNL} {
- if (*yytext=='\n') yyextra->lineNr++;
- }
-<HtmlComment>[^\\\n\-]+ { // ignore unimportant characters
- }
-<HtmlComment>. { // ignore every else
- }
+<HtmlComment>"--"[!]?">"{B}* { BEGIN( Comment ); }
+<HtmlComment>{DOCNL} {
+ if (*yytext=='\n')
+ {
+ addOutput(yyscanner,*yytext);
+ yyextra->lineNr++;
+ }
+ }
+<HtmlComment>[^\\\n\-]+ { // ignore unimportant characters
+ }
+<HtmlComment>. { // ignore every else
+ }
<CdataSection>"\]\]>" {
BEGIN( Comment );
}
-<CdataSection>{DOCNL} {
+<CdataSection>{DOCNL} {
addOutput(yyscanner,'\n');
if (*yytext=='\n') yyextra->lineNr++;
}
@@ -954,262 +913,272 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<CdataSection>[^\\\n\]<>&]+ {
addOutput(yyscanner,yytext);
}
-<CdataSection>. {
+<CdataSection>. {
addOutput(yyscanner,*yytext);
}
/* -------------- Rules for handling formulas ---------------- */
-
-<ReadFormulaShort>{CMD}"f$" { // end of inline formula
- yyextra->formulaText+="$";
- addOutput(yyscanner," "+addFormula(yyscanner));
- BEGIN(Comment);
- }
-<ReadFormulaLong>{CMD}"f]" { // end of block formula
- yyextra->formulaText+="\\]";
- addOutput(yyscanner," "+addFormula(yyscanner));
- BEGIN(Comment);
- }
-<ReadFormulaLong>{CMD}"f}" { // end of custom env formula
- yyextra->formulaText+="\\end";
- yyextra->formulaText+=yyextra->formulaEnv;
- addOutput(yyscanner," "+addFormula(yyscanner));
- BEGIN(Comment);
- }
+
+<ReadFormulaShort>{CMD}"f$" { // end of inline formula
+ yyextra->formulaText+="$";
+ addOutput(yyscanner," "+addFormula(yyscanner));
+ BEGIN(Comment);
+ }
+<ReadFormulaLong>{CMD}"f]" { // end of block formula
+ yyextra->formulaText+="\\]";
+ addOutput(yyscanner," "+addFormula(yyscanner));
+ BEGIN(Comment);
+ }
+<ReadFormulaLong>{CMD}"f}" { // end of custom env formula
+ yyextra->formulaText+="\\end";
+ yyextra->formulaText+=yyextra->formulaEnv;
+ addOutput(yyscanner," "+addFormula(yyscanner));
+ BEGIN(Comment);
+ }
<ReadFormulaLong,ReadFormulaShort>[^\\@\n]+ { // any non-special character
- yyextra->formulaText+=yytext;
- }
-<ReadFormulaLong,ReadFormulaShort>\n { // new line
+ yyextra->formulaText+=yytext;
+ }
+<ReadFormulaLong,ReadFormulaShort>\n { // new line
yyextra->formulaNewLines++;
- yyextra->formulaText+=*yytext;
- yyextra->lineNr++;
- }
+ yyextra->formulaText+=*yytext;
+ yyextra->lineNr++;
+ }
<ReadFormulaLong,ReadFormulaShort>. { // any other character
- yyextra->formulaText+=*yytext;
- }
+ yyextra->formulaText+=*yytext;
+ }
/* ------------ handle argument of enum command --------------- */
-<EnumDocArg1>{SCOPEID} { // handle argument
- yyextra->current->name = yytext;
- BEGIN( Comment );
- }
-<EnumDocArg1>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
+<EnumDocArg1>{SCOPEID} { // handle argument
+ yyextra->current->name = yytext;
+ BEGIN( Comment );
+ }
+<EnumDocArg1>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
-<EnumDocArg1>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
+<EnumDocArg1>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
"missing argument after \\enum."
);
- addOutput(yyscanner,'\n');
- if (*yytext=='\n') yyextra->lineNr++;
- BEGIN( Comment );
- }
-<EnumDocArg1>. { // ignore other stuff
- }
+ unput_string(yytext,yyleng);
+ //addOutput(yyscanner,'\n');
+ //if (*yytext=='\n') yyextra->lineNr++;
+ BEGIN( Comment );
+ }
+<EnumDocArg1>. { // ignore other stuff
+ }
/* ------------ handle argument of namespace command --------------- */
-<NameSpaceDocArg1>{SCOPENAME} { // handle argument
- yyextra->current->name = substitute(yytext,".","::");
- BEGIN( Comment );
- }
-<NameSpaceDocArg1>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
+<NameSpaceDocArg1>{SCOPENAME} { // handle argument
+ yyextra->current->name = substitute(yytext,".","::");
+ BEGIN( Comment );
}
-<NameSpaceDocArg1>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
+<NameSpaceDocArg1>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<NameSpaceDocArg1>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
"missing argument after "
- "\\namespace."
+ "\\namespace."
);
- addOutput(yyscanner,'\n');
- if (*yytext=='\n') yyextra->lineNr++;
- BEGIN( Comment );
- }
-<NameSpaceDocArg1>. { // ignore other stuff
- }
+ unput_string(yytext,yyleng);
+ //addOutput(yyscanner,'\n');
+ //if (*yytext=='\n') yyextra->lineNr++;
+ BEGIN( Comment );
+ }
+<NameSpaceDocArg1>. { // ignore other stuff
+ }
/* ------------ handle argument of package command --------------- */
-<PackageDocArg1>{ID}("."{ID})* { // handle argument
- yyextra->current->name = yytext;
- BEGIN( Comment );
- }
-<PackageDocArg1>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
+<PackageDocArg1>{ID}("."{ID})* { // handle argument
+ yyextra->current->name = yytext;
+ BEGIN( Comment );
}
-<PackageDocArg1>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
+<PackageDocArg1>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<PackageDocArg1>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
"missing argument after "
- "\\package."
+ "\\package."
);
- addOutput(yyscanner,'\n');
- if (*yytext=='\n') yyextra->lineNr++;
- BEGIN( Comment );
- }
-<PackageDocArg1>. { // ignore other stuff
- }
+ unput_string(yytext,yyleng);
+ //addOutput(yyscanner,'\n');
+ //if (*yytext=='\n') yyextra->lineNr++;
+ BEGIN( Comment );
+ }
+<PackageDocArg1>. { // ignore other stuff
+ }
/* ------ handle argument of class/struct/union command --------------- */
-<ClassDocArg1>{SCOPENAME}{TMPLSPEC} {
- yyextra->current->name = substitute(removeRedundantWhiteSpace(yytext),".","::");
- BEGIN( ClassDocArg2 );
- }
-<ClassDocArg1>{SCOPENAME} { // first argument
- yyextra->current->name = substitute(yytext,".","::");
- if (yyextra->current->section==Entry::PROTOCOLDOC_SEC)
- {
- yyextra->current->name+="-p";
- }
- // prepend outer scope name
- BEGIN( ClassDocArg2 );
- }
+<ClassDocArg1>{SCOPENAME}{TMPLSPEC} {
+ yyextra->current->name = substitute(removeRedundantWhiteSpace(yytext),".","::");
+ BEGIN( ClassDocArg2 );
+ }
+<ClassDocArg1>{SCOPENAME} { // first argument
+ yyextra->current->name = substitute(yytext,".","::");
+ if (yyextra->current->section==Entry::PROTOCOLDOC_SEC)
+ {
+ yyextra->current->name+="-p";
+ }
+ // prepend outer scope name
+ BEGIN( ClassDocArg2 );
+ }
<CategoryDocArg1>{SCOPENAME}{B}*"("[^\)]+")" {
- yyextra->current->name = substitute(yytext,".","::");
- BEGIN( ClassDocArg2 );
- }
+ yyextra->current->name = substitute(yytext,".","::");
+ BEGIN( ClassDocArg2 );
+ }
<ClassDocArg1,CategoryDocArg1>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
}
-<ClassDocArg1,CategoryDocArg1>{DOCNL} {
- warn(yyextra->fileName,yyextra->lineNr,
+<ClassDocArg1,CategoryDocArg1>{DOCNL} {
+ warn(yyextra->fileName,yyextra->lineNr,
"missing argument after "
- "\\%s.",YY_START==ClassDocArg1?"class":"category"
+ "'\\%s'.",yyextra->currentCmd.data()
);
- addOutput(yyscanner,'\n');
- if (*yytext=='\n') yyextra->lineNr++;
- BEGIN( Comment );
- }
-<ClassDocArg1,CategoryDocArg1>. { // ignore other stuff
- }
-
-<ClassDocArg2>{FILE}|"<>" { // second argument; include file
- yyextra->current->includeFile = yytext;
- BEGIN( ClassDocArg3 );
- }
-<ClassDocArg2>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<ClassDocArg2>{DOCNL} {
- addOutput(yyscanner,'\n');
- if (*yytext=='\n') yyextra->lineNr++;
- BEGIN( Comment );
- }
-<ClassDocArg2>. { // ignore other stuff
- }
-
-<ClassDocArg3>[<"]?{FILE}?[">]? { // third argument; include file name
- yyextra->current->includeName = yytext;
- BEGIN( Comment );
- }
-<ClassDocArg3>{LC} { // line continuation
+ //addOutput(yyscanner,'\n');
+ //if (*yytext=='\n') yyextra->lineNr++;
+ unput_string(yytext,yyleng);
+ BEGIN( Comment );
+ }
+<ClassDocArg1,CategoryDocArg1>. { // ignore other stuff
+ }
+
+<ClassDocArg2>{DOCNL} {
+ //addOutput(yyscanner,'\n');
+ //if (*yytext=='\n') yyextra->lineNr++;
+ unput_string(yytext,yyleng);
+ BEGIN( Comment );
+ }
+<ClassDocArg2>{FILE}|"<>" { // second argument; include file
+ yyextra->current->includeFile = yytext;
+ BEGIN( ClassDocArg3 );
+ }
+<ClassDocArg2>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<ClassDocArg2>. { // ignore other stuff
+ }
+
+<ClassDocArg3>[<"]?{FILE}?[">]? { // third argument; include file name
+ yyextra->current->includeName = yytext;
+ BEGIN( Comment );
+ }
+<ClassDocArg3>{LC} { // line continuation
yyextra->lineNr++;
- addOutput(yyscanner,'\n');
+ addOutput(yyscanner,'\n');
+ }
+<ClassDocArg3>{DOCNL} {
+ //if (*yytext=='\n') yyextra->lineNr++;
+ unput_string(yytext,yyleng);
+ BEGIN( Comment );
+ }
+<ClassDocArg3>. { // ignore other stuff
}
-<ClassDocArg3>{DOCNL} {
- if (*yytext=='\n') yyextra->lineNr++;
- BEGIN( Comment );
- }
-<ClassDocArg3>. { // ignore other stuff
- }
/* --------- handle arguments of {def,add,weak}group commands --------- */
-<GroupDocArg1>{LABELID}(".html"?) { // group name
- yyextra->current->name = yytext;
- //lastDefGroup.groupname = yytext;
- //lastDefGroup.pri = yyextra->current->groupingPri();
- // the .html stuff is for Qt compatibility
- if (yyextra->current->name.right(5)==".html")
- {
- yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-5);
- }
- yyextra->current->type.resize(0);
- BEGIN(GroupDocArg2);
- }
-<GroupDocArg1>"\\"{B}*"\n" { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<GroupDocArg1>{DOCNL} { // missing argument!
- warn(yyextra->fileName,yyextra->lineNr,
+<GroupDocArg1>{LABELID}(".html"?) { // group name
+ yyextra->current->name = yytext;
+ //lastDefGroup.groupname = yytext;
+ //lastDefGroup.pri = yyextra->current->groupingPri();
+ // the .html stuff is for Qt compatibility
+ if (yyextra->current->name.right(5)==".html")
+ {
+ yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-5);
+ }
+ yyextra->current->type.resize(0);
+ BEGIN(GroupDocArg2);
+ }
+<GroupDocArg1>"\\"{B}*"\n" { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<GroupDocArg1>{DOCNL} { // missing argument!
+ warn(yyextra->fileName,yyextra->lineNr,
"missing group name after %s",
- yyextra->current->groupDocCmd()
+ yyextra->current->groupDocCmd()
);
- addOutput(yyscanner,'\n');
- if (*yytext=='\n') yyextra->lineNr++;
- BEGIN( Comment );
- }
-<GroupDocArg1>. { // ignore other stuff
- }
-<GroupDocArg2>"\\"{B}*"\n" { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<GroupDocArg2>[^\n\\]+ { // title (stored in type)
- yyextra->current->type += yytext;
- yyextra->current->type = yyextra->current->type.stripWhiteSpace();
- }
-<GroupDocArg2>{DOCNL} {
+ //addOutput(yyscanner,'\n');
+ //if (*yytext=='\n') yyextra->lineNr++;
+ unput_string(yytext,yyleng);
+ BEGIN( Comment );
+ }
+<GroupDocArg1>. { // ignore other stuff
+ }
+<GroupDocArg2>"\\"{B}*"\n" { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<GroupDocArg2>[^\n\\]+ { // title (stored in type)
+ yyextra->current->type += yytext;
+ yyextra->current->type = yyextra->current->type.stripWhiteSpace();
+ }
+<GroupDocArg2>{DOCNL} {
if ( yyextra->current->groupDocType==Entry::GROUPDOC_NORMAL &&
- yyextra->current->type.isEmpty()
- ) // defgroup requires second argument
- {
- warn(yyextra->fileName,yyextra->lineNr,
+ yyextra->current->type.isEmpty()
+ ) // defgroup requires second argument
+ {
+ warn(yyextra->fileName,yyextra->lineNr,
"missing title after "
- "\\defgroup %s", yyextra->current->name.data()
+ "\\defgroup %s", yyextra->current->name.data()
);
- }
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
+ }
+ unput_string(yytext,yyleng);
+ //if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ BEGIN( Comment );
+ }
<GroupDocArg2>. { // title (stored in type)
- yyextra->current->type += yytext;
- yyextra->current->type = yyextra->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
- yyextra->current->name = stripQuotes(yytext);
- yyextra->current->args = "";
- BEGIN( PageDocArg2 );
- }
-<PageDocArg1>{LC} { yyextra->lineNr++;
- addOutput(yyscanner,'\n');
+<PageDocArg1>{FILE} { // first argument; page name
+ yyextra->current->name = stripQuotes(yytext);
+ yyextra->current->args = "";
+ BEGIN( PageDocArg2 );
}
-<PageDocArg1>{DOCNL} {
- warn(yyextra->fileName,yyextra->lineNr,
+<PageDocArg1>{LC} { yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<PageDocArg1>{DOCNL} {
+ warn(yyextra->fileName,yyextra->lineNr,
"missing argument after "
- "\\page."
+ "\\page."
);
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<PageDocArg1>. { // ignore other stuff
- }
-<PageDocArg2>{DOCNL} { // second argument; page title
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<PageDocArg2>{CMD}[<>] {
- // bug 748927
- QCString tmp = yytext;
- tmp = substitute(substitute(tmp,"@<","&lt;"),"@>","&gt;");
- tmp = substitute(substitute(tmp,"\\<","&lt;"),"\\>","&gt;");
- yyextra->current->args += tmp;
- }
-<PageDocArg2>. {
- yyextra->current->args += yytext;
+ unput_string(yytext,yyleng);
+ //if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ BEGIN( Comment );
+ }
+<PageDocArg1>. { // ignore other stuff
+ }
+<PageDocArg2>{DOCNL} { // second argument; page title
+ unput_string(yytext,yyleng);
+ //if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ BEGIN( Comment );
+ }
+<PageDocArg2>{CMD}[<>] {
+ // bug 748927
+ QCString tmp = yytext;
+ tmp = substitute(substitute(tmp,"@<","&lt;"),"@>","&gt;");
+ tmp = substitute(substitute(tmp,"\\<","&lt;"),"\\>","&gt;");
+ yyextra->current->args += tmp;
+ }
+<PageDocArg2>. {
+ yyextra->current->args += yytext;
}
/* --------- handle arguments of the param command ------------ */
<ParamArg1>{ID}/{B}*"," {
@@ -1229,288 +1198,291 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
/* --------- handle arguments of the file/dir/example command ------------ */
-<FileDocArg1>{DOCNL} { // no file name specified
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<FileDocArg1>{FILE} { // first argument; name
- yyextra->current->name = stripQuotes(yytext);
- BEGIN( Comment );
- }
-<FileDocArg1>{LC} { yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<FileDocArg1>. { // ignore other stuff
- }
+<FileDocArg1>{DOCNL} { // no file name specified
+ unput_string(yytext,yyleng);
+ //if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ BEGIN( Comment );
+ }
+<FileDocArg1>{FILE} { // first argument; name
+ yyextra->current->name = stripQuotes(yytext);
+ BEGIN( Comment );
+ }
+<FileDocArg1>{LC} { yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<FileDocArg1>. { // ignore other stuff
+ }
/* --------- handle arguments of the xrefitem command ------------ */
-<XRefItemParam1>{LABELID} { // first argument
- yyextra->newXRefItemKey=yytext;
+<XRefItemParam1>{LABELID} { // first argument
+ yyextra->newXRefItemKey=yytext;
setOutput(yyscanner,OutputXRef);
- BEGIN(XRefItemParam2);
- }
-<XRefItemParam1>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<XRefItemParam1>{DOCNL} { // missing arguments
- warn(yyextra->fileName,yyextra->lineNr,
- "Missing first argument of \\xrefitem"
- );
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- yyextra->inContext = OutputDoc;
- BEGIN( Comment );
- }
-<XRefItemParam1>. { // ignore other stuff
- }
-
-<XRefItemParam2>"\""[^\n\"]*"\"" { // second argument
- yyextra->xrefItemTitle = stripQuotes(yytext);
- BEGIN(XRefItemParam3);
- }
-<XRefItemParam2>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<XRefItemParam2>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
- "Missing second argument of \\xrefitem"
- );
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- yyextra->inContext = OutputDoc;
- BEGIN( Comment );
- }
-<XRefItemParam2>. { // ignore other stuff
- }
-
-<XRefItemParam3>"\""[^\n\"]*"\"" { // third argument
- yyextra->xrefListTitle = stripQuotes(yytext);
+ BEGIN(XRefItemParam2);
+ }
+<XRefItemParam1>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<XRefItemParam1>{DOCNL} { // missing arguments
+ warn(yyextra->fileName,yyextra->lineNr,
+ "Missing first argument of \\xrefitem"
+ );
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ yyextra->inContext = OutputDoc;
+ BEGIN( Comment );
+ }
+<XRefItemParam1>. { // ignore other stuff
+ }
+
+<XRefItemParam2>"\""[^\n\"]*"\"" { // second argument
+ yyextra->xrefItemTitle = stripQuotes(yytext);
+ BEGIN(XRefItemParam3);
+ }
+<XRefItemParam2>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<XRefItemParam2>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
+ "Missing second argument of \\xrefitem"
+ );
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ yyextra->inContext = OutputDoc;
+ BEGIN( Comment );
+ }
+<XRefItemParam2>. { // ignore other stuff
+ }
+
+<XRefItemParam3>"\""[^\n\"]*"\"" { // third argument
+ yyextra->xrefListTitle = stripQuotes(yytext);
yyextra->xrefKind = XRef_Item;
- BEGIN( Comment );
- }
-<XRefItemParam2,XRefItemParam3>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<XRefItemParam3>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
- "Missing third argument of \\xrefitem"
- );
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- yyextra->inContext = OutputDoc;
- BEGIN( Comment );
- }
-<XRefItemParam3>. { // ignore other stuff
- }
+ BEGIN( Comment );
+ }
+<XRefItemParam2,XRefItemParam3>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<XRefItemParam3>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
+ "Missing third argument of \\xrefitem"
+ );
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ yyextra->inContext = OutputDoc;
+ BEGIN( Comment );
+ }
+<XRefItemParam3>. { // ignore other stuff
+ }
/* ----- handle arguments of the relates(also)/memberof command ------- */
-<RelatesParam1>({ID}("::"|"."))*{ID} { // argument
- yyextra->current->relates = yytext;
- //if (yyextra->current->mGrpId!=DOX_NOGROUP)
+<RelatesParam1>({ID}("::"|"."))*{ID} { // argument
+ yyextra->current->relates = yytext;
+ //if (yyextra->current->mGrpId!=DOX_NOGROUP)
//{
// memberGroupRelates = yytext;
//}
- BEGIN( Comment );
- }
-<RelatesParam1>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<RelatesParam1>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
- "Missing argument of \\relates or \\memberof command"
- );
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<RelatesParam1>. { // ignore other stuff
- }
+ BEGIN( Comment );
+ }
+<RelatesParam1>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<RelatesParam1>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
+ "Missing argument of '\\%s' command",yyextra->currentCmd.data()
+ );
+ unput_string(yytext,yyleng);
+ //if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ BEGIN( Comment );
+ }
+<RelatesParam1>. { // ignore other stuff
+ }
/* ----- handle arguments of the relates(also)/addindex commands ----- */
-<LineParam>{DOCNL} { // end of argument
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<LineParam>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<LineParam>. { // ignore other stuff
- addOutput(yyscanner,*yytext);
- }
+<LineParam>{DOCNL} { // end of argument
+ //if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ unput_string(yytext,yyleng);
+ BEGIN( Comment );
+ }
+<LineParam>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<LineParam>. { // ignore other stuff
+ addOutput(yyscanner,*yytext);
+ }
/* ----- handle arguments of the section/subsection/.. commands ------- */
-<SectionLabel>{LABELID} { // first argument
- yyextra->sectionLabel=yytext;
+<SectionLabel>{LABELID} { // first argument
+ yyextra->sectionLabel=yytext;
addOutput(yyscanner,yytext);
- yyextra->sectionTitle.resize(0);
- BEGIN(SectionTitle);
- }
-<SectionLabel>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
- "\\section command has no label"
- );
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<SectionLabel>. { // invalid character for section label
- warn(yyextra->fileName,yyextra->lineNr,
- "Invalid or missing section label"
- );
- BEGIN(Comment);
- }
+ yyextra->sectionTitle.resize(0);
+ BEGIN(SectionTitle);
+ }
+<SectionLabel>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
+ "\\section command has no label"
+ );
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ BEGIN( Comment );
+ }
+<SectionLabel>. { // invalid character for section label
+ warn(yyextra->fileName,yyextra->lineNr,
+ "Invalid or missing section label"
+ );
+ BEGIN(Comment);
+ }
<SectionTitle>[^\n@\\*]*/"\n" { // end of section title
- addSection(yyscanner);
+ addSection(yyscanner);
addOutput(yyscanner,yytext);
- BEGIN( Comment );
- }
-<SectionTitle>[^\n@\\]*/"\\_linebr" { // end of section title
- addSection(yyscanner);
+ BEGIN( Comment );
+ }
+<SectionTitle>[^\n@\\]*/"\\ilinebr" { // end of section title
+ addSection(yyscanner);
addOutput(yyscanner,yytext);
- BEGIN( Comment );
- }
-<SectionTitle>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<SectionTitle>[^\n@\\]* { // any character without special meaning
- yyextra->sectionTitle+=yytext;
- addOutput(yyscanner,yytext);
- }
-<SectionTitle>({CMD}{CMD}){ID} { // unescape escaped command
- yyextra->sectionTitle+=&yytext[1];
- addOutput(yyscanner,yytext);
- }
-<SectionTitle>{CMD}[$@\\&~<>#%] { // unescape escaped character
- yyextra->sectionTitle+=yytext[1];
- addOutput(yyscanner,yytext);
- }
-<SectionTitle>. { // anything else
- yyextra->sectionTitle+=yytext;
- addOutput(yyscanner,*yytext);
- }
+ BEGIN( Comment );
+ }
+<SectionTitle>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<SectionTitle>[^\n@\\]* { // any character without special meaning
+ yyextra->sectionTitle+=yytext;
+ addOutput(yyscanner,yytext);
+ }
+<SectionTitle>({CMD}{CMD}){ID} { // unescape escaped command
+ yyextra->sectionTitle+=&yytext[1];
+ addOutput(yyscanner,yytext);
+ }
+<SectionTitle>{CMD}[$@\\&~<>#%] { // unescape escaped character
+ yyextra->sectionTitle+=yytext[1];
+ addOutput(yyscanner,yytext);
+ }
+<SectionTitle>. { // anything else
+ yyextra->sectionTitle+=yytext;
+ addOutput(yyscanner,*yytext);
+ }
/* ----- handle arguments of the subpage command ------- */
-<SubpageLabel>{LABELID} { // first argument
+<SubpageLabel>{LABELID} { // first argument
addOutput(yyscanner,yytext);
- // we add subpage labels as a kind of "inheritance" relation to prevent
- // needing to add another list to the Entry class.
- yyextra->current->extends.push_back(BaseInfo(yytext,Public,Normal));
- BEGIN(SubpageTitle);
- }
-<SubpageLabel>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
- "\\subpage command has no label"
- );
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<SubpageTitle>{DOCNL} { // no title, end command
- addOutput(yyscanner,yytext);
- BEGIN( Comment );
- }
-<SubpageTitle>[ \t]*"\""[^\"\n]*"\"" { // add title, end of command
- addOutput(yyscanner,yytext);
- BEGIN( Comment );
- }
-<SubpageTitle>. { // no title, end of command
- unput(*yytext);
- BEGIN( Comment );
- }
+ // we add subpage labels as a kind of "inheritance" relation to prevent
+ // needing to add another list to the Entry class.
+ yyextra->current->extends.push_back(BaseInfo(yytext,Public,Normal));
+ BEGIN(SubpageTitle);
+ }
+<SubpageLabel>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
+ "\\subpage command has no label"
+ );
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ BEGIN( Comment );
+ }
+<SubpageTitle>{DOCNL} { // no title, end command
+ addOutput(yyscanner,yytext);
+ BEGIN( Comment );
+ }
+<SubpageTitle>[ \t]*"\""[^\"\n]*"\"" { // add title, end of command
+ addOutput(yyscanner,yytext);
+ BEGIN( Comment );
+ }
+<SubpageTitle>. { // no title, end of command
+ unput(*yytext);
+ BEGIN( Comment );
+ }
/* ----- handle arguments of the anchor command ------- */
-<AnchorLabel>{LABELID} { // found argument
+<AnchorLabel>{LABELID} { // found argument
addAnchor(yyscanner,yytext);
- addOutput(yyscanner,yytext);
- BEGIN( Comment );
- }
-<AnchorLabel>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
- "\\anchor command has no label"
- );
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<AnchorLabel>. { // invalid character for anchor label
- warn(yyextra->fileName,yyextra->lineNr,
- "Invalid or missing anchor label"
- );
- BEGIN(Comment);
- }
+ addOutput(yyscanner,yytext);
+ BEGIN( Comment );
+ }
+<AnchorLabel>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
+ "\\anchor command has no label"
+ );
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ BEGIN( Comment );
+ }
+<AnchorLabel>. { // invalid character for anchor label
+ warn(yyextra->fileName,yyextra->lineNr,
+ "Invalid or missing anchor label"
+ );
+ BEGIN(Comment);
+ }
/* ----- handle arguments of the preformatted block commands ------- */
<FormatBlock>{CMD}("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"endmsc"|"endvhdlflow")/{NW} { // possible ends
- addOutput(yyscanner,yytext);
- if (&yytext[4]==yyextra->blockName) // found end of the block
- {
- BEGIN(Comment);
- }
- }
+ addOutput(yyscanner,yytext);
+ if (&yytext[4]==yyextra->blockName) // found end of the block
+ {
+ BEGIN(Comment);
+ }
+ }
<FormatBlock>{CMD}"enduml" {
- addOutput(yyscanner,yytext);
- if (yyextra->blockName=="startuml") // found end of the block
- {
- BEGIN(Comment);
- }
- }
-<FormatBlock>[^ \@\*\/\\\n]* { // some word
- addOutput(yyscanner,yytext);
- }
-<FormatBlock>{DOCNL} { // new line
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<FormatBlock>"/*" { // start of a C-comment
- if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim")) yyextra->commentCount++;
- addOutput(yyscanner,yytext);
- }
-<FormatBlock>"*/" { // end of a C-comment
- addOutput(yyscanner,yytext);
- if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim"))
+ addOutput(yyscanner,yytext);
+ if (yyextra->blockName=="startuml") // found end of the block
+ {
+ BEGIN(Comment);
+ }
+ }
+<FormatBlock>[^ \@\*\/\\\n]* { // some word
+ addOutput(yyscanner,yytext);
+ }
+<FormatBlock>{DOCNL} { // new line
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<FormatBlock>"/*" { // start of a C-comment
+ if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim")) yyextra->commentCount++;
+ addOutput(yyscanner,yytext);
+ }
+<FormatBlock>"*/" { // end of a C-comment
+ addOutput(yyscanner,yytext);
+ if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim"))
{
yyextra->commentCount--;
- if (yyextra->commentCount<0)
- {
- 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(yyscanner,*yytext);
- }
-<FormatBlock><<EOF>> {
+ if (yyextra->commentCount<0)
+ {
+ 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(yyscanner,*yytext);
+ }
+<FormatBlock><<EOF>> {
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!",
- yyextra->blockName.data(),endTag.data()
- );
- yyterminate();
- }
+ "reached end of comment while inside a \\%s block; check for missing \\%s tag!",
+ yyextra->blockName.data(),endTag.data()
+ );
+ yyterminate();
+ }
/* ----- handle arguments of if/ifnot commands ------- */
-<GuardParam>{B}*"(" {
+<GuardParam>{B}*"(" {
yyextra->guardExpr=yytext;
yyextra->roundCount=1;
BEGIN(GuardExpr);
@@ -1531,383 +1503,388 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
}
}
<GuardExpr>\n {
- warn(yyextra->fileName,yyextra->lineNr,
- "invalid expression '%s' for yyextra->guards",yyextra->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 yyextra->guards
+<GuardParam>{B}*[a-z_A-Z0-9.\-]+ { // parameter of if/ifnot yyextra->guards
handleGuard(yyscanner,yytext);
- }
-<GuardParam>{DOCNL} { // end of argument
- if (*yytext=='\n') yyextra->lineNr++;
- //next line is commented out due to bug620924
- //addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<GuardParam>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<GuardParam>. { // ignore other stuff
- addOutput(yyscanner,*yytext);
- }
-<GuardParamEnd>{B}*{DOCNL} {
- lineCount(yyscanner);
- yyextra->spaceBeforeIf.resize(0);
- BEGIN(Comment);
- }
-<GuardParamEnd>{B}* {
- if (!yyextra->spaceBeforeIf.isEmpty()) // needed for 665313 in combination with bug620924
- {
- addOutput(yyscanner,yyextra->spaceBeforeIf);
- }
- yyextra->spaceBeforeIf.resize(0);
- BEGIN(Comment);
- }
-<GuardParamEnd>. {
- unput(*yytext);
- BEGIN(Comment);
- }
+ }
+<GuardParam>{DOCNL} { // end of argument
+ if (*yytext=='\n') yyextra->lineNr++;
+ //next line is commented out due to bug620924
+ //addOutput(yyscanner,'\n');
+ BEGIN( Comment );
+ }
+<GuardParam>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<GuardParam>. { // ignore other stuff
+ addOutput(yyscanner,*yytext);
+ }
+<GuardParamEnd>{B}*{DOCNL} {
+ lineCount(yyscanner);
+ yyextra->spaceBeforeIf.resize(0);
+ BEGIN(Comment);
+ }
+<GuardParamEnd>{B}* {
+ if (!yyextra->spaceBeforeIf.isEmpty()) // needed for 665313 in combination with bug620924
+ {
+ addOutput(yyscanner,yyextra->spaceBeforeIf);
+ }
+ yyextra->spaceBeforeIf.resize(0);
+ BEGIN(Comment);
+ }
+<GuardParamEnd>. {
+ unput(*yytext);
+ BEGIN(Comment);
+ }
/* ----- handle skipping of conditional sections ------- */
-<SkipGuardedSection>{CMD}"ifnot"/{NW} {
+<SkipGuardedSection>{CMD}"ifnot"/{NW} {
yyextra->guardType = Guard_IfNot;
- BEGIN( GuardParam );
- }
-<SkipGuardedSection>{CMD}"if"/{NW} {
+ BEGIN( GuardParam );
+ }
+<SkipGuardedSection>{CMD}"if"/{NW} {
yyextra->guardType = Guard_If;
- BEGIN( GuardParam );
- }
-<SkipGuardedSection>{CMD}"endif"/{NW} {
- if (yyextra->guards.isEmpty())
- {
- warn(yyextra->fileName,yyextra->lineNr,
- "found \\endif without matching start command");
- }
- else
- {
- GuardedSection *s = yyextra->guards.pop();
- bool parentVisible = s->parentVisible();
- delete s;
+ BEGIN( GuardParam );
+ }
+<SkipGuardedSection>{CMD}"endif"/{NW} {
+ if (yyextra->guards.empty())
+ {
+ warn(yyextra->fileName,yyextra->lineNr,
+ "found \\endif without matching start command");
+ }
+ else
+ {
+ GuardedSection s = yyextra->guards.top();
+ yyextra->guards.pop();
+ bool parentVisible = s.parentVisible();
if (parentVisible)
{
- yyextra->enabledSectionFound=TRUE;
- BEGIN( GuardParamEnd );
+ yyextra->enabledSectionFound=TRUE;
+ BEGIN( GuardParamEnd );
}
- }
- }
-<SkipGuardedSection>{CMD}"else"/{NW} {
- if (yyextra->guards.isEmpty())
- {
- warn(yyextra->fileName,yyextra->lineNr,
- "found \\else without matching start command");
- }
- else
- {
- if (!yyextra->enabledSectionFound && yyextra->guards.top()->parentVisible())
- {
- delete yyextra->guards.pop();
- yyextra->guards.push(new GuardedSection(TRUE,TRUE));
- yyextra->enabledSectionFound=TRUE;
- BEGIN( GuardParamEnd );
- }
- }
- }
+ }
+ }
+<SkipGuardedSection>{CMD}"else"/{NW} {
+ if (yyextra->guards.empty())
+ {
+ warn(yyextra->fileName,yyextra->lineNr,
+ "found \\else without matching start command");
+ }
+ else
+ {
+ if (!yyextra->enabledSectionFound && yyextra->guards.top().parentVisible())
+ {
+ yyextra->guards.pop();
+ yyextra->guards.push(GuardedSection(TRUE,TRUE));
+ yyextra->enabledSectionFound=TRUE;
+ BEGIN( GuardParamEnd );
+ }
+ }
+ }
<SkipGuardedSection>{CMD}"elseif"/{NW} {
- if (yyextra->guards.isEmpty())
- {
- warn(yyextra->fileName,yyextra->lineNr,
- "found \\elseif without matching start command");
- }
- else
- {
- if (!yyextra->enabledSectionFound && yyextra->guards.top()->parentVisible())
- {
+ if (yyextra->guards.empty())
+ {
+ warn(yyextra->fileName,yyextra->lineNr,
+ "found \\elseif without matching start command");
+ }
+ else
+ {
+ if (!yyextra->enabledSectionFound && yyextra->guards.top().parentVisible())
+ {
yyextra->guardType=Guard_If;
- delete yyextra->guards.pop();
- BEGIN( GuardParam );
- }
- }
- }
-<SkipGuardedSection>{DOCNL} { // skip line
- if (*yytext=='\n') yyextra->lineNr++;
- //addOutput(yyscanner,'\n');
- }
-<SkipGuardedSection>[^ \\@\n]+ { // skip non-special characters
- }
-<SkipGuardedSection>. { // any other character
- }
+ yyextra->guards.pop();
+ BEGIN( GuardParam );
+ }
+ }
+ }
+<SkipGuardedSection>{DOCNL} { // skip line
+ if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ }
+<SkipGuardedSection>[^ \\@\n]+ { // skip non-special characters
+ }
+<SkipGuardedSection>. { // any other character
+ }
/* ----- handle skipping of internal section ------- */
-<SkipInternal>{DOCNL} { // skip line
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<SkipInternal>[@\\]"if"/[ \t] {
+<SkipInternal>{DOCNL} { // skip line
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<SkipInternal>[@\\]"if"/[ \t] {
yyextra->condCount++;
- }
-<SkipInternal>[@\\]"ifnot"/[ \t] {
+ }
+<SkipInternal>[@\\]"ifnot"/[ \t] {
yyextra->condCount++;
- }
-<SkipInternal>[@\\]/"endif" {
+ }
+<SkipInternal>[@\\]/"endif" {
yyextra->condCount--;
- if (yyextra->condCount<0) // handle conditional section around of \internal, see bug607743
- {
- unput('\\');
- BEGIN(Comment);
- }
- }
-<SkipInternal>[@\\]/"section"[ \t] {
- if (yyextra->sectionLevel>0)
- {
- unput('\\');
- BEGIN(Comment);
- }
- }
-<SkipInternal>[@\\]/"subsection"[ \t] {
- if (yyextra->sectionLevel>1)
- {
- unput('\\');
- BEGIN(Comment);
- }
- }
-<SkipInternal>[@\\]/"subsubsection"[ \t] {
- if (yyextra->sectionLevel>2)
- {
- unput('\\');
- BEGIN(Comment);
- }
- }
-<SkipInternal>[@\\]/"paragraph"[ \t] {
- if (yyextra->sectionLevel>3)
- {
- unput('\\');
- BEGIN(Comment);
- }
- }
+ if (yyextra->condCount<0) // handle conditional section around of \internal, see bug607743
+ {
+ unput('\\');
+ BEGIN(Comment);
+ }
+ }
+<SkipInternal>[@\\]/"section"[ \t] {
+ if (yyextra->sectionLevel>0)
+ {
+ unput('\\');
+ BEGIN(Comment);
+ }
+ }
+<SkipInternal>[@\\]/"subsection"[ \t] {
+ if (yyextra->sectionLevel>1)
+ {
+ unput('\\');
+ BEGIN(Comment);
+ }
+ }
+<SkipInternal>[@\\]/"subsubsection"[ \t] {
+ if (yyextra->sectionLevel>2)
+ {
+ unput('\\');
+ BEGIN(Comment);
+ }
+ }
+<SkipInternal>[@\\]/"paragraph"[ \t] {
+ if (yyextra->sectionLevel>3)
+ {
+ unput('\\');
+ BEGIN(Comment);
+ }
+ }
<SkipInternal>[@\\]"endinternal"[ \t]* {
- BEGIN(Comment);
- }
-<SkipInternal>[^ \\@\n]+ { // skip non-special characters
- }
-<SkipInternal>. { // any other character
- }
+ BEGIN(Comment);
+ }
+<SkipInternal>[^ \\@\n]+ { // skip non-special characters
+ }
+<SkipInternal>. { // any other character
+ }
/* ----- handle argument of name command ------- */
-<NameParam>{DOCNL} { // end of argument
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<NameParam>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- Doxygen::docGroup.appendHeader(' ');
- }
-<NameParam>. { // ignore other stuff
- Doxygen::docGroup.appendHeader(*yytext);
- yyextra->current->name+=*yytext;
- }
+<NameParam>{DOCNL} { // end of argument
+ //if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ unput_string(yytext,yyleng);
+ BEGIN( Comment );
+ }
+<NameParam>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ yyextra->docGroup.appendHeader(' ');
+ }
+<NameParam>. { // ignore other stuff
+ yyextra->docGroup.appendHeader(*yytext);
+ yyextra->current->name+=*yytext;
+ }
/* ----- handle argument of noop command ------- */
-<Noop>{DOCNL} { // end of argument
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<Noop>. { // ignore other stuff
- }
+<Noop>{DOCNL} { // end of argument
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ BEGIN( Comment );
+ }
+<Noop>. { // ignore other stuff
+ }
/* ----- handle argument of ingroup command ------- */
-<InGroupParam>{LABELID} { // group id
- yyextra->current->groups.push_back(
- Grouping(yytext, Grouping::GROUPING_INGROUP)
- );
- yyextra->inGroupParamFound=TRUE;
- }
-<InGroupParam>{DOCNL} { // missing argument
- if (!yyextra->inGroupParamFound)
- {
- warn(yyextra->fileName,yyextra->lineNr,
- "Missing group name for \\ingroup command"
- );
- }
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<InGroupParam>{LC} { // line continuation
- yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- }
-<InGroupParam>. { // ignore other stuff
- addOutput(yyscanner,*yytext);
- }
+<InGroupParam>{LABELID} { // group id
+ yyextra->current->groups.push_back(
+ Grouping(yytext, Grouping::GROUPING_INGROUP)
+ );
+ yyextra->inGroupParamFound=TRUE;
+ }
+<InGroupParam>{DOCNL} { // missing argument
+ if (!yyextra->inGroupParamFound)
+ {
+ warn(yyextra->fileName,yyextra->lineNr,
+ "Missing group name for \\ingroup command"
+ );
+ }
+ //if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ unput_string(yytext,yyleng);
+ BEGIN( Comment );
+ }
+<InGroupParam>{LC} { // line continuation
+ yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ }
+<InGroupParam>. { // ignore other stuff
+ addOutput(yyscanner,*yytext);
+ }
/* ----- handle argument of fn command ------- */
-<FnParam>{DOCNL} { // end of argument
- if (yyextra->braceCount==0)
- {
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- yyextra->langParser->parsePrototype(yyextra->functionProto);
- BEGIN( Comment );
- }
- }
-<FnParam>{LC} { // line continuation
- yyextra->lineNr++;
- yyextra->functionProto+=' ';
- }
-<FnParam>[^@\\\n()]+ { // non-special characters
+<FnParam>{DOCNL} { // end of argument
+ if (yyextra->braceCount==0)
+ {
+ //if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ unput_string(yytext,yyleng);
+ yyextra->langParser->parsePrototype(yyextra->functionProto);
+ BEGIN( Comment );
+ }
+ }
+<FnParam>{LC} { // line continuation
+ yyextra->lineNr++;
+ yyextra->functionProto+=' ';
+ }
+<FnParam>[^@\\\n()]+ { // non-special characters
yyextra->functionProto+=yytext;
- }
-<FnParam>"(" {
+ }
+<FnParam>"(" {
yyextra->functionProto+=yytext;
- yyextra->braceCount++;
- }
-<FnParam>")" {
+ yyextra->braceCount++;
+ }
+<FnParam>")" {
yyextra->functionProto+=yytext;
- yyextra->braceCount--;
- }
-<FnParam>. { // add other stuff
+ yyextra->braceCount--;
+ }
+<FnParam>. { // add other stuff
yyextra->functionProto+=*yytext;
- }
+ }
/* ----- handle argument of overload command ------- */
-<OverloadParam>{DOCNL} { // end of argument
- if (*yytext=='\n') yyextra->lineNr++;
- if (yyextra->functionProto.stripWhiteSpace().isEmpty())
- { // plain overload command
- addOutput(yyscanner,getOverloadDocs());
- addOutput(yyscanner,'\n');
- }
- else // overload declaration
- {
+<OverloadParam>{DOCNL} { // end of argument
+ if (*yytext=='\n') yyextra->lineNr++;
+ if (yyextra->functionProto.stripWhiteSpace().isEmpty())
+ { // plain overload command
+ addOutput(yyscanner,getOverloadDocs());
+ addOutput(yyscanner,'\n');
+ }
+ else // overload declaration
+ {
makeStructuralIndicator(yyscanner,Entry::OVERLOADDOC_SEC);
- yyextra->langParser->parsePrototype(yyextra->functionProto);
- }
- BEGIN( Comment );
- }
-<OverloadParam>{LC} { // line continuation
- yyextra->lineNr++;
- yyextra->functionProto+=' ';
- }
-<OverloadParam>. { // add other stuff
+ yyextra->langParser->parsePrototype(yyextra->functionProto);
+ }
+ BEGIN( Comment );
+ }
+<OverloadParam>{LC} { // line continuation
+ yyextra->lineNr++;
+ yyextra->functionProto+=' ';
+ }
+<OverloadParam>. { // add other stuff
yyextra->functionProto+=*yytext;
- }
+ }
/* ----- handle argument of inherit command ------- */
-<InheritParam>({ID}("::"|"."))*{ID} { // found argument
- yyextra->current->extends.push_back(
- BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal)
- );
- BEGIN( Comment );
- }
-<InheritParam>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
- "\\inherit command has no argument"
- );
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<InheritParam>. { // invalid character for anchor label
- warn(yyextra->fileName,yyextra->lineNr,
- "Invalid or missing name for \\inherit command"
- );
- BEGIN(Comment);
- }
+<InheritParam>({ID}("::"|"."))*{ID} { // found argument
+ yyextra->current->extends.push_back(
+ BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal)
+ );
+ BEGIN( Comment );
+ }
+<InheritParam>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
+ "\\inherit command has no argument"
+ );
+ if (*yytext=='\n') yyextra->lineNr++;
+ addOutput(yyscanner,'\n');
+ BEGIN( Comment );
+ }
+<InheritParam>. { // invalid character for anchor label
+ warn(yyextra->fileName,yyextra->lineNr,
+ "Invalid or missing name for \\inherit command"
+ );
+ BEGIN(Comment);
+ }
/* ----- handle argument of extends and implements commands ------- */
-<ExtendsParam>({ID}("::"|"."))*{ID} { // found argument
- yyextra->current->extends.push_back(
- BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal)
- );
- BEGIN( Comment );
- }
-<ExtendsParam>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
- "\\extends or \\implements command has no argument"
- );
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<ExtendsParam>. { // ignore other stuff
- }
+<ExtendsParam>({ID}("::"|"."))*{ID} { // found argument
+ yyextra->current->extends.push_back(
+ BaseInfo(removeRedundantWhiteSpace(yytext),Public,Normal)
+ );
+ BEGIN( Comment );
+ }
+<ExtendsParam>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
+ "'\\%s' command has no argument",yyextra->currentCmd.data()
+ );
+ //if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ unput_string(yytext,yyleng);
+ BEGIN( Comment );
+ }
+<ExtendsParam>. { // ignore other stuff
+ }
/* ----- handle language specific sections ------- */
-<SkipLang>[\\@]"~"[a-zA-Z-]* { /* language switch */
- QCString langId = &yytext[2];
- if (langId.isEmpty() ||
- qstricmp(Config_getEnum(OUTPUT_LANGUAGE),langId)==0)
- { // enable language specific section
- BEGIN(Comment);
- }
- }
-<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
- }
-<SkipLang>{DOCNL} { /* new line in verbatim block */
- if (*yytext=='\n') yyextra->lineNr++;
- }
-<SkipLang>. { /* any other character */
- }
+<SkipLang>[\\@]"~"[a-zA-Z-]* { /* language switch */
+ QCString langId = &yytext[2];
+ if (langId.isEmpty() ||
+ qstricmp(Config_getEnum(OUTPUT_LANGUAGE),langId)==0)
+ { // enable language specific section
+ BEGIN(Comment);
+ }
+ }
+<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
+ }
+<SkipLang>{DOCNL} { /* new line in verbatim block */
+ if (*yytext=='\n') yyextra->lineNr++;
+ }
+<SkipLang>. { /* any other character */
+ }
/* ----- handle arguments of the cite command ------- */
-<CiteLabel>{CITEID} { // found argument
- addCite(yyscanner);
+<CiteLabel>{CITEID} { // found argument
+ addCite(yyscanner);
addOutput(yyscanner,yytext);
- BEGIN(Comment);
- }
-<CiteLabel>{DOCNL} { // missing argument
- warn(yyextra->fileName,yyextra->lineNr,
- "\\cite command has no label"
- );
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- BEGIN( Comment );
- }
-<CiteLabel>. { // invalid character for cite label
- warn(yyextra->fileName,yyextra->lineNr,
- "Invalid or missing cite label"
- );
- BEGIN(Comment);
- }
+ BEGIN(Comment);
+ }
+<CiteLabel>{DOCNL} { // missing argument
+ warn(yyextra->fileName,yyextra->lineNr,
+ "\\cite command has no label"
+ );
+ //if (*yytext=='\n') yyextra->lineNr++;
+ //addOutput(yyscanner,'\n');
+ unput_string(yytext,yyleng);
+ BEGIN( Comment );
+ }
+<CiteLabel>. { // invalid character for cite label
+ warn(yyextra->fileName,yyextra->lineNr,
+ "Invalid or missing cite label"
+ );
+ BEGIN(Comment);
+ }
/* ----- handle argument of the copydoc command ------- */
-<CopyDoc><<EOF>> |
-<CopyDoc>{DOCNL} {
- if (*yytext=='\n') yyextra->lineNr++;
- addOutput(yyscanner,'\n');
- setOutput(yyscanner,OutputDoc);
+<CopyDoc><<EOF>> |
+<CopyDoc>{DOCNL} {
+ 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\\]+ {
- yyextra->copyDocArg+=yytext;
- addOutput(yyscanner,yytext);
- }
-<CopyDoc>. {
- yyextra->copyDocArg+=yytext;
- addOutput(yyscanner,yytext);
- }
+ addOutput(yyscanner,yyextra->copyDocArg);
+ addOutput(yyscanner,"\n");
+ BEGIN(Comment);
+ }
+<CopyDoc>[^\n\\]+ {
+ yyextra->copyDocArg+=yytext;
+ addOutput(yyscanner,yytext);
+ }
+<CopyDoc>. {
+ yyextra->copyDocArg+=yytext;
+ addOutput(yyscanner,yytext);
+ }
%%
@@ -1961,7 +1938,6 @@ static bool handleDefGroup(yyscan_t yyscanner,const QCString &, const QCStringLi
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;
}
@@ -2000,11 +1976,12 @@ static bool handlePackage(yyscan_t yyscanner,const QCString &, const QCStringLis
return stop;
}
-static bool handleClass(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleClass(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::CLASSDOC_SEC);
- BEGIN( ClassDocArg1 );
+ yyextra->currentCmd = cmd;
+ BEGIN( ClassDocArg1 );
return stop;
}
@@ -2015,51 +1992,57 @@ static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const QCString
return FALSE;
}
-static bool handleProtocol(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleProtocol(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{ // Obj-C protocol
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::PROTOCOLDOC_SEC);
- BEGIN( ClassDocArg1 );
+ yyextra->currentCmd = cmd;
+ BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleCategory(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleCategory(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{ // Obj-C category
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::CATEGORYDOC_SEC);
- BEGIN( CategoryDocArg1 );
+ yyextra->currentCmd = cmd;
+ BEGIN( CategoryDocArg1 );
return stop;
}
-static bool handleUnion(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleUnion(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::UNIONDOC_SEC);
- BEGIN( ClassDocArg1 );
+ yyextra->currentCmd = cmd;
+ BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleStruct(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleStruct(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::STRUCTDOC_SEC);
- BEGIN( ClassDocArg1 );
+ yyextra->currentCmd = cmd;
+ BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleInterface(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleInterface(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::INTERFACEDOC_SEC);
- BEGIN( ClassDocArg1 );
+ yyextra->currentCmd = cmd;
+ BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleIdlException(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleIdlException(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::EXCEPTIONDOC_SEC);
- BEGIN( ClassDocArg1 );
+ yyextra->currentCmd = cmd;
+ BEGIN( ClassDocArg1 );
return stop;
}
@@ -2076,7 +2059,7 @@ static bool handleMainpage(yyscan_t yyscanner,const QCString &, const QCStringLi
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::MAINPAGEDOC_SEC);
yyextra->current->name = "";
- if (!stop)
+ if (!stop)
{
yyextra->current->name = "mainpage";
}
@@ -2088,7 +2071,7 @@ static bool handleFile(yyscan_t yyscanner,const QCString &, const QCStringList &
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::FILEDOC_SEC);
- if (!stop)
+ if (!stop)
{
yyextra->current->name = yyextra->fileName;
}
@@ -2138,7 +2121,7 @@ static bool handleExample(yyscan_t yyscanner,const QCString &cmd, const QCString
else
{
warn(yyextra->fileName,yyextra->lineNr,
- "unsupported option '%s' for command '\\%s'",qPrint(opt),qPrint(cmd));
+ "unsupported option '%s' for command '\\%s'",qPrint(opt),qPrint(cmd));
}
}
bool stop=makeStructuralIndicator(yyscanner,section);
@@ -2152,8 +2135,8 @@ static bool handleDetails(yyscan_t yyscanner,const QCString &, const QCStringLis
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (yyextra->inContext!=OutputBrief)
{
- addOutput(yyscanner,"\n\n"); // treat @details outside brief description
- // as a new paragraph
+ addOutput(yyscanner,"\\ilinebr\\ilinebr "); // treat @details outside brief description
+ // as a new paragraph
}
setOutput(yyscanner,OutputDoc);
return FALSE;
@@ -2172,11 +2155,11 @@ static bool handleName(yyscan_t yyscanner,const QCString &, const QCStringList &
bool stop=makeStructuralIndicator(yyscanner,Entry::MEMBERGRP_SEC);
if (!stop)
{
- Doxygen::docGroup.clearHeader();
+ yyextra->docGroup.clearHeader();
BEGIN( NameParam );
- if (!Doxygen::docGroup.isEmpty()) // end of previous member group
+ if (!yyextra->docGroup.isEmpty()) // end of previous member group
{
- Doxygen::docGroup.close(yyextra->current,yyextra->fileName,yyextra->lineNr,TRUE,true);
+ yyextra->docGroup.close(yyextra->current,yyextra->fileName,yyextra->lineNr,TRUE,true);
}
}
return stop;
@@ -2232,9 +2215,9 @@ static bool handleParBlock(yyscan_t yyscanner,const QCString &, const QCStringLi
if (yyextra->insideParBlock)
{
warn(yyextra->fileName,yyextra->lineNr,
- "found \\parblock command while already in a parblock!");
+ "found \\parblock command while already in a parblock!");
}
- if (!yyextra->spaceBeforeCmd.isEmpty())
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
addOutput(yyscanner,yyextra->spaceBeforeCmd);
yyextra->spaceBeforeCmd.resize(0);
@@ -2250,7 +2233,7 @@ static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStrin
if (!yyextra->insideParBlock)
{
warn(yyextra->fileName,yyextra->lineNr,
- "found \\endparblock command without matching \\parblock!");
+ "found \\endparblock command without matching \\parblock!");
}
addOutput(yyscanner,"@endparblock");
setOutput(yyscanner,OutputDoc); // to end a parblock inside a xrefitem like context
@@ -2258,41 +2241,43 @@ static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStrin
return FALSE;
}
-static bool handleRelated(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleRelated(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (!yyextra->current->relates.isEmpty())
{
warn(yyextra->fileName,yyextra->lineNr,
- "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
+ "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
}
yyextra->current->relatesType = Simple;
BEGIN(RelatesParam1);
return FALSE;
}
-static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (!yyextra->current->relates.isEmpty())
{
warn(yyextra->fileName,yyextra->lineNr,
- "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
+ "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
}
yyextra->current->relatesType = Duplicate;
+ yyextra->currentCmd = cmd;
BEGIN(RelatesParam1);
return FALSE;
}
-static bool handleMemberOf(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleMemberOf(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (!yyextra->current->relates.isEmpty())
{
warn(yyextra->fileName,yyextra->lineNr,
- "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
+ "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
}
yyextra->current->relatesType = MemberOf;
+ yyextra->currentCmd = cmd;
BEGIN(RelatesParam1);
return FALSE;
}
@@ -2321,15 +2306,15 @@ static bool handleSection(yyscan_t yyscanner,const QCString &s, const QCStringLi
static bool handleSubpage(yyscan_t yyscanner,const QCString &s, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (yyextra->current->section!=Entry::EMPTY_SEC &&
+ if (yyextra->current->section!=Entry::EMPTY_SEC &&
yyextra->current->section!=Entry::PAGEDOC_SEC &&
yyextra->current->section!=Entry::MAINPAGEDOC_SEC
)
{
warn(yyextra->fileName,yyextra->lineNr,
- "found \\subpage command in a comment block that is not marked as a page!");
+ "found \\subpage command in a comment block that is not marked as a page!");
}
- if (!yyextra->spaceBeforeCmd.isEmpty())
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
addOutput(yyscanner,yyextra->spaceBeforeCmd);
yyextra->spaceBeforeCmd.resize(0);
@@ -2350,7 +2335,7 @@ static bool handleAnchor(yyscan_t yyscanner,const QCString &s, const QCStringLis
static bool handleCite(yyscan_t yyscanner,const QCString &s, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (!yyextra->spaceBeforeCmd.isEmpty())
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
addOutput(yyscanner,yyextra->spaceBeforeCmd);
yyextra->spaceBeforeCmd.resize(0);
@@ -2409,14 +2394,15 @@ static bool handleIfNot(yyscan_t yyscanner,const QCString &, const QCStringList
static bool handleElseIf(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (yyextra->guards.isEmpty())
+ if (yyextra->guards.empty())
{
warn(yyextra->fileName,yyextra->lineNr,
- "found \\else without matching start command");
+ "found \\else without matching start command");
}
else
{
yyextra->guardType = yyextra->enabledSectionFound ? Guard_Skip : Guard_If;
+ yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
BEGIN(GuardParam);
}
return FALSE;
@@ -2425,13 +2411,14 @@ static bool handleElseIf(yyscan_t yyscanner,const QCString &, const QCStringList
static bool handleElse(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (yyextra->guards.isEmpty())
+ if (yyextra->guards.empty())
{
warn(yyextra->fileName,yyextra->lineNr,
- "found \\else without matching start command");
+ "found \\else without matching start command");
}
else
{
+ yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
BEGIN( SkipGuardedSection );
}
return FALSE;
@@ -2440,17 +2427,17 @@ static bool handleElse(yyscan_t yyscanner,const QCString &, const QCStringList &
static bool handleEndIf(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (yyextra->guards.isEmpty())
+ if (yyextra->guards.empty())
{
warn(yyextra->fileName,yyextra->lineNr,
- "found \\endif without matching start command");
+ "found \\endif without matching start command");
}
else
{
- delete yyextra->guards.pop();
+ yyextra->guards.pop();
}
yyextra->enabledSectionFound=FALSE;
- if (!yyextra->spaceBeforeCmd.isEmpty())
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
addOutput(yyscanner,yyextra->spaceBeforeCmd);
yyextra->spaceBeforeCmd.resize(0);
@@ -2470,7 +2457,7 @@ static bool handleIngroup(yyscan_t yyscanner,const QCString &, const QCStringLis
static bool handleNoSubGrouping(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- yyextra->current->subGrouping = FALSE;
+ yyextra->current->subGrouping = FALSE;
return FALSE;
}
@@ -2552,7 +2539,7 @@ static bool handleInternal(yyscan_t yyscanner,const QCString &, const QCStringLi
// make sure some whitespace before a \internal command
// is not treated as "documentation"
if (yyextra->current->doc.stripWhiteSpace().isEmpty())
- {
+ {
yyextra->current->doc.resize(0);
}
yyextra->condCount=0;
@@ -2561,32 +2548,23 @@ static bool handleInternal(yyscan_t yyscanner,const QCString &, const QCStringLi
else
{
// re-enabled for bug640828
- addOutput(yyscanner," \\internal ");
+ addOutput(yyscanner," \\internal ");
yyextra->inInternalDocs = TRUE;
}
return FALSE;
}
-static bool handleLineBr(yyscan_t yyscanner,const QCString &, const QCStringList &)
-{
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- addOutput(yyscanner,'\n');
- return FALSE;
-}
-
static bool handleStatic(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- endBrief(yyscanner);
- yyextra->current->stat = TRUE;
+ yyextra->current->stat = TRUE;
return FALSE;
}
static bool handlePure(yyscan_t yyscanner,const QCString &, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- endBrief(yyscanner);
- yyextra->current->virt = Pure;
+ yyextra->current->virt = Pure;
return FALSE;
}
@@ -2635,7 +2613,7 @@ static bool handlePublicSection(yyscan_t yyscanner,const QCString &, const QCStr
static bool handleToc(yyscan_t yyscanner,const QCString &, const QCStringList &optList)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (yyextra->current->section==Entry::PAGEDOC_SEC ||
+ if (yyextra->current->section==Entry::PAGEDOC_SEC ||
yyextra->current->section==Entry::MAINPAGEDOC_SEC)
{
QCStringList::ConstIterator it;
@@ -2700,9 +2678,10 @@ static bool handleInherit(yyscan_t yyscanner,const QCString &, const QCStringLis
return FALSE;
}
-static bool handleExtends(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleExtends(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->currentCmd = cmd;
BEGIN(ExtendsParam);
return FALSE;
}
@@ -2716,7 +2695,7 @@ static bool handleCopyBrief(yyscan_t yyscanner,const QCString &, const QCStringL
// otherwise it will be copied inline (see bug691315 & bug700788)
setOutput(yyscanner,OutputBrief);
}
- if (!yyextra->spaceBeforeCmd.isEmpty())
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
addOutput(yyscanner,yyextra->spaceBeforeCmd);
yyextra->spaceBeforeCmd.resize(0);
@@ -2729,7 +2708,7 @@ static bool handleCopyDetails(yyscan_t yyscanner,const QCString &, const QCStrin
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
setOutput(yyscanner,OutputDoc);
- if (!yyextra->spaceBeforeCmd.isEmpty())
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
addOutput(yyscanner,yyextra->spaceBeforeCmd);
yyextra->spaceBeforeCmd.resize(0);
@@ -2742,7 +2721,7 @@ static bool handleCopyDoc(yyscan_t yyscanner,const QCString &, const QCStringLis
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
setOutput(yyscanner,OutputBrief);
- if (!yyextra->spaceBeforeCmd.isEmpty())
+ if (!yyextra->spaceBeforeCmd.isEmpty())
{
addOutput(yyscanner,yyextra->spaceBeforeCmd);
yyextra->spaceBeforeCmd.resize(0);
@@ -2760,7 +2739,7 @@ static void initParser(yyscan_t yyscanner)
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
yyextra->sectionLabel.resize(0);
yyextra->sectionTitle.resize(0);
- Doxygen::docGroup.clearHeader();
+ yyextra->docGroup.clearHeader();
yyextra->insideParBlock = FALSE;
}
@@ -2790,7 +2769,7 @@ static bool getDocSectionName(int s)
case Entry::EXAMPLE_SEC:
case Entry::MEMBERGRP_SEC:
return TRUE;
- default:
+ default:
return FALSE;
}
}
@@ -2811,6 +2790,7 @@ static bool makeStructuralIndicator(yyscan_t yyscanner,Entry::Sections s)
yyextra->current->section = s;
yyextra->current->fileName = yyextra->fileName;
yyextra->current->startLine = yyextra->lineNr;
+ yyextra->current->docLine = yyextra->lineNr;
return FALSE;
}
}
@@ -2848,49 +2828,40 @@ static void addXRefItem(yyscan_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)
+ std::unique_lock<std::mutex> lock(g_sectionMutex);
+
+ RefList *refList = RefListManager::instance().add(listName,listTitle,itemTitle);
+ RefItem *item = 0;
+ for (auto it = yyextra->current->sli.rbegin(); it != yyextra->current->sli.rend(); ++it)
{
- if (qstrcmp(item.type,listName)==0)
+ RefItem *i = *it;
+ if (i && qstrcmp(i->list()->listName(),listName)==0)
{
- //printf("found %s lii->type=%s\n",listName,lii->type);
- lii = &item;
+ //printf("found %s lii->type=%s\n",listName,i->list()->listName().data());
+ item = i;
break;
}
}
- if (lii && append) // already found item of same type just before this one
+ if (item && 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 += yyextra->outputXRef;
+ //printf("listName=%s item id = %d existing\n",listName,item->id());
+ item->setText(item->text() + " <p>" + 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);
+ item = refList->add();
+ //printf("listName=%s item id = %d new yyextra->current=%p\n",listName,item->id(),yyextra->current);
+ QCString anchorLabel;
+ anchorLabel.sprintf("_%s%06d",listName,item->id());
+ item->setText(yyextra->outputXRef);
+ item->setAnchor(anchorLabel);
+ yyextra->current->sli.push_back(item);
QCString cmdString;
- cmdString.sprintf(" \\xrefitem %s %d.",listName,itemId);
+ cmdString.sprintf(" \\xrefitem %s %d.",listName,item->id());
if (yyextra->inBody)
{
yyextra->current->inbodyDocs += cmdString;
@@ -2899,26 +2870,29 @@ static void addXRefItem(yyscan_t yyscanner,
{
yyextra->current->doc += cmdString;
}
- SectionInfo *si = Doxygen::sectionDict->find(anchorLabel);
- if (si)
+
{
- if (si->lineNr != -1)
+ SectionManager &sm = SectionManager::instance();
+ const SectionInfo *si = sm.find(anchorLabel);
+ if (si)
{
- warn(listName,yyextra->lineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",anchorLabel,si->fileName.data(),si->lineNr);
+ if (si->lineNr() != -1)
+ {
+ warn(listName,yyextra->lineNr,"multiple use of section label '%s', (first occurrence: %s, line %d)",anchorLabel.data(),si->fileName().data(),si->lineNr());
+ }
+ else
+ {
+ warn(listName,yyextra->lineNr,"multiple use of section label '%s', (first occurrence: %s)",anchorLabel.data(),si->fileName().data());
+ }
}
else
{
- warn(listName,yyextra->lineNr,"multiple use of section label '%s', (first occurrence: %s)",anchorLabel,si->fileName.data());
+ si = sm.add(anchorLabel,listName,yyextra->lineNr,
+ yyextra->sectionTitle,SectionType::Anchor,
+ yyextra->sectionLevel);
+ yyextra->current->anchors.push_back(si);
}
}
- else
- {
- si=new SectionInfo(listName,yyextra->lineNr,anchorLabel,
- yyextra->sectionTitle,SectionInfo::Anchor,
- yyextra->sectionLevel);
- Doxygen::sectionDict->append(anchorLabel,si);
- yyextra->current->anchors.push_back(si);
- }
}
yyextra->outputXRef.resize(0);
}
@@ -2929,50 +2903,41 @@ static void addXRefItem(yyscan_t yyscanner,
// not already added. Returns the label of the formula.
static QCString addFormula(yyscan_t yyscanner)
{
+ std::unique_lock<std::mutex> lock(g_formulaMutex);
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
- {
- formLabel.sprintf("\\_form#%d",f->getId());
- }
- int i;
- for (i=0;i<yyextra->formulaNewLines;i++) formLabel+="@_fakenl"; // add fake newlines to
- // keep the warnings
+ int id = FormulaManager::instance().addFormula(fText);
+ formLabel.sprintf("\\_form#%d",id);
+ for (int 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)
+static SectionType sectionLevelToType(int level)
{
- if (level>=0 && level<5) return (SectionInfo::SectionType)level;
- return SectionInfo::Anchor;
+ if (level>=0 && level<5) return (SectionType)level;
+ return SectionType::Anchor;
}
static void addSection(yyscan_t yyscanner)
{
+ std::unique_lock<std::mutex> lock(g_sectionMutex);
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- SectionInfo *si = Doxygen::sectionDict->find(yyextra->sectionLabel);
+ SectionManager &sm = SectionManager::instance();
+ const SectionInfo *si = sm.find(yyextra->sectionLabel);
if (si)
{
- if (si->lineNr != -1)
+ 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);
+ 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());
+ warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '%s' while adding section, (first occurrence: %s)",yyextra->sectionLabel.data(),si->fileName().data());
}
}
else
@@ -2980,14 +2945,12 @@ static void addSection(yyscan_t yyscanner)
// 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);
+ si = sm.add(yyextra->sectionLabel,yyextra->fileName,yyextra->lineNr,
+ 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);
}
}
@@ -2995,14 +2958,15 @@ static void addSection(yyscan_t yyscanner)
static void addCite(yyscan_t yyscanner)
{
+ std::unique_lock<std::mutex> lock(g_citeMutex);
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
QCString name=yytext;
if (yytext[0] =='"')
{
name=yytext+1;
- name=name.left(yyleng-2);
+ name=name.left((int)yyleng-2);
}
- Doxygen::citeDict->insert(name.data());
+ CitationManager::instance().insert(name.data());
}
//-----------------------------------------------------------------------------
@@ -3013,8 +2977,24 @@ 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)
+ while (i>=0)
+ {
+ c = s.at(i);
+ if (c==' ' || c=='\t' || c=='\r') // normal whitespace
+ {
+ i--;
+ }
+ else if (c=='r' && i>=7 && qstrncmp("\\ilinebr",s.data()+i-7,8)==0) // special line break marker
+ {
+ i-=8;
+ }
+ else // non-whitespace
+ {
+ break;
+ }
+ }
+ //printf("stripTrailingWhitespace(%s) i=%d len=%d\n",s.data(),i,len);
+ if (i!=(int)len-1)
{
s.resize(i+2); // string up to and including char at pos i and \0 terminator
}
@@ -3029,8 +3009,8 @@ static inline void setOutput(yyscan_t yyscanner,OutputContext ctx)
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
+ (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,
@@ -3038,10 +3018,10 @@ static inline void setOutput(yyscan_t yyscanner,OutputContext ctx)
// 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);
+ // 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
+ 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
@@ -3146,23 +3126,24 @@ static inline void setOutput(yyscan_t yyscanner,OutputContext ctx)
static void addAnchor(yyscan_t yyscanner,const char *anchor)
{
+ std::unique_lock<std::mutex> lock(g_sectionMutex);
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- SectionInfo *si = Doxygen::sectionDict->find(anchor);
+ SectionManager &sm = SectionManager::instance();
+ const SectionInfo *si = sm.find(anchor);
if (si)
{
- if (si->lineNr != -1)
+ 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);
+ 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());
+ 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);
+ si = sm.add(anchor,yyextra->fileName,yyextra->lineNr,nullptr,SectionType::Anchor,0);
yyextra->current->anchors.push_back(si);
}
}
@@ -3194,18 +3175,18 @@ static void endBrief(yyscan_t yyscanner,bool addToOutput)
}
}
-static int yyread(yyscan_t yyscanner,char *buf,int max_size)
+static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t 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;
+ yyextra->prevPosition=yyextra->inputPosition;
+ yy_size_t 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;
}
//----------------------------------------------------------------------------
@@ -3243,15 +3224,16 @@ CommentScanner::~CommentScanner()
bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *parser,
/* in */ Entry *curEntry,
/* in */ const QCString &comment,
- /* in */ const QCString &fileName,
- /* in,out */ int &lineNr,
- /* in */ bool isBrief,
- /* in */ bool isAutoBriefOn,
- /* in */ bool isInbody,
- /* in,out */ Protection &prot,
- /* in,out */ int &position,
- /* out */ bool &newEntryNeeded
- )
+ /* in */ const QCString &fileName,
+ /* in,out */ int &lineNr,
+ /* in */ bool isBrief,
+ /* in */ bool isAutoBriefOn,
+ /* in */ bool isInbody,
+ /* in,out */ Protection &prot,
+ /* in,out */ int &position,
+ /* out */ bool &newEntryNeeded,
+ /* in */ bool markdownSupport
+ )
{
yyscan_t yyscanner = p->yyscanner;
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
@@ -3259,16 +3241,16 @@ bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *pars
// isBrief,isAutoBriefOn,lineNr);
initParser(yyscanner);
- yyextra->guards.setAutoDelete(TRUE);
- yyextra->guards.clear();
+ yyextra->guards = std::stack<GuardedSection>();
yyextra->langParser = parser;
yyextra->current = curEntry;
+ yyextra->current->docLine = (lineNr > 1 ? lineNr : 1);
if (comment.isEmpty()) return FALSE; // avoid empty strings
yyextra->inputString = comment;
yyextra->inputString.append(" ");
yyextra->inputPosition = position;
- yyextra->lineNr = lineNr;
- yyextra->fileName = fileName;
+ yyextra->lineNr = lineNr;
+ yyextra->fileName = fileName;
yyextra->protection = prot;
yyextra->needNewEntry = FALSE;
yyextra->xrefKind = XRef_None;
@@ -3276,6 +3258,7 @@ bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *pars
yyextra->insidePre = FALSE;
yyextra->parseMore = FALSE;
yyextra->inBody = isInbody;
+ yyextra->markdownSupport= markdownSupport;
yyextra->outputXRef.resize(0);
if (!isBrief && !isAutoBriefOn && !yyextra->current->doc.isEmpty())
{ // add newline separator between detailed comment blocks
@@ -3297,7 +3280,7 @@ bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *pars
Debug::print(Debug::CommentScan,0,"-----------\nCommentScanner: %s:%d\n"
"input=[\n%s]\n",qPrint(fileName),lineNr,qPrint(yyextra->inputString)
);
-
+
commentscanYYrestart( 0, yyscanner );
BEGIN( Comment );
commentscanYYlex(yyscanner);
@@ -3308,7 +3291,7 @@ bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *pars
addOutput(yyscanner,getOverloadDocs());
}
- if (!yyextra->guards.isEmpty())
+ if (!yyextra->guards.empty())
{
warn(yyextra->fileName,yyextra->lineNr,"Documentation block ended in the middle of a conditional section!");
}
@@ -3316,7 +3299,7 @@ bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *pars
if (yyextra->insideParBlock)
{
warn(yyextra->fileName,yyextra->lineNr,
- "Documentation block ended while inside a \\parblock. Missing \\endparblock");
+ "Documentation block ended while inside a \\parblock. Missing \\endparblock");
}
yyextra->current->doc=stripLeadingAndTrailingEmptyLines(yyextra->current->doc,yyextra->current->docLine);
@@ -3328,23 +3311,23 @@ bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *pars
}
if (yyextra->current->section==Entry::MEMBERGRP_SEC &&
- Doxygen::docGroup.isEmpty()) // @name section but no group started yet
+ yyextra->docGroup.isEmpty()) // @name section but no group started yet
{
- Doxygen::docGroup.open(yyextra->current,yyextra->fileName,yyextra->lineNr,true);
+ yyextra->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,
- yyextra->current->briefLine,qPrint(yyextra->current->brief),
+ yyextra->current->briefLine,qPrint(yyextra->current->brief),
yyextra->current->docLine,qPrint(yyextra->current->doc),
yyextra->current->inbodyLine,qPrint(yyextra->current->inbodyDocs)
);
-
+
checkFormula(yyscanner);
prot = yyextra->protection;
-
- Doxygen::docGroup.addDocs(curEntry);
+
+ yyextra->docGroup.addDocs(curEntry);
newEntryNeeded = yyextra->needNewEntry;
@@ -3369,15 +3352,15 @@ static void handleGuard(yyscan_t yyscanner,const QCString &expr)
CondParser prs;
bool sectionEnabled=prs.parse(yyextra->fileName,yyextra->lineNr,expr.stripWhiteSpace());
bool parentEnabled = TRUE;
- if (!yyextra->guards.isEmpty()) parentEnabled = yyextra->guards.top()->isEnabled();
+ if (!yyextra->guards.empty()) parentEnabled = yyextra->guards.top().isEnabled();
if (parentEnabled)
{
if (
- (sectionEnabled && yyextra->guardType==Guard_If) ||
+ (sectionEnabled && yyextra->guardType==Guard_If) ||
(!sectionEnabled && yyextra->guardType==Guard_IfNot)
) // section is visible
{
- yyextra->guards.push(new GuardedSection(TRUE,TRUE));
+ yyextra->guards.push(GuardedSection(TRUE,TRUE));
yyextra->enabledSectionFound=TRUE;
BEGIN( GuardParamEnd );
}
@@ -3385,16 +3368,60 @@ static void handleGuard(yyscan_t yyscanner,const QCString &expr)
{
if (yyextra->guardType!=Guard_Skip)
{
- yyextra->guards.push(new GuardedSection(FALSE,TRUE));
+ yyextra->guards.push(GuardedSection(FALSE,TRUE));
}
BEGIN( SkipGuardedSection );
}
}
else // invisible because of parent
{
- yyextra->guards.push(new GuardedSection(FALSE,FALSE));
+ yyextra->guards.push(GuardedSection(FALSE,FALSE));
BEGIN( SkipGuardedSection );
}
}
+void CommentScanner::initGroupInfo(Entry *entry)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->docGroup.initGroupInfo(entry);
+}
+
+void CommentScanner::enterFile(const char *fileName,int lineNr)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->docGroup.enterFile(fileName,lineNr);
+}
+
+void CommentScanner::leaveFile(const char *fileName,int lineNr)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->docGroup.leaveFile(fileName,lineNr);
+}
+
+void CommentScanner::enterCompound(const char *fileName,int lineNr,const char *name)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->docGroup.enterCompound(fileName,lineNr,name);
+}
+
+void CommentScanner::leaveCompound(const char *fileName,int lineNr,const char *name)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->docGroup.leaveCompound(fileName,lineNr,name);
+}
+
+void CommentScanner::open(Entry *e,const char *fileName,int lineNr,bool implicit)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->docGroup.open(e,fileName,lineNr,implicit);
+}
+
+void CommentScanner::close(Entry *e,const char *fileName,int lineNr,bool foundInline,bool implicit)
+{
+ struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
+ yyextra->docGroup.close(e,fileName,lineNr,foundInline,implicit);
+}
+
+#if USE_STATE2STRING
#include "commentscan.l.h"
+#endif