/***************************************************************************** * * Copyright (C) 1997-2020 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * */ %option never-interactive %option prefix="commentscanYY" %option reentrant %option extra-type="struct commentscanYY_state *" %top{ #include } %{ /* * includes */ #include #include #include #include #include #include #include #include #include "qcstring.h" #include "cite.h" #include "commentscan.h" #include "condparser.h" #include "config.h" #include "debug.h" #include "docgroup.h" #include "doxygen.h" #include "entry.h" #include "formula.h" #include "language.h" #include "message.h" #include "parserintf.h" #include "reflist.h" #include "section.h" #include "util.h" #include "reflist.h" #define USE_STATE2STRING 0 // forward declarations static bool handleBrief(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleFn(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleDef(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleOverload(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleEnum(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleDefGroup(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleAddToGroup(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleWeakGroup(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleNamespace(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handlePackage(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleConcept(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleClass(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleProtocol(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleCategory(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleUnion(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleStruct(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleInterface(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleIdlException(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handlePage(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleMainpage(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleFile(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleDir(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleExample(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleDetails(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleNoop(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleName(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleTodo(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleTest(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleBug(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleSubpage(yyscan_t yyscanner,const QCString &s, const StringVector &); static bool handleDeprecated(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleXRefItem(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleRelated(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleMemberOf(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleRefItem(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleSection(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleAnchor(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleCite(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleFormatBlock(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleAddIndex(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleIf(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleIfNot(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleElseIf(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleElse(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleEndIf(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleIngroup(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleNoSubGrouping(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleShowInitializer(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleHideInitializer(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleCallgraph(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleHideCallgraph(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleCallergraph(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleHideCallergraph(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleReferencedByRelation(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleHideReferencedByRelation(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleReferencesRelation(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleHideReferencesRelation(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleInternal(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleStatic(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handlePure(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handlePrivate(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handlePrivateSection(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleProtected(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleProtectedSection(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handlePublic(yyscan_t yyscanner,const QCString &s, const StringVector &); static bool handlePublicSection(yyscan_t yyscanner,const QCString &s, const StringVector &); static bool handleToc(yyscan_t yyscanner,const QCString &s, const StringVector &); static bool handleInherit(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleExtends(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleCopyDoc(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleCopyBrief(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleCopyDetails(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleParBlock(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleParam(yyscan_t yyscanner,const QCString &, const StringVector &); static bool handleRetval(yyscan_t yyscanner,const QCString &, const StringVector &); #if USE_STATE2STRING static const char *stateToString(int state); #endif typedef bool (*DocCmdFunc)(yyscan_t yyscanner,const QCString &name, const StringVector &optList); enum class CommandSpacing { Invisible, // command sets some property but does not appear in the output. Inline, // command appears inline in the output which can be a brief description. Block, // command starts a new paragraphs / ends a brief description. XRef // command is a cross reference (todo, bug, test, xrefitem). }; struct DocCmdMap { DocCmdMap(DocCmdFunc h,CommandSpacing s) : handler(h), spacing(s) {} DocCmdFunc handler; CommandSpacing spacing; }; // map of command to handler function static const std::map< std::string, DocCmdMap > docCmdMap = { // command name handler function command spacing { "addindex", { &handleAddIndex, CommandSpacing::Invisible }}, { "addtogroup", { &handleAddToGroup, CommandSpacing::Invisible }}, { "anchor", { &handleAnchor, CommandSpacing::Invisible }}, { "arg", { 0, CommandSpacing::Block }}, { "attention", { 0, CommandSpacing::Block }}, { "author", { 0, CommandSpacing::Block }}, { "authors", { 0, CommandSpacing::Block }}, { "brief", { &handleBrief, CommandSpacing::Invisible }}, { "bug", { &handleBug, CommandSpacing::XRef }}, { "callergraph", { &handleCallergraph, CommandSpacing::Invisible }}, { "callgraph", { &handleCallgraph, CommandSpacing::Invisible }}, { "category", { &handleCategory, CommandSpacing::Invisible }}, { "cite", { &handleCite, CommandSpacing::Inline }}, { "class", { &handleClass, CommandSpacing::Invisible }}, { "code", { &handleFormatBlock, CommandSpacing::Block }}, { "concept", { &handleConcept, CommandSpacing::Invisible }}, { "copybrief", { &handleCopyBrief, CommandSpacing::Invisible }}, { "copydetails", { &handleCopyDetails, CommandSpacing::Block }}, { "copydoc", { &handleCopyDoc, CommandSpacing::Block }}, { "copyright", { 0, CommandSpacing::Block }}, { "date", { 0, CommandSpacing::Block }}, { "def", { &handleDef, CommandSpacing::Invisible }}, { "defgroup", { &handleDefGroup, CommandSpacing::Invisible }}, { "deprecated", { &handleDeprecated, CommandSpacing::XRef }}, { "details", { &handleDetails, CommandSpacing::Block }}, { "dir", { &handleDir, CommandSpacing::Invisible }}, { "docbookinclude", { 0, CommandSpacing::Inline }}, { "docbookonly", { &handleFormatBlock, CommandSpacing::Invisible }}, { "dot", { &handleFormatBlock, CommandSpacing::Block }}, { "dotfile", { 0, CommandSpacing::Block }}, { "else", { &handleElse, CommandSpacing::Inline }}, { "elseif", { &handleElseIf, CommandSpacing::Inline }}, { "endif", { &handleEndIf, CommandSpacing::Inline }}, { "endparblock", { &handleEndParBlock, CommandSpacing::Block }}, { "enum", { &handleEnum, CommandSpacing::Invisible }}, { "example", { &handleExample, CommandSpacing::Invisible }}, { "exception", { 0, CommandSpacing::Block }}, { "extends", { &handleExtends, CommandSpacing::Invisible }}, { "file", { &handleFile, CommandSpacing::Invisible }}, { "fn", { &handleFn, CommandSpacing::Invisible }}, { "headerfile", { &handleHeaderFile, CommandSpacing::Invisible }}, { "hidecallergraph", { &handleHideCallergraph, CommandSpacing::Invisible }}, { "hidecallgraph", { &handleHideCallgraph, CommandSpacing::Invisible }}, { "hideinitializer", { &handleHideInitializer, CommandSpacing::Invisible }}, { "hiderefby", { &handleHideReferencedByRelation, CommandSpacing::Invisible }}, { "hiderefs", { &handleHideReferencesRelation, CommandSpacing::Invisible }}, { "htmlinclude", { 0, CommandSpacing::Inline }}, { "htmlonly", { &handleFormatBlock, CommandSpacing::Invisible }}, { "idlexcept", { &handleIdlException, CommandSpacing::Invisible }}, { "if", { &handleIf, CommandSpacing::Inline }}, { "ifnot", { &handleIfNot, CommandSpacing::Inline }}, { "image", { 0, CommandSpacing::Block }}, { "implements", { &handleExtends, CommandSpacing::Invisible }}, { "include", { 0, CommandSpacing::Block }}, { "includelineno", { 0, CommandSpacing::Block }}, { "ingroup", { &handleIngroup, CommandSpacing::Invisible }}, { "inherit", { &handleInherit, CommandSpacing::Invisible }}, { "interface", { &handleInterface, CommandSpacing::Invisible }}, { "internal", { &handleInternal, CommandSpacing::Block }}, { "invariant", { 0, CommandSpacing::Block }}, { "latexinclude", { 0, CommandSpacing::Inline }}, { "latexonly", { &handleFormatBlock, CommandSpacing::Invisible }}, { "li", { 0, CommandSpacing::Block }}, { "line", { 0, CommandSpacing::Invisible }}, { "mainpage", { &handleMainpage, CommandSpacing::Invisible }}, { "maninclude", { 0, CommandSpacing::Inline }}, { "manonly", { &handleFormatBlock, CommandSpacing::Invisible }}, { "memberof", { &handleMemberOf, CommandSpacing::Invisible }}, { "msc", { &handleFormatBlock, CommandSpacing::Block }}, { "name", { &handleName, CommandSpacing::Invisible }}, { "namespace", { &handleNamespace, CommandSpacing::Invisible }}, { "noop", { &handleNoop, CommandSpacing::Invisible }}, { "nosubgrouping", { &handleNoSubGrouping, CommandSpacing::Invisible }}, { "note", { 0, CommandSpacing::Block }}, { "overload", { &handleOverload, CommandSpacing::Invisible }}, { "package", { &handlePackage, CommandSpacing::Invisible }}, { "page", { &handlePage, CommandSpacing::Invisible }}, { "par", { 0, CommandSpacing::Block }}, { "paragraph", { &handleSection, CommandSpacing::Block }}, { "param", { &handleParam, CommandSpacing::Block }}, { "parblock", { &handleParBlock, CommandSpacing::Block }}, { "post", { 0, CommandSpacing::Block }}, { "pre", { 0, CommandSpacing::Block }}, { "private", { &handlePrivate, CommandSpacing::Invisible }}, { "privatesection", { &handlePrivateSection, CommandSpacing::Invisible }}, { "property", { &handleFn, CommandSpacing::Invisible }}, { "protected", { &handleProtected, CommandSpacing::Invisible }}, { "protectedsection",{ &handleProtectedSection, CommandSpacing::Invisible }}, { "protocol", { &handleProtocol, CommandSpacing::Invisible }}, { "public", { &handlePublic, CommandSpacing::Invisible }}, { "publicsection", { &handlePublicSection, CommandSpacing::Invisible }}, { "pure", { &handlePure, CommandSpacing::Invisible }}, { "refitem", { &handleRefItem, CommandSpacing::Inline }}, { "related", { &handleRelated, CommandSpacing::Invisible }}, { "relatedalso", { &handleRelatedAlso, CommandSpacing::Invisible }}, { "relates", { &handleRelated, CommandSpacing::Invisible }}, { "relatesalso", { &handleRelatedAlso, CommandSpacing::Invisible }}, { "remark", { 0, CommandSpacing::Block }}, { "remarks", { 0, CommandSpacing::Block }}, { "result", { 0, CommandSpacing::Block }}, { "return", { 0, CommandSpacing::Block }}, { "returns", { 0, CommandSpacing::Block }}, { "retval", { &handleRetval, CommandSpacing::Block }}, { "rtfinclude", { 0, CommandSpacing::Inline }}, { "rtfonly", { &handleFormatBlock, CommandSpacing::Invisible }}, { "sa", { 0, CommandSpacing::Block }}, { "section", { &handleSection, CommandSpacing::Block }}, { "see", { 0, CommandSpacing::Block }}, { "short", { &handleBrief, CommandSpacing::Invisible }}, { "showinitializer", { &handleShowInitializer, CommandSpacing::Invisible }}, { "showrefby", { &handleReferencedByRelation, CommandSpacing::Invisible }}, { "showrefs", { &handleReferencesRelation, CommandSpacing::Invisible }}, { "since", { 0, CommandSpacing::Block }}, { "snippet", { 0, CommandSpacing::Block }}, { "snippetlineno", { 0, CommandSpacing::Block }}, { "startuml", { &handleFormatBlock, CommandSpacing::Block }}, { "static", { &handleStatic, CommandSpacing::Invisible }}, { "struct", { &handleStruct, CommandSpacing::Invisible }}, { "subpage", { &handleSubpage, CommandSpacing::Inline }}, { "subsection", { &handleSection, CommandSpacing::Block }}, { "subsubsection", { &handleSection, CommandSpacing::Block }}, { "tableofcontents", { &handleToc, CommandSpacing::Invisible }}, { "test", { &handleTest, CommandSpacing::XRef }}, { "throw", { 0, CommandSpacing::Block }}, { "throws", { 0, CommandSpacing::Block }}, { "todo", { &handleTodo, CommandSpacing::XRef }}, { "tparam", { 0, CommandSpacing::Block }}, { "typedef", { &handleFn, CommandSpacing::Invisible }}, { "union", { &handleUnion, CommandSpacing::Invisible }}, { "until", { 0, CommandSpacing::Block }}, { "var", { &handleFn, CommandSpacing::Invisible }}, { "verbatim", { &handleFormatBlock, CommandSpacing::Block }}, { "verbinclude", { 0, CommandSpacing::Inline }}, { "version", { 0, CommandSpacing::Block }}, { "warning", { 0, CommandSpacing::Block }}, { "weakgroup", { &handleWeakGroup, CommandSpacing::Invisible }}, { "xmlinclude", { 0, CommandSpacing::Inline }}, { "xmlonly", { &handleFormatBlock, CommandSpacing::Invisible }}, { "xrefitem", { &handleXRefItem, CommandSpacing::XRef }} }; #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 #define YY_NEVER_INTERACTIVE 1 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_Skip }; class GuardedSection { public: GuardedSection(bool enabled,bool parentVisible) : m_enabled(enabled),m_parentVisible(parentVisible) {} bool isEnabled() const { return m_enabled; } bool parentVisible() const { return m_parentVisible; } private: bool m_enabled; bool m_parentVisible; }; /* ----------------------------------------------------------------- * * statics */ struct commentscanYY_state { OutlineParserInterface *langParser = 0; // the language parser that is calling us QCString inputString; // input string QCString currentCmd; // the command used int inputPosition = 0; // read pointer QCString fileName; // file name that is read from int lineNr = 0; // line number in the input bool inBody = FALSE; // was the comment found inside the body of a function? OutputContext inContext; // are we inside the brief, details or xref part bool briefEndsAtDot = FALSE; // does the brief description stop at a dot? QCString formulaText; // Running text of a formula QCString formulaEnv; // environment name int formulaNewLines = 0; // amount of new lines in the formula QCString *pOutputString = 0; // pointer to string to which the output is appended. QCString outputXRef; // temp argument of todo/test/../xrefitem commands QCString blockName; // preformatted block name (e.g. verbatim, latexonly,...) XRefKind xrefKind = XRef_Item; // kind of cross-reference command XRefKind newXRefKind = XRef_Item; // GuardType guardType = Guard_If; // kind of guards for conditional section bool enabledSectionFound = FALSE; QCString functionProto; // function prototype std::stack guards; // tracks nested conditional sections (if,ifnot,..) Entry *current = 0; // working entry bool needNewEntry = FALSE; QCString sectionLabel; QCString sectionTitle; int sectionLevel = 0; QCString xrefItemKey; QCString newXRefItemKey; QCString xrefItemTitle; QCString xrefListTitle; Protection protection = Public; bool xrefAppendFlag = FALSE; bool inGroupParamFound = FALSE; int braceCount = 0; bool insidePre = FALSE; bool parseMore = FALSE; int condCount = 0; int commentCount = 0; QCString spaceBeforeCmd; QCString spaceBeforeIf; QCString copyDocArg; QCString guardExpr; int roundCount = 0; bool insideParBlock = FALSE; bool inInternalDocs = FALSE; int prevPosition = 0; DocGroup docGroup; bool markdownSupport = TRUE; }; static std::mutex g_sectionMutex; static std::mutex g_formulaMutex; static std::mutex g_citeMutex; //----------------------------------------------------------------------------- static QCString stripQuotes(const char *s); static bool getDocSectionName(int s); static SectionType sectionLevelToType(int level); static void stripTrailingWhiteSpace(QCString &s); static void initParser(yyscan_t yyscanner); static bool makeStructuralIndicator(yyscan_t yyscanner,Entry::Sections s); static void lineCount(yyscan_t yyscanner); static void addXRefItem(yyscan_t yyscanner, const QCString &listName,const QCString &itemTitle, const QCString &listTitle,bool append); static QCString addFormula(yyscan_t yyscanner); static void checkFormula(yyscan_t yyscanner); static void addSection(yyscan_t yyscanner); static inline void setOutput(yyscan_t yyscanner,OutputContext ctx); static void addAnchor(yyscan_t yyscanner,const QCString &anchor); static inline void addOutput(yyscan_t yyscanner,const char *s); static inline void addOutput(yyscan_t yyscanner,const QCString &s); static inline void addOutput(yyscan_t yyscanner,char c); static void endBrief(yyscan_t yyscanner,bool addToOutput=TRUE); static void handleGuard(yyscan_t yyscanner,const QCString &expr); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static void addCite(yyscan_t yyscanner); #define unput_string(yytext,yyleng) do { for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]); } while(0) //----------------------------------------------------------------------------- #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size); %} /* start command character */ CMD ("\\"|"@") XREFCMD {CMD}("bug"|"deprecated"|"test"|"todo"|"xrefitem") PRE [pP][rR][eE] TABLE [tT][aA][bB][lL][eE] P [pP] UL [uU][lL] OL [oO][lL] DL [dD][lL] IMG [iI][mM][gG] HR [hH][rR] PARA [pP][aA][rR][aA] CODE [cC][oO][dD][eE] CAPTION [cC][aA][pP][tT][iI][oO][nN] CENTER [cC][eE][nN][tT][eE][rR] DIV [dD][iI][vV] DETAILEDHTML {CENTER}|{DIV}|{PRE}|{UL}|{TABLE}|{OL}|{DL}|{P}|[Hh][1-6]|{IMG}|{HR}|{PARA} DETAILEDHTMLOPT {CODE} BN [ \t\n\r] BL [ \t\r]*"\n" B [ \t] Bopt {B}* BS ^(({B}*"/""/")?)(({B}*"*"+)?){B}* ATTR ({B}+[^>\n]*)? DOCNL "\n"|"\\ilinebr" LC "\\"{B}*"\n" NW [^a-z_A-Z0-9] FILESCHAR [a-z_A-Z0-9\x80-\xFF\\:\\\/\-\+@&#] FILEECHAR [a-z_A-Z0-9\x80-\xFF\-\+@&#] FILE ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|("\""[^\n\"]*"\"") ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]* LABELID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF\-]* CITESCHAR [a-z_A-Z0-9\x80-\xFF\-\?] CITEECHAR [a-z_A-Z0-9\x80-\xFF\-\+:\/\?]* CITEID {CITESCHAR}{CITEECHAR}*("."{CITESCHAR}{CITEECHAR}*)*|"\""{CITESCHAR}{CITEECHAR}*("."{CITESCHAR}{CITEECHAR}*)*"\"" SCOPEID {ID}({ID}*{BN}*"::"{BN}*)*({ID}?) SCOPENAME "$"?(({ID}?{BN}*("::"|"."){BN}*)*)((~{BN}*)?{ID}) TMPLSPEC "<"{BN}*[^>]+{BN}*">" MAILADDR [a-z_A-Z0-9.+\-]+"@"[a-z_A-Z0-9\-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+ RCSTAG "$"{ID}":"[^\n$]+"$" // C start comment CCS "/\*" // C end comment CCE "*\/" // Cpp comment CPPC "/\/" // end of section title with asterisk STAopt [^\n@\\*]* // end of section title without asterisk STopt [^\n@\\]* %option noyywrap /* comment parsing states. */ %x Comment %x PageDocArg1 %x PageDocArg2 %x RelatesParam1 %x ClassDocArg1 %x ClassDocArg2 %x ClassDocArg3 %x CategoryDocArg1 %x XRefItemParam1 %x XRefItemParam2 %x XRefItemParam3 %x FileDocArg1 %x ParamArg1 %x EnumDocArg1 %x NameSpaceDocArg1 %x PackageDocArg1 %x ConceptDocArg1 %x GroupDocArg1 %x GroupDocArg2 %x SectionLabel %x SectionTitle %x SubpageLabel %x SubpageTitle %x FormatBlock %x LineParam %x GuardParam %x GuardParamEnd %x SkipGuardedSection %x SkipInternal %x NameParam %x InGroupParam %x FnParam %x OverloadParam %x InheritParam %x ExtendsParam %x ReadFormulaShort %x ReadFormulaRound %x ReadFormulaLong %x AnchorLabel %x HtmlComment %x SkipLang %x CiteLabel %x CopyDoc %x GuardExpr %x CdataSection %x Noop %% /* What can happen in while parsing a comment block: * commands (e.g. @page, or \page) * escaped commands (e.g. @@page or \\page). * formulas (e.g. \f$...\f$ \f[...\f] \f{...\f} \f(...\f) ) * directories (e.g. \doxygen\src\) * autolist end. (e.g. a dot on an otherwise empty line) * newlines. * end of brief description due to blank line. * end of brief description due to some command (@command, or ). * words and whitespace and other characters (#,?!, etc). * grouping commands (e.g. @{ and @}) * language switch (e.g. \~english or \~). * mail address (e.g. doxygen@gmail.com). * quoted text, such as "foo@bar" * XML commands, */ {CMD}{CMD}[a-z_A-Z]+{B}* { // escaped command addOutput(yyscanner,yytext); } {CMD}{CMD}"~"[a-z_A-Z]* { // escaped command addOutput(yyscanner,yytext); } {MAILADDR} { // mail address addOutput(yyscanner,yytext); } "\""[^"\n]*"\"" { // quoted text addOutput(yyscanner,yytext); } ("\\"[a-z_A-Z]+)+"\\" { // directory (or chain of commands!) addOutput(yyscanner,yytext); } "<"{DETAILEDHTML}{ATTR}">" { // HTML command that ends a brief description setOutput(yyscanner,OutputDoc); // continue with the same input REJECT; } "<"{DETAILEDHTMLOPT}{ATTR}">" { // HTML command that ends a brief description if (yyextra->current->lang==SrcLangExt_CSharp) { setOutput(yyscanner,OutputDoc); } // continue with the same input REJECT; } "" { // start of a .NET XML style brief description setOutput(yyscanner,OutputBrief); addOutput(yyscanner,yytext); } "" { // start of a .NET XML style detailed description setOutput(yyscanner,OutputDoc); addOutput(yyscanner,yytext); } "" { // start of a .NET XML style detailed description addOutput(yyscanner,yytext); setOutput(yyscanner,OutputDoc); } "" { // end of a brief or detailed description setOutput(yyscanner,OutputDoc); addOutput(yyscanner,yytext); } "<"{CAPTION}{ATTR}">" { QCString tag(yytext); int s=tag.find("id="); if (s!=-1) // command has id attribute { char c=tag[s+3]; if (c=='\'' || c=='"') // valid start { int e=tag.find(c,s+4); if (e!=-1) // found matching end { QCString id=tag.mid(s+4,e-s-4); // extract id addAnchor(yyscanner,id); } } } addOutput(yyscanner,yytext); } "<"{PRE}{ATTR}">" { yyextra->insidePre=TRUE; addOutput(yyscanner,yytext); } "" { yyextra->insidePre=FALSE; addOutput(yyscanner,yytext); } {RCSTAG} { // RCS tag which end a brief description setOutput(yyscanner,OutputDoc); REJECT; } "