Doxygen
Loading...
Searching...
No Matches
commentscan.l File Reference
#include <stdint.h>
#include "commentscan.h"
#include <algorithm>
#include <cctype>
#include <functional>
#include <mutex>
#include <string>
#include <unordered_map>
#include "cite.h"
#include "condparser.h"
#include "config.h"
#include "debug.h"
#include "docgroup.h"
#include "doxygen.h"
#include "dstring.h"
#include "entry.h"
#include "fileinfo.h"
#include "formula.h"
#include "language.h"
#include "markdown.h"
#include "mermaid.h"
#include "message.h"
#include "reflist.h"
#include "regex.h"
#include "section.h"
#include "stringutil.h"
#include "trace.h"
#include "util.h"
#include "doxygen_lex.h"
#include "commentscan.l.h"
Include dependency graph for commentscan.l:

Go to the source code of this file.

Classes

struct  DocCmdMap
struct  HtmlContextInfo
struct  commentscanYY_state
struct  CommentScanner::Private

Macros

#define YY_TYPEDEF_YY_SCANNER_T
#define yyguts_t   commentscanYYguts_t
#define YY_NO_INPUT   1
#define YY_NO_UNISTD_H   1
#define YY_NEVER_INTERACTIVE   1
#define unput_string(yytext, yyleng)
#define YY_INPUT(buf, result, max_size)

Typedefs

typedef yyguts_t * yyscan_t
typedef bool(* DocCmdFunc) (yyscan_t yyscanner, const DString &name, const StringVector &optList)
typedef EntryType(* MakeEntryType) ()
using HtmlContextStack = std::vector<HtmlContextInfo>

Enumerations

enum  CommandSpacing { Invisible , Inline , Block , XRef }
enum  SectionHandling { Allowed , Replace , Escape , Break }
enum  XRefKind {
  XRef_Item , XRef_Todo , XRef_Test , XRef_Bug ,
  XRef_Deprecated , XRef_None
}
enum  OutputContext {
  OutputDoc , OutputBrief , OutputField , OutputXRef ,
  OutputInbody
}
enum  GuardType { Guard_If , Guard_IfNot , Guard_ElseIf }

Functions

static bool handleBrief (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleFn (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleDef (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleOverload (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleEnum (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleDefGroup (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleAddToGroup (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleWeakGroup (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleRequirement (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleSatisfies (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleVerifies (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleNamespace (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handlePackage (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleConcept (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleClass (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHeaderFile (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleProtocol (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleCategory (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleUnion (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleStruct (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleRecord (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleInterface (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleIdlException (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handlePage (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleMainpage (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleFile (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleDir (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleExample (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleDetails (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleRaiseWarning (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleNoop (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleName (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleTodo (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleTest (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleBug (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleSubpage (yyscan_t yyscanner, const DString &s, const StringVector &)
static bool handleDeprecated (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleXRefItem (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleRelated (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleRelatedAlso (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleMemberOf (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleRefItem (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleSection (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleAnchor (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleImage (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleCite (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleFormatBlock (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleMermaidFile (yyscan_t yyscanner, const DString &s, const StringVector &)
static bool handleAddIndex (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleIf (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleIfNot (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleElseIf (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleElse (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleEndIf (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleIngroup (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleNoSubGrouping (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleShowInitializer (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideInitializer (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleCallgraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideCallgraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleCallergraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideCallergraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleIncludegraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleIncludedBygraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleShowEnumValues (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideEnumValues (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleShowInlineSource (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideInlineSource (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideIncludegraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideIncludedBygraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleDirectoryGraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideDirectoryGraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleCollaborationgraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideCollaborationgraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleInheritanceGraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideInheritanceGraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleReferencedByRelation (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideReferencedByRelation (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleReferencesRelation (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideReferencesRelation (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleGroupgraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleHideGroupgraph (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleInternal (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleStatic (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handlePure (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handlePrivate (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handlePrivateSection (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleProtected (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleProtectedSection (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handlePublic (yyscan_t yyscanner, const DString &s, const StringVector &)
static bool handlePublicSection (yyscan_t yyscanner, const DString &s, const StringVector &)
static bool handleQualifier (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleToc (yyscan_t yyscanner, const DString &s, const StringVector &)
static bool handleInherit (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleExtends (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleCopyDoc (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleCopyBrief (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleCopyDetails (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleParBlock (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleEndParBlock (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleParam (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleField (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleRetval (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleFileInfo (yyscan_t yyscanner, const DString &cmdName, const StringVector &optList)
static bool handleFileInfoSection (yyscan_t yyscanner, const DString &cmdName, const StringVector &optList)
static bool handleFileInfoResult (yyscan_t yyscanner, const DString &, const StringVector &optList, bool isSection)
static bool handleLineInfo (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleModule (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleIFile (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleILine (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleIRaise (yyscan_t yyscanner, const DString &, const StringVector &)
static bool handleIPrefix (yyscan_t yyscanner, const DString &, const StringVector &)
static const char * stateToString (int state)
static DString fileInfoLookup (const FileInfo &fi, const std::string &name)
static DString stripQuotes (const char *s)
static SectionType sectionLevelToType (int level)
static void stripTrailingWhiteSpace (DString &s)
static void initParser (yyscan_t yyscanner)
static bool checkStructuralIndicator (yyscan_t yyscanner)
static bool makeStructuralIndicator (yyscan_t yyscanner, MakeEntryType maker)
static void lineCount (yyscan_t yyscanner)
static void addRequirementId (yyscan_t yyscanner)
static void addXRefItem (yyscan_t yyscanner, const DString &listName, const DString &itemTitle, const DString &listTitle, bool append)
static DString addFormula (yyscan_t yyscanner)
static void checkFormula (yyscan_t yyscanner)
static void addSection (yyscan_t yyscanner, bool addYYtext=true)
static void setOutput (yyscan_t yyscanner, OutputContext ctx)
static void addAnchor (yyscan_t yyscanner, const DString &anchor, const DString &title="")
static void addOutput (yyscan_t yyscanner, const char *s)
static void addOutput (yyscan_t yyscanner, const DString &s)
static void addOutput (yyscan_t yyscanner, char c)
static void endBrief (yyscan_t yyscanner)
static void handleGuard (yyscan_t yyscanner, const DString &expr)
static int yyread (yyscan_t yyscanner, char *buf, int max_size)
static void addCite (yyscan_t yyscanner)
static void addIline (yyscan_t yyscanner, int lineNr)
static void addIlineBreak (yyscan_t yyscanner, int lineNr)
static void escapeLabel (DString &label)
static const char * getLexerFILE ()
int yylex (yyscan_t yyscanner)
static void addXRefItemToEntry (Entry *current, const DString &docs, const DString &baseName, const DString &itemTitle, const DString &listTitle, bool append, bool inBody, int lineNr)

Variables

static const std::unordered_map< std::string, DocCmdMap > docCmdMap
static std::mutex g_sectionMutex
static std::mutex g_formulaMutex
static std::mutex g_citeMutex
static const reg::Ex nonBrief_re (R"( *[\\@]ifile \"[^\"]*\" [\\@]iline (\d+) [\\@]ilinebr ([ \n]*))")

Macro Definition Documentation

◆ unput_string

#define unput_string ( yytext,
yyleng )
Value:
do { for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]); } while(0)

Definition at line 577 of file commentscan.l.

Referenced by DocTokenizer::unputString().

◆ YY_INPUT

#define YY_INPUT ( buf,
result,
max_size )
Value:
result=yyread(yyscanner,buf,max_size);
static int yyread(yyscan_t yyscanner, char *buf, int max_size)

Definition at line 582 of file commentscan.l.

◆ YY_NEVER_INTERACTIVE

#define YY_NEVER_INTERACTIVE   1

Definition at line 426 of file commentscan.l.

◆ YY_NO_INPUT

#define YY_NO_INPUT   1

Definition at line 424 of file commentscan.l.

◆ YY_NO_UNISTD_H

#define YY_NO_UNISTD_H   1

Definition at line 425 of file commentscan.l.

◆ YY_TYPEDEF_YY_SCANNER_T

#define YY_TYPEDEF_YY_SCANNER_T

Definition at line 23 of file commentscan.l.

◆ yyguts_t

#define yyguts_t   commentscanYYguts_t

Definition at line 24 of file commentscan.l.

Typedef Documentation

◆ DocCmdFunc

typedef bool(* DocCmdFunc) (yyscan_t yyscanner, const DString &name, const StringVector &optList)

Definition at line 186 of file commentscan.l.

◆ HtmlContextStack

using HtmlContextStack = std::vector<HtmlContextInfo>

Definition at line 467 of file commentscan.l.

◆ MakeEntryType

typedef EntryType(* MakeEntryType) ()

Definition at line 187 of file commentscan.l.

◆ yyscan_t

typedef yyguts_t* yyscan_t

Definition at line 26 of file commentscan.l.

Enumeration Type Documentation

◆ CommandSpacing

enum CommandSpacing
strong
Enumerator
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, deprecated, xrefitem).

Definition at line 189 of file commentscan.l.

190{
191 Invisible, //!< command sets some property but does not appear in the output.
192 Inline, //!< command appears inline in the output which can be a brief description.
193 Block, //!< command starts a new paragraphs / ends a brief description.
194 XRef //!< command is a cross reference (todo, bug, test, deprecated, xrefitem).
@ Inline
command appears inline in the output which can be a brief description.
@ XRef
command is a cross reference (todo, bug, test, deprecated, xrefitem).
@ Invisible
command sets some property but does not appear in the output.
@ Block
command starts a new paragraphs / ends a brief description.
195};

◆ GuardType

enum GuardType
Enumerator
Guard_If 
Guard_IfNot 
Guard_ElseIf 

Definition at line 448 of file commentscan.l.

449{
450 Guard_If,
@ Guard_If
@ Guard_ElseIf
@ Guard_IfNot
453};

◆ OutputContext

Enumerator
OutputDoc 
OutputBrief 
OutputField 
OutputXRef 
OutputInbody 

Definition at line 439 of file commentscan.l.

440{
441 OutputDoc,
@ OutputXRef
@ OutputDoc
@ OutputField
@ OutputBrief
@ OutputInbody
446};

◆ SectionHandling

enum SectionHandling
strong
Enumerator
Allowed 

command is allowed without restrictions in section title

Replace 

command will be handled in here / needs special handling here

Escape 

command is not-allowed in section title, it will be escaped

Break 

command is not-allowed in section title, it will end the section title

Definition at line 197 of file commentscan.l.

198{
199 Allowed, //!< command is allowed without restrictions in section title
200 Replace, //!< command will be handled in here / needs special handling here
201 Escape, //!< command is not-allowed in section title, it will be escaped
202 Break //!< command is not-allowed in section title, it will end the section title
@ Escape
command is not-allowed in section title, it will be escaped
@ Replace
command will be handled in here / needs special handling here
@ Allowed
command is allowed without restrictions in section title
@ Break
command is not-allowed in section title, it will end the section title
203};

◆ XRefKind

enum XRefKind
Enumerator
XRef_Item 
XRef_Todo 
XRef_Test 
XRef_Bug 
XRef_Deprecated 
XRef_None 

Definition at line 429 of file commentscan.l.

430{
431 XRef_Item,
432 XRef_Todo,
433 XRef_Test,
434 XRef_Bug,
@ XRef_Item
@ XRef_Deprecated
@ XRef_Todo
@ XRef_Test
@ XRef_Bug
@ XRef_None
437};

Function Documentation

◆ addAnchor()

void addAnchor ( yyscan_t yyscanner,
const DString & anchor,
const DString & title = "" )
static

Definition at line 4879 of file commentscan.l.

4880{
4881 std::unique_lock<std::mutex> lock(g_sectionMutex);
4882 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4884 const SectionInfo *si = sm.find(anchor);
4885 if (si)
4886 {
4887 if (!si->ref().empty()) // we are from a tag file
4888 {
4889 si = sm.replace(anchor,yyextra->fileName,yyextra->lineNr,DString(),SectionType::Anchor,0);
4890 yyextra->current->anchors.push_back(si);
4891 }
4892 else if (si->lineNr() != -1)
4893 {
4894 warn(yyextra->fileName,yyextra->lineNr,
4895 "multiple use of section label '{}' while adding anchor, (first occurrence: {}, line {})",
4896 anchor,si->fileName(),si->lineNr());
4897 }
4898 else
4899 {
4900 warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '{}' while adding anchor, (first occurrence: {})",
4901 anchor,si->fileName());
4902 }
4903 }
4904 else
4905 {
4906 si = sm.add(anchor,yyextra->fileName,yyextra->lineNr,title,SectionType::Anchor,0);
4907 yyextra->current->anchors.push_back(si);
4908 }
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
const T * find(const std::string &key) const
Definition linkedmap.h:47
class that provide information about a section.
Definition section.h:58
DString fileName() const
Definition section.h:74
int lineNr() const
Definition section.h:73
DString ref() const
Definition section.h:72
singleton class that owns the list of all sections
Definition section.h:135
SectionInfo * replace(const DString &label, const DString &fileName, int lineNr, const DString &title, SectionType type, int level, const DString &ref=DString())
Definition section.h:157
SectionInfo * add(const SectionInfo &si)
Definition section.h:139
static SectionManager & instance()
returns a reference to the singleton
Definition section.h:179
static constexpr int Anchor
Definition section.h:40
#define yyguts_t
Definition code.l:23
static std::mutex g_sectionMutex
#define warn(file, line, fmt,...)
Definition message.h:97
4909}

References SectionManager::add(), SectionType::Anchor, DString::empty(), SectionInfo::fileName(), LinkedMap< T, Hash, KeyEqual, Map >::find(), g_sectionMutex, SectionManager::instance(), SectionInfo::lineNr(), SectionInfo::ref(), SectionManager::replace(), warn, and yyguts_t.

Referenced by handleImage().

◆ addCite()

void addCite ( yyscan_t yyscanner)
static

Definition at line 4672 of file commentscan.l.

4673{
4674 std::unique_lock<std::mutex> lock(g_citeMutex);
4675 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4676 DString name(yytext);
4677 if (yytext[0] =='"')
4678 {
4679 name=yytext+1;
4680 name=name.left((int)yyleng-2);
4681 }
void insert(const DString &label)
Insert a citation identified by label into the database.
Definition cite.cpp:100
static CitationManager & instance()
Definition cite.cpp:90
static std::mutex g_citeMutex
const char * name(int level)
Definition latexgen.h:368
4683}

References g_citeMutex, CitationManager::insert(), CitationManager::instance(), and yyguts_t.

◆ addFormula()

DString addFormula ( yyscan_t yyscanner)
static

Definition at line 4596 of file commentscan.l.

4597{
4598 std::unique_lock<std::mutex> lock(g_formulaMutex);
4599 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4600 DString formLabel;
4601 DString formula = (yyextra->formulaPreText +
4602 yyextra->formulaText.stripLeadingAndTrailingEmptyLines() +
4603 yyextra->formulaPostText).stripWhiteSpace();
4604 //printf("formulaText=\n=1=\n{%s}\n=2=\n{%s}\n=3=\n{%s}\n===",
4605 // qPrint(yyextra->formulaText),
4606 // qPrint(yyextra->formulaText.stripLeadingAndTrailingEmptyLines()),
4607 // qPrint(formula)
4608 // );
4609 int id = FormulaManager::instance().addFormula(formula);
4610 formLabel.sprintf("\\_form#%d",id);
4611 for (int i=0;i<yyextra->formulaNewLines;i++) formLabel+="@_fakenl"; // add fake newlines to
4612 // keep the warnings
4613 // correctly aligned.
4614 return formLabel;
DString & sprintf(const char *format,...)
Definition dstring.cpp:34
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
int addFormula(const DString &formulaText, int width=-1, int height=-1)
Definition formula.cpp:691
static FormulaManager & instance()
Definition formula.cpp:54
static std::mutex g_formulaMutex
4615}

References FormulaManager::addFormula(), g_formulaMutex, FormulaManager::instance(), DString::sprintf(), DString::stripWhiteSpace(), and yyguts_t.

◆ addIline()

void addIline ( yyscan_t yyscanner,
int lineNr )
static

Definition at line 4934 of file commentscan.l.

4935{
4936 char cmd[30];
4937 snprintf(cmd,30," \\iline %d ",lineNr);
4938 addOutput(yyscanner, cmd);
static void addOutput(yyscan_t yyscanner, const char *s)
4939}

References addOutput().

Referenced by endBrief().

◆ addIlineBreak()

void addIlineBreak ( yyscan_t yyscanner,
int lineNr )
static

Definition at line 4941 of file commentscan.l.

4942{
4943 char cmd[30];
4944 snprintf(cmd,30," \\iline %d \\ilinebr ",lineNr);
4945 addOutput(yyscanner, cmd);
4946}

References addOutput().

◆ addOutput() [1/3]

void addOutput ( yyscan_t yyscanner,
char c )
inlinestatic

Definition at line 4928 of file commentscan.l.

4929{
4930 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4931 *yyextra->pOutputString+=c;
4932}

References yyguts_t.

◆ addOutput() [2/3]

◆ addOutput() [3/3]

void addOutput ( yyscan_t yyscanner,
const DString & s )
inlinestatic

Definition at line 4920 of file commentscan.l.

4921{
4922 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4923 //printf("addOutput(yyscanner,%s)\n",s);
4924 *yyextra->pOutputString+=s;
4925}

References yyguts_t.

◆ addRequirementId()

void addRequirementId ( yyscan_t yyscanner)
static

Definition at line 4452 of file commentscan.l.

4453{
4454 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4455 std::unique_lock<std::mutex> lock(g_sectionMutex);
4456
4457 DString reqId = yyextra->current->name;
4458 //printf("### add reqId='%s' reqTitle='%s'\n",qPrint(reqId),qPrint(yyextra->current->type));
4460 const SectionInfo *si = sm.find(reqId);
4461 if (si==nullptr)
4462 {
4463 si = sm.add(reqId,"requirements",yyextra->lineNr,
4464 yyextra->current->type,SectionType::Requirement,1);
4465 }
4466 else // duplicate requirement
4467 {
4468 warn(yyextra->fileName,yyextra->lineNr,"duplicate requirement ID '{}' found at {} line {}, (first occurrence: {}, line {})",
4469 reqId,
4470 yyextra->fileName,yyextra->lineNr,
4471 si->fileName(),si->lineNr());
4472 }
static constexpr int Requirement
Definition section.h:42
4473}

References SectionManager::add(), SectionInfo::fileName(), LinkedMap< T, Hash, KeyEqual, Map >::find(), g_sectionMutex, SectionManager::instance(), SectionInfo::lineNr(), SectionType::Requirement, warn, and yyguts_t.

◆ addSection()

void addSection ( yyscan_t yyscanner,
bool addYYtext = true )
static

Definition at line 4625 of file commentscan.l.

4626{
4627 std::unique_lock<std::mutex> lock(g_sectionMutex);
4628 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4630 const SectionInfo *si = sm.find(yyextra->sectionLabel);
4631 if (si)
4632 {
4633 if (!si->ref().empty()) // we are from a tag file
4634 {
4635 // create a new section element
4636 if (addYYtext) yyextra->sectionTitle+=substitute(yytext,"#","@#");
4637 yyextra->sectionTitle=yyextra->sectionTitle.stripWhiteSpace();
4638 si = sm.replace(yyextra->sectionLabel,yyextra->fileName,yyextra->lineNr,
4639 yyextra->sectionTitle,sectionLevelToType(yyextra->sectionLevel),
4640 yyextra->sectionLevel);
static SectionType sectionLevelToType(int level)
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
Definition dstring.cpp:485
4641
4642 // add section to this entry
4643 yyextra->current->anchors.push_back(si);
4644 }
4645 else if (si->lineNr() != -1)
4646 {
4647 warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '{}' while adding section, (first occurrence: {}, line {})",
4648 yyextra->sectionLabel,si->fileName(),si->lineNr());
4649 }
4650 else
4651 {
4652 warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '{}' while adding section, (first occurrence: {})",
4653 yyextra->sectionLabel,si->fileName());
4654 }
4655 }
4656 else
4657 {
4658 // create a new section element
4659 if (addYYtext) yyextra->sectionTitle+=substitute(yytext,"#","@#");
4660 yyextra->sectionTitle=yyextra->sectionTitle.stripWhiteSpace();
4661 si = sm.add(yyextra->sectionLabel,yyextra->fileName,yyextra->lineNr,
4662 yyextra->sectionTitle,sectionLevelToType(yyextra->sectionLevel),
4663 yyextra->sectionLevel);
4664
4665 // add section to this entry
4666 yyextra->current->anchors.push_back(si);
4667 }
4668}

References SectionManager::add(), DString::empty(), SectionInfo::fileName(), LinkedMap< T, Hash, KeyEqual, Map >::find(), g_sectionMutex, SectionManager::instance(), SectionInfo::lineNr(), SectionInfo::ref(), SectionManager::replace(), sectionLevelToType(), substitute(), warn, and yyguts_t.

◆ addXRefItem()

void addXRefItem ( yyscan_t yyscanner,
const DString & listName,
const DString & itemTitle,
const DString & listTitle,
bool append )
static

Definition at line 4561 of file commentscan.l.

4564{
4565 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4566 addXRefItemToEntry(yyextra->current,yyextra->outputXRef,listName,itemTitle,listTitle,append,yyextra->inBody,yyextra->lineNr);
4567 yyextra->outputXRef.clear();
static void addXRefItemToEntry(Entry *current, const DString &docs, const DString &baseName, const DString &itemTitle, const DString &listTitle, bool append, bool inBody, int lineNr)
4568}

References addXRefItemToEntry(), and yyguts_t.

Referenced by setOutput().

◆ addXRefItemToEntry()

void addXRefItemToEntry ( Entry * current,
const DString & docs,
const DString & baseName,
const DString & itemTitle,
const DString & listTitle,
bool append,
bool inBody,
int lineNr )
static

Definition at line 4477 of file commentscan.l.

4480{
4481 if (baseName.empty()) return;
4482 //printf("addXRefItem(listName=%s,itemTitle=%s,listTitle=%s,append=%d,inbody=%d)\n",
4483 // qPrint(baseName),qPrint(itemTitle),qPrint(listTitle),append,inBody);
4484
4485 std::unique_lock<std::mutex> lock(g_sectionMutex);
4486
4487 DString listName=baseName;
4488 if (Config_getEnum(MARKDOWN_ID_STYLE) == MARKDOWN_ID_STYLE_t::GITHUB) listName = doxygenList + listName;
4489 RefList *refList = RefListManager::instance().add(listName,listTitle,itemTitle);
4490 RefItem *item = nullptr;
4491 for (auto it = current->sli.rbegin(); it != current->sli.rend(); ++it)
4492 {
4493 RefItem *i = *it;
4494 if (i && i->list()->listName()==listName)
4495 {
4496 //printf("found %s lii->type=%s\n",listName,qPrint(i->list()->listName()));
4497 item = i;
4498 break;
4499 }
4500 }
4501 if (item && append) // already found item of same type just before this one
4502 {
4503 //printf("listName=%s item id = %d existing\n",listName,item->id());
4504 item->setText(item->text() + " <p>" + docs);
4505 //printf("%s: text +=%s\n",listName,qPrint(item->text));
4506 }
4507 else // new item
4508 {
4509 // if we have already an item from the same list type (e.g. a second @todo)
4510 // in the same Entry (i.e. lii!=0) then we reuse its link anchor.
4511 item = refList->add();
4512 //printf("listName=%s item id = %d new yyextra->current=%p\n",listName,item->id(),yyextra->current);
4513 DString anchorLabel;
4514 anchorLabel.sprintf("_%s%06d",listName.data(),item->id());
4515 item->setText(docs);
4516 item->setAnchor(anchorLabel);
4517 current->sli.push_back(item);
4518 DString cmdString;
4519 cmdString.sprintf("\\ilinebr \\xrefitem %s %d.",qPrint(listName),item->id());
4520 if (inBody)
4521 {
4522 current->inbodyDocs += cmdString;
4523 }
4524 else
4525 {
4526 current->doc += cmdString;
4527 }
DString doc
documentation block (partly parsed)
Definition entry.h:208
RefItemVector sli
special lists (test/todo/bug/deprecated/..) this entry is in
Definition entry.h:235
DString inbodyDocs
documentation inside the body of a function
Definition entry.h:215
T * add(const char *k, Args &&... args)
Definition linkedmap.h:90
This struct represents an item in the list of references.
Definition reflist.h:33
int id() const
Definition reflist.h:53
DString text() const
Definition reflist.h:46
void setText(const DString &text)
Definition reflist.h:37
RefList * list() const
Definition reflist.h:54
void setAnchor(const DString &anchor)
Definition reflist.h:38
List of cross-referenced items.
Definition reflist.h:81
DString listName() const
Definition reflist.h:102
RefItem * add()
Definition reflist.cpp:35
static RefListManager & instance()
Definition reflist.h:122
#define Config_getEnum(name)
Definition config.h:35
const char * qPrint(const char *s)
Definition dstring.h:783
4528
4529 {
4531 const SectionInfo *si = sm.find(anchorLabel);
4532 if (si)
4533 {
4534 if (!si->ref().empty()) // we are from a tag file
4535 {
4536 si = sm.replace(anchorLabel,listName,lineNr,"",SectionType::Anchor,0);
4537 current->anchors.push_back(si);
4538 }
4539 else if (si->lineNr() != -1)
4540 {
4541 warn(listName,lineNr,"multiple use of section label '{}', (first occurrence: {}, line {})",
4542 anchorLabel,si->fileName(),si->lineNr());
4543 }
4544 else
4545 {
4546 warn(listName,lineNr,"multiple use of section label '{}', (first occurrence: {})",
4547 anchorLabel,si->fileName());
4548 }
4549 }
4550 else
4551 {
4552 si = sm.add(anchorLabel,listName,lineNr,"",SectionType::Anchor,0);
4553 current->anchors.push_back(si);
4554 }
4555 }
4556 }
std::vector< const SectionInfo * > anchors
list of anchors defined in this entry
Definition entry.h:231
4557}

References LinkedMap< T, Hash, KeyEqual, Map >::add(), RefList::add(), SectionManager::add(), SectionType::Anchor, Entry::anchors, Config_getEnum, DString::data(), Entry::doc, DString::empty(), SectionInfo::fileName(), LinkedMap< T, Hash, KeyEqual, Map >::find(), g_sectionMutex, RefItem::id(), Entry::inbodyDocs, RefListManager::instance(), SectionManager::instance(), SectionInfo::lineNr(), RefItem::list(), RefList::listName(), qPrint(), SectionInfo::ref(), SectionManager::replace(), RefItem::setAnchor(), RefItem::setText(), Entry::sli, DString::sprintf(), RefItem::text(), and warn.

Referenced by CommentScanner::addDeprecatedDocs(), and addXRefItem().

◆ checkFormula()

void checkFormula ( yyscan_t yyscanner)
static

Definition at line 4994 of file commentscan.l.

4995{
4996 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4997 if (YY_START==ReadFormulaShort || YY_START==ReadFormulaShortSection ||
4998 YY_START==ReadFormulaRound || YY_START==ReadFormulaRoundSection ||
4999 YY_START==ReadFormulaLong)
5000 {
5001 warn(yyextra->fileName,yyextra->lineNr,"End of comment block while inside formula.");
5002 }
5003}

References warn, and yyguts_t.

Referenced by CommentScanner::parseCommentBlock().

◆ checkStructuralIndicator()

bool checkStructuralIndicator ( yyscan_t yyscanner)
static

Definition at line 4396 of file commentscan.l.

4397{
4398 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4399 //printf("yyextra->current->section=%x\n",yyextra->current->section);
4400 return yyextra->current->section.isDoc();
4401}

References yyguts_t.

Referenced by handleCategory(), handleClass(), handleConcept(), handleDef(), handleEnum(), handleFn(), handleIdlException(), handleInterface(), handleModule(), handleNamespace(), handleProtocol(), handleRecord(), handleStruct(), and handleUnion().

◆ endBrief()

void endBrief ( yyscan_t yyscanner)
static

Definition at line 4948 of file commentscan.l.

4949{
4950 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4951 std::string_view str = yyextra->current->brief.view();
4953 if (!stripWhiteSpace(str).empty() && !reg::match(str,match,nonBrief_re))
4954 { // only go to the detailed description if we have
4955 // found some brief description and not just whitespace
4956 yyextra->briefEndsAtDot=false;
4957 setOutput(yyscanner,OutputDoc);
4958 if (yyextra->current->doc.stripWhiteSpace().empty())
4959 {
4960 yyextra->current->docLine = yyextra->lineNr;
4961 yyextra->current->doc = "";
4962 }
4963 else
4964 {
4965 addIline(yyscanner,yyextra->lineNr);
4966 }
4967 addOutput(yyscanner,yytext);
4968 }
4969 else
4970 {
4971 int saveLineNr = yyextra->lineNr;
4972 lineCount(yyscanner);
4973 yyextra->current->briefLine = yyextra->lineNr;
4974 yyextra->lineNr = saveLineNr;
4975 }
Object representing the matching results.
Definition regex.h:160
static const reg::Ex nonBrief_re(R"( *[\\@]ifile \"[^\"]*\" [\\@]iline (\d+) [\\@]ilinebr ([ \n]*))")
static void setOutput(yyscan_t yyscanner, OutputContext ctx)
static void addIline(yyscan_t yyscanner, int lineNr)
#define lineCount(s, len)
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:861
std::string_view stripWhiteSpace(std::string_view s)
Given a string view s, returns a new, narrower view on that string, skipping over any leading or trai...
Definition stringutil.h:75
4976}

References addIline(), addOutput(), lineCount, reg::match(), nonBrief_re, OutputDoc, setOutput(), stripWhiteSpace(), and yyguts_t.

◆ escapeLabel()

void escapeLabel ( DString & label)
static

Definition at line 4573 of file commentscan.l.

4574{
4575 if (label.empty()) return;
4576 signed char c = static_cast<signed char>(label[0]);
4577 if (!((c>='a' && c<='z') || (c>='A' && c<='Z') || c=='_' || c<0))
4578 {
4579 label[0]='_'; // replace invalid starting char by _
4580 }
4581 for (size_t i=1; i<label.size(); i++)
4582 {
4583 c = static_cast<signed char>(label[i]);
4584 if (!((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='_' || c<0))
4585 {
4586 label[i]='_'; // replace invalid char by _
4587 }
4588 }
size_t size() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:154
4589}

References DString::empty(), and DString::size().

◆ fileInfoLookup()

DString fileInfoLookup ( const FileInfo & fi,
const std::string & name )
static

Definition at line 3695 of file commentscan.l.

3696{
3697 using OptionFunc = std::function<DString(const FileInfo &)>;
3698 static std::unordered_map<std::string,OptionFunc> options =
3699 {
3700 // name, function producing the value
3701 { "name", [](const FileInfo &fi_) -> DString { return fi_.baseName(); } },
3702 { "extension", [](const FileInfo &fi_) -> DString { return fi_.extension(true); } },
3703 { "filename", [](const FileInfo &fi_) -> DString { return fi_.fileName(); } },
3704 { "directory", [](const FileInfo &fi_) -> DString { return fi_.dirPath(); } },
3705 { "full", [](const FileInfo &fi_) -> DString { return fi_.absFilePath(); } }
3706 };
3707 auto it = options.find(optionName);
3708 return (it!=options.end()) ? it->second(fi) : DString();
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
Minimal replacement for QFileInfo.
Definition fileinfo.h:26
3709}

References DString::find().

Referenced by handleFileInfoResult().

◆ getLexerFILE()

const char * getLexerFILE ( )
inlinestatic

Definition at line 585 of file commentscan.l.

585{return __FILE__;}

◆ handleAddIndex()

bool handleAddIndex ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3678 of file commentscan.l.

3679{
3680 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3681 addOutput(yyscanner,yytext);
3682 BEGIN(LineParam);
3683 return false;
3684}

References addOutput(), and yyguts_t.

◆ handleAddToGroup()

bool handleAddToGroup ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3115 of file commentscan.l.

3116{
3117 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3118 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeGroupDoc);
3119 yyextra->current->groupDocType = Entry::GROUPDOC_ADD;
3120 BEGIN( GroupDocArg1 );
3121 return stop;
@ GROUPDOC_ADD
addtogroup
Definition entry.h:129
static bool makeStructuralIndicator(yyscan_t yyscanner, MakeEntryType maker)
3122}

References Entry::GROUPDOC_ADD, makeStructuralIndicator(), and yyguts_t.

◆ handleAnchor()

bool handleAnchor ( yyscan_t yyscanner,
const DString & s,
const StringVector & optList )
static

Definition at line 3577 of file commentscan.l.

3578{
3579 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3580 addOutput(yyscanner,"@"+s+" ");
3581 if (optList.empty())
3582 {
3583 yyextra -> anchorTitle = "";
3584 }
3585 else
3586 {
3587 yyextra -> anchorTitle = join(optList," ");
3588 }
3589 BEGIN(AnchorLabel);
3590 return false;
std::string join(const StringVector &sv, const std::string &delimiter)
create a string where the string in the vector are joined by the given delimiter
Definition stringutil.h:165
3591}

References addOutput(), join(), and yyguts_t.

◆ handleBrief()

bool handleBrief ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3061 of file commentscan.l.

3062{
3063 //printf("handleBrief\n");
3064 setOutput(yyscanner,OutputBrief);
3065 return false;
3066}

References OutputBrief, and setOutput().

◆ handleBug()

bool handleBug ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3395 of file commentscan.l.

3396{
3397 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3398 yyextra->newXRefKind = XRef_Bug;
3399 setOutput(yyscanner,OutputXRef);
3400 yyextra->xrefKind = XRef_Bug;
3401 return false;
3402}

References OutputXRef, setOutput(), XRef_Bug, and yyguts_t.

◆ handleCallergraph()

bool handleCallergraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3982 of file commentscan.l.

3983{
3984 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3985 yyextra->current->commandOverrides.override_callerGraph(true); // ON
3986 return false;
3987}

References yyguts_t.

◆ handleCallgraph()

bool handleCallgraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3968 of file commentscan.l.

3969{
3970 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3971 yyextra->current->commandOverrides.override_callGraph(true); // ON
3972 return false;
3973}

References yyguts_t.

◆ handleCategory()

bool handleCategory ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3192 of file commentscan.l.

3193{ // Obj-C category
3194 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3195 yyextra->currentCmd = cmd;
3196 yyextra->currentMakeEntryType = EntryType::makeCategoryDoc;
3197 BEGIN( CategoryDocArg1 );
3198 return checkStructuralIndicator(yyscanner);
static bool checkStructuralIndicator(yyscan_t yyscanner)
3199}

References checkStructuralIndicator(), and yyguts_t.

◆ handleCite()

bool handleCite ( yyscan_t yyscanner,
const DString & s,
const StringVector & optList )
static

Definition at line 3623 of file commentscan.l.

3624{
3625 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3626 if (!yyextra->spaceBeforeCmd.empty())
3627 {
3628 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3629 yyextra->spaceBeforeCmd.clear();
3630 }
3631 if (optList.empty())
3632 {
3633 addOutput(yyscanner,"@"+s+" ");
3634 }
3635 else
3636 {
3637 addOutput(yyscanner,"@"+s+"{"+DString(join(optList,","))+"} ");
3638 }
3639 BEGIN(CiteLabel);
3640 return false;
3641}

References addOutput(), join(), and yyguts_t.

◆ handleClass()

bool handleClass ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3149 of file commentscan.l.

3150{
3151 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3152 yyextra->currentCmd = cmd;
3153 yyextra->currentMakeEntryType = EntryType::makeClassDoc;
3154 BEGIN( ClassDocArg1 );
3155 return checkStructuralIndicator(yyscanner);
3156}

References checkStructuralIndicator(), and yyguts_t.

◆ handleCollaborationgraph()

bool handleCollaborationgraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4066 of file commentscan.l.

4067{
4068 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4069 yyextra->current->commandOverrides.override_collaborationGraph(true); // ON
4070 return false;
4071}

References yyguts_t.

◆ handleConcept()

bool handleConcept ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3158 of file commentscan.l.

3159{
3160 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3161 yyextra->currentCmd = cmd;
3162 yyextra->currentMakeEntryType = EntryType::makeConceptDoc;
3163 BEGIN( ConceptDocArg1 );
3164 return checkStructuralIndicator(yyscanner);
3165}

References checkStructuralIndicator(), and yyguts_t.

◆ handleCopyBrief()

bool handleCopyBrief ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4331 of file commentscan.l.

4332{
4333 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4334 if (yyextra->current->brief.stripWhiteSpace().empty() && yyextra->current->doc.stripWhiteSpace().empty())
4335 { // if we don't have a brief or detailed description yet,
4336 // then the @copybrief should end up in the brief description.
4337 // otherwise it will be copied inline (see bug691315 & bug700788)
4338 setOutput(yyscanner,OutputBrief);
4339 }
4340 if (!yyextra->spaceBeforeCmd.empty())
4341 {
4342 addOutput(yyscanner,yyextra->spaceBeforeCmd);
4343 yyextra->spaceBeforeCmd.clear();
4344 }
4345 addOutput(yyscanner,"\\copybrief ");
4346 return false;
4347}

References addOutput(), OutputBrief, setOutput(), and yyguts_t.

◆ handleCopyDetails()

bool handleCopyDetails ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4349 of file commentscan.l.

4350{
4351 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4352 setOutput(yyscanner,OutputDoc);
4353 if (!yyextra->spaceBeforeCmd.empty())
4354 {
4355 addOutput(yyscanner,yyextra->spaceBeforeCmd);
4356 yyextra->spaceBeforeCmd.clear();
4357 }
4358 addOutput(yyscanner,"\\copydetails ");
4359 return false;
4360}

References addOutput(), OutputDoc, setOutput(), and yyguts_t.

◆ handleCopyDoc()

bool handleCopyDoc ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4362 of file commentscan.l.

4363{
4364 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4365 if (yyextra->current->brief.stripWhiteSpace().empty() && yyextra->current->doc.stripWhiteSpace().empty())
4366 { // if we don't have a brief or detailed description yet,
4367 // then the @copybrief should end up in the brief description.
4368 // otherwise it will be copied inline (see bug691315 & bug700788)
4369 setOutput(yyscanner,OutputBrief);
4370 }
4371 if (!yyextra->spaceBeforeCmd.empty())
4372 {
4373 addOutput(yyscanner,yyextra->spaceBeforeCmd);
4374 yyextra->spaceBeforeCmd.clear();
4375 }
4376 addOutput(yyscanner,"\\copybrief ");
4377 yyextra->copyDocArg.clear();
4378 yyextra->braceCount = 0;
4379 BEGIN(CopyDoc);
4380 return false;
4381}

References addOutput(), OutputBrief, setOutput(), and yyguts_t.

◆ handleDef()

bool handleDef ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3079 of file commentscan.l.

3080{
3081 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3082 yyextra->functionProto.clear();
3083 yyextra->braceCount=0;
3084 yyextra->currentCmd = cmd;
3085 yyextra->currentMakeEntryType = EntryType::makeDefineDoc;
3086 BEGIN( FnParam );
3087 return checkStructuralIndicator(yyscanner);
3088}

References checkStructuralIndicator(), and yyguts_t.

◆ handleDefGroup()

bool handleDefGroup ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3106 of file commentscan.l.

3107{
3108 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3109 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeGroupDoc);
3110 yyextra->current->groupDocType = Entry::GROUPDOC_NORMAL;
3111 BEGIN( GroupDocArg1 );
3112 return stop;
@ GROUPDOC_NORMAL
defgroup
Definition entry.h:128
3113}

References Entry::GROUPDOC_NORMAL, makeStructuralIndicator(), and yyguts_t.

◆ handleDeprecated()

bool handleDeprecated ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3404 of file commentscan.l.

3405{
3406 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3407 yyextra->newXRefKind = XRef_Deprecated;
3408 setOutput(yyscanner,OutputXRef);
3409 yyextra->xrefKind = XRef_Deprecated;
3410 yyextra->current->spec.setDeprDoc(true);
3411 return false;
3412}

References OutputXRef, setOutput(), XRef_Deprecated, and yyguts_t.

◆ handleDetails()

bool handleDetails ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3334 of file commentscan.l.

3335{
3336 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3337 if (yyextra->inContext!=OutputBrief)
3338 {
3339 addOutput(yyscanner," \\ilinebr\\ilinebr "); // treat @details outside brief description
3340 // as a new paragraph
3341 }
3342 setOutput(yyscanner,OutputDoc);
3343 return false;
3344}

References addOutput(), OutputBrief, OutputDoc, setOutput(), and yyguts_t.

◆ handleDir()

bool handleDir ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3303 of file commentscan.l.

3304{
3305 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3306 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeDirDoc);
3307 if (!stop) yyextra->current->name = yyextra->fileName;
3308 BEGIN( FileDocArg1 );
3309 return stop;
3310}

References makeStructuralIndicator(), and yyguts_t.

◆ handleDirectoryGraph()

bool handleDirectoryGraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4052 of file commentscan.l.

4053{
4054 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4055 yyextra->current->commandOverrides.override_directoryGraph(true); // ON
4056 return false;
4057}

References yyguts_t.

◆ handleElse()

bool handleElse ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3870 of file commentscan.l.

3871{
3872 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3873 if (yyextra->guards->empty())
3874 {
3875 warn(yyextra->fileName,yyextra->lineNr,
3876 "found \\else without matching start command");
3877 }
3878 else if (yyextra->guards->top().hasElse())
3879 {
3880 warn(yyextra->fileName,yyextra->lineNr,
3881 "found multiple \\else commands in same \\if construct");
3882 yyextra->guards->top().setEnabled(false);
3883 yyextra->guards->top().setElse();
3884 BEGIN( SkipGuardedSection );
3885 }
3886 else
3887 {
3888 yyextra->guards->top().setElse();
3889 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
3890 if (yyextra->guards->top().isEnabledFound())
3891 {
3892 yyextra->guards->top().setEnabled(false);
3893 BEGIN( SkipGuardedSection );
3894 }
3895 else
3896 {
3897 yyextra->guards->top().setEnabled(true);
3898 BEGIN( GuardParamEnd );
3899 }
3900 }
3901 return false;
3902}

References warn, and yyguts_t.

◆ handleElseIf()

bool handleElseIf ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3843 of file commentscan.l.

3844{
3845 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3846 if (yyextra->guards->empty())
3847 {
3848 warn(yyextra->fileName,yyextra->lineNr,
3849 "found \\elseif without matching start command");
3850 }
3851 else if (yyextra->guards->top().hasElse())
3852 {
3853 warn(yyextra->fileName,yyextra->lineNr,
3854 "found \\elseif command after \\else command was given in \\if construct");
3855 yyextra->guardType = Guard_ElseIf;
3856 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
3857 yyextra->guards->top().setEnabled(false);
3858 BEGIN(GuardParam);
3859 }
3860 else
3861 {
3862 yyextra->guardType = Guard_ElseIf;
3863 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
3864 yyextra->guards->top().setEnabled(false);
3865 BEGIN(GuardParam);
3866 }
3867 return false;
3868}

References Guard_ElseIf, warn, and yyguts_t.

◆ handleEndIf()

bool handleEndIf ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3904 of file commentscan.l.

3905{
3906 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3907 if (yyextra->guards->empty())
3908 {
3909 warn(yyextra->fileName,yyextra->lineNr,
3910 "found \\endif without matching start command");
3911 }
3912 else
3913 {
3914 yyextra->guards->pop();
3915 }
3916 if (!yyextra->spaceBeforeCmd.empty())
3917 {
3918 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3919 yyextra->spaceBeforeCmd.clear();
3920 }
3921 if (yyextra->guards->empty())
3922 {
3923 BEGIN( GuardParamEnd );
3924 }
3925 else
3926 {
3927 if (yyextra->guards->top().isEnabled())
3928 {
3929 BEGIN( GuardParamEnd );
3930 }
3931 else
3932 {
3933 BEGIN( SkipGuardedSection );
3934 }
3935 }
3936 return false;
3937}

References addOutput(), warn, and yyguts_t.

◆ handleEndParBlock()

bool handleEndParBlock ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3440 of file commentscan.l.

3441{
3442 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3443 if (!yyextra->insideParBlock)
3444 {
3445 warn(yyextra->fileName,yyextra->lineNr,
3446 "found \\endparblock command without matching \\parblock!");
3447 }
3448 addOutput(yyscanner,"@endparblock");
3449 setOutput(yyscanner,OutputDoc); // to end a parblock inside a xrefitem like context
3450 yyextra->insideParBlock = false;
3451 return false;
3452}

References addOutput(), OutputDoc, setOutput(), warn, and yyguts_t.

◆ handleEnum()

bool handleEnum ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3098 of file commentscan.l.

3099{
3100 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3101 yyextra->currentMakeEntryType = EntryType::makeEnumDoc;
3102 BEGIN( EnumDocArg1 );
3103 return checkStructuralIndicator(yyscanner);
3104}

References checkStructuralIndicator(), and yyguts_t.

◆ handleExample()

bool handleExample ( yyscan_t yyscanner,
const DString & cmd,
const StringVector & optList )
static

Definition at line 3312 of file commentscan.l.

3313{
3314 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3315 MakeEntryType sectionMaker = EntryType::makeExample;
3316 for (const auto &opt : optList)
3317 {
3318 if (opt=="lineno")
3319 {
3320 sectionMaker=EntryType::makeExampleLineno;
3321 }
3322 else
3323 {
3324 warn(yyextra->fileName,yyextra->lineNr,
3325 "unsupported option '{}' for command '\\{}'",opt,cmd);
3326 }
3327 }
3328 bool stop=makeStructuralIndicator(yyscanner,sectionMaker);
3329 if (!stop) yyextra->current->name = yyextra->fileName;
3330 BEGIN( FileDocArg1 );
3331 return stop;
EntryType(* MakeEntryType)()
3332}

References makeStructuralIndicator(), warn, and yyguts_t.

◆ handleExtends()

bool handleExtends ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 4323 of file commentscan.l.

4324{
4325 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4326 yyextra->currentCmd = cmd;
4327 BEGIN(ExtendsParam);
4328 return false;
4329}

References yyguts_t.

◆ handleField()

bool handleField ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3288 of file commentscan.l.

3289{
3290 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3291 BEGIN(FieldArg);
3292 return false;
3293}

References yyguts_t.

◆ handleFile()

bool handleFile ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3266 of file commentscan.l.

3267{
3268 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3269 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeFileDoc);
3270 if (!stop)
3271 {
3272 yyextra->current->name = yyextra->fileName;
3273 }
3274 BEGIN( FileDocArg1 );
3275 return stop;
3276}

References makeStructuralIndicator(), and yyguts_t.

◆ handleFileInfo()

bool handleFileInfo ( yyscan_t yyscanner,
const DString & cmdName,
const StringVector & optList )
static

Definition at line 3686 of file commentscan.l.

3687{
3688 return handleFileInfoResult(yyscanner,cmdName, optList, false);
static bool handleFileInfoResult(yyscan_t yyscanner, const DString &, const StringVector &optList, bool isSection)
3689}

References handleFileInfoResult().

◆ handleFileInfoResult()

bool handleFileInfoResult ( yyscan_t yyscanner,
const DString & ,
const StringVector & optList,
bool isSection )
static

Definition at line 3711 of file commentscan.l.

3712{
3713 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3714 if (!yyextra->spaceBeforeCmd.empty())
3715 {
3716 if (isSection) yyextra->sectionTitle+=yyextra->spaceBeforeCmd;
3717 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3718 yyextra->spaceBeforeCmd.clear();
3719 }
3720 bool first = true;
3721 FileInfo fi(yyextra->fileName.str());
3722 for (const auto &opt_ : optList)
3723 {
3724 DString optStripped = DString(opt_).stripWhiteSpace();
3725 std::string opt = optStripped.lower().str();
3726 DString result = fileInfoLookup(fi,opt);
3727 if (!result.empty())
3728 {
3729 if (!first)
3730 {
3731 warn(yyextra->fileName,yyextra->lineNr,"Multiple options specified with \\fileinfo, discarding '{}'", optStripped);
3732 }
3733 else
3734 {
3735 addOutput(yyscanner,result);
3736 if (isSection)
3737 {
3738 yyextra->sectionTitle+=result;
3739 }
3740 }
3741 first = false;
3742 }
3743 else
3744 {
3745 warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\fileinfo: '{}'", optStripped);
3746 }
3747 }
3748 if (first) // no options specified
3749 {
3750 if (Config_getBool(FULL_PATH_NAMES))
3751 {
3752 if (isSection) yyextra->sectionTitle+=stripFromPath(yyextra->fileName);
3753 addOutput(yyscanner,stripFromPath(yyextra->fileName));
3754 }
3755 else
3756 {
3757 if (isSection) yyextra->sectionTitle+=yyextra->fileName;
3758 addOutput(yyscanner,yyextra->fileName);
3759 }
3760 }
3761 return false;
DString lower() const
Definition dstring.h:326
const std::string & str() const
Definition dstring.h:645
static DString fileInfoLookup(const FileInfo &fi, const std::string &name)
#define Config_getBool(name)
Definition config.h:33
DString stripFromPath(const DString &path)
Definition util.cpp:219
3762}

References addOutput(), Config_getBool, DString::empty(), fileInfoLookup(), DString::lower(), DString::str(), stripFromPath(), DString::stripWhiteSpace(), warn, and yyguts_t.

Referenced by handleFileInfo(), and handleFileInfoSection().

◆ handleFileInfoSection()

bool handleFileInfoSection ( yyscan_t yyscanner,
const DString & cmdName,
const StringVector & optList )
static

Definition at line 3690 of file commentscan.l.

3691{
3692 return handleFileInfoResult(yyscanner,cmdName, optList, true);
3693}

References handleFileInfoResult().

◆ handleFn()

bool handleFn ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3068 of file commentscan.l.

3069{
3070 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3071 yyextra->braceCount=0;
3072 yyextra->functionProto.clear();
3073 yyextra->currentCmd = cmd;
3074 yyextra->currentMakeEntryType = EntryType::makeMemberDoc;
3075 BEGIN( FnParam );
3076 return checkStructuralIndicator(yyscanner);
3077}

References checkStructuralIndicator(), and yyguts_t.

◆ handleFormatBlock()

bool handleFormatBlock ( yyscan_t yyscanner,
const DString & s,
const StringVector & optList )
static

Definition at line 3643 of file commentscan.l.

3644{
3645 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3646 if (!yyextra->spaceBeforeCmd.empty())
3647 {
3648 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3649 yyextra->spaceBeforeCmd.clear();
3650 }
3651 if (s=="mermaid")
3652 {
3654 }
3655 if (optList.empty())
3656 {
3657 addOutput(yyscanner,"@"+s+" ");
3658 }
3659 else
3660 {
3661 addOutput(yyscanner,"@"+s+"{"+DString(join(optList,","))+"} ");
3662 }
3663 //printf("handleFormatBlock(%s) with option(%s)\n",qPrint(s),qPrint(opt));
3664 yyextra->blockName=s;
3665 yyextra->commentCount=0;
3666 BEGIN(FormatBlock);
3667 return false;
static MermaidManager & instance()
Definition mermaid.cpp:38
void setHasInlineDiagrams()
Definition mermaid.cpp:248
3668}

References addOutput(), MermaidManager::instance(), join(), MermaidManager::setHasInlineDiagrams(), and yyguts_t.

◆ handleGroupgraph()

bool handleGroupgraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4080 of file commentscan.l.

4081{
4082 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4083 yyextra->current->commandOverrides.override_groupGraph(true); // ON
4084 return false;
4085}

References yyguts_t.

◆ handleGuard()

void handleGuard ( yyscan_t yyscanner,
const DString & expr )
static

Definition at line 5156 of file commentscan.l.

5157{
5158 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
5159 CondParser prs;
5160 bool sectionEnabled = false;
5161 if (!expr.empty())
5162 {
5163 sectionEnabled=prs.parse(yyextra->fileName,yyextra->lineNr,expr.stripWhiteSpace());
5164 }
5165 bool parentEnabled = yyextra->guards->top().parentVisible();
5166 if (parentEnabled)
5167 {
5168 if (
5169 (sectionEnabled && yyextra->guardType==Guard_If) ||
5170 (!sectionEnabled && yyextra->guardType==Guard_IfNot)
5171 ) // section is visible
5172 {
Copyright (C) 1997-2026 by Dimitri van Heesch.
Definition condparser.h:29
bool parse(const DString &fileName, int lineNr, const DString &expr)
parses and evaluates the given expression.
5173
5174 yyextra->guards->top().setEnabled(true);
5175 yyextra->guards->top().setEnabledFound();
5176 BEGIN( GuardParamEnd );
5177 }
5178 else if (yyextra->guardType==Guard_ElseIf)
5179 {
5180 if (yyextra->guards->top().isEnabledFound())
5181 {
5182 yyextra->guards->top().setEnabled(false);
5183 BEGIN( SkipGuardedSection );
5184 }
5185 else if (sectionEnabled)
5186 {
5187 yyextra->guards->top().setEnabled(true);
5188 yyextra->guards->top().setEnabledFound();
5189 BEGIN( GuardParamEnd );
5190 }
5191 else
5192 {
5193 yyextra->guards->top().setEnabled(false);
5194 BEGIN( SkipGuardedSection );
5195 }
5196 }
5197 else // section is invisible
5198 {
5199 BEGIN( SkipGuardedSection );
5200 }
5201 }
5202 else // invisible because of parent
5203 {
5204 BEGIN( SkipGuardedSection );
5205 }
5206}

References DString::empty(), Guard_ElseIf, Guard_If, Guard_IfNot, CondParser::parse(), DString::stripWhiteSpace(), and yyguts_t.

◆ handleHeaderFile()

bool handleHeaderFile ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3176 of file commentscan.l.

3177{
3178 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3179 BEGIN( ClassDocArg2 );
3180 return false;
3181}

References yyguts_t.

◆ handleHideCallergraph()

bool handleHideCallergraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3989 of file commentscan.l.

3990{
3991 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3992 yyextra->current->commandOverrides.override_callerGraph(false); // OFF
3993 return false;
3994}

References yyguts_t.

◆ handleHideCallgraph()

bool handleHideCallgraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3975 of file commentscan.l.

3976{
3977 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3978 yyextra->current->commandOverrides.override_callGraph(false); // OFF
3979 return false;
3980}

References yyguts_t.

◆ handleHideCollaborationgraph()

bool handleHideCollaborationgraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4073 of file commentscan.l.

4074{
4075 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4076 yyextra->current->commandOverrides.override_collaborationGraph(false); // OFF
4077 return false;
4078}

References yyguts_t.

◆ handleHideDirectoryGraph()

bool handleHideDirectoryGraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4059 of file commentscan.l.

4060{
4061 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4062 yyextra->current->commandOverrides.override_directoryGraph(false); // OFF
4063 return false;
4064}

References yyguts_t.

◆ handleHideEnumValues()

bool handleHideEnumValues ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4003 of file commentscan.l.

4004{
4005 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4006 yyextra->current->commandOverrides.override_enumValues(false); // OFF
4007 return false;
4008}

References yyguts_t.

◆ handleHideGroupgraph()

bool handleHideGroupgraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4087 of file commentscan.l.

4088{
4089 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4090 yyextra->current->commandOverrides.override_groupGraph(false); // OFF
4091 return false;
4092}

References yyguts_t.

◆ handleHideIncludedBygraph()

bool handleHideIncludedBygraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4045 of file commentscan.l.

4046{
4047 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4048 yyextra->current->commandOverrides.override_includedByGraph(false); // OFF
4049 return false;
4050}

References yyguts_t.

◆ handleHideIncludegraph()

bool handleHideIncludegraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4038 of file commentscan.l.

4039{
4040 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4041 yyextra->current->commandOverrides.override_includeGraph(false); // OFF
4042 return false;
4043}

References yyguts_t.

◆ handleHideInheritanceGraph()

bool handleHideInheritanceGraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4133 of file commentscan.l.

4134{
4135 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4136 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::NO); // OFF
4137 return false;
4138}

References yyguts_t.

◆ handleHideInitializer()

bool handleHideInitializer ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3961 of file commentscan.l.

3962{
3963 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3964 yyextra->current->initLines = 0; // OFF
3965 return false;
3966}

References yyguts_t.

◆ handleHideInlineSource()

bool handleHideInlineSource ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4017 of file commentscan.l.

4018{
4019 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4020 yyextra->current->commandOverrides.override_inlineSource(false); // OFF
4021 return false;
4022}

References yyguts_t.

◆ handleHideReferencedByRelation()

bool handleHideReferencedByRelation ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4147 of file commentscan.l.

4148{
4149 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4150 yyextra->current->commandOverrides.override_referencedByRelation(false); // OFF
4151 return false;
4152}

References yyguts_t.

◆ handleHideReferencesRelation()

bool handleHideReferencesRelation ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4161 of file commentscan.l.

4162{
4163 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4164 yyextra->current->commandOverrides.override_referencesRelation(false); // OFF
4165 return false;
4166}

References yyguts_t.

◆ handleIdlException()

bool handleIdlException ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3236 of file commentscan.l.

3237{
3238 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3239 yyextra->currentCmd = cmd;
3240 yyextra->currentMakeEntryType = EntryType::makeExceptionDoc;
3241 BEGIN( ClassDocArg1 );
3242 return checkStructuralIndicator(yyscanner);
3243}

References checkStructuralIndicator(), and yyguts_t.

◆ handleIf()

bool handleIf ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3807 of file commentscan.l.

3808{
3809 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3810 yyextra->guardType = Guard_If;
3811 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
3812 if (yyextra->guards->empty())
3813 {
3814 yyextra->guards->emplace(true);
3815 }
3816 else
3817 {
3818 bool enabled = yyextra->guards->top().isEnabled();
3819 yyextra->guards->emplace(enabled);
3820 }
3821 BEGIN(GuardParam);
3822 return false;
3823}

References Guard_If, and yyguts_t.

◆ handleIFile()

bool handleIFile ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3784 of file commentscan.l.

3785{
3786 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3787 addOutput(yyscanner,yytext);
3788 BEGIN(IFile);
3789 return false;
3790}

References addOutput(), and yyguts_t.

◆ handleIfNot()

bool handleIfNot ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3825 of file commentscan.l.

3826{
3827 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3828 yyextra->guardType = Guard_IfNot;
3829 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
3830 if (yyextra->guards->empty())
3831 {
3832 yyextra->guards->emplace(true);
3833 }
3834 else
3835 {
3836 bool enabled = yyextra->guards->top().isEnabled();
3837 yyextra->guards->emplace(enabled);
3838 }
3839 BEGIN(GuardParam);
3840 return false;
3841}

References Guard_IfNot, and yyguts_t.

◆ handleILine()

bool handleILine ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3776 of file commentscan.l.

3777{
3778 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3779 addOutput(yyscanner,yytext);
3780 BEGIN(ILine);
3781 return false;
3782}

References addOutput(), and yyguts_t.

◆ handleImage()

bool handleImage ( yyscan_t yyscanner,
const DString & s,
const StringVector & optList )
static

Definition at line 3593 of file commentscan.l.

3594{
3595 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3596 for (const auto &opt : optList)
3597 {
3598 DString locOpt(opt);
3599 locOpt = locOpt.stripWhiteSpace();
3600 if (locOpt.lower().startsWith("anchor:"))
3601 {
3602 addAnchor(yyscanner,locOpt.mid(7));
3603 break; // real option handling will be done later on
3604 }
3605 }
3606 if (!yyextra->spaceBeforeCmd.empty())
3607 {
3608 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3609 yyextra->spaceBeforeCmd.clear();
3610 }
3611 if (optList.empty())
3612 {
3613 addOutput(yyscanner,"@"+s+" ");
3614 }
3615 else
3616 {
3617 addOutput(yyscanner,"@"+s+"{"+DString(join(optList,","))+"} ");
3618 }
3619 BEGIN(Comment);
3620 return false;
static void addAnchor(yyscan_t yyscanner, const DString &anchor, const DString &title="")
3621}

References addAnchor(), addOutput(), join(), DString::lower(), DString::mid(), DString::startsWith(), DString::stripWhiteSpace(), and yyguts_t.

◆ handleIncludedBygraph()

bool handleIncludedBygraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4031 of file commentscan.l.

4032{
4033 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4034 yyextra->current->commandOverrides.override_includedByGraph(true); // ON
4035 return false;
4036}

References yyguts_t.

◆ handleIncludegraph()

bool handleIncludegraph ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4024 of file commentscan.l.

4025{
4026 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4027 yyextra->current->commandOverrides.override_includeGraph(true); // ON
4028 return false;
4029}

References yyguts_t.

◆ handleIngroup()

bool handleIngroup ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3939 of file commentscan.l.

3940{
3941 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3942 yyextra->inGroupParamFound=false;
3943 BEGIN( InGroupParam );
3944 return false;
3945}

References yyguts_t.

◆ handleInherit()

bool handleInherit ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4316 of file commentscan.l.

4317{
4318 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4319 BEGIN(InheritParam);
4320 return false;
4321}

References yyguts_t.

◆ handleInheritanceGraph()

bool handleInheritanceGraph ( yyscan_t yyscanner,
const DString & ,
const StringVector & optList )
static

Definition at line 4094 of file commentscan.l.

4095{
4096 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4097 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::YES);
4098 for (const auto &opt_ : optList)
4099 {
4100 DString opt = DString(opt_).stripWhiteSpace().lower();
4101 if (!opt.empty())
4102 {
4103 if (opt == "yes")
4104 {
4105 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::YES);
4106 }
4107 else if (opt == "graph")
4108 {
4109 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::GRAPH);
4110 }
4111 else if (opt == "builtin")
4112 {
4113 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::BUILTIN);
4114 }
4115 else if (opt == "text")
4116 {
4117 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::TEXT);
4118 }
4119 else if (opt == "no")
4120 {
4121 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::NO);
4122 }
4123 else
4124 {
4125 warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\inheritancegraph: '{}'",
4126 DString(opt_).stripWhiteSpace());
4127 }
4128 }
4129 }
4130 return false;
4131}

References DString::empty(), DString::lower(), DString::stripWhiteSpace(), stripWhiteSpace(), warn, and yyguts_t.

◆ handleInterface()

bool handleInterface ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3227 of file commentscan.l.

3228{
3229 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3230 yyextra->currentCmd = cmd;
3231 yyextra->currentMakeEntryType = EntryType::makeInterfaceDoc;
3232 BEGIN( ClassDocArg1 );
3233 return checkStructuralIndicator(yyscanner);
3234}

References checkStructuralIndicator(), and yyguts_t.

◆ handleInternal()

bool handleInternal ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4176 of file commentscan.l.

4177{
4178 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4179 if (!Config_getBool(INTERNAL_DOCS))
4180 {
4181 // make sure some whitespace before a \internal command
4182 // is not treated as "documentation"
4183 if (yyextra->current->doc.stripWhiteSpace().empty())
4184 {
4185 yyextra->current->doc.clear();
4186 }
4187 yyextra->condCount=0;
4188 BEGIN( SkipInternal );
4189 }
4190 else
4191 {
4192 // re-enabled for bug640828
4193 addOutput(yyscanner," \\internal ");
4194 yyextra->inInternalDocs = true;
4195 }
4196 return false;
4197}

References addOutput(), Config_getBool, and yyguts_t.

◆ handleIPrefix()

bool handleIPrefix ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3799 of file commentscan.l.

3800{
3801 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3802 addOutput(yyscanner,"@iprefix ");
3803 BEGIN(IRaisePrefix);
3804 return false;
3805}

References addOutput(), and yyguts_t.

◆ handleIRaise()

bool handleIRaise ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3792 of file commentscan.l.

3793{
3794 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3795 BEGIN(IRaise);
3796 return false;
3797}

References yyguts_t.

◆ handleLineInfo()

bool handleLineInfo ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3764 of file commentscan.l.

3765{
3766 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3767 if (!yyextra->spaceBeforeCmd.empty())
3768 {
3769 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3770 yyextra->spaceBeforeCmd.clear();
3771 }
3772 addOutput(yyscanner,DString().setNum(yyextra->lineNr));
3773 return false;
3774}

References addOutput(), and yyguts_t.

◆ handleMainpage()

bool handleMainpage ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3253 of file commentscan.l.

3254{
3255 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3256 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeMainpageDoc);
3257 if (!stop)
3258 {
3259 yyextra->current->name = "mainpage";
3260 }
3261 setOutput(yyscanner,OutputDoc);
3262 BEGIN( PageDocArg2 );
3263 return stop;
3264}

References makeStructuralIndicator(), OutputDoc, setOutput(), and yyguts_t.

◆ handleMemberOf()

bool handleMemberOf ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3482 of file commentscan.l.

3483{
3484 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3485 if (!yyextra->current->relates.empty())
3486 {
3487 warn(yyextra->fileName,yyextra->lineNr,
3488 "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
3489 }
3490 yyextra->current->relatesType = RelatesType::MemberOf;
3491 yyextra->currentCmd = cmd;
3492 BEGIN(RelatesParam1);
3493 return false;
3494}

References warn, and yyguts_t.

◆ handleMermaidFile()

bool handleMermaidFile ( yyscan_t yyscanner,
const DString & s,
const StringVector &  )
static

Definition at line 3670 of file commentscan.l.

3671{
3672 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3674 addOutput(yyscanner,yytext);
3675 return false;
3676}

References addOutput(), MermaidManager::instance(), MermaidManager::setHasInlineDiagrams(), and yyguts_t.

◆ handleModule()

bool handleModule ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3167 of file commentscan.l.

3168{
3169 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3170 yyextra->currentCmd = cmd;
3171 yyextra->currentMakeEntryType = EntryType::makeModuleDoc;
3172 BEGIN( ModuleDocArg1 );
3173 return checkStructuralIndicator(yyscanner);
3174}

References checkStructuralIndicator(), and yyguts_t.

◆ handleName()

bool handleName ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3361 of file commentscan.l.

3362{
3363 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3364 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeMemberGrp);
3365 if (!stop)
3366 {
3367 yyextra->docGroup.clearHeader();
3368 BEGIN( NameParam );
3369 if (!yyextra->docGroup.empty()) // end of previous member group
3370 {
3371 yyextra->docGroup.close(yyextra->current,yyextra->fileName,yyextra->lineNr,true,true);
3372 }
3373 }
3374 return stop;
3375}

References makeStructuralIndicator(), and yyguts_t.

◆ handleNamespace()

bool handleNamespace ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3133 of file commentscan.l.

3134{
3135 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3136 yyextra->currentMakeEntryType = EntryType::makeNamespaceDoc;
3137 BEGIN( NameSpaceDocArg1 );
3138 return checkStructuralIndicator(yyscanner);
3139}

References checkStructuralIndicator(), and yyguts_t.

◆ handleNoop()

bool handleNoop ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3354 of file commentscan.l.

3355{
3356 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3357 BEGIN( Noop );
3358 return false;
3359}

References yyguts_t.

◆ handleNoSubGrouping()

bool handleNoSubGrouping ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3947 of file commentscan.l.

3948{
3949 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3950 yyextra->current->subGrouping = false;
3951 return false;
3952}

References yyguts_t.

◆ handleOverload()

bool handleOverload ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3090 of file commentscan.l.

3091{
3092 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3093 yyextra->functionProto.clear();
3094 BEGIN(OverloadParam);
3095 return false;
3096}

References yyguts_t.

◆ handlePackage()

bool handlePackage ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3141 of file commentscan.l.

3142{
3143 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3144 bool stop=makeStructuralIndicator(yyscanner,EntryType::makePackageDoc);
3145 BEGIN( PackageDocArg1 );
3146 return stop;
3147}

References makeStructuralIndicator(), and yyguts_t.

◆ handlePage()

bool handlePage ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3245 of file commentscan.l.

3246{
3247 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3248 bool stop=makeStructuralIndicator(yyscanner,EntryType::makePageDoc);
3249 BEGIN( PageDocArg1 );
3250 return stop;
3251}

References makeStructuralIndicator(), and yyguts_t.

◆ handleParam()

bool handleParam ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3278 of file commentscan.l.

3279{
3280 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3281 // we need process param and retval arguments to escape leading underscores in case of
3282 // markdown processing, see bug775493
3283 addOutput(yyscanner,"@param ");
3284 BEGIN( ParamArg1 );
3285 return false;
3286}

References addOutput(), and yyguts_t.

◆ handleParBlock()

bool handleParBlock ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3422 of file commentscan.l.

3423{
3424 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3425 if (yyextra->insideParBlock)
3426 {
3427 warn(yyextra->fileName,yyextra->lineNr,
3428 "found \\parblock command while already in a parblock!");
3429 }
3430 if (!yyextra->spaceBeforeCmd.empty())
3431 {
3432 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3433 yyextra->spaceBeforeCmd.clear();
3434 }
3435 addOutput(yyscanner,"@parblock ");
3436 yyextra->insideParBlock = true;
3437 return false;
3438}

References addOutput(), warn, and yyguts_t.

◆ handlePrivate()

bool handlePrivate ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4213 of file commentscan.l.

4214{
4215 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4216 yyextra->current->protection = Protection::Private;
4217 return false;
4218}

References yyguts_t.

◆ handlePrivateSection()

bool handlePrivateSection ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4220 of file commentscan.l.

4221{
4222 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4223 yyextra->current->protection = yyextra->protection = Protection::Private;
4224 return false;
4225}

References yyguts_t.

◆ handleProtected()

bool handleProtected ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4227 of file commentscan.l.

4228{
4229 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4230 yyextra->current->protection = Protection::Protected;
4231 return false;
4232}

References yyguts_t.

◆ handleProtectedSection()

bool handleProtectedSection ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4234 of file commentscan.l.

4235{
4236 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4237 yyextra->current->protection = yyextra->protection = Protection::Protected ;
4238 return false;
4239}

References yyguts_t.

◆ handleProtocol()

bool handleProtocol ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3183 of file commentscan.l.

3184{ // Obj-C protocol
3185 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3186 yyextra->currentCmd = cmd;
3187 yyextra->currentMakeEntryType = EntryType::makeProtocolDoc;
3188 BEGIN( ClassDocArg1 );
3189 return checkStructuralIndicator(yyscanner);
3190}

References checkStructuralIndicator(), and yyguts_t.

◆ handlePublic()

bool handlePublic ( yyscan_t yyscanner,
const DString & s,
const StringVector &  )
static

Definition at line 4241 of file commentscan.l.

4242{
4243 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4244 yyextra->current->protection = Protection::Public;
4245 return false;
4246}

References yyguts_t.

◆ handlePublicSection()

bool handlePublicSection ( yyscan_t yyscanner,
const DString & s,
const StringVector &  )
static

Definition at line 4248 of file commentscan.l.

4249{
4250 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4251 yyextra->current->protection = yyextra->protection = Protection::Public;
4252 return false;
4253}

References yyguts_t.

◆ handlePure()

bool handlePure ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4206 of file commentscan.l.

4207{
4208 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4209 yyextra->current->virt = Specifier::Pure;
4210 return false;
4211}

References yyguts_t.

◆ handleQualifier()

bool handleQualifier ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 4168 of file commentscan.l.

4169{
4170 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4171 yyextra->currentCmd = cmd;
4172 BEGIN(Qualifier);
4173 return false;
4174}

References yyguts_t.

◆ handleRaiseWarning()

bool handleRaiseWarning ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3346 of file commentscan.l.

3347{
3348 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3349 yyextra->raiseWarning = "";
3350 BEGIN( RaiseWarning );
3351 return false;
3352}

References yyguts_t.

◆ handleRecord()

bool handleRecord ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3218 of file commentscan.l.

3219{
3220 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3221 yyextra->currentCmd = cmd;
3222 yyextra->currentMakeEntryType = EntryType::makeRecordDoc;
3223 BEGIN( ClassDocArg1 );
3224 return checkStructuralIndicator(yyscanner);
3225}

References checkStructuralIndicator(), and yyguts_t.

◆ handleReferencedByRelation()

bool handleReferencedByRelation ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4140 of file commentscan.l.

4141{
4142 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4143 yyextra->current->commandOverrides.override_referencedByRelation(true); // ON
4144 return false;
4145}

References yyguts_t.

◆ handleReferencesRelation()

bool handleReferencesRelation ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4154 of file commentscan.l.

4155{
4156 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4157 yyextra->current->commandOverrides.override_referencesRelation(true); // ON
4158 return false;
4159}

References yyguts_t.

◆ handleRefItem()

bool handleRefItem ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3496 of file commentscan.l.

3497{
3498 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3499 addOutput(yyscanner,"@refitem ");
3500 BEGIN(LineParam);
3501 return false;
3502}

References addOutput(), and yyguts_t.

◆ handleRelated()

bool handleRelated ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3454 of file commentscan.l.

3455{
3456 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3457 if (!yyextra->current->relates.empty())
3458 {
3459 warn(yyextra->fileName,yyextra->lineNr,
3460 "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
3461 }
3462 yyextra->current->relatesType = RelatesType::Simple;
3463 yyextra->currentCmd = cmd;
3464 BEGIN(RelatesParam1);
3465 return false;
3466}

References warn, and yyguts_t.

◆ handleRelatedAlso()

bool handleRelatedAlso ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3468 of file commentscan.l.

3469{
3470 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3471 if (!yyextra->current->relates.empty())
3472 {
3473 warn(yyextra->fileName,yyextra->lineNr,
3474 "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
3475 }
3476 yyextra->current->relatesType = RelatesType::Duplicate;
3477 yyextra->currentCmd = cmd;
3478 BEGIN(RelatesParam1);
3479 return false;
3480}

References warn, and yyguts_t.

◆ handleRequirement()

bool handleRequirement ( yyscan_t yyscanner,
const DString & s,
const StringVector &  )
static

Definition at line 3534 of file commentscan.l.

3535{
3536 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3537 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeRequirementDoc);
3538 BEGIN( RequirementLabel );
3539 return stop;
3540}

References makeStructuralIndicator(), and yyguts_t.

◆ handleRetval()

bool handleRetval ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3295 of file commentscan.l.

3296{
3297 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3298 addOutput(yyscanner,"@retval ");
3299 BEGIN( ParamArg1 );
3300 return false;
3301}

References addOutput(), and yyguts_t.

◆ handleSatisfies()

bool handleSatisfies ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3542 of file commentscan.l.

3543{
3544 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3545 BEGIN( SatisfiesLabel );
3546 return false;
3547}

References yyguts_t.

◆ handleSection()

bool handleSection ( yyscan_t yyscanner,
const DString & s,
const StringVector &  )
static

Definition at line 3504 of file commentscan.l.

3505{
3506 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3507 setOutput(yyscanner,OutputDoc);
3508 //printf("handleSection(%s) raiseLevel=%d\n",qPrint(s),yyextra->raiseLevel);
3509 BEGIN(SectionLabel);
3510 yyextra->sectionLabel.clear();
3511 // determine natural section level
3512 if (s=="section") yyextra->sectionLevel=SectionType::Section;
3513 else if (s=="subsection") yyextra->sectionLevel=SectionType::Subsection;
3514 else if (s=="subsubsection") yyextra->sectionLevel=SectionType::Subsubsection;
3515 else if (s=="paragraph") yyextra->sectionLevel=SectionType::Paragraph;
3516 else if (s=="subparagraph") yyextra->sectionLevel=SectionType::Subparagraph;
3517 else if (s=="subsubparagraph") yyextra->sectionLevel=SectionType::Subsubparagraph;
3518 // raise it if requested
3519 yyextra->sectionLevel = std::min(yyextra->sectionLevel + yyextra->raiseLevel,SectionType::MaxLevel);
3520 // rewrite the update section level to the output
3521 switch (yyextra->sectionLevel)
3522 {
3523 case SectionType::Section: addOutput(yyscanner,"@section "); break;
3524 case SectionType::Subsection: addOutput(yyscanner,"@subsection "); break;
3525 case SectionType::Subsubsection: addOutput(yyscanner,"@subsubsection "); break;
3526 case SectionType::Paragraph: addOutput(yyscanner,"@paragraph "); break;
3527 case SectionType::Subparagraph: addOutput(yyscanner,"@subparagraph "); break;
3528 case SectionType::Subsubparagraph: addOutput(yyscanner,"@subsubparagraph "); break;
3529 default: addOutput(yyscanner,"@"+s+" "); break;
3530 }
3531 return false;
static constexpr int Section
Definition section.h:33
static constexpr int MaxLevel
Definition section.h:39
static constexpr int Subsection
Definition section.h:34
static constexpr int Subsubsection
Definition section.h:35
static constexpr int Paragraph
Definition section.h:36
static constexpr int Subsubparagraph
Definition section.h:38
static constexpr int Subparagraph
Definition section.h:37
3532}

References addOutput(), SectionType::MaxLevel, OutputDoc, SectionType::Paragraph, SectionType::Section, setOutput(), SectionType::Subparagraph, SectionType::Subsection, SectionType::Subsubparagraph, SectionType::Subsubsection, and yyguts_t.

◆ handleShowEnumValues()

bool handleShowEnumValues ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3996 of file commentscan.l.

3997{
3998 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3999 yyextra->current->commandOverrides.override_enumValues(true); // ON
4000 return false;
4001}

References yyguts_t.

◆ handleShowInitializer()

bool handleShowInitializer ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3954 of file commentscan.l.

3955{
3956 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3957 yyextra->current->initLines = 100000; // ON
3958 return false;
3959}

References yyguts_t.

◆ handleShowInlineSource()

bool handleShowInlineSource ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4010 of file commentscan.l.

4011{
4012 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4013 yyextra->current->commandOverrides.override_inlineSource(true); // ON
4014 return false;
4015}

References yyguts_t.

◆ handleStatic()

bool handleStatic ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 4199 of file commentscan.l.

4200{
4201 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4202 yyextra->current->isStatic = true;
4203 return false;
4204}

References yyguts_t.

◆ handleStruct()

bool handleStruct ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3210 of file commentscan.l.

3211{
3212 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3213 yyextra->currentCmd = cmd;
3214 yyextra->currentMakeEntryType = EntryType::makeStructDoc;
3215 BEGIN( ClassDocArg1 );
3216 return checkStructuralIndicator(yyscanner);
3217}

References checkStructuralIndicator(), and yyguts_t.

◆ handleSubpage()

bool handleSubpage ( yyscan_t yyscanner,
const DString & s,
const StringVector &  )
static

Definition at line 3556 of file commentscan.l.

3557{
3558 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3559 if (!yyextra->current->section.isEmpty() &&
3560 !yyextra->current->section.isPageDoc() &&
3561 !yyextra->current->section.isMainpageDoc()
3562 )
3563 {
3564 warn(yyextra->fileName,yyextra->lineNr,
3565 "found \\subpage command in a comment block that is not marked as a page!");
3566 }
3567 if (!yyextra->spaceBeforeCmd.empty())
3568 {
3569 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3570 yyextra->spaceBeforeCmd.clear();
3571 }
3572 addOutput(yyscanner,"@"+s+" ");
3573 BEGIN(SubpageLabel);
3574 return false;
3575}

References addOutput(), warn, and yyguts_t.

◆ handleTest()

bool handleTest ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3386 of file commentscan.l.

3387{
3388 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3389 yyextra->newXRefKind = XRef_Test;
3390 setOutput(yyscanner,OutputXRef);
3391 yyextra->xrefKind = XRef_Test;
3392 return false;
3393}

References OutputXRef, setOutput(), XRef_Test, and yyguts_t.

◆ handleToc()

bool handleToc ( yyscan_t yyscanner,
const DString & s,
const StringVector & optList )
static

Definition at line 4255 of file commentscan.l.

4256{
4257 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4258 if (yyextra->current->section.isPageDoc() ||
4259 yyextra->current->section.isMainpageDoc())
4260 {
4261 for (const auto &opt_ : optList)
4262 {
4263 DString opt = DString(opt_).stripWhiteSpace().lower();
4264 int level = SectionType::MaxLevel;
4265 size_t i = opt.find(':');
4266 if (i!=DString::npos && i>0) // found ':' but not on position 0 what would mean just a level
4267 {
4268 char dum=0;
4269 if (sscanf(opt.mid(i+1).data(),"%d%c",&level,&dum) != 1)
4270 {
4271 warn(yyextra->fileName,yyextra->lineNr,"Unknown option:level specified with \\tableofcontents: '{}'",
4272 qPrint(DString(opt_).stripWhiteSpace()));
4273 opt = "";
4274 }
4275 else
4276 {
4277 level = level<=0 ? SectionType::MaxLevel : std::min(level,SectionType::MaxLevel);
4278 opt = opt.left(i).stripWhiteSpace();
4279 }
4280 }
4281 if (!opt.empty())
4282 {
4283 if (opt == "html")
4284 {
4285 yyextra->current->localToc.enableHtml(level);
4286 }
4287 else if (opt == "latex")
4288 {
4289 yyextra->current->localToc.enableLatex(level);
4290 }
4291 else if (opt == "xml")
4292 {
4293 yyextra->current->localToc.enableXml(level);
4294 }
4295 else if (opt == "docbook")
4296 {
4297 yyextra->current->localToc.enableDocbook(level);
4298 }
4299 else
4300 {
4301 warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\tableofcontents: '{}'",
4302 DString(opt_).stripWhiteSpace());
4303 }
4304 }
4305 }
4306 if (yyextra->current->localToc.nothingEnabled())
4307 {
4308 // for backward compatibility
4309 yyextra->current->localToc.enableHtml(SectionType::MaxLevel);
4310 yyextra->current->localToc.enableXml(SectionType::MaxLevel);
4311 }
4312 }
4313 return false;
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:178
DString left(size_t len) const
Definition dstring.h:306
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:157
4314}

References DString::data(), DString::empty(), DString::find(), DString::left(), DString::lower(), SectionType::MaxLevel, DString::mid(), DString::npos, qPrint(), DString::stripWhiteSpace(), stripWhiteSpace(), warn, and yyguts_t.

◆ handleTodo()

bool handleTodo ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3377 of file commentscan.l.

3378{
3379 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3380 yyextra->newXRefKind = XRef_Todo;
3381 setOutput(yyscanner,OutputXRef);
3382 yyextra->xrefKind = XRef_Todo;
3383 return false;
3384}

References OutputXRef, setOutput(), XRef_Todo, and yyguts_t.

◆ handleUnion()

bool handleUnion ( yyscan_t yyscanner,
const DString & cmd,
const StringVector &  )
static

Definition at line 3201 of file commentscan.l.

3202{
3203 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3204 yyextra->currentCmd = cmd;
3205 yyextra->currentMakeEntryType = EntryType::makeUnionDoc;
3206 BEGIN( ClassDocArg1 );
3207 return checkStructuralIndicator(yyscanner);
3208}

References checkStructuralIndicator(), and yyguts_t.

◆ handleVerifies()

bool handleVerifies ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3549 of file commentscan.l.

3550{
3551 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3552 BEGIN( VerifiesLabel );
3553 return false;
3554}

References yyguts_t.

◆ handleWeakGroup()

bool handleWeakGroup ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3124 of file commentscan.l.

3125{
3126 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3127 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeGroupDoc);
3128 yyextra->current->groupDocType = Entry::GROUPDOC_WEAK;
3129 BEGIN( GroupDocArg1 );
3130 return stop;
@ GROUPDOC_WEAK
weakgroup
Definition entry.h:130
3131}

References Entry::GROUPDOC_WEAK, makeStructuralIndicator(), and yyguts_t.

◆ handleXRefItem()

bool handleXRefItem ( yyscan_t yyscanner,
const DString & ,
const StringVector &  )
static

Definition at line 3414 of file commentscan.l.

3415{
3416 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3417 yyextra->newXRefKind = XRef_Item;
3418 BEGIN(XRefItemParam1);
3419 return false;
3420}

References XRef_Item, and yyguts_t.

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 4385 of file commentscan.l.

4386{
4387 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4388 yyextra->sectionLabel.clear();
4389 yyextra->sectionTitle.clear();
4390 yyextra->docGroup.clearHeader();
4391 yyextra->insideParBlock = false;
4392}

References yyguts_t.

Referenced by CommentScanner::parseCommentBlock().

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 4429 of file commentscan.l.

4430{
4431 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4432 for( const char* c = yytext ; *c ; ++c )
4433 yyextra->lineNr += (*c == '\n') ;
4434}

References yyguts_t.

◆ makeStructuralIndicator()

bool makeStructuralIndicator ( yyscan_t yyscanner,
MakeEntryType maker )
static

Definition at line 4403 of file commentscan.l.

4404{
4405 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4406 ASSERT(maker!=nullptr); // detect programming error
4407 //printf("yyextra->current->section=%x\n",yyextra->current->section);
4408 if (yyextra->current->section.isDoc())
4409 {
4410 return true;
4411 }
4412 else if (maker)
4413 {
4414 yyextra->needNewEntry = true;
4415 yyextra->current->section = maker();
4416 yyextra->current->fileName = yyextra->fileName;
4417 yyextra->current->startLine = yyextra->lineNr;
4418 if (yyextra->current->docLine == -1) yyextra->current->docLine = yyextra->lineNr;
4419 return false;
4420 }
4421 else
4422 {
4423 return false;
4424 }
#define ASSERT(x)
Definition message.h:142
4425}

References ASSERT, and yyguts_t.

Referenced by handleAddToGroup(), handleDefGroup(), handleDir(), handleExample(), handleFile(), handleMainpage(), handleName(), handlePackage(), handlePage(), handleRequirement(), and handleWeakGroup().

◆ sectionLevelToType()

SectionType sectionLevelToType ( int level)
static

Definition at line 4619 of file commentscan.l.

4620{
4621 if (level>=0 && level<SectionType::MaxLevel) return SectionType(level);
4622 return SectionType::Anchor;
4623}

References SectionType::Anchor, and SectionType::MaxLevel.

Referenced by addSection().

◆ setOutput()

void setOutput ( yyscan_t yyscanner,
OutputContext ctx )
inlinestatic

Definition at line 4717 of file commentscan.l.

4718{
4719 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4720 bool xrefAppendToPrev = yyextra->xrefAppendFlag;
4721 // determine append flag for the next item (i.e. the end of this item)
4722 yyextra->xrefAppendFlag = !yyextra->inBody &&
4723 yyextra->inContext==OutputXRef && ctx==OutputXRef && // two consecutive xref items
4724 yyextra->newXRefKind==yyextra->xrefKind && // of the same kind
4725 (yyextra->xrefKind!=XRef_Item ||
4726 yyextra->newXRefItemKey==yyextra->xrefItemKey); // with the same key if \xrefitem
4727 //printf("%d && %d && %d && (%d || %d)\n",
4728 // yyextra->inContext==OutputXRef,
4729 // ctx==OutputXRef,
4730 // yyextra->newXRefKind==yyextra->xrefKind,
4731 // yyextra->xrefKind!=XRef_Item,
4732 // yyextra->newXRefItemKey==yyextra->xrefItemKey);
4733 //printf("refKind=%d yyextra->newXRefKind=%d xrefAppendToPrev=%d yyextra->xrefAppendFlag=%d\n",
4734 // yyextra->xrefKind,yyextra->newXRefKind,xrefAppendToPrev,yyextra->xrefAppendFlag);
4735
4736 //printf("setOutput(yyscanner,yyextra->inContext=%d ctx=%d)\n",yyextra->inContext,ctx);
4737 if (yyextra->inContext==OutputXRef) // end of XRef section => add the item
4738 {
4739 // See if we can append this new xref item to the previous one.
4740 // We know this at the start of the next item of the same
4741 // type and need to remember this until the end of that item.
4742 switch(yyextra->xrefKind)
4743 {
4744 case XRef_Todo:
4745 addXRefItem(yyscanner,DString("todo"),
4748 xrefAppendToPrev
4749 );
4750 break;
4751 case XRef_Test:
4752 addXRefItem(yyscanner,DString("test"),
4755 xrefAppendToPrev
4756 );
4757 break;
4758 case XRef_Bug:
4759 addXRefItem(yyscanner,DString("bug"),
4762 xrefAppendToPrev
4763 );
4764 break;
4765 case XRef_Deprecated:
4766 addXRefItem(yyscanner,DString("deprecated"),
4769 xrefAppendToPrev || yyextra->current->spec.isDeprAttr()
4770 );
4771 break;
4772 case XRef_Item: // user defined list
4773 addXRefItem(yyscanner,yyextra->xrefItemKey,
4774 yyextra->xrefItemTitle,
4775 yyextra->xrefListTitle,
4776 xrefAppendToPrev
4777 );
4778 break;
4779 case XRef_None:
4780 ASSERT(0);
4781 break;
4782 }
4783 }
4784 yyextra->xrefItemKey = yyextra->newXRefItemKey;
virtual DString trTestList()=0
virtual DString trBugList()=0
virtual DString trBug()=0
virtual DString trTodoList()=0
virtual DString trDeprecatedList()=0
virtual DString trDeprecated()=0
virtual DString trTodo()=0
virtual DString trTest()=0
static void addXRefItem(yyscan_t yyscanner, const DString &listName, const DString &itemTitle, const DString &listTitle, bool append)
Translator * theTranslator
Definition language.cpp:76
4785
4786 int oldContext = yyextra->inContext;
4787 yyextra->inContext = ctx;
4788 if (yyextra->inContext!=OutputXRef && yyextra->inBody) yyextra->inContext=OutputInbody;
4789 switch(yyextra->inContext)
4790 {
4791 case OutputDoc:
4792 if (oldContext!=yyextra->inContext)
4793 {
4794 if (oldContext==OutputField)
4795 {
4796 if (!yyextra->current->doc.empty()) yyextra->current->doc += '\n';
4797 }
4798 else
4799 {
4800 stripTrailingWhiteSpace(yyextra->current->doc);
4801 }
4802 if (yyextra->current->doc.empty()) yyextra->current->docLine = yyextra->lineNr;
4803 if (yyextra->current->docFile.empty())
4804 {
4805 yyextra->current->docFile = yyextra->fileName;
4806 yyextra->current->docLine = yyextra->lineNr;
4807 }
4808 }
4809 yyextra->pOutputString = &yyextra->current->doc;
4810 break;
4811 case OutputBrief:
4812 {
4813 if (oldContext!=yyextra->inContext)
4814 {
4815 if (yyextra->current->brief.empty()) yyextra->current->briefLine = yyextra->lineNr;
4816 if (yyextra->current->briefFile.empty())
4817 {
4818 yyextra->current->briefFile = yyextra->fileName;
4819 yyextra->current->briefLine = yyextra->lineNr;
4820 }
4821 }
4822 bool foundMatch = false;
4823 if (yyextra->current->brief.stripWhiteSpace().empty()) // we only want one brief
4824 // description even if multiple
4825 // are given...
4826 {
4827 foundMatch = true;
4828 }
4829 else
4830 {
4831 std::string str = yyextra->current->brief.str();
4833 if (reg::match(str,match,nonBrief_re)) // match found
4834 {
4835 size_t cnt = 0;
4836 for (size_t i = 0; i < match[2].str().size(); i++)
4837 {
4838 if (match[2].str()[i] == '\n') cnt++;
4839 }
4840 if (cnt>0)
4841 {
4842 yyextra->current->brief = yyextra->current->brief.left(yyextra->current->brief.length()-cnt);
4843 // set warning line correct
4844 yyextra->current->brief += " \\iline " + DString().setNum(cnt + static_cast<int>(std::stoul(match[1].str()))) + " \\ilinebr ";
4845 }
4846 foundMatch = true;
4847 }
4848 }
4849 if (foundMatch)
4850 {
4851 yyextra->pOutputString = &yyextra->current->brief;
4852 }
4853 else
4854 {
4855 if (!yyextra->current->doc.empty()) // when appending parts add a new line
4856 {
4857 yyextra->current->doc += "\n";
4858 }
4859 yyextra->pOutputString = &yyextra->current->doc;
4860 yyextra->inContext = OutputDoc; // need to switch to detailed docs, see bug 631380
4861 }
4862 }
4863 break;
4864 case OutputField:
4865 yyextra->pOutputString = &yyextra->current->fieldDocs.back().doc;
4866 break;
4867 case OutputXRef:
4868 yyextra->pOutputString = &yyextra->outputXRef;
4869 // first item found, so can't append to previous
4870 //yyextra->xrefAppendFlag = false;
4871 break;
4872 case OutputInbody:
4873 yyextra->pOutputString = &yyextra->current->inbodyDocs;
4874 break;
4875 }
DString & setNum(short n)
Definition dstring.h:552
static void stripTrailingWhiteSpace(DString &s)
4876}

References addXRefItem(), ASSERT, reg::match(), nonBrief_re, OutputBrief, OutputDoc, OutputField, OutputInbody, OutputXRef, DString::setNum(), stripTrailingWhiteSpace(), theTranslator, Translator::trBug(), Translator::trBugList(), Translator::trDeprecated(), Translator::trDeprecatedList(), Translator::trTest(), Translator::trTestList(), Translator::trTodo(), Translator::trTodoList(), XRef_Bug, XRef_Deprecated, XRef_Item, XRef_None, XRef_Test, XRef_Todo, and yyguts_t.

Referenced by endBrief(), handleBrief(), handleBug(), handleCopyBrief(), handleCopyDetails(), handleCopyDoc(), handleDeprecated(), handleDetails(), handleEndParBlock(), handleMainpage(), handleSection(), handleTest(), handleTodo(), and CommentScanner::parseCommentBlock().

◆ stateToString()

const char * stateToString ( int state)
static

◆ stripQuotes()

DString stripQuotes ( const char * s)
static

Definition at line 4438 of file commentscan.l.

4439{
4440 DString name;
4441 if (s==nullptr || *s==0) return name;
4442 name=s;
4443 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
4444 {
4445 name=name.mid(1,name.length()-2);
4446 }
4447 return name;
4448}

◆ stripTrailingWhiteSpace()

void stripTrailingWhiteSpace ( DString & s)
static

Definition at line 4689 of file commentscan.l.

4690{
4691 size_t len = s.length();
4692 int i = (int)len-1;
4693 while (i>=0)
4694 {
4695 char c = s.at(i);
4696 if (c==' ' || c=='\t' || c=='\r') // normal whitespace
4697 {
4698 i--;
4699 }
4700 else if (c=='r' && i>=7 && literal_at(s.data()+i-7,"\\ilinebr")) // special line break marker
4701 {
4702 i-=8;
4703 }
4704 else // non-whitespace
4705 {
4706 break;
4707 }
4708 }
4709 //printf("stripTrailingWhitespace(%s) i=%d len=%d\n",qPrint(s),i,len);
4710 if (i!=(int)len-1)
4711 {
4712 s.resize(i+1); // string up to and including char at pos i
4713 }
void resize(size_t newlen)
Definition dstring.h:209
char & at(size_t i)
Returns a reference to the character at index i.
Definition dstring.h:686
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
bool literal_at(const char *data, const char(&str)[N])
returns true iff data points to a substring that matches string literal str
Definition stringutil.h:101
4714}

References DString::at(), DString::data(), DString::length(), literal_at(), and DString::resize().

Referenced by setOutput().

◆ yylex()

int yylex ( yyscan_t yyscanner)

Definition at line 725 of file commentscan.l.

744 {CMD}{CMD}[a-z_A-Z]+{B}* { // escaped command
745 addOutput(yyscanner,yytext);
746 }
747<Comment>{CMD}{CMD}"~"[a-z_A-Z]* { // escaped command
748 addOutput(yyscanner,yytext);
749 }
750<Comment>{MAILADDR} { // mail address
751 addOutput(yyscanner,yytext);
752 }
753<Comment>"\""[^"\n]*"\"" { // quoted text
754 addOutput(yyscanner,yytext);
755 }
756<Comment>("\\"[a-z_A-Z]+)+"\\" { // directory (or chain of commands!)
757 addOutput(yyscanner,yytext);
758 }
759<Comment>"<"{DETAILEDHTML}{ATTR}">" { // HTML command that ends a brief description
760 DString htmlOpenTag(yytext);
761 size_t spacePos = htmlOpenTag.find(' '); // check for optional attributes
762 if (spacePos==DString::npos) spacePos=yyleng-1;
763 DString htmlTagName = htmlOpenTag.mid(1,spacePos-1);
764 //printf("found open tag '%s'\n",qPrint(htmlTagName));
765 yyextra->htmlContextStack.emplace_back(htmlTagName,yyextra->inContext);
766 if (yyextra->inContext==OutputBrief)
767 {
768 setOutput(yyscanner,OutputDoc);
769 }
770 // continue with the same input
771 REJECT;
772 }
773<Comment>"</"{DETAILEDHTML}">" { // HTML command that ends a brief description
774 DString htmlCloseTag(yytext);
775 DString htmlTagName = htmlCloseTag.mid(2,htmlCloseTag.length()-3);
776 //printf("found close tag '%s'\n",qPrint(htmlTagName));
777 if (!yyextra->htmlContextStack.empty() &&
778 yyextra->htmlContextStack.back().tagName==htmlTagName)
779 {
780 if (yyextra->inContext==OutputXRef && yyextra->htmlContextStack.back().context!=OutputXRef)
781 {
782 //printf("switching back to OutputDoc\n");
783 setOutput(yyscanner,OutputDoc);
784 }
785 yyextra->htmlContextStack.pop_back();
786 }
787 REJECT;
788 }
789<Comment>"<"{DETAILEDHTMLOPT}">" { // HTML <code> command that ends a brief description
790 // without attributes
791 if (yyextra->current->lang==SrcLangExt::CSharp)
792 {
793 yyextra->CScode=true;
794 setOutput(yyscanner,OutputDoc);
795 addOutput(yyscanner,"@code{cs}");
796 }
797 else
798 {
799 // continue with the same input
800 REJECT;
801 }
802 }
803<Comment>"<"{DETAILEDHTMLOPTEND}">" { // HTML command that ends a brief description
804 if (yyextra->CScode)
805 {
806 addOutput(yyscanner,"@endcode");
807 yyextra->CScode=false;
808 }
809 else
810 {
811 yyextra->CScode=false;
812 // continue with the same input
813 REJECT;
814 }
815 }
816<Comment>"<"{DETAILEDHTMLOPT}{ATTR}">" { // HTML <code> command that ends a brief description
817 // with attributes, so cannot be CS.
818 if (yyextra->current->lang==SrcLangExt::CSharp)
819 {
820 setOutput(yyscanner,OutputDoc);
821 }
822 // continue with the same input
823 REJECT;
824 }
825<Comment>"<"{DETAILS}{ATTR}">" { // start of a HTML style details description
826 yyextra->htmlDetailsStack.push_back(0);
827 yyextra->htmlContextStack.emplace_back("details",yyextra->inContext);
828 if (yyextra->inContext==OutputBrief)
829 {
830 setOutput(yyscanner,OutputDoc);
831 }
832 addOutput(yyscanner,yytext);
833 }
834<Comment>"</"{DETAILS}">" { // end of a HTML style details description
835 if (!yyextra->htmlDetailsStack.empty())
836 {
837 yyextra->htmlDetailsStack.pop_back();
838 }
839 if (!yyextra->htmlContextStack.empty() &&
840 yyextra->htmlContextStack.back().tagName=="details")
841 {
842 if (yyextra->inContext==OutputXRef && yyextra->htmlContextStack.back().context!=OutputXRef)
843 {
844 //printf("switching back to OutputDoc\n");
845 setOutput(yyscanner,OutputDoc);
846 }
847 yyextra->htmlContextStack.pop_back();
848 }
849 addOutput(yyscanner,yytext);
850 }
851<Comment>"<"{AHTML} { // potential start of HTML anchor, see issue 9200
852 yyextra->htmlAnchorStr = yytext;
853 yyextra->htmlAnchor = false;
854 BEGIN(HtmlA);
855 }
856<HtmlA>{ANCHTML} { // only labels that can be converted to doxygen anchor
857 yyextra->htmlAnchorStr += yytext;
858 DString tag(yytext);
859 size_t s=tag.find("=");
860 char c=tag[s+1];
861 DString id;
862 if (c=='\'' || c=='"') // valid start
863 {
864 size_t e=tag.find(c,s+2);
865 if (e!=DString::npos) // found matching end
866 {
867 id=tag.mid(s+2,e-s-2); // extract id
868 addAnchor(yyscanner,id);
869 }
870 }
871 else
872 {
873 id=tag.mid(s+1);
874 addAnchor(yyscanner,id);
875 }
876 if (!id.empty() && !yyextra->htmlAnchor)
877 {
878 // only use first analogous to what is in docparser
879 addOutput(yyscanner,"@anchor ");
880 addOutput(yyscanner,id.data());
881 addOutput(yyscanner," ");
882 yyextra->htmlAnchor = true;
883 }
884 }
885<HtmlA>("\""[^\n\"]*"\""|"'"[^\n']*"'") {
886 yyextra->htmlAnchorStr += yytext;
887 }
888<HtmlA>">"|"/>" {
889 if (!yyextra->htmlAnchor)
890 {
891 addOutput(yyscanner,yyextra->htmlAnchorStr);
892 addOutput(yyscanner,yytext);
893 }
894 else
895 {
896 if (yyleng == 1) // to keep <a></a> pairs, otherwise single </a> present
897 {
898 addOutput(yyscanner,"<a>");
899 }
900 }
901 BEGIN(Comment);
902 }
903<HtmlA>{DOCNL} { // newline
904 yyextra->htmlAnchorStr += yytext;
905 if (*yytext == '\n') yyextra->lineNr++;
906 }
907<HtmlA>. { // catch-all for anything else
908 yyextra->htmlAnchorStr += yytext;
909 }
910<Comment>"<"{SUMMARY}">" { // start of a .NET XML style brief description
911 if (yyextra->htmlDetailsStack.empty())
912 {
913 setOutput(yyscanner,OutputBrief);
914 }
915 else // HTML5 style <summary> as part of <details> section.
916 {
917 addOutput(yyscanner,yytext);
918 }
919 }
920<Comment>"<"{REMARKS}">" { // start of a .NET XML style detailed description
921 setOutput(yyscanner,OutputDoc);
922 addOutput(yyscanner,yytext);
923 }
924<Comment>"</"{SUMMARY}">" { // start of a .NET XML style detailed description
925 if (!yyextra->htmlDetailsStack.empty())
926 {
927 addOutput(yyscanner,yytext);
928 }
929 else
930 {
931 setOutput(yyscanner,OutputDoc);
932 }
933 }
934<Comment>"</"{REMARKS}">" { // end of a brief or detailed description
935 setOutput(yyscanner,OutputDoc);
936 addOutput(yyscanner,yytext);
937 }
938<Comment>"<"{CAPTION}{ATTR}">" {
939 DString tag(yytext);
940 size_t s=tag.find("id=");
941 if (s!=DString::npos) // command has id attribute
942 {
943 char c=tag[s+3];
944 if (c=='\'' || c=='"') // valid start
945 {
946 size_t e=tag.find(c,s+4);
947 if (e!=DString::npos) // found matching end
948 {
949 DString id=tag.mid(s+4,e-s-4); // extract id
950 addAnchor(yyscanner,id);
951 }
952 }
953 }
954 addOutput(yyscanner,yytext);
955 }
956<Comment>"<"{PRE}{ATTR}">" {
957 yyextra->insidePre=true;
958 addOutput(yyscanner,yytext);
959 }
960<Comment>"</"{PRE}">" {
961 yyextra->insidePre=false;
962 addOutput(yyscanner,yytext);
963 }
964<Comment>{RCSTAG} { // RCS tag which end a brief description
965 setOutput(yyscanner,OutputDoc);
966 REJECT;
967 }
968<Comment>"<!--" {
969 BEGIN(HtmlComment);
970 }
971<Comment>"<!\‍[CDATA\‍[" {
972 BEGIN(CdataSection);
973 }
974<Comment>{B}*{CMD}"endinternal"{B}* {
975 addOutput(yyscanner," \\endinternal ");
976 if (!yyextra->inInternalDocs)
977 warn(yyextra->fileName,yyextra->lineNr,
978 "found \\endinternal without matching \\internal"
979 );
980 yyextra->inInternalDocs = false;
981 }
982<Comment>{B}*"\\ilinebr "{B}* { // preserve spacing around \\ilinebr
983 addOutput(yyscanner,yytext);
984 }
985<Comment>(\n|"\\ilinebr ")/({B}*(\n|{IFILELINE}?"\\ilinebr "))+ { // at least one blank line (or blank line command)
986 if (yyextra->inContext==OutputBrief)
987 {
988 endBrief(yyscanner);
989 }
990 else
991 {
992 REJECT;
993 }
994 }
static void endBrief(yyscan_t yyscanner)
995<Comment>{B}*{CMD}[a-z_A-Z]+"{"[^}]*"}"{B}* |
996<Comment>{B}*{CMD}[a-z_A-Z]+{B}* { // potentially interesting command
997 // the {B}* in the front was added for bug620924
998 DString fullMatch = yytext;
999 size_t idx = fullMatch.find('{');
1000 /* handle `f{` command as special case */
1001 if ((idx != DString::npos) && (idx > 1) && (yytext[idx-1] == 'f') && (yytext[idx-2] == '\\' || yytext[idx-2] =='@')) REJECT;
1002 size_t idxEnd = DString::npos;
1003 if (idx != DString::npos) idxEnd = fullMatch.find('}',idx+1);
1004 DString cmdName;
1005 StringVector optList;
1006 if (idx == DString::npos) // no options
1007 {
1008 cmdName = fullMatch.stripWhiteSpace().mid(1); // to remove {CMD}
1009 }
1010 else // options present
1011 {
1012 cmdName = fullMatch.left(idx).stripWhiteSpace().mid(1); // to remove {CMD}
1013 DString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace();
1014 optList = split(optStr.str(),",");
1015 }
1016 auto it = docCmdMap.find(cmdName.str());
1017 //printf("lookup command '%s' found=%d\n",qPrint(cmdName),it!=docCmdMap.end());
1018 if (it!=docCmdMap.end()) // special action is required
1019 {
1020 int i=0;
1021 while (yytext[i]==' ' || yytext[i]=='\t') i++;
1022 yyextra->spaceBeforeCmd = fullMatch.left(i);
1023 CommandSpacing spacing = it->second.spacing;
1024 if ((spacing==CommandSpacing::Block || spacing==CommandSpacing::XRef) &&
1025 !(yyextra->inContext==OutputXRef && cmdName=="parblock"))
1026 {
1027 yyextra->briefEndsAtDot=false;
1028 bool insideXRef = yyextra->inContext==OutputXRef && spacing==CommandSpacing::XRef;
1029 // this command forces the end of brief description
1030 setOutput(yyscanner,insideXRef ? OutputXRef : OutputDoc);
1031 }
1032 //if (i>0) addOutput(yyscanner,DString(yytext).left(i)); // removed for bug 689341
1033 if (it->second.handler && it->second.handler(yyscanner, cmdName, optList))
1034 {
1035 // implicit split of the comment block into two
1036 // entries. Restart the next block at the start
1037 // of this command.
1038 yyextra->parseMore=true;
CommandSpacing
static const std::unordered_map< std::string, DocCmdMap > docCmdMap
std::vector< std::string > StringVector
Definition containers.h:33
StringVector split(const std::string &s, const std::string &delimiter, bool retainEmpty=false)
split input string s by string delimiter delimiter.
Definition stringutil.h:119
1039
1040 yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);
1041 yyterminate();
1042 }
1043 else if (it->second.handler==nullptr)
1044 {
1045 // command without handler, to be processed
1046 // later by parsedoc.cpp
1047 addOutput(yyscanner,yytext);
1048 }
1049 }
1050 else // command not relevant
1051 {
1052 addOutput(yyscanner,yytext);
1053 }
1054 }
#define yyterminate()
1055<Comment>{B}*({CMD}{CMD})"f"[$\‍[{] { // escaped formula command
1056 addOutput(yyscanner,yytext);
1057 }
1058<Comment>{B}*{CMD}"~"[a-z_A-Z-]* { // language switch command
1059 DString langId = DString(yytext).stripWhiteSpace().mid(2);
1060 if (!langId.empty() &&
1061 dstricmp(Config_getEnumAsString(OUTPUT_LANGUAGE),langId)!=0)
1062 { // enable language specific section
1063 if (!Config_isAvailableEnum(OUTPUT_LANGUAGE,langId))
1064 {
1065 warn(yyextra->fileName,yyextra->lineNr,
1066 "non supported language '{}' specified in '{}'",langId,DString(yytext).stripWhiteSpace());
1067 }
1068 BEGIN(SkipLang);
1069 }
1070 }
#define Config_getEnumAsString(name)
Definition config.h:36
#define Config_isAvailableEnum(name, value)
Definition config.h:45
int dstricmp(const char *s1, const char *s2)
Definition dstring.cpp:444
1071<Comment>{B}*{CMD}"f{"[^}\n]+"}"("{"?) { // start of a formula with custom environment
1072 setOutput(yyscanner,OutputDoc);
1073 yyextra->formulaText="";
1074 yyextra->formulaPreText="\\begin";
1075 yyextra->formulaPostText="";
1076 yyextra->formulaEnv=DString(yytext).stripWhiteSpace().mid(2);
1077 if (yyextra->formulaEnv.at(yyextra->formulaEnv.length()-1)=='{')
1078 {
1079 // remove trailing open brace
1080 yyextra->formulaEnv=yyextra->formulaEnv.left(yyextra->formulaEnv.length()-1);
1081 }
1082 yyextra->formulaPreText+=yyextra->formulaEnv;
1083 yyextra->formulaNewLines=0;
1084 BEGIN(ReadFormulaLong);
1085 }
1086<Comment>{B}*{CMD}"f$" { // start of a inline formula
1087 yyextra->formulaText="";
1088 yyextra->formulaPreText="$";
1089 yyextra->formulaPostText="";
1090 yyextra->formulaNewLines=0;
1091 BEGIN(ReadFormulaShort);
1092 }
1093<Comment>{B}*{CMD}"f(" { // start of a inline formula
1094 yyextra->formulaText="";
1095 yyextra->formulaPreText="";
1096 yyextra->formulaPostText="";
1097 yyextra->formulaNewLines=0;
1098 BEGIN(ReadFormulaRound);
1099 }
1100<Comment>{B}*{CMD}"f[" { // start of a block formula
1101 setOutput(yyscanner,OutputDoc);
1102 yyextra->formulaText="";
1103 yyextra->formulaPreText="\\[";
1104 yyextra->formulaPostText="";
1105 yyextra->formulaNewLines=0;
1106 BEGIN(ReadFormulaLong);
1107 }
1108<Comment>{B}*{CMD}"{" { // begin of a group
1109 //yyextra->langParser->handleGroupStartCommand(yyextra->memberGroupHeader);
1110 yyextra->docGroup.open(yyextra->current,yyextra->fileName,yyextra->lineNr);
1111 }
1112<Comment>{B}*{CMD}"}" { // end of a group
1113 //yyextra->langParser->handleGroupEndCommand();
1114 yyextra->docGroup.close(yyextra->current,yyextra->fileName,yyextra->lineNr,true);
1115 yyextra->docGroup.clearHeader();
1116 yyextra->parseMore=true;
1117 yyextra->needNewEntry = true;
1118 yyextra->inputPosition=yyextra->prevPosition + (int)(yy_bp - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) + (int)strlen(yytext);
1119 yyterminate();
1120 }
1121<Comment>{B}*{CMD}[$@\\&~<>#%] { // escaped character
1122 addOutput(yyscanner,yytext);
1123 }
1124<Comment>[a-z_A-Z]+ { // normal word
1125 addOutput(yyscanner,yytext);
1126 }
1127<Comment>^{B}*"."{Bopt}/\n { // explicit end autolist: e.g " ."
1128 addOutput(yyscanner,yytext);
1129 }
1130<Comment>^{B}*[1-9][0-9]*"."{B}+ |
1131<Comment>^{B}*[*+]{B}+ { // start of autolist
1132 if (!yyextra->markdownSupport)
1133 {
1134 REJECT;
1135 }
1136 else
1137 {
1138 if (yyextra->inContext!=OutputXRef)
1139 {
1140 yyextra->briefEndsAtDot=false;
1141 setOutput(yyscanner,OutputDoc);
1142 }
1143 addOutput(yyscanner,yytext);
1144 }
1145 }
1146<Comment>^{B}*"-"{B}+ { // start of autolist
1147 if (yyextra->inContext!=OutputXRef)
1148 {
1149 yyextra->briefEndsAtDot=false;
1150 setOutput(yyscanner,OutputDoc);
1151 }
1152 addOutput(yyscanner,yytext);
1153 }
1154<Comment>^{B}*([\-:|]{B}*)*("--"|"---")({B}*[\-:|])*{Bopt}/\n { // horizontal line (dashed)
1155 addOutput(yyscanner,yytext);
1156 }
1157<Comment>{CMD}"---" { // escaped mdash
1158 addOutput(yyscanner,yytext);
1159 }
1160<Comment>{CMD}"--" { // escaped ndash
1161 addOutput(yyscanner,yytext);
1162 }
1163<Comment>"---" { // mdash
1164 addOutput(yyscanner,yyextra->insidePre || yyextra->markdownSupport ? yytext : "&mdash;");
1165 }
1166<Comment>"--" { // ndash
1167 addOutput(yyscanner,yyextra->insidePre || yyextra->markdownSupport ? yytext : "&ndash;");
1168 }
1169<Comment>"-#"{B}+ { // numbered item
1170 if (yyextra->inContext!=OutputXRef)
1171 {
1172 yyextra->briefEndsAtDot=false;
1173 setOutput(yyscanner,OutputDoc);
1174 }
1175 addOutput(yyscanner,yytext);
1176 }
1177<Comment>[?!][a-z_A-Z0-9\‍(\‍)=<] |
1178<Comment>("."+)[a-z_A-Z0-9\‍)] { // . at start or in the middle of a word, or ellipsis
1179 // ? or ! in middle of word or followed by equal sign or round bracket.
1180 addOutput(yyscanner,yytext);
1181 }
1182<Comment>{CMD}[\.?!] { // we have to be a bit careful with the special commands
1183 // \. \? and \! as they might otherwise terminate a brief description
1184 addOutput(yyscanner,yytext);
1185 }
1186<Comment>".\\"[ \t] { // . with escaped space.
1187 addOutput(yyscanner,yytext[0]);
1188 addOutput(yyscanner,yytext[2]);
1189 }
1190<Comment>"."[,:;] { // . with some puntuations such as "e.g.," or "e.g.:"
1191 addOutput(yyscanner,yytext);
1192 }
1193<Comment>"...\\"[ \t] { // ellipsis with escaped space.
1194 addOutput(yyscanner,"... ");
1195 }
1196<Comment>"..."/[^\.] { // ellipsis
1197 addOutput(yyscanner,"...");
1198 }
1199<Comment>".."[\.]?/[^ \t\n] { // internal ellipsis
1200 addOutput(yyscanner,yytext);
1201 }
1202<Comment>(\n|"\\ilinebr ")({B}*(\n|"\\ilinebr "))+ { // at least one blank line (or blank line command)
1203 if (yyextra->inContext==OutputXRef)
1204 {
1205 // see bug 613024, we need to put the newlines after ending the XRef section.
1206 if (!yyextra->insideParBlock) setOutput(yyscanner,OutputDoc);
1207 yy_size_t i;
1208 for (i=0;i<(yy_size_t)yyleng;)
1209 {
1210 if (yytext[i]=='\n') addOutput(yyscanner,'\n'),i++;
1211 else if (strncmp(yytext+i,"\\ilinebr ",9)==0) addOutput(yyscanner,"\\ilinebr "),i+=9;
1212 else i++;
1213 }
1214 }
1215 else if (yyextra->inContext!=OutputBrief)
1216 {
1217 yy_size_t i;
1218 for (i=0;i<(yy_size_t)yyleng;)
1219 {
1220 if (yytext[i]=='\n') addOutput(yyscanner,'\n'),i++;
1221 else if (strncmp(yytext+i,"\\ilinebr ",9)==0) addOutput(yyscanner,"\\ilinebr "),i+=9;
1222 else i++;
1223 }
1224 setOutput(yyscanner,OutputDoc);
1225 }
1226 else // yyextra->inContext==OutputBrief
1227 { // only go to the detailed description if we have
1228 // found some brief description and not just whitespace
1229 endBrief(yyscanner);
1230 }
1231 lineCount(yyscanner);
1232 }
1233<Comment>"."[?!] |
1234<Comment>[\.?!] { // potential end of a JavaDoc style comment
1235 addOutput(yyscanner,yytext);
1236 if (yyextra->briefEndsAtDot)
1237 {
1238 setOutput(yyscanner,OutputDoc);
1239 yyextra->briefEndsAtDot=false;
1240 }
1241 }
1242<Comment>{DOCNL} { // newline
1243 addOutput(yyscanner,yytext);
1244 if (*yytext == '\n') yyextra->lineNr++;
1245 }
1246<Comment>"<"[/]?{TABLEDEL}">" { // In case in xrefitem type some special handling is required
1247 if (yyextra->inContext==OutputXRef)
1248 {
1249 setOutput(yyscanner,OutputDoc);
1250 addOutput(yyscanner,yytext);
1251 }
1252 else
1253 {
1254 REJECT;
1255 }
1256 }
1257<Comment>. { // catch-all for anything else
1258 addOutput(yyscanner,*yytext);
1259 }
1260
1261
1262 /* -------------- Rules for handling HTML comments ----------- */
1263
1264<HtmlComment>"---"[!]?">"{B}* {
1265 warn(yyextra->fileName,yyextra->lineNr,
1266 "incorrect HTML end comment --->"
1267 );
1268 }
1269<HtmlComment>"--"[!]?">"{B}* { BEGIN( Comment ); }
1270<HtmlComment>{DOCNL} {
1271 if (*yytext=='\n')
1272 {
1273 yyextra->lineNr++;
1274 addOutput(yyscanner," \\iline "+DString().setNum(yyextra->lineNr)+" ");
1275 }
1276 }
1277<HtmlComment>[^\\\n\-]+ { // ignore unimportant characters
1278 }
1279<HtmlComment>. { // ignore every else
1280 }
1281
1282<CdataSection>"\‍]\‍]>" {
1283 BEGIN( Comment );
1284 }
1285<CdataSection>{DOCNL} {
1286 addOutput(yyscanner,'\n');
1287 if (*yytext=='\n') yyextra->lineNr++;
1288 }
1289<CdataSection>[<>&] { // the special XML characters for iwhich the CDATA section is especially used
1290 addOutput(yyscanner,'\\');
1291 addOutput(yyscanner,*yytext);
1292 }
1293<CdataSection>[^\\\n\‍]<>&]+ {
1294 addOutput(yyscanner,yytext);
1295 }
1296<CdataSection>. {
1297 addOutput(yyscanner,*yytext);
1298 }
1299
1300 /* -------------- Rules for handling formulas ---------------- */
1301
1302<ReadFormulaShort,ReadFormulaShortSection>{CMD}"f$" { // end of inline formula
1303 yyextra->formulaPostText+="$";
1304 DString form = addFormula(yyscanner);
1305 addOutput(yyscanner," "+form);
1306 if (YY_START == ReadFormulaShort)
1307 {
1308 BEGIN(Comment);
1309 }
1310 else
1311 {
1312 yyextra->sectionTitle+= " "+form;
1313 BEGIN(SectionTitle);
1314 }
1315 }
static DString addFormula(yyscan_t yyscanner)
1316<ReadFormulaRound,ReadFormulaRoundSection>{CMD}"f)" { // end of inline formula
1317 DString form = addFormula(yyscanner);
1318 addOutput(yyscanner," "+form);
1319 if (YY_START == ReadFormulaRound)
1320 {
1321 BEGIN(Comment);
1322 }
1323 else
1324 {
1325 yyextra->sectionTitle+= " "+form;
1326 BEGIN(SectionTitle);
1327 }
1328 }
1329<ReadFormulaLong>{CMD}"f]" { // end of block formula
1330 yyextra->formulaPostText+="\\]";
1331 addOutput(yyscanner," "+addFormula(yyscanner));
1332 BEGIN(Comment);
1333 }
1334<ReadFormulaLong>{CMD}"f}" { // end of custom env formula
1335 yyextra->formulaPostText+="\\end";
1336 yyextra->formulaPostText+=yyextra->formulaEnv;
1337 addOutput(yyscanner," "+addFormula(yyscanner));
1338 BEGIN(Comment);
1339 }
1340<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>[^\\@\n]+ { // any non-special character
1341 yyextra->formulaText+=yytext;
1342 }
1343<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>\n { // new line
1344 yyextra->formulaNewLines++;
1345 yyextra->formulaText+=*yytext;
1346 yyextra->lineNr++;
1347 addIline(yyscanner,yyextra->lineNr);
1348 }
1349<ReadFormulaLong,ReadFormulaShort,ReadFormulaShortSection,ReadFormulaRound,ReadFormulaRoundSection>. { // any other character
1350 yyextra->formulaText+=*yytext;
1351 }
1352
1353 /* ------------ handle argument of enum command --------------- */
1354
1355<EnumDocArg1>{SCOPEID} { // handle argument
1356 makeStructuralIndicator(yyscanner,yyextra->currentMakeEntryType);
1357 yyextra->current->name = yytext;
1358 BEGIN( Comment );
1359 }
1360<EnumDocArg1>{LC} { // line continuation
1361 yyextra->lineNr++;
1362 addOutput(yyscanner,'\n');
1363 }
1364<EnumDocArg1>{DOCNL} { // missing argument
1365 warn(yyextra->fileName,yyextra->lineNr,
1366 "missing argument after '\\enum'."
1367 );
1368 unput_string(yytext,yyleng);
1369 BEGIN( Comment );
1370 }
#define unput_string(yytext, yyleng)
1371<EnumDocArg1>. { // ignore other stuff
1372 }
1373
1374 /* ------------ handle argument of namespace command --------------- */
1375
1376<NameSpaceDocArg1>{SCOPENAME} { // handle argument
1377 makeStructuralIndicator(yyscanner,yyextra->currentMakeEntryType);
1378 lineCount(yyscanner);
1379 yyextra->current->name = substitute(removeRedundantWhiteSpace(yytext),".","::");
1380 BEGIN( Comment );
1381 }
DString removeRedundantWhiteSpace(const DString &s)
Definition util.cpp:427
1382<NameSpaceDocArg1>{LC} { // line continuation
1383 yyextra->lineNr++;
1384 addOutput(yyscanner,'\n');
1385 }
1386<NameSpaceDocArg1>{DOCNL} { // missing argument
1387 warn(yyextra->fileName,yyextra->lineNr,
1388 "missing argument after '\\namespace'."
1389 );
1390 unput_string(yytext,yyleng);
1391 BEGIN( Comment );
1392 }
1393<NameSpaceDocArg1>. { // ignore other stuff
1394 }
1395
1396 /* ------------ handle argument of package command --------------- */
1397
1398<PackageDocArg1>{ID}("."{ID})* { // handle argument
1399 yyextra->current->name = yytext;
1400 BEGIN( Comment );
1401 }
1402<PackageDocArg1>{LC} { // line continuation
1403 yyextra->lineNr++;
1404 addOutput(yyscanner,'\n');
1405 }
1406<PackageDocArg1>{DOCNL} { // missing argument
1407 warn(yyextra->fileName,yyextra->lineNr,
1408 "missing argument after \\package."
1409 );
1410 unput_string(yytext,yyleng);
1411 //addOutput(yyscanner,'\n');
1412 //if (*yytext=='\n') yyextra->lineNr++;
1413 BEGIN( Comment );
1414 }
1415<PackageDocArg1>. { // ignore other stuff
1416 }
1417
1418 /* ------------ handle argument of concept command --------------- */
1419
1420<ConceptDocArg1>{SCOPEID} { // handle argument
1421 makeStructuralIndicator(yyscanner,yyextra->currentMakeEntryType);
1422 yyextra->current->name = yytext;
1423 BEGIN( Comment );
1424 }
1425<ConceptDocArg1>{LC} { // line continuation
1426 yyextra->lineNr++;
1427 addOutput(yyscanner,'\n');
1428 }
1429<ConceptDocArg1>{DOCNL} { // missing argument
1430 warn(yyextra->fileName,yyextra->lineNr,
1431 "missing argument after '\\concept'."
1432 );
1433 unput_string(yytext,yyleng);
1434 BEGIN( Comment );
1435 }
1436<ConceptDocArg1>. { // ignore other stuff
1437 }
1438
1439 /* ------------ handle argument of module command --------------- */
1440<ModuleDocArg1>{MODULE_ID} { // handle argument
1441 makeStructuralIndicator(yyscanner,yyextra->currentMakeEntryType);
1442 yyextra->current->name = yytext;
1443 BEGIN( Comment );
1444 }
1445<ModuleDocArg1>{LC} { // line continuation
1446 yyextra->lineNr++;
1447 addOutput(yyscanner,'\n');
1448 }
1449<ModuleDocArg1>{DOCNL} { // missing argument
1450 warn(yyextra->fileName,yyextra->lineNr,
1451 "missing argument after '\\module'."
1452 );
1453 unput_string(yytext,yyleng);
1454 BEGIN( Comment );
1455 }
1456<ModuleDocArg1>. { // ignore other stuff
1457 }
1458
1459 /* ------ handle argument of class/struct/union command --------------- */
1460
1461<ClassDocArg1>{SCOPENAME}{TMPLSPEC} {
1462 makeStructuralIndicator(yyscanner,yyextra->currentMakeEntryType);
1463 lineCount(yyscanner);
1464 yyextra->current->name = substitute(removeRedundantWhiteSpace(yytext),".","::");
1465 BEGIN( ClassDocArg2 );
1466 }
1467<ClassDocArg1>{SCOPENAME} { // first argument
1468 makeStructuralIndicator(yyscanner,yyextra->currentMakeEntryType);
1469 lineCount(yyscanner);
1470 yyextra->current->name = substitute(yytext,".","::");
1471 if (yyextra->current->section.isProtocolDoc())
1472 {
1473 yyextra->current->name+="-p";
1474 }
1475 // prepend outer scope name
1476 BEGIN( ClassDocArg2 );
1477 }
1478<CategoryDocArg1>{SCOPENAME}{B}*"("[^\‍)]+")" {
1479 makeStructuralIndicator(yyscanner,yyextra->currentMakeEntryType);
1480 lineCount(yyscanner);
1481 yyextra->current->name = substitute(yytext,".","::");
1482 BEGIN( ClassDocArg2 );
1483 }
1484<ClassDocArg1,CategoryDocArg1>{LC} { // line continuation
1485 yyextra->lineNr++;
1486 addOutput(yyscanner,'\n');
1487 }
1488<ClassDocArg1,CategoryDocArg1>{DOCNL} {
1489 warn(yyextra->fileName,yyextra->lineNr,
1490 "missing argument after '\\{}'.",yyextra->currentCmd
1491 );
1492 unput_string(yytext,yyleng);
1493 BEGIN( Comment );
1494 }
1495<ClassDocArg1,CategoryDocArg1>. { // ignore other stuff
1496 }
1497
1498<ClassDocArg2>{DOCNL} {
1499 unput_string(yytext,yyleng);
1500 BEGIN( Comment );
1501 }
1502<ClassDocArg2>{FILE}|"<>" { // second argument; include file
1503 yyextra->current->includeFile = yytext;
1504 BEGIN( ClassDocArg3 );
1505 }
1506<ClassDocArg2>{LC} { // line continuation
1507 yyextra->lineNr++;
1508 addOutput(yyscanner,'\n');
1509 }
1510<ClassDocArg2>. { // ignore other stuff
1511 }
1512
1513<ClassDocArg3>[<"]?{FILE}?[">]? { // third argument; include file name
1514 yyextra->current->includeName = yytext;
1515 BEGIN( Comment );
1516 }
1517<ClassDocArg3>{LC} { // line continuation
1518 yyextra->lineNr++;
1519 addOutput(yyscanner,'\n');
1520 }
1521<ClassDocArg3>{DOCNL} {
1522 //if (*yytext=='\n') yyextra->lineNr++;
1523 if (yyextra->current->includeFile!="<>")
1524 {
1525 yyextra->current->includeName = yyextra->current->includeFile;
1526 }
1527 unput_string(yytext,yyleng);
1528 BEGIN( Comment );
1529 }
1530<ClassDocArg3>. { // ignore other stuff
1531 }
1532
1533 /* --------- handle arguments of {def,add,weak}group commands --------- */
1534
1535<GroupDocArg1>{LABELID}(".html"|".xhtml")? { // group name
1536 yyextra->current->name = yytext;
1537 //lastDefGroup.groupname = yytext;
1538 //lastDefGroup.pri = yyextra->current->groupingPri();
1539 // the .html stuff is for Qt compatibility
1540 if (yyextra->current->name.endsWith(".html"))
1541 {
1542 yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-5);
1543 }
1544 else if (yyextra->current->name.endsWith(".xhtml"))
1545 {
1546 yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-6);
1547 }
1548 yyextra->current->type.clear();
1549 BEGIN(GroupDocArg2);
1550 }
1551<GroupDocArg1>"\\"{B}*"\n" { // line continuation
1552 yyextra->lineNr++;
1553 addOutput(yyscanner,'\n');
1554 }
1555<GroupDocArg1>{DOCNL} { // missing argument!
1556 warn(yyextra->fileName,yyextra->lineNr,
1557 "missing group name after {}",
1558 yyextra->current->groupDocCmd()
1559 );
1560 //addOutput(yyscanner,'\n');
1561 //if (*yytext=='\n') yyextra->lineNr++;
1562 unput_string(yytext,yyleng);
1563 BEGIN( Comment );
1564 }
1565<GroupDocArg1>. { // ignore other stuff
1566 }
1567<GroupDocArg2>"\\"{B}*"\n" { // line continuation
1568 yyextra->lineNr++;
1569 addOutput(yyscanner,'\n');
1570 }
1571<GroupDocArg2>[^\n\\‍]+ { // title (stored in type)
1572 yyextra->current->type += yytext;
1573 }
1574<GroupDocArg2>{DOCNL}+ {
1575 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
1576 if ( yyextra->current->groupDocType==Entry::GROUPDOC_NORMAL &&
1577 yyextra->current->type.empty()
1578 ) // defgroup requires second argument
1579 {
1580 warn(yyextra->fileName,yyextra->lineNr,
1581 "missing title after "
1582 "\\defgroup {}", yyextra->current->name
1583 );
1584 }
1585 unput_string(yytext,yyleng);
1586 int extraLineNr = 0;
1587 if (yyextra->inContext == OutputBrief)
1588 {
1589 for (int i = 0; i < yyleng; i++)
1590 {
1591 if (yytext[i]=='\n') extraLineNr++;
1592 }
1593 }
1594 //if (*yytext=='\n') yyextra->lineNr++;
1595 //addOutput(yyscanner,'\n');
1596 if ( yyextra->current->groupDocType!=Entry::GROUPDOC_NORMAL)
1597 {
1598 addOutput(yyscanner," \\ifile \""+ yyextra->fileName);
1599 addOutput(yyscanner,"\" \\iline " + DString().setNum(yyextra->lineNr + extraLineNr) + " \\ilinebr ");
1600 }
1601 BEGIN( Comment );
1602 }
1603<GroupDocArg2>. { // title (stored in type)
1604 yyextra->current->type += yytext;
1605 }
1606
1607 /* --------- handle arguments of page/mainpage command ------------------- */
1608
1609<PageDocArg1>[^\n]*"\\ilinebr @ianchor"\{[^\‍]\n]*\}{B}{FILE} { // special case where the Markdown processor has rewritten
1610 // "@page label Title" as
1611 // "@page md_label Title\ilinebr @ianchor{Title} label"
1612 DString text = yytext;
1613 size_t start = text.find('{');
1614 size_t end = text.find('}',start+1);
1615 yyextra->current->name = text.mid(end+2);
1616 size_t istart = yyextra->current->name.find("\\ilinebr");
1617 if (istart != DString::npos)
1618 {
1619 DString rest = yyextra->current->name.mid(istart);
1620 unput_string(rest,rest.length());
1621 yyextra->current->name = yyextra->current->name.left(istart);
1622 }
1623 yyextra->current->args = text.mid(start+1,end-start-1);
1624 //printf("name='%s' title='%s'\n",qPrint(yyextra->current->name),qPrint(yyextra->current->args));
1625 BEGIN( PageDocArg2 );
1626 }
DirIterator end(const DirIterator &) noexcept
Definition dir.cpp:180
1627<PageDocArg1>{FILE} { // first argument; page name
1628 yyextra->current->name = stripQuotes(yytext);
1629 yyextra->current->args = "";
1630 BEGIN( PageDocArg2 );
1631 }
static DString stripQuotes(const char *s)
1632<PageDocArg1>{LC} { yyextra->lineNr++;
1633 addOutput(yyscanner,'\n');
1634 }
1635<PageDocArg1>{DOCNL} {
1636 warn(yyextra->fileName,yyextra->lineNr,
1637 "missing argument after \\page."
1638 );
1639 unput_string(yytext,yyleng);
1640 //if (*yytext=='\n') yyextra->lineNr++;
1641 //addOutput(yyscanner,'\n');
1642 BEGIN( Comment );
1643 }
1644<PageDocArg1>. { // ignore other stuff
1645 }
1646<PageDocArg2>{DOCNL} { // second argument; page title
1647 unput_string(yytext,yyleng);
1648 //if (*yytext=='\n') yyextra->lineNr++;
1649 //addOutput(yyscanner,'\n');
1650 addOutput(yyscanner," \\ifile \""+ yyextra->fileName);
1651 addOutput(yyscanner,"\" \\iline " + DString().setNum(yyextra->lineNr) + " \\ilinebr ");
1652 BEGIN( Comment );
1653 }
1654<PageDocArg2>{CMD}[<>] {
1655 // bug 748927
1656 DString tmp(yytext);
1657 tmp = substitute(substitute(tmp,"@<","&lt;"),"@>","&gt;");
1658 tmp = substitute(substitute(tmp,"\\<","&lt;"),"\\>","&gt;");
1659 yyextra->current->args += tmp;
1660 }
1661<PageDocArg2>. {
1662 yyextra->current->args += yytext;
1663 }
1664 /* --------- handle the argument of the field command ------------ */
1665<FieldArg>{ID} {
1666 yyextra->current->fieldDocs.push_back({yytext,{},yyextra->fileName,yyextra->lineNr});
1667 setOutput(yyscanner,OutputField);
1668 BEGIN(Comment);
1669 }
1670<FieldArg>{DOCNL}|. {
1671 warn_doc_error(yyextra->fileName,yyextra->lineNr,"expected a field name after \\field");
1672 unput_string(yytext,yyleng);
1673 BEGIN(Comment);
1674 }
#define warn_doc_error(file, line, fmt,...)
Definition message.h:112
1675
1676 /* --------- handle arguments of the param command ------------ */
1677<ParamArg1>{ID}/{B}*"," {
1678 addOutput(yyscanner,yytext);
1679 }
1680<ParamArg1>"," {
1681 addOutput(yyscanner," , ");
1682 }
1683<ParamArg1>{DOCNL} {
1684 if (*yytext=='\n') yyextra->lineNr++;
1685 addOutput(yyscanner," ");
1686 }
1687<ParamArg1>{ID} {
1688 addOutput(yyscanner,yytext);
1689 BEGIN( Comment );
1690 }
1691<ParamArg1>. {
1692 unput(yytext[0]);
1693 BEGIN( Comment );
1694 }
1695
1696 /* --------- handle arguments of the file/dir/example command ------------ */
1697
1698<FileDocArg1>{DOCNL} { // no file name specified
1699 unput_string(yytext,yyleng);
1700 //if (*yytext=='\n') yyextra->lineNr++;
1701 //addOutput(yyscanner,'\n');
1702 BEGIN( Comment );
1703 }
1704<FileDocArg1>{FILE} { // first argument; name
1705 yyextra->current->name = stripQuotes(yytext);
1706 BEGIN( Comment );
1707 }
1708<FileDocArg1>{LC} { yyextra->lineNr++;
1709 addOutput(yyscanner,'\n');
1710 }
1711<FileDocArg1>. { // ignore other stuff
1712 }
1713
1714 /* --------- handle arguments of the xrefitem command ------------ */
1715
1716<XRefItemParam1>{LABELID} { // first argument
1717 yyextra->newXRefItemKey=yytext;
1718 setOutput(yyscanner,OutputXRef);
1719 BEGIN(XRefItemParam2);
1720 }
1721<XRefItemParam1>{LC} { // line continuation
1722 yyextra->lineNr++;
1723 addOutput(yyscanner,'\n');
1724 }
1725<XRefItemParam1>{DOCNL} { // missing arguments
1726 warn(yyextra->fileName,yyextra->lineNr,
1727 "Missing first argument of \\xrefitem"
1728 );
1729 if (*yytext=='\n') yyextra->lineNr++;
1730 addOutput(yyscanner,'\n');
1731 yyextra->inContext = OutputDoc;
1732 BEGIN( Comment );
1733 }
1734<XRefItemParam1>. { // ignore other stuff
1735 }
1736
1737<XRefItemParam2>"\""[^\n\"]*"\"" { // second argument
1738 yyextra->xrefItemTitle = stripQuotes(yytext);
1739 BEGIN(XRefItemParam3);
1740 }
1741<XRefItemParam2>{LC} { // line continuation
1742 yyextra->lineNr++;
1743 addOutput(yyscanner,'\n');
1744 }
1745<XRefItemParam2>{DOCNL} { // missing argument
1746 warn(yyextra->fileName,yyextra->lineNr,
1747 "Missing second argument of \\xrefitem"
1748 );
1749 if (*yytext=='\n') yyextra->lineNr++;
1750 addOutput(yyscanner,'\n');
1751 yyextra->inContext = OutputDoc;
1752 BEGIN( Comment );
1753 }
1754<XRefItemParam2>. { // ignore other stuff
1755 }
1756
1757<XRefItemParam3>"\""[^\n\"]*"\"" { // third argument
1758 yyextra->xrefListTitle = stripQuotes(yytext);
1759 yyextra->xrefKind = XRef_Item;
1760 BEGIN( Comment );
1761 }
1762<XRefItemParam2,XRefItemParam3>{LC} { // line continuation
1763 yyextra->lineNr++;
1764 addOutput(yyscanner,'\n');
1765 }
1766<XRefItemParam3>{DOCNL} { // missing argument
1767 warn(yyextra->fileName,yyextra->lineNr,
1768 "Missing third argument of \\xrefitem"
1769 );
1770 if (*yytext=='\n') yyextra->lineNr++;
1771 addOutput(yyscanner,'\n');
1772 yyextra->inContext = OutputDoc;
1773 BEGIN( Comment );
1774 }
1775<XRefItemParam3>. { // ignore other stuff
1776 }
1777
1778
1779 /* ----- handle arguments of the relates(also)/memberof command ------- */
1780
1781<RelatesParam1>({ID}("::"|"."))*{ID} { // argument
1782 yyextra->current->relates = yytext;
1783 //if (yyextra->current->mGrpId!=DOX_NOGROUP)
1784 //{
1785 // memberGroupRelates = yytext;
1786 //}
1787 BEGIN( Comment );
1788 }
1789<RelatesParam1>{LC} { // line continuation
1790 yyextra->lineNr++;
1791 addOutput(yyscanner,'\n');
1792 }
1793<RelatesParam1>{DOCNL} { // missing argument
1794 warn(yyextra->fileName,yyextra->lineNr,
1795 "Missing argument of '\\{}' command",yyextra->currentCmd
1796 );
1797 unput_string(yytext,yyleng);
1798 //if (*yytext=='\n') yyextra->lineNr++;
1799 //addOutput(yyscanner,'\n');
1800 BEGIN( Comment );
1801 }
1802<RelatesParam1>. { // ignore other stuff
1803 }
1804
1805
1806 /* ----- handle arguments of the qualifier command ----- */
1807<Qualifier>{LABELID} { // unquoted version, simple label
1808 yyextra->current->qualifiers.emplace_back(yytext);
1809 BEGIN( Comment );
1810 }
1811<Qualifier>"\""[^\"]*"\"" { // quotes version, add without quotes
1812 std::string inp(yytext);
1813 yyextra->current->qualifiers.push_back(inp.substr(1,yyleng-2));
1814 BEGIN( Comment );
1815 }
1816<Qualifier>{DOCNL} { // missing argument
1817 warn(yyextra->fileName,yyextra->lineNr,
1818 "Missing argument of '\\{}' command",yyextra->currentCmd
1819 );
1820 unput_string(yytext,yyleng);
1821 BEGIN( Comment );
1822 }
1823<Qualifier>. {
1824 warn(yyextra->fileName,yyextra->lineNr,
1825 "Argument of '\\{}' command should be quoted",yyextra->currentCmd
1826 );
1827 unput_string(yytext,yyleng);
1828 BEGIN( Comment );
1829 }
1830 /* ----- handle arguments of the iline command ----- */
1831<ILine>{LINENR}/[\\@\n\.] |
1832<ILine>{LINENR}{B} {
1833 bool ok = false;
1834 int nr = DString(yytext).toInt(&ok);
1835 if (!ok)
1836 {
1837 warn(yyextra->fileName,yyextra->lineNr,"Invalid line number '{}' for iline command",yytext);
1838 }
1839 else
1840 {
1841 yyextra->lineNr = nr;
1842 }
1843 addOutput(yyscanner,yytext);
1844 if (YY_START == ILine)
1845 {
1846 BEGIN(Comment);
1847 }
1848 else
1849 {
1850 yyextra->sectionTitle+=yytext;
1851 BEGIN(SectionTitle);
1852 }
1853 }
int toInt(bool *ok=nullptr, int base=10) const
Definition dstring.cpp:191
1854<ILine,ILineSection>. {
1855 addOutput(yyscanner,yytext);
1856 if (YY_START == ILine)
1857 {
1858 BEGIN(Comment);
1859 }
1860 else
1861 {
1862 yyextra->sectionTitle+=yytext;
1863 BEGIN(SectionTitle);
1864 }
1865 }
1866
1867 /* ----- handle arguments of the iraise command ----- */
1868<IRaise>{B}*[0-9]+/[\\@\n\.] |
1869<IRaise>{B}*[0-9]+{B} {
1870 bool ok = false;
1871 int nr = DString(yytext).toInt(&ok);
1872 if (!ok)
1873 {
1874 warn(yyextra->fileName,yyextra->lineNr,"Invalid level '{}' for iraise command",yytext);
1875 }
1876 else
1877 {
1878 yyextra->raiseLevel = nr;
1879 }
1880 BEGIN(Comment);
1881 }
1882<IRaise>. {
1883 unput(yytext[0]);
1884 BEGIN(Comment);
1885 }
1886 /* ----- handle arguments of the iprefix command ----- */
1887
1888<IRaisePrefix>{B}*"\""({LABELID})?"\"" {
1889 DString text(yytext);
1890 yyextra->raisePrefix = text.stripWhiteSpace().mid(1,text.length()-2);
1891 addOutput(yyscanner,yytext);
1892 BEGIN(Comment);
1893 }
1894<IRaisePrefix>. {
1895 unput(yytext[0]);
1896 BEGIN(Comment);
1897 }
1898
1899
1900 /* ----- handle arguments of the ifile command ----- */
1901
1902<IFile,IFileSection>{FILE} {
1903 addOutput(yyscanner,yytext);
1904 DString text(yytext);
1905 if (yytext[0] == '\"') yyextra->fileName = text.mid(1,text.length()-2);
1906 else yyextra->fileName = yytext;
1907 if (YY_START == IFile)
1908 {
1909 BEGIN(Comment);
1910 }
1911 else
1912 {
1913 yyextra->sectionTitle+=yytext;
1914 BEGIN(SectionTitle);
1915 }
1916 }
1917
1918<LinkSection>[^\\@\n]* {
1919 yyextra->sectionTitle+=yytext;
1920 }
1921<LinkSection>{CMD}{CMD} {
1922 yyextra->sectionTitle+=yytext;
1923 }
1924<LinkSection>{DOCNL} {
1925 addOutput(yyscanner,yytext);
1926 if (*yytext == '\n') yyextra->lineNr++;
1927 yyextra->sectionTitle+=yytext;
1928 }
1929<LinkSection>{CMD}"endlink" {
1930 yyextra->sectionTitle+=yytext;
1931 BEGIN(SectionTitle);
1932 }
1933<LinkSection>. {
1934 yyextra->sectionTitle+=yytext;
1935 }
1936<LinkSection><<EOF>> {
1937 warn(yyextra->fileName,yyextra->lineNr,
1938 "reached end of comment while inside a '\\link' command, missing '\\endlink' command"
1939 );
1940 yyterminate();
1941 }
1942 /* ----- handle arguments of the relates(also)/addindex commands ----- */
1943
1944<LineParam>{CMD}{CMD} { // escaped command
1945 addOutput(yyscanner,yytext);
1946 }
1947<LineParam>{DOCNL} { // end of argument
1948 //if (*yytext=='\n') yyextra->lineNr++;
1949 //addOutput(yyscanner,'\n');
1950 unput_string(yytext,yyleng);
1951 BEGIN( Comment );
1952 }
1953<LineParam>{LC} { // line continuation
1954 yyextra->lineNr++;
1955 addOutput(yyscanner,'\n');
1956 }
1957<LineParam>({CMD}{CMD}){ID} { // escaped command
1958 addOutput(yyscanner,yytext);
1959 }
1960<LineParam>. { // ignore other stuff
1961 addOutput(yyscanner,*yytext);
1962 }
1963
1964 /* ----- handle arguments of the section/subsection/.. commands ------- */
1965
1966<SectionLabel>{LABELID} {
1967 yyextra->sectionLabel+=yytext;
1968 }
1969<SectionLabel>{CMD}"lineinfo"("{}")? {
1970 yyextra->sectionLabel += DString().setNum(yyextra->lineNr);
1971 }
1972<SectionLabel>{CMD}"fileinfo"("{"[^}]*"}")? {
1973 FileInfo fi(yyextra->fileName.str());
1974 bool hasOption = false;
1975 DString label;
1976 if (yytext[yyleng-1] == '}') // has parameters
1977 {
1978 StringVector optList;
1979 DString txt = yytext;
1980 DString optStr = txt.mid(10,yyleng-11).stripWhiteSpace();
1981 optList = split(optStr.str(),",");
1982 for (const auto &opt_ : optList)
1983 {
1984 DString optStripped = DString(opt_).stripWhiteSpace();
1985 std::string opt = optStripped.lower().str();
1986 DString result = fileInfoLookup(fi,opt);
1987 if (!result.empty())
1988 {
1989 if (hasOption) // oops: already found an option
1990 {
1991 warn(yyextra->fileName,yyextra->lineNr,"Multiple options specified with \\fileinfo, discarding '{}'", optStripped);
1992 }
1993 else
1994 {
1995 label = result;
1996 }
1997 hasOption = true;
1998 }
1999 else
2000 {
2001 warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\fileinfo: '{}'", optStripped);
2002 }
2003 }
2004 }
2005 if (!hasOption)
2006 {
2007 if (Config_getBool(FULL_PATH_NAMES))
2008 {
2009 label=stripFromPath(yyextra->fileName);
2010 }
2011 else
2012 {
2013 label=yyextra->fileName;
2014 }
2015 }
2016 escapeLabel(label);
2017 yyextra->sectionLabel+=label;
2018 }
static void escapeLabel(DString &label)
2019<SectionLabel>{DOCNL} {
2020 yyextra->sectionTitle.clear();
2021 if (yyextra->sectionLabel.empty())
2022 { // missing argument
2023 warn(yyextra->fileName,yyextra->lineNr,
2024 "\\section command has no label"
2025 );
2026 }
2027 else
2028 {
2029 yyextra->sectionLabel=yyextra->raisePrefix+yyextra->sectionLabel;
2030 addOutput(yyscanner,yyextra->sectionLabel.data());
2031 addSection(yyscanner);
2032 }
2033 if (*yytext=='\n') yyextra->lineNr++;
2034 addOutput(yyscanner,'\n');
2035 BEGIN( Comment );
2036 }
static void addSection(yyscan_t yyscanner, bool addYYtext=true)
2037<SectionLabel>. { // invalid character for section label
2038 if (yyextra->sectionLabel.empty())
2039 {
2040 warn(yyextra->fileName,yyextra->lineNr,
2041 "Invalid or missing section label"
2042 );
2043 BEGIN(Comment);
2044 }
2045 else
2046 {
2047 yyextra->sectionLabel=yyextra->raisePrefix+yyextra->sectionLabel;
2048 addOutput(yyscanner,yyextra->sectionLabel.data());
2049 yyextra->sectionTitle.clear();
2050 unput_string(yytext,yyleng);
2051 BEGIN(SectionTitle);
2052 }
2053 }
2054<SectionTitle>{STAopt}/"\n" { // end of section title
2055 addSection(yyscanner);
2056 addOutput(yyscanner,yytext);
2057 BEGIN( Comment );
2058 }
2059<SectionTitle>{STopt}"\\\\ilinebr" { // escaped end of section title
2060 yyextra->sectionTitle+=substitute(yytext,"#","@#");
2061 }
2062<SectionTitle>{STopt}/"\\ilinebr" { // end of section title
2063 addSection(yyscanner);
2064 addOutput(yyscanner,yytext);
2065 BEGIN( Comment );
2066 }
2067<SectionTitle>{B}*{CMD}"f$" {
2068 yyextra->formulaText="";
2069 yyextra->formulaPreText="$";
2070 yyextra->formulaPostText="";
2071 yyextra->formulaNewLines=0;
2072 BEGIN(ReadFormulaShortSection);
2073 }
2074<SectionTitle>{B}*{CMD}"f(" { // start of a inline formula
2075 yyextra->formulaText="";
2076 yyextra->formulaPreText="";
2077 yyextra->formulaPostText="";
2078 yyextra->formulaNewLines=0;
2079 BEGIN(ReadFormulaRoundSection);
2080 }
2081<SectionTitle>{B}*{CMD}"~"[a-z_A-Z-]* | // language switch command
2082<SectionTitle>{B}*{CMD}"f"[\‍[{] { // block formula
2083 setOutput(yyscanner,OutputDoc);
2084 addOutput(yyscanner," \\ilinebr ");
2085 addSection(yyscanner,false);
2086 warn(yyextra->fileName,yyextra->lineNr,
2087 "'\\{}' command is not allowed in section title, ending section title.",
2088 DString(yytext).stripWhiteSpace()
2089 );
2090 unput_string(yytext,yyleng);
2091 BEGIN(Comment);
2092 }
2093<SectionTitle>{LC} { // line continuation
2094 yyextra->lineNr++;
2095 addOutput(yyscanner,'\n');
2096 }
2097<SectionTitle>[^\n@\\‍]* { // any character without special meaning
2098 yyextra->sectionTitle+=substitute(yytext,"#","@#");
2099 addOutput(yyscanner,yytext);
2100 }
2101<SectionTitle>{B}*{CMD}{CMD} {
2102 yyextra->sectionTitle+=yytext;
2103 addOutput(yyscanner,yytext);
2104 }
2105<SectionTitle>{CMD}# { // escaped hash
2106 yyextra->sectionTitle+=yytext;
2107 addOutput(yyscanner,*yytext);
2108 }
2109<SectionTitle>{B}*{CMD}[a-z_A-Z]+"{"[^}]*"}"{B}* |
2110<SectionTitle>{B}*{CMD}[a-z_A-Z]+{B}* { // handling command in section title
2111 DString fullMatch = yytext;
2112 size_t idx = fullMatch.find('{');
2113 /* handle `f{` command as special case */
2114 if ((idx != DString::npos) && (idx > 1) && (yytext[idx-1] == 'f') && (yytext[idx-2] == '\\' || yytext[idx-2] =='@')) REJECT;
2115 size_t idxEnd = DString::npos;
2116 if (idx != DString::npos) idxEnd = fullMatch.find("}",idx+1);
2117 DString cmdName;
2118 StringVector optList;
2119 if (idx == DString::npos) // no options
2120 {
2121 cmdName = fullMatch.stripWhiteSpace().mid(1); // to remove {CMD}
2122 }
2123 else // options present
2124 {
2125 cmdName = fullMatch.left(idx).stripWhiteSpace().mid(1); // to remove {CMD}
2126 DString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace();
2127 optList = split(optStr.str(),",");
2128 }
2129 auto it = docCmdMap.find(cmdName.str());
2130 if (it!=docCmdMap.end()) // special action is required
2131 {
2132 switch (it->second.sectionHandling)
2133 {
2135 {
2136 int i=0;
2137 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2138 yyextra->sectionTitle+=fullMatch.left(i);
2139 yyextra->sectionTitle+='@';
2140 yyextra->sectionTitle+=fullMatch.mid(i);
2141 addOutput(yyscanner,qPrint(fullMatch.left(i)));
2142 addOutput(yyscanner,'@');
2143 addOutput(yyscanner,qPrint(fullMatch.mid(i)));
2144 warn(yyextra->fileName,yyextra->lineNr,
2145 "'\\{}' command is not allowed in section title, escaping command.",cmdName
2146 );
2147 }
2148 break;
2150 {
2151 addSection(yyscanner,false);
2152 addOutput(yyscanner," \\ilinebr ");
2153 warn(yyextra->fileName,yyextra->lineNr,
2154 "'\\{}' command is not allowed in section title, ending section title.",cmdName
2155 );
2156 unput_string(yytext,yyleng);
2157 BEGIN(Comment);
2158 }
2159 break;
2161 {
2162 if (cmdName == "fileinfo")
2163 {
2164 int i=0;
2165 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2166 yyextra->sectionTitle+=fullMatch.left(i);
2167 addOutput(yyscanner,fullMatch.left(i));
2168 handleFileInfoSection(yyscanner,cmdName,optList);
2169 }
2170 else if (cmdName == "lineinfo")
2171 {
2172 int i=0;
2173 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2174 yyextra->sectionTitle+=fullMatch.left(i);
2175 yyextra->sectionTitle+=DString().setNum(yyextra->lineNr);
2176 addOutput(yyscanner,fullMatch.left(i));
2177 addOutput(yyscanner,DString().setNum(yyextra->lineNr));
2178 }
2179 else if (cmdName == "raisewarning")
2180 {
2181 yyextra->raiseWarning = "";
2182 BEGIN(RaiseWarningSection);
2183 }
2184 else if (cmdName == "noop")
2185 {
2186 addSection(yyscanner,false);
2187 BEGIN(Noop);
2188 }
2189 else if (cmdName == "cite")
2190 {
2191 yyextra->sectionTitle+=yytext;
2192 addOutput(yyscanner,yytext);
2193 BEGIN(CiteLabelSection);
2194 }
2195 else if (cmdName == "iline")
2196 {
2197 yyextra->sectionTitle+=yytext;
2198 addOutput(yyscanner,yytext);
2199 BEGIN(ILineSection);
2200 }
2201 else if (cmdName == "ifile")
2202 {
2203 yyextra->sectionTitle+=yytext;
2204 addOutput(yyscanner,yytext);
2205 BEGIN(IFileSection);
2206 }
2207 else if ((cmdName == "anchor") || (cmdName == "ianchor"))
2208 {
2209 addOutput(yyscanner,"@"+cmdName);
2210 if (optList.empty())
2211 {
2212 yyextra -> anchorTitle = "";
2213 }
2214 else
2215 {
2216 addOutput(yyscanner,"{"+join(optList," ")+"}");
2217 yyextra -> anchorTitle = join(optList," ");
2218 }
2219 addOutput(yyscanner," ");
2220 BEGIN(AnchorLabelSection);
2221 }
2222 else if (cmdName == "link")
2223 {
2224 yyextra->sectionTitle+=yytext;
2225 BEGIN(LinkSection);
2226 }
2227 else
2228 {
2229 yyextra->sectionTitle+=yytext;
2230 warn(yyextra->fileName,yyextra->lineNr,
2231 "internal error '\\{}' command is to be replaced in section title.",cmdName
2232 );
2233 }
2234 }
2235 break;
2237 {
2238 yyextra->sectionTitle+=yytext;
2239 addOutput(yyscanner,yytext);
2240 }
2241 break;
2242 }
2243 }
2244 else
2245 {
2246 yyextra->sectionTitle+=yytext;
2247 addOutput(yyscanner,yytext);
2248 }
2249 }
static bool handleFileInfoSection(yyscan_t yyscanner, const DString &cmdName, const StringVector &optList)
2250<SectionTitle>. { // anything else
2251 yyextra->sectionTitle+=yytext;
2252 addOutput(yyscanner,*yytext);
2253 }
2254
2255 /* ----- handle arguments of the subpage command ------- */
2256
2257<SubpageLabel>{FILE} { // first argument
2258 addOutput(yyscanner,yytext);
2259 // we add subpage labels as a kind of "inheritance" relation to prevent
2260 // needing to add another list to the Entry class.
2261 yyextra->current->extends.emplace_back(yytext,Protection::Public,Specifier::Normal);
2262 BEGIN(SubpageTitle);
2263 }
2264<SubpageLabel>{DOCNL} { // missing argument
2265 warn(yyextra->fileName,yyextra->lineNr,
2266 "\\subpage command has no label"
2267 );
2268 if (*yytext=='\n') yyextra->lineNr++;
2269 addOutput(yyscanner,'\n');
2270 BEGIN( Comment );
2271 }
2272<SubpageLabel>. {
2273 unput(yytext[0]);
2274 BEGIN( Comment );
2275 }
2276<SubpageTitle>{DOCNL} { // no title, end command
2277 addOutput(yyscanner,yytext);
2278 BEGIN( Comment );
2279 }
2280<SubpageTitle>[ \t]*"\""[^\"\n]*"\"" { // add title, end of command
2281 addOutput(yyscanner,yytext);
2282 BEGIN( Comment );
2283 }
2284<SubpageTitle>. { // no title, end of command
2285 unput(*yytext);
2286 BEGIN( Comment );
2287 }
2288
2289 /* ----- handle arguments of the anchor command ------- */
2290
2291<AnchorLabel,AnchorLabelSection>{LABELID} { // found argument
2292 DString lbl = yyextra->raisePrefix+yytext;
2293 addAnchor(yyscanner,lbl, yyextra->anchorTitle);
2294 addOutput(yyscanner,lbl.data());
2295 if (YY_START == AnchorLabel)
2296 {
2297 BEGIN(Comment);
2298 }
2299 else
2300 {
2301 BEGIN(SectionTitle);
2302 }
2303 }
2304<AnchorLabel,AnchorLabelSection>{DOCNL} { // missing argument
2305 warn(yyextra->fileName,yyextra->lineNr,
2306 "\\anchor command has no label"
2307 );
2308 if (*yytext=='\n') yyextra->lineNr++;
2309 addOutput(yyscanner,'\n');
2310 if (YY_START == AnchorLabel)
2311 {
2312 BEGIN(Comment);
2313 }
2314 else
2315 {
2316 BEGIN(SectionTitle);
2317 }
2318 }
2319<AnchorLabel,AnchorLabelSection>. { // invalid character for anchor label
2320 warn(yyextra->fileName,yyextra->lineNr,
2321 "Invalid or missing anchor label"
2322 );
2323 addOutput(yyscanner,yytext);
2324 if (YY_START == AnchorLabel)
2325 {
2326 BEGIN(Comment);
2327 }
2328 else
2329 {
2330 BEGIN(SectionTitle);
2331 }
2332 }
2333
2334 /* ----- handle arguments of the anchor command ------- */
2335
2336<RequirementLabel>{REQID} { // found argument
2337 yyextra->current->name = yytext;
2338 yyextra->current->type.clear();
2339 BEGIN( RequirementTitle );
2340 }
2341<SatisfiesLabel>{REQID} { // found argument
2342 yyextra->reqId = yytext;
2343 yyextra->reqTitle.clear();
2344 BEGIN( SatisfiesTitle );
2345 }
2346<VerifiesLabel>{REQID} { // found argument
2347 yyextra->reqId = yytext;
2348 yyextra->reqTitle.clear();
2349 BEGIN( VerifiesTitle );
2350 }
2351<RequirementLabel,SatisfiesLabel,VerifiesLabel>"\\"{B}*"\n" { // line continuation
2352 yyextra->lineNr++;
2353 addOutput(yyscanner,'\n');
2354 }
2355<RequirementLabel,SatisfiesLabel,VerifiesLabel>{DOCNL} { // missing argument
2356 warn(yyextra->fileName,yyextra->lineNr,
2357 "missing requirement ID after \\requirement command"
2358 );
2359 unput_string(yytext,yyleng);
2360 BEGIN( Comment );
2361 }
2362<RequirementLabel,SatisfiesLabel,VerifiesLabel>. { // invalid character for requirement label
2363 }
2364
2365<RequirementTitle,SatisfiesTitle,VerifiesTitle>"\\"{B}*"\n" { // line continuation
2366 yyextra->lineNr++;
2367 addOutput(yyscanner,'\n');
2368 }
2369<RequirementTitle>[^\n\\‍]+ { // title (stored in type)
2370 yyextra->current->type += yytext;
2371 }
2372<SatisfiesTitle,VerifiesTitle>[^\n\\@]+ { // title (stored in type)
2373 yyextra->reqTitle += yytext;
2374 }
2375<RequirementTitle>({CMD}("verifies"|"satisfies"|"requirement"){B}+)|{DOCNL}+ {
2376 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
2377 unput_string(yytext,yyleng);
2378 addRequirementId(yyscanner);
2379 BEGIN( Comment );
2380 }
static void addRequirementId(yyscan_t yyscanner)
2381<SatisfiesTitle>({CMD}("verifies"|"satisfies"|"requirement"){B}+)|{DOCNL}+ {
2382 yyextra->reqTitle = yyextra->reqTitle.stripWhiteSpace();
2383 unput_string(yytext,yyleng);
2384 if (yyextra->current->section.isRequirementDoc())
2385 {
2386 warn(yyextra->fileName,yyextra->lineNr,
2387 "@satisfies command is not allowed in documentation of a requirement. Put in at the place where the requirement is implemented."
2388 );
2389 }
2390 else
2391 {
2392 yyextra->current->rqli.emplace_back(RequirementRefType::Satisfies,
2393 yyextra->reqId,
2394 yyextra->reqTitle,
2395 yyextra->fileName,
2396 yyextra->lineNr);
2397 }
2398 BEGIN( Comment );
2399 }
2400<VerifiesTitle>({CMD}("verifies"|"satisfies"|"requirement"){B}+)|{DOCNL}+ {
2401 yyextra->reqTitle = yyextra->reqTitle.stripWhiteSpace();
2402 unput_string(yytext,yyleng);
2403 if (yyextra->current->section.isRequirementDoc())
2404 {
2405 warn(yyextra->fileName,yyextra->lineNr,
2406 "@verifies command is not allowed in documentation of a requirement. Put in at the place where the requirement is tested."
2407 );
2408 }
2409 else
2410 {
2411 yyextra->current->rqli.emplace_back(RequirementRefType::Verifies,
2412 yyextra->reqId,
2413 yyextra->reqTitle,
2414 yyextra->fileName,
2415 yyextra->lineNr);
2416 }
2417 BEGIN( Comment );
2418 }
2419<RequirementTitle>. { // title (stored in type)
2420 yyextra->current->type += yytext;
2421 }
2422<SatisfiesTitle,VerifiesTitle>. { // title (stored in reqTitle)
2423 yyextra->reqTitle += yytext;
2424 }
2425
2426
2427 /* ----- handle arguments of the preformatted block commands ------- */
2428
2429<FormatBlock>{CMD}("endverbatim"|"endiverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"endicode"|"endmsc"|"endmermaid")/{NW} { // possible ends
2430 addOutput(yyscanner,yytext);
2431 if (&yytext[4]==yyextra->blockName) // found end of the block
2432 {
2433 BEGIN(Comment);
2434 }
2435 }
2436<FormatBlock>{CMD}"enduml" {
2437 addOutput(yyscanner,yytext);
2438 if (yyextra->blockName=="startuml") // found end of the block
2439 {
2440 BEGIN(Comment);
2441 }
2442 }
2443<FormatBlock>[^ \@\*\/\\\n]* { // some word
2444 addOutput(yyscanner,yytext);
2445 }
2446<FormatBlock>{DOCNL} { // new line
2447 if (*yytext=='\n') yyextra->lineNr++;
2448 addOutput(yyscanner,'\n');
2449 }
2450<FormatBlock>{CCS} { // start of a C-comment
2451 if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim" ||
2452 yyextra->blockName=="icode" || yyextra->blockName=="iverbatim"||
2453 yyextra->blockName=="iliteral"
2454 )
2455 ) yyextra->commentCount++;
2456 addOutput(yyscanner,yytext);
2457 }
2458<FormatBlock>{CCE} { // end of a C-comment
2459 addOutput(yyscanner,yytext);
2460 if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim" ||
2461 yyextra->blockName=="icode" || yyextra->blockName=="iverbatim"||
2462 yyextra->blockName=="iliteral"
2463 )
2464 )
2465 {
2466 yyextra->commentCount--;
2467 if (yyextra->commentCount<0)
2468 {
2469 DString endTag = "end"+yyextra->blockName;
2470 if (yyextra->blockName=="startuml") endTag="enduml";
2471 warn(yyextra->fileName,yyextra->lineNr,
2472 "found */ without matching /* while inside a \\{} block! Perhaps a missing \\{}?",
2473 yyextra->blockName,endTag);
2474 }
2475 }
2476 }
2477<FormatBlock>. {
2478 addOutput(yyscanner,*yytext);
2479 }
2480<FormatBlock><<EOF>> {
2481 DString endTag = "end"+yyextra->blockName;
2482 if (yyextra->blockName=="startuml") endTag="enduml";
2483 warn(yyextra->fileName,yyextra->lineNr,
2484 "reached end of comment while inside a \\{} block; check for missing \\{} tag!",
2485 yyextra->blockName,endTag
2486 );
2487 yyterminate();
2488 }
2489
2490 /* ----- handle arguments of if/ifnot commands ------- */
2491
2492<GuardParam>{B}*"(" {
2493 yyextra->guardExpr=yytext;
2494 yyextra->roundCount=1;
2495 BEGIN(GuardExpr);
2496 }
2497<GuardExpr>[^()]* {
2498 yyextra->guardExpr+=yytext;
2499 lineCount(yyscanner);
2500 }
2501<GuardExpr>"(" {
2502 yyextra->guardExpr+=yytext;
2503 yyextra->roundCount++;
2504 }
2505<GuardExpr>")" {
2506 yyextra->guardExpr+=yytext;
2507 yyextra->roundCount--;
2508 if (yyextra->roundCount==0)
2509 {
2510 handleGuard(yyscanner,yyextra->guardExpr);
2511 }
2512 }
static void handleGuard(yyscan_t yyscanner, const DString &expr)
2513<GuardExpr>\n {
2514 warn(yyextra->fileName,yyextra->lineNr,
2515 "invalid expression '{}' for yyextra->guards",yyextra->guardExpr);
2516 unput(*yytext);
2517 BEGIN(GuardParam);
2518 }
2519<GuardParam>{B}*{CMD}doxyconfig{B}+{DOXYCFG} {
2520 handleGuard(yyscanner,yytext);
2521 }
2522<GuardParam>{B}*[a-z_A-Z0-9.\-]+({B}*{CMD}doxyconfig{B}+{DOXYCFG})? { // parameter of if/ifnot yyextra->guards
2523 handleGuard(yyscanner,yytext);
2524 }
2525<GuardParam>{DOCNL} { // end of argument
2526 //next line is commented out due to bug620924
2527 //addOutput(yyscanner,'\n');
2528 addIlineBreak(yyscanner,yyextra->lineNr);
2529 unput_string(yytext,yyleng);
2530 handleGuard(yyscanner,DString());
2531 }
static void addIlineBreak(yyscan_t yyscanner, int lineNr)
2532<GuardParam>{LC} { // line continuation
2533 yyextra->lineNr++;
2534 addOutput(yyscanner,'\n');
2535 }
2536<GuardParam>. { // empty condition
2537 unput(*yytext);
2538 handleGuard(yyscanner,DString());
2539 }
2540<GuardParamEnd>{B}*{DOCNL} {
2541 lineCount(yyscanner);
2542 yyextra->spaceBeforeIf.clear();
2543 addIlineBreak(yyscanner,yyextra->lineNr);
2544 BEGIN(Comment);
2545 }
2546<GuardParamEnd>{B}* {
2547 if (!yyextra->spaceBeforeIf.empty()) // needed for 665313 in combination with bug620924
2548 {
2549 addOutput(yyscanner,yyextra->spaceBeforeIf);
2550 }
2551 yyextra->spaceBeforeIf.clear();
2552 addIlineBreak(yyscanner,yyextra->lineNr);
2553 BEGIN(Comment);
2554 }
2555<GuardParamEnd>. {
2556 unput(*yytext);
2557 addIlineBreak(yyscanner,yyextra->lineNr);
2558 BEGIN(Comment);
2559 }
2560
2561 /* ----- handle skipping of conditional sections ------- */
2562
2563<SkipGuardedSection>{CMD}"ifnot"/{NW} {
2564 yyextra->guardType = Guard_IfNot;
2565 yyextra->guards->emplace(false);
2566 BEGIN( GuardParam );
2567 }
2568<SkipGuardedSection>{CMD}"if"/{NW} {
2569 yyextra->guardType = Guard_If;
2570 yyextra->guards->emplace(false);
2571 BEGIN( GuardParam );
2572 }
2573<SkipGuardedSection>{CMD}"endif"/{NW} {
2574 if (yyextra->guards->empty())
2575 {
2576 warn(yyextra->fileName,yyextra->lineNr,
2577 "found \\endif without matching start command");
2578 BEGIN( Comment );
2579 }
2580 else
2581 {
2582 yyextra->guards->pop();
2583 if (yyextra->guards->empty())
2584 {
2585 BEGIN( GuardParamEnd );
2586 }
2587 else
2588 {
2589 if (yyextra->guards->top().isEnabled())
2590 {
2591 BEGIN( GuardParamEnd );
2592 }
2593 else
2594 {
2595 BEGIN( SkipGuardedSection );
2596 }
2597 }
2598 }
2599 }
2600<SkipGuardedSection>{CMD}"else"/{NW} {
2601 if (yyextra->guards->empty())
2602 {
2603 warn(yyextra->fileName,yyextra->lineNr,
2604 "found \\else without matching start command");
2605 }
2606 else if (yyextra->guards->top().hasElse())
2607 {
2608 warn(yyextra->fileName,yyextra->lineNr,
2609 "found multiple \\else commands in same \\if construct");
2610 yyextra->guards->top().setEnabled(false);
2611 BEGIN( SkipGuardedSection );
2612 }
2613 else if (!yyextra->guards->top().parentVisible())
2614 {
2615 yyextra->guards->top().setEnabled(false);
2616 BEGIN( SkipGuardedSection );
2617 }
2618 else
2619 {
2620 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2621 yyextra->guards->top().setElse();
2622 if (!yyextra->guards->top().parentVisible())
2623 {
2624 yyextra->guards->top().setEnabled(false);
2625 BEGIN( SkipGuardedSection );
2626 }
2627 else if (yyextra->guards->top().isEnabledFound())
2628 {
2629 yyextra->guards->top().setEnabled(false);
2630 BEGIN( SkipGuardedSection );
2631 }
2632 else
2633 {
2634 yyextra->guards->top().setEnabled(true);
2635 BEGIN( GuardParamEnd );
2636 }
2637 }
2638 }
2639<SkipGuardedSection>{CMD}"elseif"/{NW} {
2640 if (yyextra->guards->empty())
2641 {
2642 warn(yyextra->fileName,yyextra->lineNr,
2643 "found \\elseif without matching start command");
2644 }
2645 else if (yyextra->guards->top().hasElse())
2646 {
2647 warn(yyextra->fileName,yyextra->lineNr,
2648 "found \\elseif command after \\else command was given in \\if construct");
2649 yyextra->guardType = Guard_ElseIf;
2650 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2651 yyextra->guards->top().setEnabled(false);
2652 BEGIN( GuardParam );
2653 }
2654 else
2655 {
2656 yyextra->guardType = Guard_ElseIf;
2657 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2658 yyextra->guards->top().setEnabled(false);
2659 BEGIN( GuardParam );
2660 }
2661 }
2662<SkipGuardedSection>{DOCNL} { // skip line
2663 if (*yytext=='\n') yyextra->lineNr++;
2664 //addOutput(yyscanner,'\n');
2665 }
2666<SkipGuardedSection>[^ \\@\n]+ { // skip non-special characters
2667 }
2668<SkipGuardedSection>{CMD}{CMD} |
2669<SkipGuardedSection>. { // any other character
2670 }
2671
2672
2673 /* ----- handle skipping of internal section ------- */
2674
2675<SkipInternal>{DOCNL} { // skip line
2676 if (*yytext=='\n') yyextra->lineNr++;
2677 addOutput(yyscanner,'\n');
2678 }
2679<SkipInternal>{CMD}"if"/[ \t] {
2680 yyextra->condCount++;
2681 }
2682<SkipInternal>{CMD}"ifnot"/[ \t] {
2683 yyextra->condCount++;
2684 }
2685<SkipInternal>{CMD}/"endif" {
2686 yyextra->condCount--;
2687 if (yyextra->condCount<0) // handle conditional section around of \internal, see bug607743
2688 {
2689 unput('\\');
2690 BEGIN(Comment);
2691 }
2692 }
2693<SkipInternal>{CMD}/"section"[ \t] {
2694 if (yyextra->sectionLevel>0)
2695 {
2696 unput('\\');
2697 BEGIN(Comment);
2698 }
2699 }
2700<SkipInternal>{CMD}/"subsection"[ \t] {
2701 if (yyextra->sectionLevel>1)
2702 {
2703 unput('\\');
2704 BEGIN(Comment);
2705 }
2706 }
2707<SkipInternal>{CMD}/"subsubsection"[ \t] {
2708 if (yyextra->sectionLevel>2)
2709 {
2710 unput('\\');
2711 BEGIN(Comment);
2712 }
2713 }
2714<SkipInternal>{CMD}/"paragraph"[ \t] {
2715 if (yyextra->sectionLevel>3)
2716 {
2717 unput('\\');
2718 BEGIN(Comment);
2719 }
2720 }
2721<SkipInternal>{CMD}/"subparagraph"[ \t] {
2722 if (yyextra->sectionLevel>4)
2723 {
2724 unput('\\');
2725 BEGIN(Comment);
2726 }
2727 }
2728<SkipInternal>{CMD}/"subsubparagraph"[ \t] {
2729 if (yyextra->sectionLevel>5)
2730 {
2731 unput('\\');
2732 BEGIN(Comment);
2733 }
2734 }
2735<SkipInternal>{CMD}"endinternal"[ \t]* {
2736 BEGIN(Comment);
2737 }
2738<SkipInternal>[^ \\@\n]+ { // skip non-special characters
2739 }
2740<SkipInternal>. { // any other character
2741 }
2742
2743
2744 /* ----- handle argument of name command ------- */
2745
2746<NameParam>{DOCNL} { // end of argument
2747 //if (*yytext=='\n') yyextra->lineNr++;
2748 //addOutput(yyscanner,'\n');
2749 unput_string(yytext,yyleng);
2750 BEGIN( Comment );
2751 }
2752<NameParam>{LC} { // line continuation
2753 yyextra->lineNr++;
2754 addOutput(yyscanner,'\n');
2755 yyextra->docGroup.appendHeader(' ');
2756 }
2757<NameParam>. { // ignore other stuff
2758 yyextra->docGroup.appendHeader(*yytext);
2759 yyextra->current->name+=*yytext;
2760 }
2761
2762 /* ----- handle argument of noop command ------- */
2763<Noop>{DOCNL} { // end of argument
2764 if (*yytext=='\n')
2765 {
2766 yyextra->lineNr++;
2767 addOutput(yyscanner,'\n');
2768 }
2769 BEGIN( Comment );
2770 }
2771<Noop>. { // ignore other stuff
2772 }
2773 /* ----- handle argument of raisewarning command ------- */
2774<RaiseWarning,RaiseWarningSection>{DOCNL} { // end of argument
2775 warn_doc_error(yyextra->fileName,yyextra->lineNr,
2776 "{}",yyextra->raiseWarning);
2777 yyextra->raiseWarning = "";
2778 if (*yytext=='\n') yyextra->lineNr++;
2779 addOutput(yyscanner,'\n');
2780 if (YY_START == RaiseWarning)
2781 {
2782 BEGIN(Comment);
2783 }
2784 else
2785 {
2786 yyextra->sectionTitle+=yytext;
2787 BEGIN(SectionTitle);
2788 }
2789 }
2790<RaiseWarning,RaiseWarningSection>. { // ignore other stuff
2791 yyextra->raiseWarning += yytext;
2792 }
2793 /* ----- handle argument of ingroup command ------- */
2794
2795<InGroupParam>{LABELID} { // group id
2796 yyextra->current->groups.emplace_back(
2798 );
2799 yyextra->inGroupParamFound=true;
2800 }
@ GROUPING_INGROUP
membership in group was defined by @ingroup
Definition types.h:236
2801<InGroupParam>{DOCNL} { // missing argument
2802 if (!yyextra->inGroupParamFound)
2803 {
2804 warn(yyextra->fileName,yyextra->lineNr,
2805 "Missing group name for \\ingroup command"
2806 );
2807 }
2808 //if (*yytext=='\n') yyextra->lineNr++;
2809 //addOutput(yyscanner,'\n');
2810 unput_string(yytext,yyleng);
2811 BEGIN( Comment );
2812 }
2813<InGroupParam>{LC} { // line continuation
2814 yyextra->lineNr++;
2815 addOutput(yyscanner,'\n');
2816 }
2817<InGroupParam>. { // ignore other stuff
2818 addOutput(yyscanner,*yytext);
2819 }
2820
2821 /* ----- handle argument of fn command ------- */
2822
2823<FnParam>{DOCNL} { // end of argument
2824 if (yyextra->braceCount==0)
2825 {
2826 if (yyextra->functionProto.stripWhiteSpace().empty())
2827 {
2828 warn(yyextra->fileName,yyextra->lineNr,
2829 "missing argument after '\\{}'.",yyextra->currentCmd
2830 );
2831 }
2832 else
2833 {
2834 makeStructuralIndicator(yyscanner,yyextra->currentMakeEntryType);
2835 yyextra->langParser->parsePrototype(yyextra->functionProto);
2836 }
2837 unput_string(yytext,yyleng);
2838 BEGIN( Comment );
2839 }
2840 }
2841<FnParam>{LC} { // line continuation
2842 yyextra->lineNr++;
2843 yyextra->functionProto+=' ';
2844 }
2845<FnParam>[^@\\\n()]+ { // non-special characters
2846 yyextra->functionProto+=yytext;
2847 }
2848<FnParam>"(" {
2849 yyextra->functionProto+=yytext;
2850 yyextra->braceCount++;
2851 }
2852<FnParam>")" {
2853 yyextra->functionProto+=yytext;
2854 yyextra->braceCount--;
2855 }
2856<FnParam>. { // add other stuff
2857 yyextra->functionProto+=*yytext;
2858 }
2859
2860
2861 /* ----- handle argument of overload command ------- */
2862
2863
2864<OverloadParam>{DOCNL} { // end of argument
2865 if (*yytext=='\n') yyextra->lineNr++;
2866 if (yyextra->functionProto.stripWhiteSpace().empty())
2867 { // plain overload command
2869 addOutput(yyscanner,'\n');
2870 }
2871 else // overload declaration
2872 {
2873 makeStructuralIndicator(yyscanner,EntryType::makeOverloadDoc);
2874 yyextra->langParser->parsePrototype(yyextra->functionProto);
2875 }
2876 BEGIN( Comment );
2877 }
virtual DString trOverloadText()=0
2878<OverloadParam>{LC} { // line continuation
2879 yyextra->lineNr++;
2880 yyextra->functionProto+=' ';
2881 }
2882<OverloadParam>. { // add other stuff
2883 yyextra->functionProto+=*yytext;
2884 }
2885
2886 /* ----- handle argument of inherit command ------- */
2887
2888<InheritParam>({ID}("::"|"."))*{ID} { // found argument
2889 yyextra->current->extends.emplace_back(
2890 removeRedundantWhiteSpace(yytext),Protection::Public,Specifier::Normal
2891 );
2892 BEGIN( Comment );
2893 }
2894<InheritParam>{DOCNL} { // missing argument
2895 warn(yyextra->fileName,yyextra->lineNr,
2896 "\\inherit command has no argument"
2897 );
2898 if (*yytext=='\n') yyextra->lineNr++;
2899 addOutput(yyscanner,'\n');
2900 BEGIN( Comment );
2901 }
2902<InheritParam>. { // invalid character for anchor label
2903 warn(yyextra->fileName,yyextra->lineNr,
2904 "Invalid or missing name for \\inherit command"
2905 );
2906 BEGIN(Comment);
2907 }
2908
2909 /* ----- handle argument of extends and implements commands ------- */
2910
2911<ExtendsParam>({ID}("::"|"."))*{ID} { // found argument
2912 yyextra->current->extends.emplace_back(
2913 removeRedundantWhiteSpace(yytext),Protection::Public,Specifier::Normal
2914 );
2915 BEGIN( Comment );
2916 }
2917<ExtendsParam>{DOCNL} { // missing argument
2918 warn(yyextra->fileName,yyextra->lineNr,
2919 "'\\{}' command has no argument",yyextra->currentCmd
2920 );
2921 //if (*yytext=='\n') yyextra->lineNr++;
2922 //addOutput(yyscanner,'\n');
2923 unput_string(yytext,yyleng);
2924 BEGIN( Comment );
2925 }
2926<ExtendsParam>. { // ignore other stuff
2927 }
2928
2929 /* ----- handle language specific sections ------- */
2930
2931<SkipLang>{CMD}"~"[a-zA-Z-]* { /* language switch */
2932 DString langId(&yytext[2]);
2933 if (!langId.empty() && !Config_isAvailableEnum(OUTPUT_LANGUAGE,langId))
2934 {
2935 warn(yyextra->fileName,yyextra->lineNr,
2936 "non supported language '{}' specified in '{}'",langId,DString(yytext).stripWhiteSpace());
2937 }
2938 else if (langId.empty() ||
2939 dstricmp(Config_getEnumAsString(OUTPUT_LANGUAGE),langId)==0)
2940 { // enable language specific section
2941 BEGIN(Comment);
2942 }
2943 }
2944<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
2945 }
2946<SkipLang>{DOCNL} { /* new line in verbatim block */
2947 if (*yytext=='\n') yyextra->lineNr++;
2948 }
2949<SkipLang>. { /* any other character */
2950 }
2951
2952 /* ----- handle arguments of the cite command ------- */
2953
2954<CiteLabel,CiteLabelSection>{CITEID} { // found argument
2955 addCite(yyscanner);
2956 addOutput(yyscanner,yytext);
2957 if (YY_START == CiteLabel)
2958 {
2959 BEGIN(Comment);
2960 }
2961 else
2962 {
2963 yyextra->sectionTitle+=yytext;
2964 BEGIN(SectionTitle);
2965 }
2966 }
static void addCite(yyscan_t yyscanner)
2967<CiteLabel,CiteLabelSection>{DOCNL} { // missing argument
2968 warn(yyextra->fileName,yyextra->lineNr,
2969 "\\cite command has no label"
2970 );
2971 //if (*yytext=='\n') yyextra->lineNr++;
2972 //addOutput(yyscanner,'\n');
2973 if (YY_START == CiteLabel)
2974 {
2975 unput_string(yytext,yyleng);
2976 BEGIN(Comment);
2977 }
2978 else
2979 {
2980 yyextra->sectionTitle+=yytext;
2981 unput_string(yytext,yyleng);
2982 BEGIN(SectionTitle);
2983 }
2984 }
2985<CiteLabel,CiteLabelSection>. { // invalid character for cite label
2986 warn(yyextra->fileName,yyextra->lineNr,
2987 "Invalid or missing cite label"
2988 );
2989 if (YY_START == CiteLabel)
2990 {
2991 BEGIN(Comment);
2992 }
2993 else
2994 {
2995 yyextra->sectionTitle+=yytext;
2996 BEGIN(SectionTitle);
2997 }
2998 }
2999
3000 /* ----- handle argument of the copydoc command ------- */
3001
3002<CopyDoc><<EOF>> {
3003 setOutput(yyscanner,OutputDoc);
3004 addOutput(yyscanner," \\ilinebr\\ilinebr\\copydetails ");
3005 addOutput(yyscanner,yyextra->copyDocArg);
3006 addOutput(yyscanner,"\n");
3007 BEGIN(Comment);
3008 }
3009<CopyDoc>"<"[/]?{TABLEDEL}">" {
3010 if (yyextra->braceCount==0)
3011 {
3012 setOutput(yyscanner,OutputDoc);
3013 addOutput(yyscanner," \\ilinebr\\ilinebr\\copydetails ");
3014 addOutput(yyscanner,yyextra->copyDocArg);
3015 addOutput(yyscanner,yytext);
3016 BEGIN(Comment);
3017 }
3018 }
3019<CopyDoc>{DOCNL} {
3020 if (*yytext=='\n') yyextra->lineNr++;
3021 if (yyextra->braceCount==0)
3022 {
3023 setOutput(yyscanner,OutputDoc);
3024 addOutput(yyscanner," \\ilinebr\\ilinebr\\copydetails ");
3025 addOutput(yyscanner,yyextra->copyDocArg);
3026 addOutput(yyscanner,"\n");
3027 BEGIN(Comment);
3028 }
3029 }
3030<CopyDoc>{LC} { // line continuation
3031 yyextra->lineNr++;
3032 }
3033<CopyDoc>[^@\\\n()<]+ { // non-special characters
3034 yyextra->copyDocArg+=yytext;
3035 addOutput(yyscanner,yytext);
3036 }
3037<CopyDoc>"(" {
3038 yyextra->copyDocArg+=yytext;
3039 addOutput(yyscanner,yytext);
3040 yyextra->braceCount++;
3041 }
3042<CopyDoc>")" {
3043 yyextra->copyDocArg+=yytext;
3044 addOutput(yyscanner,yytext);
3045 yyextra->braceCount--;
3046 }
3047<CopyDoc>. {
3048 yyextra->copyDocArg+=yytext;
3049 addOutput(yyscanner,yytext);
3050 }
3051
3052 /*
3053<*>. { fprintf(stderr,"Lex scanner %s %sdefault rule for state %s: #%s#\n", __FILE__,!yyextra->fileName.empty() ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START),yytext);}
3054<*>\n { fprintf(stderr,"Lex scanner %s %sdefault rule newline for state %s.\n", __FILE__, !yyextra->fileName.empty() ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START));}
3055 */
3056
3057%%

◆ yyread()

int yyread ( yyscan_t yyscanner,
char * buf,
int max_size )
static

Definition at line 4978 of file commentscan.l.

4979{
4980 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4981 yyextra->prevPosition=yyextra->inputPosition;
4982 int c=0;
4983 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
4984 {
4985 *buf = yyextra->inputString[yyextra->inputPosition++] ;
4986 //printf("%d (%c)\n",*buf,*buf);
4987 c++; buf++;
4988 }
4989 return c;
4990}

References yyguts_t.

Variable Documentation

◆ docCmdMap

const std::unordered_map< std::string, DocCmdMap > docCmdMap
static

Definition at line 214 of file commentscan.l.

Referenced by CommentScanner::isCommand().

◆ g_citeMutex

std::mutex g_citeMutex
static

Definition at line 545 of file commentscan.l.

Referenced by addCite().

◆ g_formulaMutex

std::mutex g_formulaMutex
static

Definition at line 544 of file commentscan.l.

Referenced by addFormula().

◆ g_sectionMutex

std::mutex g_sectionMutex
static

Definition at line 543 of file commentscan.l.

Referenced by addAnchor(), addRequirementId(), addSection(), and addXRefItemToEntry().

◆ nonBrief_re

const reg::Ex nonBrief_re(R"( *[\\@]ifile \"[^\"]*\" [\\@]iline (\d+) [\\@]ilinebr ([ \n]*))") ( R"( *[\\@]ifile \"[^\"]*\" [\\@]iline (\d+) [\\@]ilinebr ([ \n]*))" )
static

Referenced by endBrief(), and setOutput().