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

Macro Definition Documentation

◆ unput_string

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

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

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

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

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

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

◆ addFormula()

DString addFormula ( yyscan_t yyscanner)
static

Definition at line 4562 of file commentscan.l.

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

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

◆ addIline()

void addIline ( yyscan_t yyscanner,
int lineNr )
static

Definition at line 4890 of file commentscan.l.

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

References addOutput().

Referenced by endBrief().

◆ addIlineBreak()

void addIlineBreak ( yyscan_t yyscanner,
int lineNr )
static

Definition at line 4897 of file commentscan.l.

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

References addOutput().

◆ addOutput() [1/3]

void addOutput ( yyscan_t yyscanner,
char c )
inlinestatic

Definition at line 4884 of file commentscan.l.

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

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

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

◆ addRequirementId()

void addRequirementId ( yyscan_t yyscanner)
static

Definition at line 4418 of file commentscan.l.

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

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

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

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

◆ addXRefItem()

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

Definition at line 4527 of file commentscan.l.

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

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

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

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

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

References warn.

Referenced by CommentScanner::parseCommentBlock().

◆ checkStructuralIndicator()

bool checkStructuralIndicator ( yyscan_t yyscanner)
static

Definition at line 4362 of file commentscan.l.

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

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

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

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

◆ escapeLabel()

void escapeLabel ( DString & label)
static

Definition at line 4539 of file commentscan.l.

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

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

◆ fileInfoLookup()

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

Definition at line 3661 of file commentscan.l.

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

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

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

References addOutput().

◆ handleAddToGroup()

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

Definition at line 3096 of file commentscan.l.

3097{
3098 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3099 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeGroupDoc);
3100 yyextra->current->groupDocType = Entry::GROUPDOC_ADD;
3101 BEGIN( GroupDocArg1 );
3102 return stop;
@ GROUPDOC_ADD
addtogroup
Definition entry.h:121
static bool makeStructuralIndicator(yyscan_t yyscanner, MakeEntryType maker)
3103}

References Entry::GROUPDOC_ADD, and makeStructuralIndicator().

◆ handleAnchor()

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

Definition at line 3543 of file commentscan.l.

3544{
3545 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3546 addOutput(yyscanner,"@"+s+" ");
3547 if (optList.empty())
3548 {
3549 yyextra -> anchorTitle = "";
3550 }
3551 else
3552 {
3553 yyextra -> anchorTitle = join(optList," ");
3554 }
3555 BEGIN(AnchorLabel);
3556 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
3557}

References addOutput(), and join().

◆ handleBrief()

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

Definition at line 3042 of file commentscan.l.

3043{
3044 //printf("handleBrief\n");
3045 setOutput(yyscanner,OutputBrief);
3046 return false;
3047}

References OutputBrief, and setOutput().

◆ handleBug()

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

Definition at line 3361 of file commentscan.l.

3362{
3363 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3364 yyextra->newXRefKind = XRef_Bug;
3365 setOutput(yyscanner,OutputXRef);
3366 yyextra->xrefKind = XRef_Bug;
3367 return false;
3368}

References OutputXRef, setOutput(), and XRef_Bug.

◆ handleCallergraph()

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

Definition at line 3948 of file commentscan.l.

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

◆ handleCallgraph()

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

Definition at line 3934 of file commentscan.l.

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

◆ handleCategory()

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

Definition at line 3173 of file commentscan.l.

3174{ // Obj-C category
3175 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3176 yyextra->currentCmd = cmd;
3177 yyextra->currentMakeEntryType = EntryType::makeCategoryDoc;
3178 BEGIN( CategoryDocArg1 );
3179 return checkStructuralIndicator(yyscanner);
static bool checkStructuralIndicator(yyscan_t yyscanner)
3180}

References checkStructuralIndicator().

◆ handleCite()

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

Definition at line 3589 of file commentscan.l.

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

References addOutput(), and join().

◆ handleClass()

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

Definition at line 3130 of file commentscan.l.

3131{
3132 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3133 yyextra->currentCmd = cmd;
3134 yyextra->currentMakeEntryType = EntryType::makeClassDoc;
3135 BEGIN( ClassDocArg1 );
3136 return checkStructuralIndicator(yyscanner);
3137}

References checkStructuralIndicator().

◆ handleCollaborationgraph()

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

Definition at line 4032 of file commentscan.l.

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

◆ handleConcept()

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

Definition at line 3139 of file commentscan.l.

3140{
3141 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3142 yyextra->currentCmd = cmd;
3143 yyextra->currentMakeEntryType = EntryType::makeConceptDoc;
3144 BEGIN( ConceptDocArg1 );
3145 return checkStructuralIndicator(yyscanner);
3146}

References checkStructuralIndicator().

◆ handleCopyBrief()

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

Definition at line 4297 of file commentscan.l.

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

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

◆ handleCopyDetails()

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

Definition at line 4315 of file commentscan.l.

4316{
4317 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4318 setOutput(yyscanner,OutputDoc);
4319 if (!yyextra->spaceBeforeCmd.empty())
4320 {
4321 addOutput(yyscanner,yyextra->spaceBeforeCmd);
4322 yyextra->spaceBeforeCmd.clear();
4323 }
4324 addOutput(yyscanner,"\\copydetails ");
4325 return false;
4326}

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

◆ handleCopyDoc()

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

Definition at line 4328 of file commentscan.l.

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

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

◆ handleDef()

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

Definition at line 3060 of file commentscan.l.

3061{
3062 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3063 yyextra->functionProto.clear();
3064 yyextra->braceCount=0;
3065 yyextra->currentCmd = cmd;
3066 yyextra->currentMakeEntryType = EntryType::makeDefineDoc;
3067 BEGIN( FnParam );
3068 return checkStructuralIndicator(yyscanner);
3069}

References checkStructuralIndicator().

◆ handleDefGroup()

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

Definition at line 3087 of file commentscan.l.

3088{
3089 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3090 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeGroupDoc);
3091 yyextra->current->groupDocType = Entry::GROUPDOC_NORMAL;
3092 BEGIN( GroupDocArg1 );
3093 return stop;
@ GROUPDOC_NORMAL
defgroup
Definition entry.h:120
3094}

References Entry::GROUPDOC_NORMAL, and makeStructuralIndicator().

◆ handleDeprecated()

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

Definition at line 3370 of file commentscan.l.

3371{
3372 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3373 yyextra->newXRefKind = XRef_Deprecated;
3374 setOutput(yyscanner,OutputXRef);
3375 yyextra->xrefKind = XRef_Deprecated;
3376 yyextra->current->spec.setDeprDoc(true);
3377 return false;
3378}

References OutputXRef, setOutput(), and XRef_Deprecated.

◆ handleDetails()

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

Definition at line 3300 of file commentscan.l.

3301{
3302 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3303 if (yyextra->inContext!=OutputBrief)
3304 {
3305 addOutput(yyscanner," \\ilinebr\\ilinebr "); // treat @details outside brief description
3306 // as a new paragraph
3307 }
3308 setOutput(yyscanner,OutputDoc);
3309 return false;
3310}

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

◆ handleDir()

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

Definition at line 3269 of file commentscan.l.

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

References makeStructuralIndicator().

◆ handleDirectoryGraph()

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

Definition at line 4018 of file commentscan.l.

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

◆ handleElse()

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

Definition at line 3836 of file commentscan.l.

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

References warn.

◆ handleElseIf()

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

Definition at line 3809 of file commentscan.l.

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

References Guard_ElseIf, and warn.

◆ handleEndIf()

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

Definition at line 3870 of file commentscan.l.

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

References addOutput(), and warn.

◆ handleEndParBlock()

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

Definition at line 3406 of file commentscan.l.

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

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

◆ handleEnum()

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

Definition at line 3079 of file commentscan.l.

3080{
3081 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3082 yyextra->currentMakeEntryType = EntryType::makeEnumDoc;
3083 BEGIN( EnumDocArg1 );
3084 return checkStructuralIndicator(yyscanner);
3085}

References checkStructuralIndicator().

◆ handleExample()

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

Definition at line 3278 of file commentscan.l.

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

References makeStructuralIndicator(), and warn.

◆ handleExtends()

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

Definition at line 4289 of file commentscan.l.

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

◆ handleFile()

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

Definition at line 3239 of file commentscan.l.

3240{
3241 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3242 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeFileDoc);
3243 if (!stop)
3244 {
3245 yyextra->current->name = yyextra->fileName;
3246 }
3247 BEGIN( FileDocArg1 );
3248 return stop;
3249}

References makeStructuralIndicator().

◆ handleFileInfo()

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

Definition at line 3652 of file commentscan.l.

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

References handleFileInfoResult().

◆ handleFileInfoResult()

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

Definition at line 3677 of file commentscan.l.

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

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

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

References handleFileInfoResult().

◆ handleFn()

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

Definition at line 3049 of file commentscan.l.

3050{
3051 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3052 yyextra->braceCount=0;
3053 yyextra->functionProto.clear();
3054 yyextra->currentCmd = cmd;
3055 yyextra->currentMakeEntryType = EntryType::makeMemberDoc;
3056 BEGIN( FnParam );
3057 return checkStructuralIndicator(yyscanner);
3058}

References checkStructuralIndicator().

◆ handleFormatBlock()

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

Definition at line 3609 of file commentscan.l.

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

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

◆ handleGroupgraph()

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

Definition at line 4046 of file commentscan.l.

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

◆ handleGuard()

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

Definition at line 5112 of file commentscan.l.

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

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

3158{
3159 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3160 BEGIN( ClassDocArg2 );
3161 return false;
3162}

◆ handleHideCallergraph()

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

Definition at line 3955 of file commentscan.l.

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

◆ handleHideCallgraph()

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

Definition at line 3941 of file commentscan.l.

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

◆ handleHideCollaborationgraph()

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

Definition at line 4039 of file commentscan.l.

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

◆ handleHideDirectoryGraph()

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

Definition at line 4025 of file commentscan.l.

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

◆ handleHideEnumValues()

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

Definition at line 3969 of file commentscan.l.

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

◆ handleHideGroupgraph()

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

Definition at line 4053 of file commentscan.l.

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

◆ handleHideIncludedBygraph()

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

Definition at line 4011 of file commentscan.l.

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

◆ handleHideIncludegraph()

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

Definition at line 4004 of file commentscan.l.

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

◆ handleHideInheritanceGraph()

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

Definition at line 4099 of file commentscan.l.

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

◆ handleHideInitializer()

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

Definition at line 3927 of file commentscan.l.

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

◆ handleHideInlineSource()

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

Definition at line 3983 of file commentscan.l.

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

◆ handleHideReferencedByRelation()

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

Definition at line 4113 of file commentscan.l.

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

◆ handleHideReferencesRelation()

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

Definition at line 4127 of file commentscan.l.

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

◆ handleIdlException()

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

Definition at line 3209 of file commentscan.l.

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

References checkStructuralIndicator().

◆ handleIf()

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

Definition at line 3773 of file commentscan.l.

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

References Guard_If.

◆ handleIFile()

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

Definition at line 3750 of file commentscan.l.

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

References addOutput().

◆ handleIfNot()

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

Definition at line 3791 of file commentscan.l.

3792{
3793 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3794 yyextra->guardType = Guard_IfNot;
3795 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
3796 if (yyextra->guards->empty())
3797 {
3798 yyextra->guards->emplace(true);
3799 }
3800 else
3801 {
3802 bool enabled = yyextra->guards->top().isEnabled();
3803 yyextra->guards->emplace(enabled);
3804 }
3805 BEGIN(GuardParam);
3806 return false;
3807}

References Guard_IfNot.

◆ handleILine()

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

Definition at line 3742 of file commentscan.l.

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

References addOutput().

◆ handleImage()

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

Definition at line 3559 of file commentscan.l.

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

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

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

◆ handleIncludegraph()

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

Definition at line 3990 of file commentscan.l.

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

◆ handleIngroup()

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

Definition at line 3905 of file commentscan.l.

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

◆ handleInherit()

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

Definition at line 4282 of file commentscan.l.

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

◆ handleInheritanceGraph()

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

Definition at line 4060 of file commentscan.l.

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

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

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

References checkStructuralIndicator().

◆ handleInternal()

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

Definition at line 4142 of file commentscan.l.

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

References addOutput(), and Config_getBool.

◆ handleIPrefix()

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

Definition at line 3765 of file commentscan.l.

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

References addOutput().

◆ handleIRaise()

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

Definition at line 3758 of file commentscan.l.

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

◆ handleLineInfo()

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

Definition at line 3730 of file commentscan.l.

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

References addOutput().

◆ handleMainpage()

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

Definition at line 3226 of file commentscan.l.

3227{
3228 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3229 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeMainpageDoc);
3230 if (!stop)
3231 {
3232 yyextra->current->name = "mainpage";
3233 }
3234 setOutput(yyscanner,OutputDoc);
3235 BEGIN( PageDocArg2 );
3236 return stop;
3237}

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

◆ handleMemberOf()

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

Definition at line 3448 of file commentscan.l.

3449{
3450 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3451 if (!yyextra->current->relates.empty())
3452 {
3453 warn(yyextra->fileName,yyextra->lineNr,
3454 "found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
3455 }
3456 yyextra->current->relatesType = RelatesType::MemberOf;
3457 yyextra->currentCmd = cmd;
3458 BEGIN(RelatesParam1);
3459 return false;
3460}

References warn.

◆ handleMermaidFile()

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

Definition at line 3636 of file commentscan.l.

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

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

◆ handleModule()

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

Definition at line 3148 of file commentscan.l.

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

References checkStructuralIndicator().

◆ handleName()

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

Definition at line 3327 of file commentscan.l.

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

References makeStructuralIndicator().

◆ handleNamespace()

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

Definition at line 3114 of file commentscan.l.

3115{
3116 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3117 yyextra->currentMakeEntryType = EntryType::makeNamespaceDoc;
3118 BEGIN( NameSpaceDocArg1 );
3119 return checkStructuralIndicator(yyscanner);
3120}

References checkStructuralIndicator().

◆ handleNoop()

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

Definition at line 3320 of file commentscan.l.

3321{
3322 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3323 BEGIN( Noop );
3324 return false;
3325}

◆ handleNoSubGrouping()

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

Definition at line 3913 of file commentscan.l.

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

◆ handleOverload()

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

Definition at line 3071 of file commentscan.l.

3072{
3073 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3074 yyextra->functionProto.clear();
3075 BEGIN(OverloadParam);
3076 return false;
3077}

◆ handlePackage()

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

Definition at line 3122 of file commentscan.l.

3123{
3124 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3125 bool stop=makeStructuralIndicator(yyscanner,EntryType::makePackageDoc);
3126 BEGIN( PackageDocArg1 );
3127 return stop;
3128}

References makeStructuralIndicator().

◆ handlePage()

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

Definition at line 3218 of file commentscan.l.

3219{
3220 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3221 bool stop=makeStructuralIndicator(yyscanner,EntryType::makePageDoc);
3222 BEGIN( PageDocArg1 );
3223 return stop;
3224}

References makeStructuralIndicator().

◆ handleParam()

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

Definition at line 3251 of file commentscan.l.

3252{
3253 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3254 // we need process param and retval arguments to escape leading underscores in case of
3255 // markdown processing, see bug775493
3256 addOutput(yyscanner,"@param ");
3257 BEGIN( ParamArg1 );
3258 return false;
3259}

References addOutput().

◆ handleParBlock()

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

Definition at line 3388 of file commentscan.l.

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

References addOutput(), and warn.

◆ handlePrivate()

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

Definition at line 4179 of file commentscan.l.

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

◆ handlePrivateSection()

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

Definition at line 4186 of file commentscan.l.

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

◆ handleProtected()

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

Definition at line 4193 of file commentscan.l.

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

◆ handleProtectedSection()

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

Definition at line 4200 of file commentscan.l.

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

◆ handleProtocol()

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

Definition at line 3164 of file commentscan.l.

3165{ // Obj-C protocol
3166 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3167 yyextra->currentCmd = cmd;
3168 yyextra->currentMakeEntryType = EntryType::makeProtocolDoc;
3169 BEGIN( ClassDocArg1 );
3170 return checkStructuralIndicator(yyscanner);
3171}

References checkStructuralIndicator().

◆ handlePublic()

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

Definition at line 4207 of file commentscan.l.

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

◆ handlePublicSection()

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

Definition at line 4214 of file commentscan.l.

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

◆ handlePure()

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

Definition at line 4172 of file commentscan.l.

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

◆ handleQualifier()

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

Definition at line 4134 of file commentscan.l.

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

◆ handleRaiseWarning()

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

Definition at line 3312 of file commentscan.l.

3313{
3314 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3315 yyextra->raiseWarning = "";
3316 BEGIN( RaiseWarning );
3317 return false;
3318}

◆ handleReferencedByRelation()

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

Definition at line 4106 of file commentscan.l.

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

◆ handleReferencesRelation()

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

Definition at line 4120 of file commentscan.l.

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

◆ handleRefItem()

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

Definition at line 3462 of file commentscan.l.

3463{
3464 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3465 addOutput(yyscanner,"@refitem ");
3466 BEGIN(LineParam);
3467 return false;
3468}

References addOutput().

◆ handleRelated()

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

Definition at line 3420 of file commentscan.l.

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

References warn.

◆ handleRelatedAlso()

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

Definition at line 3434 of file commentscan.l.

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

References warn.

◆ handleRequirement()

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

Definition at line 3500 of file commentscan.l.

3501{
3502 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3503 bool stop=makeStructuralIndicator(yyscanner,EntryType::makeRequirementDoc);
3504 BEGIN( RequirementLabel );
3505 return stop;
3506}

References makeStructuralIndicator().

◆ handleRetval()

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

Definition at line 3261 of file commentscan.l.

3262{
3263 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3264 addOutput(yyscanner,"@retval ");
3265 BEGIN( ParamArg1 );
3266 return false;
3267}

References addOutput().

◆ handleSatisfies()

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

Definition at line 3508 of file commentscan.l.

3509{
3510 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3511 BEGIN( SatisfiesLabel );
3512 return false;
3513}

◆ handleSection()

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

Definition at line 3470 of file commentscan.l.

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

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

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

◆ handleShowInitializer()

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

Definition at line 3920 of file commentscan.l.

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

◆ handleShowInlineSource()

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

Definition at line 3976 of file commentscan.l.

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

◆ handleStatic()

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

Definition at line 4165 of file commentscan.l.

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

◆ handleStruct()

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

Definition at line 3191 of file commentscan.l.

3192{
3193 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3194 yyextra->currentCmd = cmd;
3195 yyextra->currentMakeEntryType = EntryType::makeStructDoc;
3196 BEGIN( ClassDocArg1 );
3197 return checkStructuralIndicator(yyscanner);
3198}

References checkStructuralIndicator().

◆ handleSubpage()

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

Definition at line 3522 of file commentscan.l.

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

References addOutput(), and warn.

◆ handleTest()

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

Definition at line 3352 of file commentscan.l.

3353{
3354 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3355 yyextra->newXRefKind = XRef_Test;
3356 setOutput(yyscanner,OutputXRef);
3357 yyextra->xrefKind = XRef_Test;
3358 return false;
3359}

References OutputXRef, setOutput(), and XRef_Test.

◆ handleToc()

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

Definition at line 4221 of file commentscan.l.

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

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

3344{
3345 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3346 yyextra->newXRefKind = XRef_Todo;
3347 setOutput(yyscanner,OutputXRef);
3348 yyextra->xrefKind = XRef_Todo;
3349 return false;
3350}

References OutputXRef, setOutput(), and XRef_Todo.

◆ handleUnion()

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

Definition at line 3182 of file commentscan.l.

3183{
3184 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3185 yyextra->currentCmd = cmd;
3186 yyextra->currentMakeEntryType = EntryType::makeUnionDoc;
3187 BEGIN( ClassDocArg1 );
3188 return checkStructuralIndicator(yyscanner);
3189}

References checkStructuralIndicator().

◆ handleVerifies()

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

Definition at line 3515 of file commentscan.l.

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

◆ handleWeakGroup()

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

Definition at line 3105 of file commentscan.l.

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

References Entry::GROUPDOC_WEAK, and makeStructuralIndicator().

◆ handleXRefItem()

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

Definition at line 3380 of file commentscan.l.

3381{
3382 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3383 yyextra->newXRefKind = XRef_Item;
3384 BEGIN(XRefItemParam1);
3385 return false;
3386}

References XRef_Item.

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 4351 of file commentscan.l.

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

Referenced by CommentScanner::parseCommentBlock().

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 4395 of file commentscan.l.

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

◆ makeStructuralIndicator()

bool makeStructuralIndicator ( yyscan_t yyscanner,
MakeEntryType maker )
static

Definition at line 4369 of file commentscan.l.

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

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

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

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

Referenced by addSection().

◆ setOutput()

void setOutput ( yyscan_t yyscanner,
OutputContext ctx )
inlinestatic

Definition at line 4683 of file commentscan.l.

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

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

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

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

◆ stripTrailingWhiteSpace()

void stripTrailingWhiteSpace ( DString & s)
static

Definition at line 4655 of file commentscan.l.

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

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 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 if (yyextra->current->includeFile!="<>")
1517 {
1518 yyextra->current->includeName = yyextra->current->includeFile;
1519 }
1520 unput_string(yytext,yyleng);
1521 BEGIN( Comment );
1522 }
1523<ClassDocArg3>. { // ignore other stuff
1524 }
1525
1526 /* --------- handle arguments of {def,add,weak}group commands --------- */
1527
1528<GroupDocArg1>{LABELID}(".html"|".xhtml")? { // group name
1529 yyextra->current->name = yytext;
1530 //lastDefGroup.groupname = yytext;
1531 //lastDefGroup.pri = yyextra->current->groupingPri();
1532 // the .html stuff is for Qt compatibility
1533 if (yyextra->current->name.endsWith(".html"))
1534 {
1535 yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-5);
1536 }
1537 else if (yyextra->current->name.endsWith(".xhtml"))
1538 {
1539 yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-6);
1540 }
1541 yyextra->current->type.clear();
1542 BEGIN(GroupDocArg2);
1543 }
1544<GroupDocArg1>"\\"{B}*"\n" { // line continuation
1545 yyextra->lineNr++;
1546 addOutput(yyscanner,'\n');
1547 }
1548<GroupDocArg1>{DOCNL} { // missing argument!
1549 warn(yyextra->fileName,yyextra->lineNr,
1550 "missing group name after {}",
1551 yyextra->current->groupDocCmd()
1552 );
1553 //addOutput(yyscanner,'\n');
1554 //if (*yytext=='\n') yyextra->lineNr++;
1555 unput_string(yytext,yyleng);
1556 BEGIN( Comment );
1557 }
1558<GroupDocArg1>. { // ignore other stuff
1559 }
1560<GroupDocArg2>"\\"{B}*"\n" { // line continuation
1561 yyextra->lineNr++;
1562 addOutput(yyscanner,'\n');
1563 }
1564<GroupDocArg2>[^\n\\‍]+ { // title (stored in type)
1565 yyextra->current->type += yytext;
1566 }
1567<GroupDocArg2>{DOCNL}+ {
1568 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
1569 if ( yyextra->current->groupDocType==Entry::GROUPDOC_NORMAL &&
1570 yyextra->current->type.empty()
1571 ) // defgroup requires second argument
1572 {
1573 warn(yyextra->fileName,yyextra->lineNr,
1574 "missing title after "
1575 "\\defgroup {}", yyextra->current->name
1576 );
1577 }
1578 unput_string(yytext,yyleng);
1579 int extraLineNr = 0;
1580 if (yyextra->inContext == OutputBrief)
1581 {
1582 for (int i = 0; i < yyleng; i++)
1583 {
1584 if (yytext[i]=='\n') extraLineNr++;
1585 }
1586 }
1587 //if (*yytext=='\n') yyextra->lineNr++;
1588 //addOutput(yyscanner,'\n');
1589 if ( yyextra->current->groupDocType!=Entry::GROUPDOC_NORMAL)
1590 {
1591 addOutput(yyscanner," \\ifile \""+ yyextra->fileName);
1592 addOutput(yyscanner,"\" \\iline " + DString().setNum(yyextra->lineNr + extraLineNr) + " \\ilinebr ");
1593 }
1594 BEGIN( Comment );
1595 }
1596<GroupDocArg2>. { // title (stored in type)
1597 yyextra->current->type += yytext;
1598 }
1599
1600 /* --------- handle arguments of page/mainpage command ------------------- */
1601
1602<PageDocArg1>[^\n]*"\\ilinebr @ianchor"\{[^\‍]\n]*\}{B}{FILE} { // special case where the Markdown processor has rewritten
1603 // "@page label Title" as
1604 // "@page md_label Title\ilinebr @ianchor{Title} label"
1605 DString text = yytext;
1606 size_t start = text.find('{');
1607 size_t end = text.find('}',start+1);
1608 yyextra->current->name = text.mid(end+2);
1609 size_t istart = yyextra->current->name.find("\\ilinebr");
1610 if (istart != DString::npos)
1611 {
1612 DString rest = yyextra->current->name.mid(istart);
1613 unput_string(rest,rest.length());
1614 yyextra->current->name = yyextra->current->name.left(istart);
1615 }
1616 yyextra->current->args = text.mid(start+1,end-start-1);
1617 //printf("name='%s' title='%s'\n",qPrint(yyextra->current->name),qPrint(yyextra->current->args));
1618 BEGIN( PageDocArg2 );
1619 }
DirIterator end(const DirIterator &) noexcept
Definition dir.cpp:181
1620<PageDocArg1>{FILE} { // first argument; page name
1621 yyextra->current->name = stripQuotes(yytext);
1622 yyextra->current->args = "";
1623 BEGIN( PageDocArg2 );
1624 }
static DString stripQuotes(const char *s)
1625<PageDocArg1>{LC} { yyextra->lineNr++;
1626 addOutput(yyscanner,'\n');
1627 }
1628<PageDocArg1>{DOCNL} {
1629 warn(yyextra->fileName,yyextra->lineNr,
1630 "missing argument after \\page."
1631 );
1632 unput_string(yytext,yyleng);
1633 //if (*yytext=='\n') yyextra->lineNr++;
1634 //addOutput(yyscanner,'\n');
1635 BEGIN( Comment );
1636 }
1637<PageDocArg1>. { // ignore other stuff
1638 }
1639<PageDocArg2>{DOCNL} { // second argument; page title
1640 unput_string(yytext,yyleng);
1641 //if (*yytext=='\n') yyextra->lineNr++;
1642 //addOutput(yyscanner,'\n');
1643 addOutput(yyscanner," \\ifile \""+ yyextra->fileName);
1644 addOutput(yyscanner,"\" \\iline " + DString().setNum(yyextra->lineNr) + " \\ilinebr ");
1645 BEGIN( Comment );
1646 }
1647<PageDocArg2>{CMD}[<>] {
1648 // bug 748927
1649 DString tmp(yytext);
1650 tmp = substitute(substitute(tmp,"@<","&lt;"),"@>","&gt;");
1651 tmp = substitute(substitute(tmp,"\\<","&lt;"),"\\>","&gt;");
1652 yyextra->current->args += tmp;
1653 }
1654<PageDocArg2>. {
1655 yyextra->current->args += yytext;
1656 }
1657 /* --------- handle arguments of the param command ------------ */
1658<ParamArg1>{ID}/{B}*"," {
1659 addOutput(yyscanner,yytext);
1660 }
1661<ParamArg1>"," {
1662 addOutput(yyscanner," , ");
1663 }
1664<ParamArg1>{DOCNL} {
1665 if (*yytext=='\n') yyextra->lineNr++;
1666 addOutput(yyscanner," ");
1667 }
1668<ParamArg1>{ID} {
1669 addOutput(yyscanner,yytext);
1670 BEGIN( Comment );
1671 }
1672<ParamArg1>. {
1673 unput(yytext[0]);
1674 BEGIN( Comment );
1675 }
1676
1677 /* --------- handle arguments of the file/dir/example command ------------ */
1678
1679<FileDocArg1>{DOCNL} { // no file name specified
1680 unput_string(yytext,yyleng);
1681 //if (*yytext=='\n') yyextra->lineNr++;
1682 //addOutput(yyscanner,'\n');
1683 BEGIN( Comment );
1684 }
1685<FileDocArg1>{FILE} { // first argument; name
1686 yyextra->current->name = stripQuotes(yytext);
1687 BEGIN( Comment );
1688 }
1689<FileDocArg1>{LC} { yyextra->lineNr++;
1690 addOutput(yyscanner,'\n');
1691 }
1692<FileDocArg1>. { // ignore other stuff
1693 }
1694
1695 /* --------- handle arguments of the xrefitem command ------------ */
1696
1697<XRefItemParam1>{LABELID} { // first argument
1698 yyextra->newXRefItemKey=yytext;
1699 setOutput(yyscanner,OutputXRef);
1700 BEGIN(XRefItemParam2);
1701 }
1702<XRefItemParam1>{LC} { // line continuation
1703 yyextra->lineNr++;
1704 addOutput(yyscanner,'\n');
1705 }
1706<XRefItemParam1>{DOCNL} { // missing arguments
1707 warn(yyextra->fileName,yyextra->lineNr,
1708 "Missing first argument of \\xrefitem"
1709 );
1710 if (*yytext=='\n') yyextra->lineNr++;
1711 addOutput(yyscanner,'\n');
1712 yyextra->inContext = OutputDoc;
1713 BEGIN( Comment );
1714 }
1715<XRefItemParam1>. { // ignore other stuff
1716 }
1717
1718<XRefItemParam2>"\""[^\n\"]*"\"" { // second argument
1719 yyextra->xrefItemTitle = stripQuotes(yytext);
1720 BEGIN(XRefItemParam3);
1721 }
1722<XRefItemParam2>{LC} { // line continuation
1723 yyextra->lineNr++;
1724 addOutput(yyscanner,'\n');
1725 }
1726<XRefItemParam2>{DOCNL} { // missing argument
1727 warn(yyextra->fileName,yyextra->lineNr,
1728 "Missing second argument of \\xrefitem"
1729 );
1730 if (*yytext=='\n') yyextra->lineNr++;
1731 addOutput(yyscanner,'\n');
1732 yyextra->inContext = OutputDoc;
1733 BEGIN( Comment );
1734 }
1735<XRefItemParam2>. { // ignore other stuff
1736 }
1737
1738<XRefItemParam3>"\""[^\n\"]*"\"" { // third argument
1739 yyextra->xrefListTitle = stripQuotes(yytext);
1740 yyextra->xrefKind = XRef_Item;
1741 BEGIN( Comment );
1742 }
1743<XRefItemParam2,XRefItemParam3>{LC} { // line continuation
1744 yyextra->lineNr++;
1745 addOutput(yyscanner,'\n');
1746 }
1747<XRefItemParam3>{DOCNL} { // missing argument
1748 warn(yyextra->fileName,yyextra->lineNr,
1749 "Missing third argument of \\xrefitem"
1750 );
1751 if (*yytext=='\n') yyextra->lineNr++;
1752 addOutput(yyscanner,'\n');
1753 yyextra->inContext = OutputDoc;
1754 BEGIN( Comment );
1755 }
1756<XRefItemParam3>. { // ignore other stuff
1757 }
1758
1759
1760 /* ----- handle arguments of the relates(also)/memberof command ------- */
1761
1762<RelatesParam1>({ID}("::"|"."))*{ID} { // argument
1763 yyextra->current->relates = yytext;
1764 //if (yyextra->current->mGrpId!=DOX_NOGROUP)
1765 //{
1766 // memberGroupRelates = yytext;
1767 //}
1768 BEGIN( Comment );
1769 }
1770<RelatesParam1>{LC} { // line continuation
1771 yyextra->lineNr++;
1772 addOutput(yyscanner,'\n');
1773 }
1774<RelatesParam1>{DOCNL} { // missing argument
1775 warn(yyextra->fileName,yyextra->lineNr,
1776 "Missing argument of '\\{}' command",yyextra->currentCmd
1777 );
1778 unput_string(yytext,yyleng);
1779 //if (*yytext=='\n') yyextra->lineNr++;
1780 //addOutput(yyscanner,'\n');
1781 BEGIN( Comment );
1782 }
1783<RelatesParam1>. { // ignore other stuff
1784 }
1785
1786
1787 /* ----- handle arguments of the qualifier command ----- */
1788<Qualifier>{LABELID} { // unquoted version, simple label
1789 yyextra->current->qualifiers.emplace_back(yytext);
1790 BEGIN( Comment );
1791 }
1792<Qualifier>"\""[^\"]*"\"" { // quotes version, add without quotes
1793 std::string inp(yytext);
1794 yyextra->current->qualifiers.push_back(inp.substr(1,yyleng-2));
1795 BEGIN( Comment );
1796 }
1797<Qualifier>{DOCNL} { // missing argument
1798 warn(yyextra->fileName,yyextra->lineNr,
1799 "Missing argument of '\\{}' command",yyextra->currentCmd
1800 );
1801 unput_string(yytext,yyleng);
1802 BEGIN( Comment );
1803 }
1804<Qualifier>. {
1805 warn(yyextra->fileName,yyextra->lineNr,
1806 "Argument of '\\{}' command should be quoted",yyextra->currentCmd
1807 );
1808 unput_string(yytext,yyleng);
1809 BEGIN( Comment );
1810 }
1811 /* ----- handle arguments of the iline command ----- */
1812<ILine>{LINENR}/[\\@\n\.] |
1813<ILine>{LINENR}{B} {
1814 bool ok = false;
1815 int nr = DString(yytext).toInt(&ok);
1816 if (!ok)
1817 {
1818 warn(yyextra->fileName,yyextra->lineNr,"Invalid line number '{}' for iline command",yytext);
1819 }
1820 else
1821 {
1822 yyextra->lineNr = nr;
1823 }
1824 addOutput(yyscanner,yytext);
1825 if (YY_START == ILine)
1826 {
1827 BEGIN(Comment);
1828 }
1829 else
1830 {
1831 yyextra->sectionTitle+=yytext;
1832 BEGIN(SectionTitle);
1833 }
1834 }
int toInt(bool *ok=nullptr, int base=10) const
Definition dstring.cpp:191
1835<ILine,ILineSection>. {
1836 addOutput(yyscanner,yytext);
1837 if (YY_START == ILine)
1838 {
1839 BEGIN(Comment);
1840 }
1841 else
1842 {
1843 yyextra->sectionTitle+=yytext;
1844 BEGIN(SectionTitle);
1845 }
1846 }
1847
1848 /* ----- handle arguments of the iraise command ----- */
1849<IRaise>{B}*[0-9]+/[\\@\n\.] |
1850<IRaise>{B}*[0-9]+{B} {
1851 bool ok = false;
1852 int nr = DString(yytext).toInt(&ok);
1853 if (!ok)
1854 {
1855 warn(yyextra->fileName,yyextra->lineNr,"Invalid level '{}' for iraise command",yytext);
1856 }
1857 else
1858 {
1859 yyextra->raiseLevel = nr;
1860 }
1861 BEGIN(Comment);
1862 }
1863<IRaise>. {
1864 unput(yytext[0]);
1865 BEGIN(Comment);
1866 }
1867 /* ----- handle arguments of the iprefix command ----- */
1868
1869<IRaisePrefix>{B}*"\""({LABELID})?"\"" {
1870 DString text(yytext);
1871 yyextra->raisePrefix = text.stripWhiteSpace().mid(1,text.length()-2);
1872 addOutput(yyscanner,yytext);
1873 BEGIN(Comment);
1874 }
1875<IRaisePrefix>. {
1876 unput(yytext[0]);
1877 BEGIN(Comment);
1878 }
1879
1880
1881 /* ----- handle arguments of the ifile command ----- */
1882
1883<IFile,IFileSection>{FILE} {
1884 addOutput(yyscanner,yytext);
1885 DString text(yytext);
1886 if (yytext[0] == '\"') yyextra->fileName = text.mid(1,text.length()-2);
1887 else yyextra->fileName = yytext;
1888 if (YY_START == IFile)
1889 {
1890 BEGIN(Comment);
1891 }
1892 else
1893 {
1894 yyextra->sectionTitle+=yytext;
1895 BEGIN(SectionTitle);
1896 }
1897 }
1898
1899<LinkSection>[^\\@\n]* {
1900 yyextra->sectionTitle+=yytext;
1901 }
1902<LinkSection>{CMD}{CMD} {
1903 yyextra->sectionTitle+=yytext;
1904 }
1905<LinkSection>{DOCNL} {
1906 addOutput(yyscanner,yytext);
1907 if (*yytext == '\n') yyextra->lineNr++;
1908 yyextra->sectionTitle+=yytext;
1909 }
1910<LinkSection>{CMD}"endlink" {
1911 yyextra->sectionTitle+=yytext;
1912 BEGIN(SectionTitle);
1913 }
1914<LinkSection>. {
1915 yyextra->sectionTitle+=yytext;
1916 }
1917<LinkSection><<EOF>> {
1918 warn(yyextra->fileName,yyextra->lineNr,
1919 "reached end of comment while inside a '\\link' command, missing '\\endlink' command"
1920 );
1921 yyterminate();
1922 }
1923 /* ----- handle arguments of the relates(also)/addindex commands ----- */
1924
1925<LineParam>{CMD}{CMD} { // escaped command
1926 addOutput(yyscanner,yytext);
1927 }
1928<LineParam>{DOCNL} { // end of argument
1929 //if (*yytext=='\n') yyextra->lineNr++;
1930 //addOutput(yyscanner,'\n');
1931 unput_string(yytext,yyleng);
1932 BEGIN( Comment );
1933 }
1934<LineParam>{LC} { // line continuation
1935 yyextra->lineNr++;
1936 addOutput(yyscanner,'\n');
1937 }
1938<LineParam>({CMD}{CMD}){ID} { // escaped command
1939 addOutput(yyscanner,yytext);
1940 }
1941<LineParam>. { // ignore other stuff
1942 addOutput(yyscanner,*yytext);
1943 }
1944
1945 /* ----- handle arguments of the section/subsection/.. commands ------- */
1946
1947<SectionLabel>{LABELID} {
1948 yyextra->sectionLabel+=yytext;
1949 }
1950<SectionLabel>{CMD}"lineinfo"("{}")? {
1951 yyextra->sectionLabel += DString().setNum(yyextra->lineNr);
1952 }
1953<SectionLabel>{CMD}"fileinfo"("{"[^}]*"}")? {
1954 FileInfo fi(yyextra->fileName.str());
1955 bool hasOption = false;
1956 DString label;
1957 if (yytext[yyleng-1] == '}') // has parameters
1958 {
1959 StringVector optList;
1960 DString txt = yytext;
1961 DString optStr = txt.mid(10,yyleng-11).stripWhiteSpace();
1962 optList = split(optStr.str(),",");
1963 for (const auto &opt_ : optList)
1964 {
1965 DString optStripped = DString(opt_).stripWhiteSpace();
1966 std::string opt = optStripped.lower().str();
1967 DString result = fileInfoLookup(fi,opt);
1968 if (!result.empty())
1969 {
1970 if (hasOption) // oops: already found an option
1971 {
1972 warn(yyextra->fileName,yyextra->lineNr,"Multiple options specified with \\fileinfo, discarding '{}'", optStripped);
1973 }
1974 else
1975 {
1976 label = result;
1977 }
1978 hasOption = true;
1979 }
1980 else
1981 {
1982 warn(yyextra->fileName,yyextra->lineNr,"Unknown option specified with \\fileinfo: '{}'", optStripped);
1983 }
1984 }
1985 }
1986 if (!hasOption)
1987 {
1988 if (Config_getBool(FULL_PATH_NAMES))
1989 {
1990 label=stripFromPath(yyextra->fileName);
1991 }
1992 else
1993 {
1994 label=yyextra->fileName;
1995 }
1996 }
1997 escapeLabel(label);
1998 yyextra->sectionLabel+=label;
1999 }
static void escapeLabel(DString &label)
2000<SectionLabel>{DOCNL} {
2001 yyextra->sectionTitle.clear();
2002 if (yyextra->sectionLabel.empty())
2003 { // missing argument
2004 warn(yyextra->fileName,yyextra->lineNr,
2005 "\\section command has no label"
2006 );
2007 }
2008 else
2009 {
2010 yyextra->sectionLabel=yyextra->raisePrefix+yyextra->sectionLabel;
2011 addOutput(yyscanner,yyextra->sectionLabel.data());
2012 addSection(yyscanner);
2013 }
2014 if (*yytext=='\n') yyextra->lineNr++;
2015 addOutput(yyscanner,'\n');
2016 BEGIN( Comment );
2017 }
static void addSection(yyscan_t yyscanner, bool addYYtext=true)
2018<SectionLabel>. { // invalid character for section label
2019 if (yyextra->sectionLabel.empty())
2020 {
2021 warn(yyextra->fileName,yyextra->lineNr,
2022 "Invalid or missing section label"
2023 );
2024 BEGIN(Comment);
2025 }
2026 else
2027 {
2028 yyextra->sectionLabel=yyextra->raisePrefix+yyextra->sectionLabel;
2029 addOutput(yyscanner,yyextra->sectionLabel.data());
2030 yyextra->sectionTitle.clear();
2031 unput_string(yytext,yyleng);
2032 BEGIN(SectionTitle);
2033 }
2034 }
2035<SectionTitle>{STAopt}/"\n" { // end of section title
2036 addSection(yyscanner);
2037 addOutput(yyscanner,yytext);
2038 BEGIN( Comment );
2039 }
2040<SectionTitle>{STopt}"\\\\ilinebr" { // escaped end of section title
2041 yyextra->sectionTitle+=substitute(yytext,"#","@#");
2042 }
2043<SectionTitle>{STopt}/"\\ilinebr" { // end of section title
2044 addSection(yyscanner);
2045 addOutput(yyscanner,yytext);
2046 BEGIN( Comment );
2047 }
2048<SectionTitle>{B}*{CMD}"f$" {
2049 yyextra->formulaText="";
2050 yyextra->formulaPreText="$";
2051 yyextra->formulaPostText="";
2052 yyextra->formulaNewLines=0;
2053 BEGIN(ReadFormulaShortSection);
2054 }
2055<SectionTitle>{B}*{CMD}"f(" { // start of a inline formula
2056 yyextra->formulaText="";
2057 yyextra->formulaPreText="";
2058 yyextra->formulaPostText="";
2059 yyextra->formulaNewLines=0;
2060 BEGIN(ReadFormulaRoundSection);
2061 }
2062<SectionTitle>{B}*{CMD}"~"[a-z_A-Z-]* | // language switch command
2063<SectionTitle>{B}*{CMD}"f"[\‍[{] { // block formula
2064 setOutput(yyscanner,OutputDoc);
2065 addOutput(yyscanner," \\ilinebr ");
2066 addSection(yyscanner,false);
2067 warn(yyextra->fileName,yyextra->lineNr,
2068 "'\\{}' command is not allowed in section title, ending section title.",
2069 DString(yytext).stripWhiteSpace()
2070 );
2071 unput_string(yytext,yyleng);
2072 BEGIN(Comment);
2073 }
2074<SectionTitle>{LC} { // line continuation
2075 yyextra->lineNr++;
2076 addOutput(yyscanner,'\n');
2077 }
2078<SectionTitle>[^\n@\\‍]* { // any character without special meaning
2079 yyextra->sectionTitle+=substitute(yytext,"#","@#");
2080 addOutput(yyscanner,yytext);
2081 }
2082<SectionTitle>{B}*{CMD}{CMD} {
2083 yyextra->sectionTitle+=yytext;
2084 addOutput(yyscanner,yytext);
2085 }
2086<SectionTitle>{CMD}# { // escaped hash
2087 yyextra->sectionTitle+=yytext;
2088 addOutput(yyscanner,*yytext);
2089 }
2090<SectionTitle>{B}*{CMD}[a-z_A-Z]+"{"[^}]*"}"{B}* |
2091<SectionTitle>{B}*{CMD}[a-z_A-Z]+{B}* { // handling command in section title
2092 DString fullMatch = yytext;
2093 size_t idx = fullMatch.find('{');
2094 /* handle `f{` command as special case */
2095 if ((idx != DString::npos) && (idx > 1) && (yytext[idx-1] == 'f') && (yytext[idx-2] == '\\' || yytext[idx-2] =='@')) REJECT;
2096 size_t idxEnd = DString::npos;
2097 if (idx != DString::npos) idxEnd = fullMatch.find("}",idx+1);
2098 DString cmdName;
2099 StringVector optList;
2100 if (idx == DString::npos) // no options
2101 {
2102 cmdName = fullMatch.stripWhiteSpace().mid(1); // to remove {CMD}
2103 }
2104 else // options present
2105 {
2106 cmdName = fullMatch.left(idx).stripWhiteSpace().mid(1); // to remove {CMD}
2107 DString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace();
2108 optList = split(optStr.str(),",");
2109 }
2110 auto it = docCmdMap.find(cmdName.str());
2111 if (it!=docCmdMap.end()) // special action is required
2112 {
2113 switch (it->second.sectionHandling)
2114 {
2116 {
2117 int i=0;
2118 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2119 yyextra->sectionTitle+=fullMatch.left(i);
2120 yyextra->sectionTitle+='@';
2121 yyextra->sectionTitle+=fullMatch.mid(i);
2122 addOutput(yyscanner,qPrint(fullMatch.left(i)));
2123 addOutput(yyscanner,'@');
2124 addOutput(yyscanner,qPrint(fullMatch.mid(i)));
2125 warn(yyextra->fileName,yyextra->lineNr,
2126 "'\\{}' command is not allowed in section title, escaping command.",cmdName
2127 );
2128 }
2129 break;
2131 {
2132 addSection(yyscanner,false);
2133 addOutput(yyscanner," \\ilinebr ");
2134 warn(yyextra->fileName,yyextra->lineNr,
2135 "'\\{}' command is not allowed in section title, ending section title.",cmdName
2136 );
2137 unput_string(yytext,yyleng);
2138 BEGIN(Comment);
2139 }
2140 break;
2142 {
2143 if (cmdName == "fileinfo")
2144 {
2145 int i=0;
2146 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2147 yyextra->sectionTitle+=fullMatch.left(i);
2148 addOutput(yyscanner,fullMatch.left(i));
2149 handleFileInfoSection(yyscanner,cmdName,optList);
2150 }
2151 else if (cmdName == "lineinfo")
2152 {
2153 int i=0;
2154 while (yytext[i]==' ' || yytext[i]=='\t') i++;
2155 yyextra->sectionTitle+=fullMatch.left(i);
2156 yyextra->sectionTitle+=DString().setNum(yyextra->lineNr);
2157 addOutput(yyscanner,fullMatch.left(i));
2158 addOutput(yyscanner,DString().setNum(yyextra->lineNr));
2159 }
2160 else if (cmdName == "raisewarning")
2161 {
2162 yyextra->raiseWarning = "";
2163 BEGIN(RaiseWarningSection);
2164 }
2165 else if (cmdName == "noop")
2166 {
2167 addSection(yyscanner,false);
2168 BEGIN(Noop);
2169 }
2170 else if (cmdName == "cite")
2171 {
2172 yyextra->sectionTitle+=yytext;
2173 addOutput(yyscanner,yytext);
2174 BEGIN(CiteLabelSection);
2175 }
2176 else if (cmdName == "iline")
2177 {
2178 yyextra->sectionTitle+=yytext;
2179 addOutput(yyscanner,yytext);
2180 BEGIN(ILineSection);
2181 }
2182 else if (cmdName == "ifile")
2183 {
2184 yyextra->sectionTitle+=yytext;
2185 addOutput(yyscanner,yytext);
2186 BEGIN(IFileSection);
2187 }
2188 else if ((cmdName == "anchor") || (cmdName == "ianchor"))
2189 {
2190 addOutput(yyscanner,"@"+cmdName);
2191 if (optList.empty())
2192 {
2193 yyextra -> anchorTitle = "";
2194 }
2195 else
2196 {
2197 addOutput(yyscanner,"{"+join(optList," ")+"}");
2198 yyextra -> anchorTitle = join(optList," ");
2199 }
2200 addOutput(yyscanner," ");
2201 BEGIN(AnchorLabelSection);
2202 }
2203 else if (cmdName == "link")
2204 {
2205 yyextra->sectionTitle+=yytext;
2206 BEGIN(LinkSection);
2207 }
2208 else
2209 {
2210 yyextra->sectionTitle+=yytext;
2211 warn(yyextra->fileName,yyextra->lineNr,
2212 "internal error '\\{}' command is to be replaced in section title.",cmdName
2213 );
2214 }
2215 }
2216 break;
2218 {
2219 yyextra->sectionTitle+=yytext;
2220 addOutput(yyscanner,yytext);
2221 }
2222 break;
2223 }
2224 }
2225 else
2226 {
2227 yyextra->sectionTitle+=yytext;
2228 addOutput(yyscanner,yytext);
2229 }
2230 }
static bool handleFileInfoSection(yyscan_t yyscanner, const DString &cmdName, const StringVector &optList)
2231<SectionTitle>. { // anything else
2232 yyextra->sectionTitle+=yytext;
2233 addOutput(yyscanner,*yytext);
2234 }
2235
2236 /* ----- handle arguments of the subpage command ------- */
2237
2238<SubpageLabel>{FILE} { // first argument
2239 addOutput(yyscanner,yytext);
2240 // we add subpage labels as a kind of "inheritance" relation to prevent
2241 // needing to add another list to the Entry class.
2242 yyextra->current->extends.emplace_back(yytext,Protection::Public,Specifier::Normal);
2243 BEGIN(SubpageTitle);
2244 }
2245<SubpageLabel>{DOCNL} { // missing argument
2246 warn(yyextra->fileName,yyextra->lineNr,
2247 "\\subpage command has no label"
2248 );
2249 if (*yytext=='\n') yyextra->lineNr++;
2250 addOutput(yyscanner,'\n');
2251 BEGIN( Comment );
2252 }
2253<SubpageLabel>. {
2254 unput(yytext[0]);
2255 BEGIN( Comment );
2256 }
2257<SubpageTitle>{DOCNL} { // no title, end command
2258 addOutput(yyscanner,yytext);
2259 BEGIN( Comment );
2260 }
2261<SubpageTitle>[ \t]*"\""[^\"\n]*"\"" { // add title, end of command
2262 addOutput(yyscanner,yytext);
2263 BEGIN( Comment );
2264 }
2265<SubpageTitle>. { // no title, end of command
2266 unput(*yytext);
2267 BEGIN( Comment );
2268 }
2269
2270 /* ----- handle arguments of the anchor command ------- */
2271
2272<AnchorLabel,AnchorLabelSection>{LABELID} { // found argument
2273 DString lbl = yyextra->raisePrefix+yytext;
2274 addAnchor(yyscanner,lbl, yyextra->anchorTitle);
2275 addOutput(yyscanner,lbl.data());
2276 if (YY_START == AnchorLabel)
2277 {
2278 BEGIN(Comment);
2279 }
2280 else
2281 {
2282 BEGIN(SectionTitle);
2283 }
2284 }
2285<AnchorLabel,AnchorLabelSection>{DOCNL} { // missing argument
2286 warn(yyextra->fileName,yyextra->lineNr,
2287 "\\anchor command has no label"
2288 );
2289 if (*yytext=='\n') yyextra->lineNr++;
2290 addOutput(yyscanner,'\n');
2291 if (YY_START == AnchorLabel)
2292 {
2293 BEGIN(Comment);
2294 }
2295 else
2296 {
2297 BEGIN(SectionTitle);
2298 }
2299 }
2300<AnchorLabel,AnchorLabelSection>. { // invalid character for anchor label
2301 warn(yyextra->fileName,yyextra->lineNr,
2302 "Invalid or missing anchor label"
2303 );
2304 addOutput(yyscanner,yytext);
2305 if (YY_START == AnchorLabel)
2306 {
2307 BEGIN(Comment);
2308 }
2309 else
2310 {
2311 BEGIN(SectionTitle);
2312 }
2313 }
2314
2315 /* ----- handle arguments of the anchor command ------- */
2316
2317<RequirementLabel>{REQID} { // found argument
2318 yyextra->current->name = yytext;
2319 yyextra->current->type.clear();
2320 BEGIN( RequirementTitle );
2321 }
2322<SatisfiesLabel>{REQID} { // found argument
2323 yyextra->reqId = yytext;
2324 yyextra->reqTitle.clear();
2325 BEGIN( SatisfiesTitle );
2326 }
2327<VerifiesLabel>{REQID} { // found argument
2328 yyextra->reqId = yytext;
2329 yyextra->reqTitle.clear();
2330 BEGIN( VerifiesTitle );
2331 }
2332<RequirementLabel,SatisfiesLabel,VerifiesLabel>"\\"{B}*"\n" { // line continuation
2333 yyextra->lineNr++;
2334 addOutput(yyscanner,'\n');
2335 }
2336<RequirementLabel,SatisfiesLabel,VerifiesLabel>{DOCNL} { // missing argument
2337 warn(yyextra->fileName,yyextra->lineNr,
2338 "missing requirement ID after \\requirement command"
2339 );
2340 unput_string(yytext,yyleng);
2341 BEGIN( Comment );
2342 }
2343<RequirementLabel,SatisfiesLabel,VerifiesLabel>. { // invalid character for requirement label
2344 }
2345
2346<RequirementTitle,SatisfiesTitle,VerifiesTitle>"\\"{B}*"\n" { // line continuation
2347 yyextra->lineNr++;
2348 addOutput(yyscanner,'\n');
2349 }
2350<RequirementTitle>[^\n\\‍]+ { // title (stored in type)
2351 yyextra->current->type += yytext;
2352 }
2353<SatisfiesTitle,VerifiesTitle>[^\n\\@]+ { // title (stored in type)
2354 yyextra->reqTitle += yytext;
2355 }
2356<RequirementTitle>({CMD}("verifies"|"satisfies"|"requirement"){B}+)|{DOCNL}+ {
2357 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
2358 unput_string(yytext,yyleng);
2359 addRequirementId(yyscanner);
2360 BEGIN( Comment );
2361 }
static void addRequirementId(yyscan_t yyscanner)
2362<SatisfiesTitle>({CMD}("verifies"|"satisfies"|"requirement"){B}+)|{DOCNL}+ {
2363 yyextra->reqTitle = yyextra->reqTitle.stripWhiteSpace();
2364 unput_string(yytext,yyleng);
2365 if (yyextra->current->section.isRequirementDoc())
2366 {
2367 warn(yyextra->fileName,yyextra->lineNr,
2368 "@satisfies command is not allowed in documentation of a requirement. Put in at the place where the requirement is implemented."
2369 );
2370 }
2371 else
2372 {
2373 yyextra->current->rqli.emplace_back(RequirementRefType::Satisfies,
2374 yyextra->reqId,
2375 yyextra->reqTitle,
2376 yyextra->fileName,
2377 yyextra->lineNr);
2378 }
2379 BEGIN( Comment );
2380 }
2381<VerifiesTitle>({CMD}("verifies"|"satisfies"|"requirement"){B}+)|{DOCNL}+ {
2382 yyextra->reqTitle = yyextra->reqTitle.stripWhiteSpace();
2383 unput_string(yytext,yyleng);
2384 if (yyextra->current->section.isRequirementDoc())
2385 {
2386 warn(yyextra->fileName,yyextra->lineNr,
2387 "@verifies command is not allowed in documentation of a requirement. Put in at the place where the requirement is tested."
2388 );
2389 }
2390 else
2391 {
2392 yyextra->current->rqli.emplace_back(RequirementRefType::Verifies,
2393 yyextra->reqId,
2394 yyextra->reqTitle,
2395 yyextra->fileName,
2396 yyextra->lineNr);
2397 }
2398 BEGIN( Comment );
2399 }
2400<RequirementTitle>. { // title (stored in type)
2401 yyextra->current->type += yytext;
2402 }
2403<SatisfiesTitle,VerifiesTitle>. { // title (stored in reqTitle)
2404 yyextra->reqTitle += yytext;
2405 }
2406
2407
2408 /* ----- handle arguments of the preformatted block commands ------- */
2409
2410<FormatBlock>{CMD}("endverbatim"|"endiverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"endicode"|"endmsc"|"endmermaid")/{NW} { // possible ends
2411 addOutput(yyscanner,yytext);
2412 if (&yytext[4]==yyextra->blockName) // found end of the block
2413 {
2414 BEGIN(Comment);
2415 }
2416 }
2417<FormatBlock>{CMD}"enduml" {
2418 addOutput(yyscanner,yytext);
2419 if (yyextra->blockName=="startuml") // found end of the block
2420 {
2421 BEGIN(Comment);
2422 }
2423 }
2424<FormatBlock>[^ \@\*\/\\\n]* { // some word
2425 addOutput(yyscanner,yytext);
2426 }
2427<FormatBlock>{DOCNL} { // new line
2428 if (*yytext=='\n') yyextra->lineNr++;
2429 addOutput(yyscanner,'\n');
2430 }
2431<FormatBlock>{CCS} { // start of a C-comment
2432 if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim" ||
2433 yyextra->blockName=="icode" || yyextra->blockName=="iverbatim"||
2434 yyextra->blockName=="iliteral"
2435 )
2436 ) yyextra->commentCount++;
2437 addOutput(yyscanner,yytext);
2438 }
2439<FormatBlock>{CCE} { // end of a C-comment
2440 addOutput(yyscanner,yytext);
2441 if (!(yyextra->blockName=="code" || yyextra->blockName=="verbatim" ||
2442 yyextra->blockName=="icode" || yyextra->blockName=="iverbatim"||
2443 yyextra->blockName=="iliteral"
2444 )
2445 )
2446 {
2447 yyextra->commentCount--;
2448 if (yyextra->commentCount<0)
2449 {
2450 DString endTag = "end"+yyextra->blockName;
2451 if (yyextra->blockName=="startuml") endTag="enduml";
2452 warn(yyextra->fileName,yyextra->lineNr,
2453 "found */ without matching /* while inside a \\{} block! Perhaps a missing \\{}?",
2454 yyextra->blockName,endTag);
2455 }
2456 }
2457 }
2458<FormatBlock>. {
2459 addOutput(yyscanner,*yytext);
2460 }
2461<FormatBlock><<EOF>> {
2462 DString endTag = "end"+yyextra->blockName;
2463 if (yyextra->blockName=="startuml") endTag="enduml";
2464 warn(yyextra->fileName,yyextra->lineNr,
2465 "reached end of comment while inside a \\{} block; check for missing \\{} tag!",
2466 yyextra->blockName,endTag
2467 );
2468 yyterminate();
2469 }
2470
2471 /* ----- handle arguments of if/ifnot commands ------- */
2472
2473<GuardParam>{B}*"(" {
2474 yyextra->guardExpr=yytext;
2475 yyextra->roundCount=1;
2476 BEGIN(GuardExpr);
2477 }
2478<GuardExpr>[^()]* {
2479 yyextra->guardExpr+=yytext;
2480 lineCount(yyscanner);
2481 }
2482<GuardExpr>"(" {
2483 yyextra->guardExpr+=yytext;
2484 yyextra->roundCount++;
2485 }
2486<GuardExpr>")" {
2487 yyextra->guardExpr+=yytext;
2488 yyextra->roundCount--;
2489 if (yyextra->roundCount==0)
2490 {
2491 handleGuard(yyscanner,yyextra->guardExpr);
2492 }
2493 }
static void handleGuard(yyscan_t yyscanner, const DString &expr)
2494<GuardExpr>\n {
2495 warn(yyextra->fileName,yyextra->lineNr,
2496 "invalid expression '{}' for yyextra->guards",yyextra->guardExpr);
2497 unput(*yytext);
2498 BEGIN(GuardParam);
2499 }
2500<GuardParam>{B}*{CMD}doxyconfig{B}+{DOXYCFG} {
2501 handleGuard(yyscanner,yytext);
2502 }
2503<GuardParam>{B}*[a-z_A-Z0-9.\-]+({B}*{CMD}doxyconfig{B}+{DOXYCFG})? { // parameter of if/ifnot yyextra->guards
2504 handleGuard(yyscanner,yytext);
2505 }
2506<GuardParam>{DOCNL} { // end of argument
2507 //next line is commented out due to bug620924
2508 //addOutput(yyscanner,'\n');
2509 addIlineBreak(yyscanner,yyextra->lineNr);
2510 unput_string(yytext,yyleng);
2511 handleGuard(yyscanner,DString());
2512 }
static void addIlineBreak(yyscan_t yyscanner, int lineNr)
2513<GuardParam>{LC} { // line continuation
2514 yyextra->lineNr++;
2515 addOutput(yyscanner,'\n');
2516 }
2517<GuardParam>. { // empty condition
2518 unput(*yytext);
2519 handleGuard(yyscanner,DString());
2520 }
2521<GuardParamEnd>{B}*{DOCNL} {
2522 lineCount(yyscanner);
2523 yyextra->spaceBeforeIf.clear();
2524 addIlineBreak(yyscanner,yyextra->lineNr);
2525 BEGIN(Comment);
2526 }
2527<GuardParamEnd>{B}* {
2528 if (!yyextra->spaceBeforeIf.empty()) // needed for 665313 in combination with bug620924
2529 {
2530 addOutput(yyscanner,yyextra->spaceBeforeIf);
2531 }
2532 yyextra->spaceBeforeIf.clear();
2533 addIlineBreak(yyscanner,yyextra->lineNr);
2534 BEGIN(Comment);
2535 }
2536<GuardParamEnd>. {
2537 unput(*yytext);
2538 addIlineBreak(yyscanner,yyextra->lineNr);
2539 BEGIN(Comment);
2540 }
2541
2542 /* ----- handle skipping of conditional sections ------- */
2543
2544<SkipGuardedSection>{CMD}"ifnot"/{NW} {
2545 yyextra->guardType = Guard_IfNot;
2546 yyextra->guards->emplace(false);
2547 BEGIN( GuardParam );
2548 }
2549<SkipGuardedSection>{CMD}"if"/{NW} {
2550 yyextra->guardType = Guard_If;
2551 yyextra->guards->emplace(false);
2552 BEGIN( GuardParam );
2553 }
2554<SkipGuardedSection>{CMD}"endif"/{NW} {
2555 if (yyextra->guards->empty())
2556 {
2557 warn(yyextra->fileName,yyextra->lineNr,
2558 "found \\endif without matching start command");
2559 BEGIN( Comment );
2560 }
2561 else
2562 {
2563 yyextra->guards->pop();
2564 if (yyextra->guards->empty())
2565 {
2566 BEGIN( GuardParamEnd );
2567 }
2568 else
2569 {
2570 if (yyextra->guards->top().isEnabled())
2571 {
2572 BEGIN( GuardParamEnd );
2573 }
2574 else
2575 {
2576 BEGIN( SkipGuardedSection );
2577 }
2578 }
2579 }
2580 }
2581<SkipGuardedSection>{CMD}"else"/{NW} {
2582 if (yyextra->guards->empty())
2583 {
2584 warn(yyextra->fileName,yyextra->lineNr,
2585 "found \\else without matching start command");
2586 }
2587 else if (yyextra->guards->top().hasElse())
2588 {
2589 warn(yyextra->fileName,yyextra->lineNr,
2590 "found multiple \\else commands in same \\if construct");
2591 yyextra->guards->top().setEnabled(false);
2592 BEGIN( SkipGuardedSection );
2593 }
2594 else if (!yyextra->guards->top().parentVisible())
2595 {
2596 yyextra->guards->top().setEnabled(false);
2597 BEGIN( SkipGuardedSection );
2598 }
2599 else
2600 {
2601 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2602 yyextra->guards->top().setElse();
2603 if (!yyextra->guards->top().parentVisible())
2604 {
2605 yyextra->guards->top().setEnabled(false);
2606 BEGIN( SkipGuardedSection );
2607 }
2608 else if (yyextra->guards->top().isEnabledFound())
2609 {
2610 yyextra->guards->top().setEnabled(false);
2611 BEGIN( SkipGuardedSection );
2612 }
2613 else
2614 {
2615 yyextra->guards->top().setEnabled(true);
2616 BEGIN( GuardParamEnd );
2617 }
2618 }
2619 }
2620<SkipGuardedSection>{CMD}"elseif"/{NW} {
2621 if (yyextra->guards->empty())
2622 {
2623 warn(yyextra->fileName,yyextra->lineNr,
2624 "found \\elseif without matching start command");
2625 }
2626 else if (yyextra->guards->top().hasElse())
2627 {
2628 warn(yyextra->fileName,yyextra->lineNr,
2629 "found \\elseif command after \\else command was given in \\if construct");
2630 yyextra->guardType = Guard_ElseIf;
2631 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2632 yyextra->guards->top().setEnabled(false);
2633 BEGIN( GuardParam );
2634 }
2635 else
2636 {
2637 yyextra->guardType = Guard_ElseIf;
2638 yyextra->spaceBeforeIf = yyextra->spaceBeforeCmd;
2639 yyextra->guards->top().setEnabled(false);
2640 BEGIN( GuardParam );
2641 }
2642 }
2643<SkipGuardedSection>{DOCNL} { // skip line
2644 if (*yytext=='\n') yyextra->lineNr++;
2645 //addOutput(yyscanner,'\n');
2646 }
2647<SkipGuardedSection>[^ \\@\n]+ { // skip non-special characters
2648 }
2649<SkipGuardedSection>{CMD}{CMD} |
2650<SkipGuardedSection>. { // any other character
2651 }
2652
2653
2654 /* ----- handle skipping of internal section ------- */
2655
2656<SkipInternal>{DOCNL} { // skip line
2657 if (*yytext=='\n') yyextra->lineNr++;
2658 addOutput(yyscanner,'\n');
2659 }
2660<SkipInternal>{CMD}"if"/[ \t] {
2661 yyextra->condCount++;
2662 }
2663<SkipInternal>{CMD}"ifnot"/[ \t] {
2664 yyextra->condCount++;
2665 }
2666<SkipInternal>{CMD}/"endif" {
2667 yyextra->condCount--;
2668 if (yyextra->condCount<0) // handle conditional section around of \internal, see bug607743
2669 {
2670 unput('\\');
2671 BEGIN(Comment);
2672 }
2673 }
2674<SkipInternal>{CMD}/"section"[ \t] {
2675 if (yyextra->sectionLevel>0)
2676 {
2677 unput('\\');
2678 BEGIN(Comment);
2679 }
2680 }
2681<SkipInternal>{CMD}/"subsection"[ \t] {
2682 if (yyextra->sectionLevel>1)
2683 {
2684 unput('\\');
2685 BEGIN(Comment);
2686 }
2687 }
2688<SkipInternal>{CMD}/"subsubsection"[ \t] {
2689 if (yyextra->sectionLevel>2)
2690 {
2691 unput('\\');
2692 BEGIN(Comment);
2693 }
2694 }
2695<SkipInternal>{CMD}/"paragraph"[ \t] {
2696 if (yyextra->sectionLevel>3)
2697 {
2698 unput('\\');
2699 BEGIN(Comment);
2700 }
2701 }
2702<SkipInternal>{CMD}/"subparagraph"[ \t] {
2703 if (yyextra->sectionLevel>4)
2704 {
2705 unput('\\');
2706 BEGIN(Comment);
2707 }
2708 }
2709<SkipInternal>{CMD}/"subsubparagraph"[ \t] {
2710 if (yyextra->sectionLevel>5)
2711 {
2712 unput('\\');
2713 BEGIN(Comment);
2714 }
2715 }
2716<SkipInternal>{CMD}"endinternal"[ \t]* {
2717 BEGIN(Comment);
2718 }
2719<SkipInternal>[^ \\@\n]+ { // skip non-special characters
2720 }
2721<SkipInternal>. { // any other character
2722 }
2723
2724
2725 /* ----- handle argument of name command ------- */
2726
2727<NameParam>{DOCNL} { // end of argument
2728 //if (*yytext=='\n') yyextra->lineNr++;
2729 //addOutput(yyscanner,'\n');
2730 unput_string(yytext,yyleng);
2731 BEGIN( Comment );
2732 }
2733<NameParam>{LC} { // line continuation
2734 yyextra->lineNr++;
2735 addOutput(yyscanner,'\n');
2736 yyextra->docGroup.appendHeader(' ');
2737 }
2738<NameParam>. { // ignore other stuff
2739 yyextra->docGroup.appendHeader(*yytext);
2740 yyextra->current->name+=*yytext;
2741 }
2742
2743 /* ----- handle argument of noop command ------- */
2744<Noop>{DOCNL} { // end of argument
2745 if (*yytext=='\n')
2746 {
2747 yyextra->lineNr++;
2748 addOutput(yyscanner,'\n');
2749 }
2750 BEGIN( Comment );
2751 }
2752<Noop>. { // ignore other stuff
2753 }
2754 /* ----- handle argument of raisewarning command ------- */
2755<RaiseWarning,RaiseWarningSection>{DOCNL} { // end of argument
2756 warn_doc_error(yyextra->fileName,yyextra->lineNr,
2757 "{}",yyextra->raiseWarning);
2758 yyextra->raiseWarning = "";
2759 if (*yytext=='\n') yyextra->lineNr++;
2760 addOutput(yyscanner,'\n');
2761 if (YY_START == RaiseWarning)
2762 {
2763 BEGIN(Comment);
2764 }
2765 else
2766 {
2767 yyextra->sectionTitle+=yytext;
2768 BEGIN(SectionTitle);
2769 }
2770 }
#define warn_doc_error(file, line, fmt,...)
Definition message.h:112
2771<RaiseWarning,RaiseWarningSection>. { // ignore other stuff
2772 yyextra->raiseWarning += yytext;
2773 }
2774 /* ----- handle argument of ingroup command ------- */
2775
2776<InGroupParam>{LABELID} { // group id
2777 yyextra->current->groups.emplace_back(
2779 );
2780 yyextra->inGroupParamFound=true;
2781 }
@ GROUPING_INGROUP
membership in group was defined by @ingroup
Definition types.h:236
2782<InGroupParam>{DOCNL} { // missing argument
2783 if (!yyextra->inGroupParamFound)
2784 {
2785 warn(yyextra->fileName,yyextra->lineNr,
2786 "Missing group name for \\ingroup command"
2787 );
2788 }
2789 //if (*yytext=='\n') yyextra->lineNr++;
2790 //addOutput(yyscanner,'\n');
2791 unput_string(yytext,yyleng);
2792 BEGIN( Comment );
2793 }
2794<InGroupParam>{LC} { // line continuation
2795 yyextra->lineNr++;
2796 addOutput(yyscanner,'\n');
2797 }
2798<InGroupParam>. { // ignore other stuff
2799 addOutput(yyscanner,*yytext);
2800 }
2801
2802 /* ----- handle argument of fn command ------- */
2803
2804<FnParam>{DOCNL} { // end of argument
2805 if (yyextra->braceCount==0)
2806 {
2807 if (yyextra->functionProto.stripWhiteSpace().empty())
2808 {
2809 warn(yyextra->fileName,yyextra->lineNr,
2810 "missing argument after '\\{}'.",yyextra->currentCmd
2811 );
2812 }
2813 else
2814 {
2815 makeStructuralIndicator(yyscanner,yyextra->currentMakeEntryType);
2816 yyextra->langParser->parsePrototype(yyextra->functionProto);
2817 }
2818 unput_string(yytext,yyleng);
2819 BEGIN( Comment );
2820 }
2821 }
2822<FnParam>{LC} { // line continuation
2823 yyextra->lineNr++;
2824 yyextra->functionProto+=' ';
2825 }
2826<FnParam>[^@\\\n()]+ { // non-special characters
2827 yyextra->functionProto+=yytext;
2828 }
2829<FnParam>"(" {
2830 yyextra->functionProto+=yytext;
2831 yyextra->braceCount++;
2832 }
2833<FnParam>")" {
2834 yyextra->functionProto+=yytext;
2835 yyextra->braceCount--;
2836 }
2837<FnParam>. { // add other stuff
2838 yyextra->functionProto+=*yytext;
2839 }
2840
2841
2842 /* ----- handle argument of overload command ------- */
2843
2844
2845<OverloadParam>{DOCNL} { // end of argument
2846 if (*yytext=='\n') yyextra->lineNr++;
2847 if (yyextra->functionProto.stripWhiteSpace().empty())
2848 { // plain overload command
2850 addOutput(yyscanner,'\n');
2851 }
2852 else // overload declaration
2853 {
2854 makeStructuralIndicator(yyscanner,EntryType::makeOverloadDoc);
2855 yyextra->langParser->parsePrototype(yyextra->functionProto);
2856 }
2857 BEGIN( Comment );
2858 }
virtual DString trOverloadText()=0
2859<OverloadParam>{LC} { // line continuation
2860 yyextra->lineNr++;
2861 yyextra->functionProto+=' ';
2862 }
2863<OverloadParam>. { // add other stuff
2864 yyextra->functionProto+=*yytext;
2865 }
2866
2867 /* ----- handle argument of inherit command ------- */
2868
2869<InheritParam>({ID}("::"|"."))*{ID} { // found argument
2870 yyextra->current->extends.emplace_back(
2871 removeRedundantWhiteSpace(yytext),Protection::Public,Specifier::Normal
2872 );
2873 BEGIN( Comment );
2874 }
2875<InheritParam>{DOCNL} { // missing argument
2876 warn(yyextra->fileName,yyextra->lineNr,
2877 "\\inherit command has no argument"
2878 );
2879 if (*yytext=='\n') yyextra->lineNr++;
2880 addOutput(yyscanner,'\n');
2881 BEGIN( Comment );
2882 }
2883<InheritParam>. { // invalid character for anchor label
2884 warn(yyextra->fileName,yyextra->lineNr,
2885 "Invalid or missing name for \\inherit command"
2886 );
2887 BEGIN(Comment);
2888 }
2889
2890 /* ----- handle argument of extends and implements commands ------- */
2891
2892<ExtendsParam>({ID}("::"|"."))*{ID} { // found argument
2893 yyextra->current->extends.emplace_back(
2894 removeRedundantWhiteSpace(yytext),Protection::Public,Specifier::Normal
2895 );
2896 BEGIN( Comment );
2897 }
2898<ExtendsParam>{DOCNL} { // missing argument
2899 warn(yyextra->fileName,yyextra->lineNr,
2900 "'\\{}' command has no argument",yyextra->currentCmd
2901 );
2902 //if (*yytext=='\n') yyextra->lineNr++;
2903 //addOutput(yyscanner,'\n');
2904 unput_string(yytext,yyleng);
2905 BEGIN( Comment );
2906 }
2907<ExtendsParam>. { // ignore other stuff
2908 }
2909
2910 /* ----- handle language specific sections ------- */
2911
2912<SkipLang>{CMD}"~"[a-zA-Z-]* { /* language switch */
2913 DString langId(&yytext[2]);
2914 if (!langId.empty() && !Config_isAvailableEnum(OUTPUT_LANGUAGE,langId))
2915 {
2916 warn(yyextra->fileName,yyextra->lineNr,
2917 "non supported language '{}' specified in '{}'",langId,DString(yytext).stripWhiteSpace());
2918 }
2919 else if (langId.empty() ||
2920 dstricmp(Config_getEnumAsString(OUTPUT_LANGUAGE),langId)==0)
2921 { // enable language specific section
2922 BEGIN(Comment);
2923 }
2924 }
2925<SkipLang>[^*@\\\n]* { /* any character not a *, @, backslash or new line */
2926 }
2927<SkipLang>{DOCNL} { /* new line in verbatim block */
2928 if (*yytext=='\n') yyextra->lineNr++;
2929 }
2930<SkipLang>. { /* any other character */
2931 }
2932
2933 /* ----- handle arguments of the cite command ------- */
2934
2935<CiteLabel,CiteLabelSection>{CITEID} { // found argument
2936 addCite(yyscanner);
2937 addOutput(yyscanner,yytext);
2938 if (YY_START == CiteLabel)
2939 {
2940 BEGIN(Comment);
2941 }
2942 else
2943 {
2944 yyextra->sectionTitle+=yytext;
2945 BEGIN(SectionTitle);
2946 }
2947 }
static void addCite(yyscan_t yyscanner)
2948<CiteLabel,CiteLabelSection>{DOCNL} { // missing argument
2949 warn(yyextra->fileName,yyextra->lineNr,
2950 "\\cite command has no label"
2951 );
2952 //if (*yytext=='\n') yyextra->lineNr++;
2953 //addOutput(yyscanner,'\n');
2954 if (YY_START == CiteLabel)
2955 {
2956 unput_string(yytext,yyleng);
2957 BEGIN(Comment);
2958 }
2959 else
2960 {
2961 yyextra->sectionTitle+=yytext;
2962 unput_string(yytext,yyleng);
2963 BEGIN(SectionTitle);
2964 }
2965 }
2966<CiteLabel,CiteLabelSection>. { // invalid character for cite label
2967 warn(yyextra->fileName,yyextra->lineNr,
2968 "Invalid or missing cite label"
2969 );
2970 if (YY_START == CiteLabel)
2971 {
2972 BEGIN(Comment);
2973 }
2974 else
2975 {
2976 yyextra->sectionTitle+=yytext;
2977 BEGIN(SectionTitle);
2978 }
2979 }
2980
2981 /* ----- handle argument of the copydoc command ------- */
2982
2983<CopyDoc><<EOF>> {
2984 setOutput(yyscanner,OutputDoc);
2985 addOutput(yyscanner," \\ilinebr\\ilinebr\\copydetails ");
2986 addOutput(yyscanner,yyextra->copyDocArg);
2987 addOutput(yyscanner,"\n");
2988 BEGIN(Comment);
2989 }
2990<CopyDoc>"<"[/]?{TABLEDEL}">" {
2991 if (yyextra->braceCount==0)
2992 {
2993 setOutput(yyscanner,OutputDoc);
2994 addOutput(yyscanner," \\ilinebr\\ilinebr\\copydetails ");
2995 addOutput(yyscanner,yyextra->copyDocArg);
2996 addOutput(yyscanner,yytext);
2997 BEGIN(Comment);
2998 }
2999 }
3000<CopyDoc>{DOCNL} {
3001 if (*yytext=='\n') yyextra->lineNr++;
3002 if (yyextra->braceCount==0)
3003 {
3004 setOutput(yyscanner,OutputDoc);
3005 addOutput(yyscanner," \\ilinebr\\ilinebr\\copydetails ");
3006 addOutput(yyscanner,yyextra->copyDocArg);
3007 addOutput(yyscanner,"\n");
3008 BEGIN(Comment);
3009 }
3010 }
3011<CopyDoc>{LC} { // line continuation
3012 yyextra->lineNr++;
3013 }
3014<CopyDoc>[^@\\\n()<]+ { // non-special characters
3015 yyextra->copyDocArg+=yytext;
3016 addOutput(yyscanner,yytext);
3017 }
3018<CopyDoc>"(" {
3019 yyextra->copyDocArg+=yytext;
3020 addOutput(yyscanner,yytext);
3021 yyextra->braceCount++;
3022 }
3023<CopyDoc>")" {
3024 yyextra->copyDocArg+=yytext;
3025 addOutput(yyscanner,yytext);
3026 yyextra->braceCount--;
3027 }
3028<CopyDoc>. {
3029 yyextra->copyDocArg+=yytext;
3030 addOutput(yyscanner,yytext);
3031 }
3032
3033 /*
3034<*>. { fprintf(stderr,"Lex scanner %s %sdefault rule for state %s: #%s#\n", __FILE__,!yyextra->fileName.empty() ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START),yytext);}
3035<*>\n { fprintf(stderr,"Lex scanner %s %sdefault rule newline for state %s.\n", __FILE__, !yyextra->fileName.empty() ? ("(" + yyextra->fileName +") ").data(): "",stateToString(YY_START));}
3036 */
3037
3038%%

◆ yyread()

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

Definition at line 4934 of file commentscan.l.

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

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().