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 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 , 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 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 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, DocCmdMapdocCmdMap
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 571 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 xml.l:230

Definition at line 576 of file commentscan.l.

◆ YY_NEVER_INTERACTIVE

#define YY_NEVER_INTERACTIVE   1

Definition at line 421 of file commentscan.l.

◆ YY_NO_INPUT

#define YY_NO_INPUT   1

Definition at line 419 of file commentscan.l.

◆ YY_NO_UNISTD_H

#define YY_NO_UNISTD_H   1

Definition at line 420 of file commentscan.l.

◆ YY_TYPEDEF_YY_SCANNER_T

#define YY_TYPEDEF_YY_SCANNER_T

Definition at line 23 of file commentscan.l.

Typedef Documentation

◆ DocCmdFunc

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

Definition at line 183 of file commentscan.l.

◆ HtmlContextStack

using HtmlContextStack = std::vector<HtmlContextInfo>

Definition at line 461 of file commentscan.l.

◆ MakeEntryType

typedef EntryType(* MakeEntryType) ()

Definition at line 184 of file commentscan.l.

◆ yyscan_t

typedef yyguts_t* yyscan_t

Definition at line 25 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 186 of file commentscan.l.

187{
188 Invisible, //!< command sets some property but does not appear in the output.
189 Inline, //!< command appears inline in the output which can be a brief description.
190 Block, //!< command starts a new paragraphs / ends a brief description.
191 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.
192};

◆ GuardType

enum GuardType
Enumerator
Guard_If 
Guard_IfNot 
Guard_ElseIf 

Definition at line 442 of file commentscan.l.

443{
444 Guard_If,
@ Guard_If
@ Guard_ElseIf
@ Guard_IfNot
447};

◆ OutputContext

Enumerator
OutputDoc 
OutputBrief 
OutputXRef 
OutputInbody 

Definition at line 434 of file commentscan.l.

435{
436 OutputDoc,
@ OutputXRef
@ OutputDoc
@ OutputBrief
@ OutputInbody
440};

◆ 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 194 of file commentscan.l.

195{
196 Allowed, //!< command is allowed without restrictions in section title
197 Replace, //!< command will be handled in here / needs special handling here
198 Escape, //!< command is not-allowed in section title, it will be escaped
199 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
200};

◆ XRefKind

enum XRefKind
Enumerator
XRef_Item 
XRef_Todo 
XRef_Test 
XRef_Bug 
XRef_Deprecated 
XRef_None 

Definition at line 424 of file commentscan.l.

425{
426 XRef_Item,
427 XRef_Todo,
428 XRef_Test,
429 XRef_Bug,
@ XRef_Item
@ XRef_Deprecated
@ XRef_Todo
@ XRef_Test
@ XRef_Bug
@ XRef_None
432};

Function Documentation

◆ addAnchor()

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

Definition at line 4836 of file commentscan.l.

4837{
4838 std::unique_lock<std::mutex> lock(g_sectionMutex);
4839 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4841 const SectionInfo *si = sm.find(anchor);
4842 if (si)
4843 {
4844 if (!si->ref().empty()) // we are from a tag file
4845 {
4846 si = sm.replace(anchor,yyextra->fileName,yyextra->lineNr,DString(),SectionType::Anchor,0);
4847 yyextra->current->anchors.push_back(si);
4848 }
4849 else if (si->lineNr() != -1)
4850 {
4851 warn(yyextra->fileName,yyextra->lineNr,
4852 "multiple use of section label '{}' while adding anchor, (first occurrence: {}, line {})",
4853 anchor,si->fileName(),si->lineNr());
4854 }
4855 else
4856 {
4857 warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '{}' while adding anchor, (first occurrence: {})",
4858 anchor,si->fileName());
4859 }
4860 }
4861 else
4862 {
4863 si = sm.add(anchor,yyextra->fileName,yyextra->lineNr,title,SectionType::Anchor,0);
4864 yyextra->current->anchors.push_back(si);
4865 }
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
static std::mutex g_sectionMutex
#define warn(file, line, fmt,...)
Definition message.h:97
4866}

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(), and warn.

Referenced by handleImage().

◆ addCite()

void addCite ( yyscan_t yyscanner)
static

Definition at line 4639 of file commentscan.l.

4640{
4641 std::unique_lock<std::mutex> lock(g_citeMutex);
4642 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4643 DString name(yytext);
4644 if (yytext[0] =='"')
4645 {
4646 name=yytext+1;
4647 name=name.left((int)yyleng-2);
4648 }
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
4650}

References g_citeMutex, CitationManager::insert(), CitationManager::instance(), and DString::left().

◆ addFormula()

DString addFormula ( yyscan_t yyscanner)
static

Definition at line 4563 of file commentscan.l.

4564{
4565 std::unique_lock<std::mutex> lock(g_formulaMutex);
4566 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4567 DString formLabel;
4568 DString formula = (yyextra->formulaPreText +
4569 yyextra->formulaText.stripLeadingAndTrailingEmptyLines() +
4570 yyextra->formulaPostText).stripWhiteSpace();
4571 //printf("formulaText=\n=1=\n{%s}\n=2=\n{%s}\n=3=\n{%s}\n===",
4572 // qPrint(yyextra->formulaText),
4573 // qPrint(yyextra->formulaText.stripLeadingAndTrailingEmptyLines()),
4574 // qPrint(formula)
4575 // );
4576 int id = FormulaManager::instance().addFormula(formula);
4577 formLabel.sprintf("\\_form#%d",id);
4578 for (int i=0;i<yyextra->formulaNewLines;i++) formLabel+="@_fakenl"; // add fake newlines to
4579 // keep the warnings
4580 // correctly aligned.
4581 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
4582}

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

◆ addIline()

void addIline ( yyscan_t yyscanner,
int lineNr )
static

Definition at line 4891 of file commentscan.l.

4892{
4893 char cmd[30];
4894 snprintf(cmd,30," \\iline %d ",lineNr);
4895 addOutput(yyscanner, cmd);
static void addOutput(yyscan_t yyscanner, const char *s)
4896}

References addOutput().

Referenced by endBrief().

◆ addIlineBreak()

void addIlineBreak ( yyscan_t yyscanner,
int lineNr )
static

Definition at line 4898 of file commentscan.l.

4899{
4900 char cmd[30];
4901 snprintf(cmd,30," \\iline %d \\ilinebr ",lineNr);
4902 addOutput(yyscanner, cmd);
4903}

References addOutput().

◆ addOutput() [1/3]

void addOutput ( yyscan_t yyscanner,
char c )
inlinestatic

Definition at line 4885 of file commentscan.l.

4886{
4887 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4888 *yyextra->pOutputString+=c;
4889}

◆ addOutput() [2/3]

void addOutput ( yyscan_t yyscanner,
const char * s )
inlinestatic

◆ addOutput() [3/3]

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

Definition at line 4877 of file commentscan.l.

4878{
4879 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4880 //printf("addOutput(yyscanner,%s)\n",s);
4881 *yyextra->pOutputString+=s;
4882}

◆ addRequirementId()

void addRequirementId ( yyscan_t yyscanner)
static

Definition at line 4419 of file commentscan.l.

4420{
4421 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4422 std::unique_lock<std::mutex> lock(g_sectionMutex);
4423
4424 DString reqId = yyextra->current->name;
4425 //printf("### add reqId='%s' reqTitle='%s'\n",qPrint(reqId),qPrint(yyextra->current->type));
4427 const SectionInfo *si = sm.find(reqId);
4428 if (si==nullptr)
4429 {
4430 si = sm.add(reqId,"requirements",yyextra->lineNr,
4431 yyextra->current->type,SectionType::Requirement,1);
4432 }
4433 else // duplicate requirement
4434 {
4435 warn(yyextra->fileName,yyextra->lineNr,"duplicate requirement ID '{}' found at {} line {}, (first occurrence: {}, line {})",
4436 reqId,
4437 yyextra->fileName,yyextra->lineNr,
4438 si->fileName(),si->lineNr());
4439 }
static constexpr int Requirement
Definition section.h:42
4440}

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

◆ addSection()

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

Definition at line 4592 of file commentscan.l.

4593{
4594 std::unique_lock<std::mutex> lock(g_sectionMutex);
4595 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4597 const SectionInfo *si = sm.find(yyextra->sectionLabel);
4598 if (si)
4599 {
4600 if (!si->ref().empty()) // we are from a tag file
4601 {
4602 // create a new section element
4603 if (addYYtext) yyextra->sectionTitle+=yytext;
4604 yyextra->sectionTitle=yyextra->sectionTitle.stripWhiteSpace();
4605 si = sm.replace(yyextra->sectionLabel,yyextra->fileName,yyextra->lineNr,
4606 yyextra->sectionTitle,sectionLevelToType(yyextra->sectionLevel),
4607 yyextra->sectionLevel);
static SectionType sectionLevelToType(int level)
4608
4609 // add section to this entry
4610 yyextra->current->anchors.push_back(si);
4611 }
4612 else if (si->lineNr() != -1)
4613 {
4614 warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '{}' while adding section, (first occurrence: {}, line {})",
4615 yyextra->sectionLabel,si->fileName(),si->lineNr());
4616 }
4617 else
4618 {
4619 warn(yyextra->fileName,yyextra->lineNr,"multiple use of section label '{}' while adding section, (first occurrence: {})",
4620 yyextra->sectionLabel,si->fileName());
4621 }
4622 }
4623 else
4624 {
4625 // create a new section element
4626 if (addYYtext) yyextra->sectionTitle+=yytext;
4627 yyextra->sectionTitle=yyextra->sectionTitle.stripWhiteSpace();
4628 si = sm.add(yyextra->sectionLabel,yyextra->fileName,yyextra->lineNr,
4629 yyextra->sectionTitle,sectionLevelToType(yyextra->sectionLevel),
4630 yyextra->sectionLevel);
4631
4632 // add section to this entry
4633 yyextra->current->anchors.push_back(si);
4634 }
4635}

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

◆ addXRefItem()

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

Definition at line 4528 of file commentscan.l.

4531{
4532 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4533 addXRefItemToEntry(yyextra->current,yyextra->outputXRef,listName,itemTitle,listTitle,append,yyextra->inBody,yyextra->lineNr);
4534 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)
4535}

References addXRefItemToEntry().

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 4444 of file commentscan.l.

4447{
4448 if (baseName.empty()) return;
4449 //printf("addXRefItem(listName=%s,itemTitle=%s,listTitle=%s,append=%d,inbody=%d)\n",
4450 // qPrint(baseName),qPrint(itemTitle),qPrint(listTitle),append,inBody);
4451
4452 std::unique_lock<std::mutex> lock(g_sectionMutex);
4453
4454 DString listName=baseName;
4455 if (Config_getEnum(MARKDOWN_ID_STYLE) == MARKDOWN_ID_STYLE_t::GITHUB) listName = "Doxygen_List_" + listName;
4456 RefList *refList = RefListManager::instance().add(listName,listTitle,itemTitle);
4457 RefItem *item = nullptr;
4458 for (auto it = current->sli.rbegin(); it != current->sli.rend(); ++it)
4459 {
4460 RefItem *i = *it;
4461 if (i && i->list()->listName()==listName)
4462 {
4463 //printf("found %s lii->type=%s\n",listName,qPrint(i->list()->listName()));
4464 item = i;
4465 break;
4466 }
4467 }
4468 if (item && append) // already found item of same type just before this one
4469 {
4470 //printf("listName=%s item id = %d existing\n",listName,item->id());
4471 item->setText(item->text() + " <p>" + docs);
4472 //printf("%s: text +=%s\n",listName,qPrint(item->text));
4473 }
4474 else // new item
4475 {
4476 // if we have already an item from the same list type (e.g. a second @todo)
4477 // in the same Entry (i.e. lii!=0) then we reuse its link anchor.
4478 item = refList->add();
4479 //printf("listName=%s item id = %d new yyextra->current=%p\n",listName,item->id(),yyextra->current);
4480 DString anchorLabel;
4481 anchorLabel.sprintf("_%s%06d",listName.data(),item->id());
4482 item->setText(docs);
4483 item->setAnchor(anchorLabel);
4484 current->sli.push_back(item);
4485 DString cmdString;
4486 cmdString.sprintf("\\ilinebr \\xrefitem %s %d.",qPrint(listName),item->id());
4487 if (inBody)
4488 {
4489 current->inbodyDocs += cmdString;
4490 }
4491 else
4492 {
4493 current->doc += cmdString;
4494 }
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
DString doc
documentation block (partly parsed)
Definition entry.h:200
RefItemVector sli
special lists (test/todo/bug/deprecated/..) this entry is in
Definition entry.h:226
DString inbodyDocs
documentation inside the body of a function
Definition entry.h:206
T * add(const char *k, Args &&... args)
Definition linkedmap.h:90
This struct represents an item in the list of references.
Definition reflist.h:31
int id() const
Definition reflist.h:51
DString text() const
Definition reflist.h:44
void setText(const DString &text)
Definition reflist.h:35
RefList * list() const
Definition reflist.h:52
void setAnchor(const DString &anchor)
Definition reflist.h:36
List of cross-referenced items.
Definition reflist.h:79
DString listName() const
Definition reflist.h:100
RefItem * add()
Definition reflist.cpp:35
static RefListManager & instance()
Definition reflist.h:120
#define Config_getEnum(name)
Definition config.h:35
const char * qPrint(const char *s)
Definition dstring.h:783
4495
4496 {
4498 const SectionInfo *si = sm.find(anchorLabel);
4499 if (si)
4500 {
4501 if (!si->ref().empty()) // we are from a tag file
4502 {
4503 si = sm.replace(anchorLabel,listName,lineNr,"",SectionType::Anchor,0);
4504 current->anchors.push_back(si);
4505 }
4506 else if (si->lineNr() != -1)
4507 {
4508 warn(listName,lineNr,"multiple use of section label '{}', (first occurrence: {}, line {})",
4509 anchorLabel,si->fileName(),si->lineNr());
4510 }
4511 else
4512 {
4513 warn(listName,lineNr,"multiple use of section label '{}', (first occurrence: {})",
4514 anchorLabel,si->fileName());
4515 }
4516 }
4517 else
4518 {
4519 si = sm.add(anchorLabel,listName,lineNr,"",SectionType::Anchor,0);
4520 current->anchors.push_back(si);
4521 }
4522 }
4523 }
std::vector< const SectionInfo * > anchors
list of anchors defined in this entry
Definition entry.h:222
4524}

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 4951 of file commentscan.l.

4952{
4953 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4954 if (YY_START==ReadFormulaShort || YY_START==ReadFormulaShortSection ||
4955 YY_START==ReadFormulaRound || YY_START==ReadFormulaRoundSection ||
4956 YY_START==ReadFormulaLong)
4957 {
4958 warn(yyextra->fileName,yyextra->lineNr,"End of comment block while inside formula.");
4959 }
4960}

References warn.

Referenced by CommentScanner::parseCommentBlock().

◆ checkStructuralIndicator()

bool checkStructuralIndicator ( yyscan_t yyscanner)
static

Definition at line 4363 of file commentscan.l.

4364{
4365 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4366 //printf("yyextra->current->section=%x\n",yyextra->current->section);
4367 return yyextra->current->section.isDoc();
4368}

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

◆ endBrief()

void endBrief ( yyscan_t yyscanner)
static

Definition at line 4905 of file commentscan.l.

4906{
4907 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4908 std::string_view str = yyextra->current->brief.view();
4910 if (!stripWhiteSpace(str).empty() && !reg::match(str,match,nonBrief_re))
4911 { // only go to the detailed description if we have
4912 // found some brief description and not just whitespace
4913 yyextra->briefEndsAtDot=false;
4914 setOutput(yyscanner,OutputDoc);
4915 if (yyextra->current->doc.stripWhiteSpace().empty())
4916 {
4917 yyextra->current->docLine = yyextra->lineNr;
4918 yyextra->current->doc = "";
4919 }
4920 else
4921 {
4922 addIline(yyscanner,yyextra->lineNr);
4923 }
4924 addOutput(yyscanner,yytext);
4925 }
4926 else
4927 {
4928 int saveLineNr = yyextra->lineNr;
4929 lineCount(yyscanner);
4930 yyextra->current->briefLine = yyextra->lineNr;
4931 yyextra->lineNr = saveLineNr;
4932 }
Object representing the matching results.
Definition regex.h:154
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
4933}

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

◆ escapeLabel()

void escapeLabel ( DString & label)
static

Definition at line 4540 of file commentscan.l.

4541{
4542 if (label.empty()) return;
4543 signed char c = static_cast<signed char>(label[0]);
4544 if (!((c>='a' && c<='z') || (c>='A' && c<='Z') || c=='_' || c<0))
4545 {
4546 label[0]='_'; // replace invalid starting char by _
4547 }
4548 for (size_t i=1; i<label.size(); i++)
4549 {
4550 c = static_cast<signed char>(label[i]);
4551 if (!((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='_' || c<0))
4552 {
4553 label[i]='_'; // replace invalid char by _
4554 }
4555 }
size_t size() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:154
4556}

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

◆ fileInfoLookup()

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

Definition at line 3662 of file commentscan.l.

3663{
3664 using OptionFunc = std::function<DString(const FileInfo &)>;
3665 static std::unordered_map<std::string,OptionFunc> options =
3666 {
3667 // name, function producing the value
3668 { "name", [](const FileInfo &fi_) -> DString { return fi_.baseName(); } },
3669 { "extension", [](const FileInfo &fi_) -> DString { return fi_.extension(true); } },
3670 { "filename", [](const FileInfo &fi_) -> DString { return fi_.fileName(); } },
3671 { "directory", [](const FileInfo &fi_) -> DString { return fi_.dirPath(); } },
3672 { "full", [](const FileInfo &fi_) -> DString { return fi_.absFilePath(); } }
3673 };
3674 auto it = options.find(optionName);
3675 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
3676}

References DString::find().

Referenced by handleFileInfoResult().

◆ getLexerFILE()

const char * getLexerFILE ( )
inlinestatic

Definition at line 579 of file commentscan.l.

579{return __FILE__;}

◆ handleAddIndex()

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

Definition at line 3645 of file commentscan.l.

3646{
3647 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3648 addOutput(yyscanner,yytext);
3649 BEGIN(LineParam);
3650 return false;
3651}

References addOutput().

◆ handleAddToGroup()

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

Definition at line 3102 of file commentscan.l.

3103{
3104 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3105 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeGroupDoc);
3106 yyextra->current->groupDocType = Entry::GROUPDOC_ADD;
3107 BEGIN( GroupDocArg1 );
3108 return stop;
@ GROUPDOC_ADD
addtogroup
Definition entry.h:121
static bool makeStructuralIndicator(yyscan_t yyscanner, MakeEntryType maker)
3109}

References Entry::GROUPDOC_ADD, and makeStructuralIndicator().

◆ handleAnchor()

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

Definition at line 3549 of file commentscan.l.

3550{
3551 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3552 addOutput(yyscanner,"@"+s+" ");
3553 if (optList.empty())
3554 {
3555 yyextra -> anchorTitle = "";
3556 }
3557 else
3558 {
3559 yyextra -> anchorTitle = join(optList," ");
3560 }
3561 BEGIN(AnchorLabel);
3562 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:153
3563}

References addOutput(), and join().

◆ handleBrief()

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

Definition at line 3048 of file commentscan.l.

3049{
3050 //printf("handleBrief\n");
3051 setOutput(yyscanner,OutputBrief);
3052 return false;
3053}

References OutputBrief, and setOutput().

◆ handleBug()

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

Definition at line 3367 of file commentscan.l.

3368{
3369 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3370 yyextra->newXRefKind = XRef_Bug;
3371 setOutput(yyscanner,OutputXRef);
3372 yyextra->xrefKind = XRef_Bug;
3373 return false;
3374}

References OutputXRef, setOutput(), and XRef_Bug.

◆ handleCallergraph()

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

Definition at line 3949 of file commentscan.l.

3950{
3951 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3952 yyextra->current->commandOverrides.override_callerGraph(true); // ON
3953 return false;
3954}

◆ handleCallgraph()

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

Definition at line 3935 of file commentscan.l.

3936{
3937 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3938 yyextra->current->commandOverrides.override_callGraph(true); // ON
3939 return false;
3940}

◆ handleCategory()

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

Definition at line 3179 of file commentscan.l.

3180{ // Obj-C category
3181 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3182 yyextra->currentCmd = cmd;
3183 yyextra->currentMakeEntryType = EntryType::makeCategoryDoc;
3184 BEGIN( CategoryDocArg1 );
3185 return checkStructuralIndicator(yyscanner);
static bool checkStructuralIndicator(yyscan_t yyscanner)
3186}

References checkStructuralIndicator().

◆ handleCite()

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

Definition at line 3590 of file commentscan.l.

3591{
3592 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3593 if (!yyextra->spaceBeforeCmd.empty())
3594 {
3595 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3596 yyextra->spaceBeforeCmd.clear();
3597 }
3598 if (optList.empty())
3599 {
3600 addOutput(yyscanner,"@"+s+" ");
3601 }
3602 else
3603 {
3604 addOutput(yyscanner,"@"+s+"{"+DString(join(optList,","))+"} ");
3605 }
3606 BEGIN(CiteLabel);
3607 return false;
3608}

References addOutput(), and join().

◆ handleClass()

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

Definition at line 3136 of file commentscan.l.

3137{
3138 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3139 yyextra->currentCmd = cmd;
3140 yyextra->currentMakeEntryType = EntryType::makeClassDoc;
3141 BEGIN( ClassDocArg1 );
3142 return checkStructuralIndicator(yyscanner);
3143}

References checkStructuralIndicator().

◆ handleCollaborationgraph()

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

Definition at line 4033 of file commentscan.l.

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

◆ handleConcept()

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

Definition at line 3145 of file commentscan.l.

3146{
3147 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3148 yyextra->currentCmd = cmd;
3149 yyextra->currentMakeEntryType = EntryType::makeConceptDoc;
3150 BEGIN( ConceptDocArg1 );
3151 return checkStructuralIndicator(yyscanner);
3152}

References checkStructuralIndicator().

◆ handleCopyBrief()

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

Definition at line 4298 of file commentscan.l.

4299{
4300 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4301 if (yyextra->current->brief.stripWhiteSpace().empty() && yyextra->current->doc.stripWhiteSpace().empty())
4302 { // if we don't have a brief or detailed description yet,
4303 // then the @copybrief should end up in the brief description.
4304 // otherwise it will be copied inline (see bug691315 & bug700788)
4305 setOutput(yyscanner,OutputBrief);
4306 }
4307 if (!yyextra->spaceBeforeCmd.empty())
4308 {
4309 addOutput(yyscanner,yyextra->spaceBeforeCmd);
4310 yyextra->spaceBeforeCmd.clear();
4311 }
4312 addOutput(yyscanner,"\\copybrief ");
4313 return false;
4314}

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

◆ handleCopyDetails()

bool handleCopyDetails ( 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 setOutput(yyscanner,OutputDoc);
4320 if (!yyextra->spaceBeforeCmd.empty())
4321 {
4322 addOutput(yyscanner,yyextra->spaceBeforeCmd);
4323 yyextra->spaceBeforeCmd.clear();
4324 }
4325 addOutput(yyscanner,"\\copydetails ");
4326 return false;
4327}

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

◆ handleCopyDoc()

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

Definition at line 4329 of file commentscan.l.

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

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

◆ handleDef()

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

Definition at line 3066 of file commentscan.l.

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

References checkStructuralIndicator().

◆ handleDefGroup()

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

Definition at line 3093 of file commentscan.l.

3094{
3095 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3096 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeGroupDoc);
3097 yyextra->current->groupDocType = Entry::GROUPDOC_NORMAL;
3098 BEGIN( GroupDocArg1 );
3099 return stop;
@ GROUPDOC_NORMAL
defgroup
Definition entry.h:120
3100}

References Entry::GROUPDOC_NORMAL, and makeStructuralIndicator().

◆ handleDeprecated()

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

Definition at line 3376 of file commentscan.l.

3377{
3378 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3379 yyextra->newXRefKind = XRef_Deprecated;
3380 setOutput(yyscanner,OutputXRef);
3381 yyextra->xrefKind = XRef_Deprecated;
3382 yyextra->current->spec.setDeprDoc(true);
3383 return false;
3384}

References OutputXRef, setOutput(), and XRef_Deprecated.

◆ handleDetails()

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

Definition at line 3306 of file commentscan.l.

3307{
3308 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3309 if (yyextra->inContext!=OutputBrief)
3310 {
3311 addOutput(yyscanner," \\ilinebr\\ilinebr "); // treat @details outside brief description
3312 // as a new paragraph
3313 }
3314 setOutput(yyscanner,OutputDoc);
3315 return false;
3316}

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

◆ handleDir()

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

Definition at line 3275 of file commentscan.l.

3276{
3277 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3278 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeDirDoc);
3279 if (!stop) yyextra->current->name = yyextra->fileName;
3280 BEGIN( FileDocArg1 );
3281 return stop;
3282}

References makeStructuralIndicator().

◆ handleDirectoryGraph()

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

Definition at line 4019 of file commentscan.l.

4020{
4021 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4022 yyextra->current->commandOverrides.override_directoryGraph(true); // ON
4023 return false;
4024}

◆ handleElse()

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

Definition at line 3837 of file commentscan.l.

3838{
3839 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3840 if (yyextra->guards->empty())
3841 {
3842 warn(yyextra->fileName,yyextra->lineNr,
3843 "found \\else without matching start command");
3844 }
3845 else if (yyextra->guards->top().hasElse())
3846 {
3847 warn(yyextra->fileName,yyextra->lineNr,
3848 "found multiple \\else commands in same \\if construct");
3849 yyextra->guards->top().setEnabled(false);
3850 yyextra->guards->top().setElse();
3851 BEGIN( SkipGuardedSection );
3852 }
3853 else
3854 {
3855 yyextra->guards->top().setElse();
3856 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
3857 if (yyextra->guards->top().isEnabledFound())
3858 {
3859 yyextra->guards->top().setEnabled(false);
3860 BEGIN( SkipGuardedSection );
3861 }
3862 else
3863 {
3864 yyextra->guards->top().setEnabled(true);
3865 BEGIN( GuardParamEnd );
3866 }
3867 }
3868 return false;
3869}

References warn.

◆ handleElseIf()

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

Definition at line 3810 of file commentscan.l.

3811{
3812 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3813 if (yyextra->guards->empty())
3814 {
3815 warn(yyextra->fileName,yyextra->lineNr,
3816 "found \\elseif without matching start command");
3817 }
3818 else if (yyextra->guards->top().hasElse())
3819 {
3820 warn(yyextra->fileName,yyextra->lineNr,
3821 "found \\elseif command after \\else command was given in \\if construct");
3822 yyextra->guardType = Guard_ElseIf;
3823 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
3824 yyextra->guards->top().setEnabled(false);
3825 BEGIN(GuardParam);
3826 }
3827 else
3828 {
3829 yyextra->guardType = Guard_ElseIf;
3830 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
3831 yyextra->guards->top().setEnabled(false);
3832 BEGIN(GuardParam);
3833 }
3834 return false;
3835}

References Guard_ElseIf, and warn.

◆ handleEndIf()

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

Definition at line 3871 of file commentscan.l.

3872{
3873 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3874 if (yyextra->guards->empty())
3875 {
3876 warn(yyextra->fileName,yyextra->lineNr,
3877 "found \\endif without matching start command");
3878 }
3879 else
3880 {
3881 yyextra->guards->pop();
3882 }
3883 if (!yyextra->spaceBeforeCmd.empty())
3884 {
3885 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3886 yyextra->spaceBeforeCmd.clear();
3887 }
3888 if (yyextra->guards->empty())
3889 {
3890 BEGIN( GuardParamEnd );
3891 }
3892 else
3893 {
3894 if (yyextra->guards->top().isEnabled())
3895 {
3896 BEGIN( GuardParamEnd );
3897 }
3898 else
3899 {
3900 BEGIN( SkipGuardedSection );
3901 }
3902 }
3903 return false;
3904}

References addOutput(), and warn.

◆ handleEndParBlock()

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

Definition at line 3412 of file commentscan.l.

3413{
3414 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3415 if (!yyextra->insideParBlock)
3416 {
3417 warn(yyextra->fileName,yyextra->lineNr,
3418 "found \\endparblock command without matching \\parblock!");
3419 }
3420 addOutput(yyscanner,"@endparblock");
3421 setOutput(yyscanner,OutputDoc); // to end a parblock inside a xrefitem like context
3422 yyextra->insideParBlock = false;
3423 return false;
3424}

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

◆ handleEnum()

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

Definition at line 3085 of file commentscan.l.

3086{
3087 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3088 yyextra->currentMakeEntryType = EntryType::makeEnumDoc;
3089 BEGIN( EnumDocArg1 );
3090 return checkStructuralIndicator(yyscanner);
3091}

References checkStructuralIndicator().

◆ handleExample()

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

Definition at line 3284 of file commentscan.l.

3285{
3286 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3287 MakeEntryType sectionMaker = EntryType::makeExample;
3288 for (const auto &opt : optList)
3289 {
3290 if (opt=="lineno")
3291 {
3292 sectionMaker=EntryType::makeExampleLineno;
3293 }
3294 else
3295 {
3296 warn(yyextra->fileName,yyextra->lineNr,
3297 "unsupported option '{}' for command '\\{}'",opt,cmd);
3298 }
3299 }
3300 bool stop=makeStructuralIndicator(yyscanner,sectionMaker);
3301 if (!stop) yyextra->current->name = yyextra->fileName;
3302 BEGIN( FileDocArg1 );
3303 return stop;
EntryType(* MakeEntryType)()
3304}

References makeStructuralIndicator(), and warn.

◆ handleExtends()

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

Definition at line 4290 of file commentscan.l.

4291{
4292 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4293 yyextra->currentCmd = cmd;
4294 BEGIN(ExtendsParam);
4295 return false;
4296}

◆ handleFile()

bool handleFile ( 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::makeFileDoc);
3249 if (!stop)
3250 {
3251 yyextra->current->name = yyextra->fileName;
3252 }
3253 BEGIN( FileDocArg1 );
3254 return stop;
3255}

References makeStructuralIndicator().

◆ handleFileInfo()

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

Definition at line 3653 of file commentscan.l.

3654{
3655 return handleFileInfoResult(yyscanner,cmdName, optList, false);
static bool handleFileInfoResult(yyscan_t yyscanner, const DString &, const StringVector &optList, bool isSection)
3656}

References handleFileInfoResult().

◆ handleFileInfoResult()

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

Definition at line 3678 of file commentscan.l.

3679{
3680 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3681 if (!yyextra->spaceBeforeCmd.empty())
3682 {
3683 if (isSection) yyextra->sectionTitle+=yyextra->spaceBeforeCmd;
3684 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3685 yyextra->spaceBeforeCmd.clear();
3686 }
3687 bool first = true;
3688 FileInfo fi(yyextra->fileName.str());
3689 for (const auto &opt_ : optList)
3690 {
3691 DString optStripped = DString(opt_).stripWhiteSpace();
3692 std::string opt = optStripped.lower().str();
3693 DString result = fileInfoLookup(fi,opt);
3694 if (!result.empty())
3695 {
3696 if (!first)
3697 {
3698 warn(yyextra->fileName,yyextra->lineNr,"Multiple options specified with \\fileinfo, discarding '{}'", optStripped);
3699 }
3700 else
3701 {
3702 addOutput(yyscanner,result);
3703 if (isSection)
3704 {
3705 yyextra->sectionTitle+=result;
3706 }
3707 }
3708 first = false;
3709 }
3710 else
3711 {
3712 warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\fileinfo: '{}'", optStripped);
3713 }
3714 }
3715 if (first) // no options specified
3716 {
3717 if (Config_getBool(FULL_PATH_NAMES))
3718 {
3719 if (isSection) yyextra->sectionTitle+=stripFromPath(yyextra->fileName);
3720 addOutput(yyscanner,stripFromPath(yyextra->fileName));
3721 }
3722 else
3723 {
3724 if (isSection) yyextra->sectionTitle+=yyextra->fileName;
3725 addOutput(yyscanner,yyextra->fileName);
3726 }
3727 }
3728 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
3729}

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

Referenced by handleFileInfo(), and handleFileInfoSection().

◆ handleFileInfoSection()

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

Definition at line 3657 of file commentscan.l.

3658{
3659 return handleFileInfoResult(yyscanner,cmdName, optList, true);
3660}

References handleFileInfoResult().

◆ handleFn()

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

Definition at line 3055 of file commentscan.l.

3056{
3057 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3058 yyextra->braceCount=0;
3059 yyextra->functionProto.clear();
3060 yyextra->currentCmd = cmd;
3061 yyextra->currentMakeEntryType = EntryType::makeMemberDoc;
3062 BEGIN( FnParam );
3063 return checkStructuralIndicator(yyscanner);
3064}

References checkStructuralIndicator().

◆ handleFormatBlock()

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

Definition at line 3610 of file commentscan.l.

3611{
3612 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3613 if (!yyextra->spaceBeforeCmd.empty())
3614 {
3615 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3616 yyextra->spaceBeforeCmd.clear();
3617 }
3618 if (s=="mermaid")
3619 {
3621 }
3622 if (optList.empty())
3623 {
3624 addOutput(yyscanner,"@"+s+" ");
3625 }
3626 else
3627 {
3628 addOutput(yyscanner,"@"+s+"{"+DString(join(optList,","))+"} ");
3629 }
3630 //printf("handleFormatBlock(%s) with option(%s)\n",qPrint(s),qPrint(opt));
3631 yyextra->blockName=s;
3632 yyextra->commentCount=0;
3633 BEGIN(FormatBlock);
3634 return false;
static MermaidManager & instance()
Definition mermaid.cpp:38
void setHasInlineDiagrams()
Definition mermaid.cpp:248
3635}

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

◆ handleGroupgraph()

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

Definition at line 4047 of file commentscan.l.

4048{
4049 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4050 yyextra->current->commandOverrides.override_groupGraph(true); // ON
4051 return false;
4052}

◆ handleGuard()

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

Definition at line 5113 of file commentscan.l.

5114{
5115 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
5116 CondParser prs;
5117 bool sectionEnabled = false;
5118 if (!expr.empty())
5119 {
5120 sectionEnabled=prs.parse(yyextra->fileName,yyextra->lineNr,expr.stripWhiteSpace());
5121 }
5122 bool parentEnabled = yyextra->guards->top().parentVisible();
5123 if (parentEnabled)
5124 {
5125 if (
5126 (sectionEnabled && yyextra->guardType==Guard_If) ||
5127 (!sectionEnabled && yyextra->guardType==Guard_IfNot)
5128 ) // section is visible
5129 {
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.
5130
5131 yyextra->guards->top().setEnabled(true);
5132 yyextra->guards->top().setEnabledFound();
5133 BEGIN( GuardParamEnd );
5134 }
5135 else if (yyextra->guardType==Guard_ElseIf)
5136 {
5137 if (yyextra->guards->top().isEnabledFound())
5138 {
5139 yyextra->guards->top().setEnabled(false);
5140 BEGIN( SkipGuardedSection );
5141 }
5142 else if (sectionEnabled)
5143 {
5144 yyextra->guards->top().setEnabled(true);
5145 yyextra->guards->top().setEnabledFound();
5146 BEGIN( GuardParamEnd );
5147 }
5148 else
5149 {
5150 yyextra->guards->top().setEnabled(false);
5151 BEGIN( SkipGuardedSection );
5152 }
5153 }
5154 else // section is invisible
5155 {
5156 BEGIN( SkipGuardedSection );
5157 }
5158 }
5159 else // invisible because of parent
5160 {
5161 BEGIN( SkipGuardedSection );
5162 }
5163}

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

◆ handleHeaderFile()

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

Definition at line 3163 of file commentscan.l.

3164{
3165 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3166 BEGIN( ClassDocArg2 );
3167 return false;
3168}

◆ handleHideCallergraph()

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

Definition at line 3956 of file commentscan.l.

3957{
3958 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3959 yyextra->current->commandOverrides.override_callerGraph(false); // OFF
3960 return false;
3961}

◆ handleHideCallgraph()

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

Definition at line 3942 of file commentscan.l.

3943{
3944 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3945 yyextra->current->commandOverrides.override_callGraph(false); // OFF
3946 return false;
3947}

◆ handleHideCollaborationgraph()

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

Definition at line 4040 of file commentscan.l.

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

◆ handleHideDirectoryGraph()

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

Definition at line 4026 of file commentscan.l.

4027{
4028 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4029 yyextra->current->commandOverrides.override_directoryGraph(false); // OFF
4030 return false;
4031}

◆ handleHideEnumValues()

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

Definition at line 3970 of file commentscan.l.

3971{
3972 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3973 yyextra->current->commandOverrides.override_enumValues(false); // OFF
3974 return false;
3975}

◆ handleHideGroupgraph()

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

Definition at line 4054 of file commentscan.l.

4055{
4056 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4057 yyextra->current->commandOverrides.override_groupGraph(false); // OFF
4058 return false;
4059}

◆ handleHideIncludedBygraph()

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

Definition at line 4012 of file commentscan.l.

4013{
4014 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4015 yyextra->current->commandOverrides.override_includedByGraph(false); // OFF
4016 return false;
4017}

◆ handleHideIncludegraph()

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

Definition at line 4005 of file commentscan.l.

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

◆ handleHideInheritanceGraph()

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

Definition at line 4100 of file commentscan.l.

4101{
4102 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4103 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::NO); // OFF
4104 return false;
4105}

◆ handleHideInitializer()

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

Definition at line 3928 of file commentscan.l.

3929{
3930 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3931 yyextra->current->initLines = 0; // OFF
3932 return false;
3933}

◆ handleHideInlineSource()

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

Definition at line 3984 of file commentscan.l.

3985{
3986 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3987 yyextra->current->commandOverrides.override_inlineSource(false); // OFF
3988 return false;
3989}

◆ handleHideReferencedByRelation()

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

Definition at line 4114 of file commentscan.l.

4115{
4116 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4117 yyextra->current->commandOverrides.override_referencedByRelation(false); // OFF
4118 return false;
4119}

◆ handleHideReferencesRelation()

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

Definition at line 4128 of file commentscan.l.

4129{
4130 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4131 yyextra->current->commandOverrides.override_referencesRelation(false); // OFF
4132 return false;
4133}

◆ handleIdlException()

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

Definition at line 3215 of file commentscan.l.

3216{
3217 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3218 yyextra->currentCmd = cmd;
3219 yyextra->currentMakeEntryType = EntryType::makeExceptionDoc;
3220 BEGIN( ClassDocArg1 );
3221 return checkStructuralIndicator(yyscanner);
3222}

References checkStructuralIndicator().

◆ handleIf()

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

Definition at line 3774 of file commentscan.l.

3775{
3776 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3777 yyextra->guardType = Guard_If;
3778 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
3779 if (yyextra->guards->empty())
3780 {
3781 yyextra->guards->emplace(true);
3782 }
3783 else
3784 {
3785 bool enabled = yyextra->guards->top().isEnabled();
3786 yyextra->guards->emplace(enabled);
3787 }
3788 BEGIN(GuardParam);
3789 return false;
3790}

References Guard_If.

◆ handleIFile()

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

Definition at line 3751 of file commentscan.l.

3752{
3753 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3754 addOutput(yyscanner,yytext);
3755 BEGIN(IFile);
3756 return false;
3757}

References addOutput().

◆ handleIfNot()

bool handleIfNot ( 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 yyextra->guardType = Guard_IfNot;
3796 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
3797 if (yyextra->guards->empty())
3798 {
3799 yyextra->guards->emplace(true);
3800 }
3801 else
3802 {
3803 bool enabled = yyextra->guards->top().isEnabled();
3804 yyextra->guards->emplace(enabled);
3805 }
3806 BEGIN(GuardParam);
3807 return false;
3808}

References Guard_IfNot.

◆ handleILine()

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

Definition at line 3743 of file commentscan.l.

3744{
3745 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3746 addOutput(yyscanner,yytext);
3747 BEGIN(ILine);
3748 return false;
3749}

References addOutput().

◆ handleImage()

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

Definition at line 3565 of file commentscan.l.

3566{
3567 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3568 for (const auto &opt : optList)
3569 {
3570 DString locOpt(opt);
3571 locOpt = locOpt.stripWhiteSpace();
3572 if (locOpt.lower().startsWith("anchor:"))
3573 {
3574 addAnchor(yyscanner,locOpt.mid(7));
3575 break; // real option handling will be done later on
3576 }
3577 }
3578 if (optList.empty())
3579 {
3580 addOutput(yyscanner,"@"+s+" ");
3581 }
3582 else
3583 {
3584 addOutput(yyscanner,"@"+s+"{"+DString(join(optList,","))+"} ");
3585 }
3586 BEGIN(Comment);
3587 return false;
static void addAnchor(yyscan_t yyscanner, const DString &anchor, const DString &title="")
3588}

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

◆ handleIncludedBygraph()

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

Definition at line 3998 of file commentscan.l.

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

◆ handleIncludegraph()

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

Definition at line 3991 of file commentscan.l.

3992{
3993 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3994 yyextra->current->commandOverrides.override_includeGraph(true); // ON
3995 return false;
3996}

◆ handleIngroup()

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

Definition at line 3906 of file commentscan.l.

3907{
3908 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3909 yyextra->inGroupParamFound=false;
3910 BEGIN( InGroupParam );
3911 return false;
3912}

◆ handleInherit()

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

Definition at line 4283 of file commentscan.l.

4284{
4285 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4286 BEGIN(InheritParam);
4287 return false;
4288}

◆ handleInheritanceGraph()

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

Definition at line 4061 of file commentscan.l.

4062{
4063 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4064 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::YES);
4065 for (const auto &opt_ : optList)
4066 {
4067 DString opt = DString(opt_).stripWhiteSpace().lower();
4068 if (!opt.empty())
4069 {
4070 if (opt == "yes")
4071 {
4072 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::YES);
4073 }
4074 else if (opt == "graph")
4075 {
4076 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::GRAPH);
4077 }
4078 else if (opt == "builtin")
4079 {
4080 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::BUILTIN);
4081 }
4082 else if (opt == "text")
4083 {
4084 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::TEXT);
4085 }
4086 else if (opt == "no")
4087 {
4088 yyextra->current->commandOverrides.override_inheritanceGraph(CLASS_GRAPH_t::NO);
4089 }
4090 else
4091 {
4092 warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\inheritancegraph: '{}'",
4093 DString(opt_).stripWhiteSpace());
4094 }
4095 }
4096 }
4097 return false;
4098}

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

◆ handleInterface()

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

Definition at line 3206 of file commentscan.l.

3207{
3208 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3209 yyextra->currentCmd = cmd;
3210 yyextra->currentMakeEntryType = EntryType::makeInterfaceDoc;
3211 BEGIN( ClassDocArg1 );
3212 return checkStructuralIndicator(yyscanner);
3213}

References checkStructuralIndicator().

◆ handleInternal()

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

Definition at line 4143 of file commentscan.l.

4144{
4145 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4146 if (!Config_getBool(INTERNAL_DOCS))
4147 {
4148 // make sure some whitespace before a \internal command
4149 // is not treated as "documentation"
4150 if (yyextra->current->doc.stripWhiteSpace().empty())
4151 {
4152 yyextra->current->doc.clear();
4153 }
4154 yyextra->condCount=0;
4155 BEGIN( SkipInternal );
4156 }
4157 else
4158 {
4159 // re-enabled for bug640828
4160 addOutput(yyscanner," \\internal ");
4161 yyextra->inInternalDocs = true;
4162 }
4163 return false;
4164}

References addOutput(), and Config_getBool.

◆ handleIPrefix()

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

Definition at line 3766 of file commentscan.l.

3767{
3768 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3769 addOutput(yyscanner,"@iprefix ");
3770 BEGIN(IRaisePrefix);
3771 return false;
3772}

References addOutput().

◆ handleIRaise()

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

Definition at line 3759 of file commentscan.l.

3760{
3761 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3762 BEGIN(IRaise);
3763 return false;
3764}

◆ handleLineInfo()

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

Definition at line 3731 of file commentscan.l.

3732{
3733 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3734 if (!yyextra->spaceBeforeCmd.empty())
3735 {
3736 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3737 yyextra->spaceBeforeCmd.clear();
3738 }
3739 addOutput(yyscanner,DString().setNum(yyextra->lineNr));
3740 return false;
3741}

References addOutput().

◆ handleMainpage()

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

Definition at line 3232 of file commentscan.l.

3233{
3234 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3235 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeMainpageDoc);
3236 if (!stop)
3237 {
3238 yyextra->current->name = "mainpage";
3239 }
3240 setOutput(yyscanner,OutputDoc);
3241 BEGIN( PageDocArg2 );
3242 return stop;
3243}

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

◆ handleMemberOf()

bool handleMemberOf ( 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::MemberOf;
3463 yyextra->currentCmd = cmd;
3464 BEGIN(RelatesParam1);
3465 return false;
3466}

References warn.

◆ handleMermaidFile()

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

Definition at line 3637 of file commentscan.l.

3638{
3639 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3641 addOutput(yyscanner,yytext);
3642 return false;
3643}

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

◆ handleModule()

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

Definition at line 3154 of file commentscan.l.

3155{
3156 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3157 yyextra->currentCmd = cmd;
3158 yyextra->currentMakeEntryType = EntryType::makeModuleDoc;
3159 BEGIN( ModuleDocArg1 );
3160 return checkStructuralIndicator(yyscanner);
3161}

References checkStructuralIndicator().

◆ handleName()

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

Definition at line 3333 of file commentscan.l.

3334{
3335 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3336 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeMemberGrp);
3337 if (!stop)
3338 {
3339 yyextra->docGroup.clearHeader();
3340 BEGIN( NameParam );
3341 if (!yyextra->docGroup.empty()) // end of previous member group
3342 {
3343 yyextra->docGroup.close(yyextra->current,yyextra->fileName,yyextra->lineNr,true,true);
3344 }
3345 }
3346 return stop;
3347}

References makeStructuralIndicator().

◆ handleNamespace()

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

Definition at line 3120 of file commentscan.l.

3121{
3122 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3123 yyextra->currentMakeEntryType = EntryType::makeNamespaceDoc;
3124 BEGIN( NameSpaceDocArg1 );
3125 return checkStructuralIndicator(yyscanner);
3126}

References checkStructuralIndicator().

◆ handleNoop()

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

Definition at line 3326 of file commentscan.l.

3327{
3328 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3329 BEGIN( Noop );
3330 return false;
3331}

◆ handleNoSubGrouping()

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

Definition at line 3914 of file commentscan.l.

3915{
3916 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3917 yyextra->current->subGrouping = false;
3918 return false;
3919}

◆ handleOverload()

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

Definition at line 3077 of file commentscan.l.

3078{
3079 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3080 yyextra->functionProto.clear();
3081 BEGIN(OverloadParam);
3082 return false;
3083}

◆ handlePackage()

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

Definition at line 3128 of file commentscan.l.

3129{
3130 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3131 bool stop=makeStructuralIndicator(yyscanner,EntryType::makePackageDoc);
3132 BEGIN( PackageDocArg1 );
3133 return stop;
3134}

References makeStructuralIndicator().

◆ handlePage()

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

Definition at line 3224 of file commentscan.l.

3225{
3226 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3227 bool stop=makeStructuralIndicator(yyscanner,EntryType::makePageDoc);
3228 BEGIN( PageDocArg1 );
3229 return stop;
3230}

References makeStructuralIndicator().

◆ handleParam()

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

Definition at line 3257 of file commentscan.l.

3258{
3259 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3260 // we need process param and retval arguments to escape leading underscores in case of
3261 // markdown processing, see bug775493
3262 addOutput(yyscanner,"@param ");
3263 BEGIN( ParamArg1 );
3264 return false;
3265}

References addOutput().

◆ handleParBlock()

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

Definition at line 3394 of file commentscan.l.

3395{
3396 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3397 if (yyextra->insideParBlock)
3398 {
3399 warn(yyextra->fileName,yyextra->lineNr,
3400 "found \\parblock command while already in a parblock!");
3401 }
3402 if (!yyextra->spaceBeforeCmd.empty())
3403 {
3404 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3405 yyextra->spaceBeforeCmd.clear();
3406 }
3407 addOutput(yyscanner,"@parblock ");
3408 yyextra->insideParBlock = true;
3409 return false;
3410}

References addOutput(), and warn.

◆ handlePrivate()

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

Definition at line 4180 of file commentscan.l.

4181{
4182 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4183 yyextra->current->protection = Protection::Private;
4184 return false;
4185}

◆ handlePrivateSection()

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

Definition at line 4187 of file commentscan.l.

4188{
4189 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4190 yyextra->current->protection = yyextra->protection = Protection::Private;
4191 return false;
4192}

◆ handleProtected()

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

Definition at line 4194 of file commentscan.l.

4195{
4196 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4197 yyextra->current->protection = Protection::Protected;
4198 return false;
4199}

◆ handleProtectedSection()

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

Definition at line 4201 of file commentscan.l.

4202{
4203 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4204 yyextra->current->protection = yyextra->protection = Protection::Protected ;
4205 return false;
4206}

◆ handleProtocol()

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

Definition at line 3170 of file commentscan.l.

3171{ // Obj-C protocol
3172 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3173 yyextra->currentCmd = cmd;
3174 yyextra->currentMakeEntryType = EntryType::makeProtocolDoc;
3175 BEGIN( ClassDocArg1 );
3176 return checkStructuralIndicator(yyscanner);
3177}

References checkStructuralIndicator().

◆ handlePublic()

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

Definition at line 4208 of file commentscan.l.

4209{
4210 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4211 yyextra->current->protection = Protection::Public;
4212 return false;
4213}

◆ handlePublicSection()

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

Definition at line 4215 of file commentscan.l.

4216{
4217 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4218 yyextra->current->protection = yyextra->protection = Protection::Public;
4219 return false;
4220}

◆ handlePure()

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

Definition at line 4173 of file commentscan.l.

4174{
4175 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4176 yyextra->current->virt = Specifier::Pure;
4177 return false;
4178}

◆ handleQualifier()

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

Definition at line 4135 of file commentscan.l.

4136{
4137 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4138 yyextra->currentCmd = cmd;
4139 BEGIN(Qualifier);
4140 return false;
4141}

◆ handleRaiseWarning()

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

Definition at line 3318 of file commentscan.l.

3319{
3320 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3321 yyextra->raiseWarning = "";
3322 BEGIN( RaiseWarning );
3323 return false;
3324}

◆ handleReferencedByRelation()

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

Definition at line 4107 of file commentscan.l.

4108{
4109 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4110 yyextra->current->commandOverrides.override_referencedByRelation(true); // ON
4111 return false;
4112}

◆ handleReferencesRelation()

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

Definition at line 4121 of file commentscan.l.

4122{
4123 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4124 yyextra->current->commandOverrides.override_referencesRelation(true); // ON
4125 return false;
4126}

◆ handleRefItem()

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

Definition at line 3468 of file commentscan.l.

3469{
3470 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3471 addOutput(yyscanner,"@refitem ");
3472 BEGIN(LineParam);
3473 return false;
3474}

References addOutput().

◆ handleRelated()

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

Definition at line 3426 of file commentscan.l.

3427{
3428 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3429 if (!yyextra->current->relates.empty())
3430 {
3431 warn(yyextra->fileName,yyextra->lineNr,
3432 "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
3433 }
3434 yyextra->current->relatesType = RelatesType::Simple;
3435 yyextra->currentCmd = cmd;
3436 BEGIN(RelatesParam1);
3437 return false;
3438}

References warn.

◆ handleRelatedAlso()

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

Definition at line 3440 of file commentscan.l.

3441{
3442 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3443 if (!yyextra->current->relates.empty())
3444 {
3445 warn(yyextra->fileName,yyextra->lineNr,
3446 "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
3447 }
3448 yyextra->current->relatesType = RelatesType::Duplicate;
3449 yyextra->currentCmd = cmd;
3450 BEGIN(RelatesParam1);
3451 return false;
3452}

References warn.

◆ handleRequirement()

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

Definition at line 3506 of file commentscan.l.

3507{
3508 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3509 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeRequirementDoc);
3510 BEGIN( RequirementLabel );
3511 return stop;
3512}

References makeStructuralIndicator().

◆ handleRetval()

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

Definition at line 3267 of file commentscan.l.

3268{
3269 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3270 addOutput(yyscanner,"@retval ");
3271 BEGIN( ParamArg1 );
3272 return false;
3273}

References addOutput().

◆ handleSatisfies()

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

Definition at line 3514 of file commentscan.l.

3515{
3516 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3517 BEGIN( SatisfiesLabel );
3518 return false;
3519}

◆ handleSection()

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

Definition at line 3476 of file commentscan.l.

3477{
3478 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3479 setOutput(yyscanner,OutputDoc);
3480 //printf("handleSection(%s) raiseLevel=%d\n",qPrint(s),yyextra->raiseLevel);
3481 BEGIN(SectionLabel);
3482 yyextra->sectionLabel.clear();
3483 // determine natural section level
3484 if (s=="section") yyextra->sectionLevel=SectionType::Section;
3485 else if (s=="subsection") yyextra->sectionLevel=SectionType::Subsection;
3486 else if (s=="subsubsection") yyextra->sectionLevel=SectionType::Subsubsection;
3487 else if (s=="paragraph") yyextra->sectionLevel=SectionType::Paragraph;
3488 else if (s=="subparagraph") yyextra->sectionLevel=SectionType::Subparagraph;
3489 else if (s=="subsubparagraph") yyextra->sectionLevel=SectionType::Subsubparagraph;
3490 // raise it if requested
3491 yyextra->sectionLevel = std::min(yyextra->sectionLevel + yyextra->raiseLevel,SectionType::MaxLevel);
3492 // rewrite the update section level to the output
3493 switch (yyextra->sectionLevel)
3494 {
3495 case SectionType::Section: addOutput(yyscanner,"@section "); break;
3496 case SectionType::Subsection: addOutput(yyscanner,"@subsection "); break;
3497 case SectionType::Subsubsection: addOutput(yyscanner,"@subsubsection "); break;
3498 case SectionType::Paragraph: addOutput(yyscanner,"@paragraph "); break;
3499 case SectionType::Subparagraph: addOutput(yyscanner,"@subparagraph "); break;
3500 case SectionType::Subsubparagraph: addOutput(yyscanner,"@subsubparagraph "); break;
3501 default: addOutput(yyscanner,"@"+s+" "); break;
3502 }
3503 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
3504}

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

◆ handleShowEnumValues()

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

Definition at line 3963 of file commentscan.l.

3964{
3965 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3966 yyextra->current->commandOverrides.override_enumValues(true); // ON
3967 return false;
3968}

◆ handleShowInitializer()

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

Definition at line 3921 of file commentscan.l.

3922{
3923 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3924 yyextra->current->initLines = 100000; // ON
3925 return false;
3926}

◆ handleShowInlineSource()

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

Definition at line 3977 of file commentscan.l.

3978{
3979 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3980 yyextra->current->commandOverrides.override_inlineSource(true); // ON
3981 return false;
3982}

◆ handleStatic()

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

Definition at line 4166 of file commentscan.l.

4167{
4168 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4169 yyextra->current->isStatic = true;
4170 return false;
4171}

◆ handleStruct()

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

Definition at line 3197 of file commentscan.l.

3198{
3199 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3200 yyextra->currentCmd = cmd;
3201 yyextra->currentMakeEntryType = EntryType::makeStructDoc;
3202 BEGIN( ClassDocArg1 );
3203 return checkStructuralIndicator(yyscanner);
3204}

References checkStructuralIndicator().

◆ handleSubpage()

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

Definition at line 3528 of file commentscan.l.

3529{
3530 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3531 if (!yyextra->current->section.isEmpty() &&
3532 !yyextra->current->section.isPageDoc() &&
3533 !yyextra->current->section.isMainpageDoc()
3534 )
3535 {
3536 warn(yyextra->fileName,yyextra->lineNr,
3537 "found \\subpage command in a comment block that is not marked as a page!");
3538 }
3539 if (!yyextra->spaceBeforeCmd.empty())
3540 {
3541 addOutput(yyscanner,yyextra->spaceBeforeCmd);
3542 yyextra->spaceBeforeCmd.clear();
3543 }
3544 addOutput(yyscanner,"@"+s+" ");
3545 BEGIN(SubpageLabel);
3546 return false;
3547}

References addOutput(), and warn.

◆ handleTest()

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

Definition at line 3358 of file commentscan.l.

3359{
3360 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3361 yyextra->newXRefKind = XRef_Test;
3362 setOutput(yyscanner,OutputXRef);
3363 yyextra->xrefKind = XRef_Test;
3364 return false;
3365}

References OutputXRef, setOutput(), and XRef_Test.

◆ handleToc()

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

Definition at line 4222 of file commentscan.l.

4223{
4224 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4225 if (yyextra->current->section.isPageDoc() ||
4226 yyextra->current->section.isMainpageDoc())
4227 {
4228 for (const auto &opt_ : optList)
4229 {
4230 DString opt = DString(opt_).stripWhiteSpace().lower();
4231 int level = SectionType::MaxLevel;
4232 size_t i = opt.find(':');
4233 if (i!=DString::npos && i>0) // found ':' but not on position 0 what would mean just a level
4234 {
4235 char dum=0;
4236 if (sscanf(opt.mid(i+1).data(),"%d%c",&level,&dum) != 1)
4237 {
4238 warn(yyextra->fileName,yyextra->lineNr,"Unknown option:level specified with \\tableofcontents: '{}'",
4239 qPrint(DString(opt_).stripWhiteSpace()));
4240 opt = "";
4241 }
4242 else
4243 {
4244 level = level<=0 ? SectionType::MaxLevel : std::min(level,SectionType::MaxLevel);
4245 opt = opt.left(i).stripWhiteSpace();
4246 }
4247 }
4248 if (!opt.empty())
4249 {
4250 if (opt == "html")
4251 {
4252 yyextra->current->localToc.enableHtml(level);
4253 }
4254 else if (opt == "latex")
4255 {
4256 yyextra->current->localToc.enableLatex(level);
4257 }
4258 else if (opt == "xml")
4259 {
4260 yyextra->current->localToc.enableXml(level);
4261 }
4262 else if (opt == "docbook")
4263 {
4264 yyextra->current->localToc.enableDocbook(level);
4265 }
4266 else
4267 {
4268 warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\tableofcontents: '{}'",
4269 DString(opt_).stripWhiteSpace());
4270 }
4271 }
4272 }
4273 if (yyextra->current->localToc.nothingEnabled())
4274 {
4275 // for backward compatibility
4276 yyextra->current->localToc.enableHtml(SectionType::MaxLevel);
4277 yyextra->current->localToc.enableXml(SectionType::MaxLevel);
4278 }
4279 }
4280 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
4281}

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

◆ handleTodo()

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

Definition at line 3349 of file commentscan.l.

3350{
3351 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3352 yyextra->newXRefKind = XRef_Todo;
3353 setOutput(yyscanner,OutputXRef);
3354 yyextra->xrefKind = XRef_Todo;
3355 return false;
3356}

References OutputXRef, setOutput(), and XRef_Todo.

◆ handleUnion()

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

Definition at line 3188 of file commentscan.l.

3189{
3190 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3191 yyextra->currentCmd = cmd;
3192 yyextra->currentMakeEntryType = EntryType::makeUnionDoc;
3193 BEGIN( ClassDocArg1 );
3194 return checkStructuralIndicator(yyscanner);
3195}

References checkStructuralIndicator().

◆ handleVerifies()

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

Definition at line 3521 of file commentscan.l.

3522{
3523 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3524 BEGIN( VerifiesLabel );
3525 return false;
3526}

◆ handleWeakGroup()

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

Definition at line 3111 of file commentscan.l.

3112{
3113 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3114 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeGroupDoc);
3115 yyextra->current->groupDocType = Entry::GROUPDOC_WEAK;
3116 BEGIN( GroupDocArg1 );
3117 return stop;
@ GROUPDOC_WEAK
weakgroup
Definition entry.h:122
3118}

References Entry::GROUPDOC_WEAK, and makeStructuralIndicator().

◆ handleXRefItem()

bool handleXRefItem ( 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_Item;
3390 BEGIN(XRefItemParam1);
3391 return false;
3392}

References XRef_Item.

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 4352 of file commentscan.l.

4353{
4354 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4355 yyextra->sectionLabel.clear();
4356 yyextra->sectionTitle.clear();
4357 yyextra->docGroup.clearHeader();
4358 yyextra->insideParBlock = false;
4359}

Referenced by CommentScanner::parseCommentBlock().

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 4396 of file commentscan.l.

4397{
4398 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4399 for( const char* c = yytext ; *c ; ++c )
4400 yyextra->lineNr += (*c == '\n') ;
4401}

◆ makeStructuralIndicator()

bool makeStructuralIndicator ( yyscan_t yyscanner,
MakeEntryType maker )
static

Definition at line 4370 of file commentscan.l.

4371{
4372 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4373 ASSERT(maker!=nullptr); // detect programming error
4374 //printf("yyextra->current->section=%x\n",yyextra->current->section);
4375 if (yyextra->current->section.isDoc())
4376 {
4377 return true;
4378 }
4379 else if (maker)
4380 {
4381 yyextra->needNewEntry = true;
4382 yyextra->current->section = maker();
4383 yyextra->current->fileName = yyextra->fileName;
4384 yyextra->current->startLine = yyextra->lineNr;
4385 if (yyextra->current->docLine == -1) yyextra->current->docLine = yyextra->lineNr;
4386 return false;
4387 }
4388 else
4389 {
4390 return false;
4391 }
#define ASSERT(x)
Definition message.h:142
4392}

References ASSERT.

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

◆ sectionLevelToType()

SectionType sectionLevelToType ( int level)
static

Definition at line 4586 of file commentscan.l.

4587{
4588 if (level>=0 && level<SectionType::MaxLevel) return SectionType(level);
4589 return SectionType::Anchor;
4590}

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

Referenced by addSection().

◆ setOutput()

void setOutput ( yyscan_t yyscanner,
OutputContext ctx )
inlinestatic

Definition at line 4684 of file commentscan.l.

4685{
4686 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4687 bool xrefAppendToPrev = yyextra->xrefAppendFlag;
4688 // determine append flag for the next item (i.e. the end of this item)
4689 yyextra->xrefAppendFlag = !yyextra->inBody &&
4690 yyextra->inContext==OutputXRef && ctx==OutputXRef && // two consecutive xref items
4691 yyextra->newXRefKind==yyextra->xrefKind && // of the same kind
4692 (yyextra->xrefKind!=XRef_Item ||
4693 yyextra->newXRefItemKey==yyextra->xrefItemKey); // with the same key if \xrefitem
4694 //printf("%d && %d && %d && (%d || %d)\n",
4695 // yyextra->inContext==OutputXRef,
4696 // ctx==OutputXRef,
4697 // yyextra->newXRefKind==yyextra->xrefKind,
4698 // yyextra->xrefKind!=XRef_Item,
4699 // yyextra->newXRefItemKey==yyextra->xrefItemKey);
4700 //printf("refKind=%d yyextra->newXRefKind=%d xrefAppendToPrev=%d yyextra->xrefAppendFlag=%d\n",
4701 // yyextra->xrefKind,yyextra->newXRefKind,xrefAppendToPrev,yyextra->xrefAppendFlag);
4702
4703 //printf("setOutput(yyscanner,yyextra->inContext=%d ctx=%d)\n",yyextra->inContext,ctx);
4704 if (yyextra->inContext==OutputXRef) // end of XRef section => add the item
4705 {
4706 // See if we can append this new xref item to the previous one.
4707 // We know this at the start of the next item of the same
4708 // type and need to remember this until the end of that item.
4709 switch(yyextra->xrefKind)
4710 {
4711 case XRef_Todo:
4712 addXRefItem(yyscanner,DString("todo"),
4715 xrefAppendToPrev
4716 );
4717 break;
4718 case XRef_Test:
4719 addXRefItem(yyscanner,DString("test"),
4722 xrefAppendToPrev
4723 );
4724 break;
4725 case XRef_Bug:
4726 addXRefItem(yyscanner,DString("bug"),
4729 xrefAppendToPrev
4730 );
4731 break;
4732 case XRef_Deprecated:
4733 addXRefItem(yyscanner,DString("deprecated"),
4736 xrefAppendToPrev || yyextra->current->spec.isDeprAttr()
4737 );
4738 break;
4739 case XRef_Item: // user defined list
4740 addXRefItem(yyscanner,yyextra->xrefItemKey,
4741 yyextra->xrefItemTitle,
4742 yyextra->xrefListTitle,
4743 xrefAppendToPrev
4744 );
4745 break;
4746 case XRef_None:
4747 ASSERT(0);
4748 break;
4749 }
4750 }
4751 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
4752
4753 int oldContext = yyextra->inContext;
4754 yyextra->inContext = ctx;
4755 if (yyextra->inContext!=OutputXRef && yyextra->inBody) yyextra->inContext=OutputInbody;
4756 switch(yyextra->inContext)
4757 {
4758 case OutputDoc:
4759 if (oldContext!=yyextra->inContext)
4760 {
4761 stripTrailingWhiteSpace(yyextra->current->doc);
4762 if (yyextra->current->doc.empty()) yyextra->current->docLine = yyextra->lineNr;
4763 if (yyextra->current->docFile.empty())
4764 {
4765 yyextra->current->docFile = yyextra->fileName;
4766 yyextra->current->docLine = yyextra->lineNr;
4767 }
4768 }
4769 yyextra->pOutputString = &yyextra->current->doc;
4770 break;
4771 case OutputBrief:
4772 {
4773 if (oldContext!=yyextra->inContext)
4774 {
4775 if (yyextra->current->brief.empty()) yyextra->current->briefLine = yyextra->lineNr;
4776 if (yyextra->current->briefFile.empty())
4777 {
4778 yyextra->current->briefFile = yyextra->fileName;
4779 yyextra->current->briefLine = yyextra->lineNr;
4780 }
4781 }
4782 bool foundMatch = false;
4783 if (yyextra->current->brief.stripWhiteSpace().empty()) // we only want one brief
4784 // description even if multiple
4785 // are given...
4786 {
4787 foundMatch = true;
4788 }
4789 else
4790 {
4791 std::string str = yyextra->current->brief.str();
4793 if (reg::match(str,match,nonBrief_re)) // match found
4794 {
4795 size_t cnt = 0;
4796 for (size_t i = 0; i < match[2].str().size(); i++)
4797 {
4798 if (match[2].str()[i] == '\n') cnt++;
4799 }
4800 if (cnt>0)
4801 {
4802 yyextra->current->brief = yyextra->current->brief.left(yyextra->current->brief.length()-cnt);
4803 // set warning line correct
4804 yyextra->current->brief += " \\iline " + DString().setNum(cnt + static_cast<int>(std::stoul(match[1].str()))) + " \\ilinebr ";
4805 }
4806 foundMatch = true;
4807 }
4808 }
4809 if (foundMatch)
4810 {
4811 yyextra->pOutputString = &yyextra->current->brief;
4812 }
4813 else
4814 {
4815 if (!yyextra->current->doc.empty()) // when appending parts add a new line
4816 {
4817 yyextra->current->doc += "\n";
4818 }
4819 yyextra->pOutputString = &yyextra->current->doc;
4820 yyextra->inContext = OutputDoc; // need to switch to detailed docs, see bug 631380
4821 }
4822 }
4823 break;
4824 case OutputXRef:
4825 yyextra->pOutputString = &yyextra->outputXRef;
4826 // first item found, so can't append to previous
4827 //yyextra->xrefAppendFlag = false;
4828 break;
4829 case OutputInbody:
4830 yyextra->pOutputString = &yyextra->current->inbodyDocs;
4831 break;
4832 }
DString & setNum(short n)
Definition dstring.h:552
static void stripTrailingWhiteSpace(DString &s)
4833}

References addXRefItem(), ASSERT, reg::match(), nonBrief_re, OutputBrief, OutputDoc, 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, and XRef_Todo.

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 4405 of file commentscan.l.

4406{
4407 DString name;
4408 if (s==nullptr || *s==0) return name;
4409 name=s;
4410 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
4411 {
4412 name=name.mid(1,name.length()-2);
4413 }
4414 return name;
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
4415}

References DString::at(), DString::length(), and DString::mid().

◆ stripTrailingWhiteSpace()

void stripTrailingWhiteSpace ( DString & s)
static

Definition at line 4656 of file commentscan.l.

4657{
4658 size_t len = s.length();
4659 int i = (int)len-1;
4660 while (i>=0)
4661 {
4662 char c = s.at(i);
4663 if (c==' ' || c=='\t' || c=='\r') // normal whitespace
4664 {
4665 i--;
4666 }
4667 else if (c=='r' && i>=7 && literal_at(s.data()+i-7,"\\ilinebr")) // special line break marker
4668 {
4669 i-=8;
4670 }
4671 else // non-whitespace
4672 {
4673 break;
4674 }
4675 }
4676 //printf("stripTrailingWhitespace(%s) i=%d len=%d\n",qPrint(s),i,len);
4677 if (i!=(int)len-1)
4678 {
4679 s.resize(i+1); // string up to and including char at pos i
4680 }
void resize(size_t newlen)
Definition dstring.h:209
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
4681}

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

Referenced by setOutput().

◆ yylex()

int yylex ( yyscan_t yyscanner)

Definition at line 718 of file commentscan.l.

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

◆ yyread()

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

Definition at line 4935 of file commentscan.l.

4936{
4937 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4938 yyextra->prevPosition=yyextra->inputPosition;
4939 int c=0;
4940 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
4941 {
4942 *buf = yyextra->inputString[yyextra->inputPosition++] ;
4943 //printf("%d (%c)\n",*buf,*buf);
4944 c++; buf++;
4945 }
4946 return c;
4947}

Variable Documentation

◆ docCmdMap

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

Definition at line 211 of file commentscan.l.

Referenced by CommentScanner::isCommand().

◆ g_citeMutex

std::mutex g_citeMutex
static

Definition at line 539 of file commentscan.l.

Referenced by addCite().

◆ g_formulaMutex

std::mutex g_formulaMutex
static

Definition at line 538 of file commentscan.l.

Referenced by addFormula().

◆ g_sectionMutex

std::mutex g_sectionMutex
static

Definition at line 537 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().