From a390d6a9ad62019c7ca3d3689184fd3ce6afd57c Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 12 Aug 2019 18:51:01 +0200 Subject: Incorrect NCName in docbook citations In a bibtex reference it is possible to have a colon as the id, but in docbook this will result in: ``` docbook/citelist.xml:5: validity error : xml:id : attribute value _citelist_1CITEREF_pre:post is not an NCName [1] ``` So the id has to be translated. A colon in an id can only happen in case the names is provided from the outside. --- src/docbookvisitor.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index ce3a845..83c34e7 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -36,6 +36,7 @@ #include "htmlentity.h" #include "emoji.h" #include "plantuml.h" +#include "growbuf.h" #if 0 #define DB_VIS_C DB_VIS_C1(m_t) @@ -49,6 +50,25 @@ #define DB_VIS_C2a(x,y) #endif +static QCString filterId(const char *s) +{ + static GrowBuf growBuf; + growBuf.clear(); + if (s==0) return ""; + const unsigned char *p=(const unsigned char *)s; + char c; + while ((c=*p++)) + { + switch (c) + { + case ':': growBuf.addStr("_1"); break; + default: growBuf.addChar(c); break; + } + } + growBuf.addChar(0); + return growBuf.get(); +} + void DocbookDocVisitor::visitCaption(const QList &children) { QListIterator cli(children); @@ -374,7 +394,7 @@ void DocbookDocVisitor::visit(DocAnchor *anc) { DB_VIS_C if (m_hide) return; - m_t << "file()) << "_1" << anc->anchor() << "\"/>"; + m_t << "file()) << "_1" << filterId(anc->anchor()) << "\"/>"; } void DocbookDocVisitor::visit(DocInclude *inc) @@ -550,7 +570,7 @@ void DocbookDocVisitor::visit(DocCite *cite) { DB_VIS_C if (m_hide) return; - if (!cite->file().isEmpty()) startLink(cite->file(),cite->anchor()); + if (!cite->file().isEmpty()) startLink(cite->file(),filterId(cite->anchor())); filter(cite->text()); if (!cite->file().isEmpty()) endLink(); } -- cgit v0.12 From d43815b2d1aed4fd10a918f18688c35995298677 Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 19 Aug 2019 14:39:12 +0200 Subject: Warning in case of usage of a single quote in a code span. When we have a single quotes in a codespan we can get the warning: ``` warning: found tag without matching ``` Added the workaround to the documentation. --- doc/markdown.doc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/markdown.doc b/doc/markdown.doc index 5edbaf9..883e831 100644 --- a/doc/markdown.doc +++ b/doc/markdown.doc @@ -193,10 +193,12 @@ code spans appear inline in a paragraph. An example: Use the `printf()` function. -To show a literal backtick inside a code span use double backticks, i.e. +To show a literal backtick or single quote inside a code span use double backticks, i.e. To assign the output of command `ls` to `var` use ``var=`ls```. + To assign the text 'text' to `var` use ``var='text'``. + See section \ref mddox_code_spans for more info how doxygen handles code spans slightly different than standard Markdown. @@ -606,6 +608,9 @@ In other words; a single quote cancels the special treatment of a code span wrapped in a pair of backtick characters. This extra restriction was added for backward compatibility reasons. +In case you want to have single quotes inside a code span, don't use +one backtick but two backticks around the code span. + \subsection mddox_lists Lists Extensions With Markdown two lists separated by an empty line are joined together into -- cgit v0.12 From 5576550317561f0fc33c26db144d0bea5561bc9f Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 20 Aug 2019 12:34:59 +0200 Subject: issue #7210: 1.8.16: Image inclusion is inconsistent The consequence of #7084 (Missing warning about ambiguous files) was that in case a file was ambiguous only a message was given. Now a warning is given plus one of the ambiguous files is used (might be the wrong one). --- src/docparser.cpp | 62 +++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index 9dd1c71..4ec4b52 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -287,8 +287,17 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool bool ambig; FileDef *fd; //printf("Search for %s\n",fileName); - if ((fd=findFileDef(Doxygen::imageNameDict,fileName,ambig)) && !ambig) + if (fd=findFileDef(Doxygen::imageNameDict,fileName,ambig)) { + if (ambig & dowarn) + { + QCString text; + text.sprintf("image file name %s is ambiguous.\n",qPrint(fileName)); + text+="Possible candidates:\n"; + text+=showFileDefMatches(Doxygen::imageNameDict,fileName); + warn_doc_error(g_fileName,doctokenizerYYlineno,text); + } + QCString inputFile = fd->absFilePath(); QFile inImage(inputFile); if (inImage.open(IO_ReadOnly)) @@ -378,17 +387,6 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool return baseName; } } - else if (ambig) - { - if (dowarn) - { - QCString text; - text.sprintf("image file name %s is ambiguous.\n",qPrint(fileName)); - text+="Possible candidates:\n"; - text+=showFileDefMatches(Doxygen::imageNameDict,fileName); - warn_doc_error(g_fileName,doctokenizerYYlineno,text); - } - } else { result=fileName; @@ -1846,16 +1844,16 @@ static void readTextFileByName(const QCString &file,QCString &text) // as a fallback we also look in the exampleNameDict bool ambig; FileDef *fd; - if ((fd=findFileDef(Doxygen::exampleNameDict,file,ambig)) && !ambig) + if (fd=findFileDef(Doxygen::exampleNameDict,file,ambig)) { text = fileToString(fd->absFilePath(),Config_getBool(FILTER_SOURCE_FILES)); - } - else if (ambig) - { - warn_doc_error(g_fileName,doctokenizerYYlineno,"included file name %s is ambiguous" + if (ambig) + { + warn_doc_error(g_fileName,doctokenizerYYlineno,"included file name %s is ambiguous" "Possible candidates:\n%s",qPrint(file), qPrint(showFileDefMatches(Doxygen::exampleNameDict,file)) ); + } } else { @@ -2748,17 +2746,17 @@ bool DocDotFile::parse() { fd = findFileDef(Doxygen::dotFileNameDict,m_name+".dot",ambig); } - if (fd && !ambig) + if (fd) { m_file = fd->absFilePath(); ok = true; - } - else if (ambig) - { - warn_doc_error(g_fileName,doctokenizerYYlineno,"included dot file name %s is ambiguous.\n" + if (ambig) + { + warn_doc_error(g_fileName,doctokenizerYYlineno,"included dot file name %s is ambiguous.\n" "Possible candidates:\n%s",qPrint(m_name), qPrint(showFileDefMatches(Doxygen::dotFileNameDict,m_name)) ); + } } else { @@ -2785,17 +2783,17 @@ bool DocMscFile::parse() { fd = findFileDef(Doxygen::mscFileNameDict,m_name+".msc",ambig); } - if (fd && !ambig) + if (fd) { m_file = fd->absFilePath(); ok = true; - } - else if (ambig) - { - warn_doc_error(g_fileName,doctokenizerYYlineno,"included msc file name %s is ambiguous.\n" + if (ambig) + { + warn_doc_error(g_fileName,doctokenizerYYlineno,"included msc file name %s is ambiguous.\n" "Possible candidates:\n%s",qPrint(m_name), qPrint(showFileDefMatches(Doxygen::mscFileNameDict,m_name)) ); + } } else { @@ -2824,17 +2822,17 @@ bool DocDiaFile::parse() { fd = findFileDef(Doxygen::diaFileNameDict,m_name+".dia",ambig); } - if (fd && !ambig) + if (fd) { m_file = fd->absFilePath(); ok = true; - } - else if (ambig) - { - warn_doc_error(g_fileName,doctokenizerYYlineno,"included dia file name %s is ambiguous.\n" + if (ambig) + { + warn_doc_error(g_fileName,doctokenizerYYlineno,"included dia file name %s is ambiguous.\n" "Possible candidates:\n%s",qPrint(m_name), qPrint(showFileDefMatches(Doxygen::diaFileNameDict,m_name)) ); + } } else { -- cgit v0.12 From 4e2a1ac22f27046f16acc95ea7d763a67bb7f344 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 23 Aug 2019 15:15:37 +0200 Subject: Text ' ' appears in code segments In case we have the UTF-8 code for nbsp in our source this is (see #6983) replaced with ` `, though in code fragments this is unwanted as here the text appears literally. the UTF-8 nbsp is temporary replaced by a "doxygen" tag and for fenced code blocks, backtick blocks and special bloc commands (code, verbatim, htmlonly, formulas,...) replaced back with the UTF-8 version, the remaining "doxygen" tags are at the end replaced with ` ` --- src/markdown.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/markdown.cpp b/src/markdown.cpp index 2cbdcb5..a3455ab 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -108,7 +108,8 @@ static Entry *g_current; static QCString g_fileName; static int g_lineNr; static int g_indentLevel=0; // 0 is outside markdown, -1=page level - +static char g_doxynbsputf8[3] = {'\xc2', '\xa0', '\0'}; // UTF-8 nbsp +static char *g_doxynbsp = "&_doxy_nbsp;"; //---------- const int codeBlockIndent = 4; @@ -1044,7 +1045,7 @@ static int processSpecialCommand(GrowBuf &out, const char *data, int offset, int if (qstrncmp(&data[i+1],endBlockName,l)==0) { //printf("found end at %d\n",i); - out.addStr(data,i+1+l); + out.addStr(substitute(QCString(data).left(i+1+l),g_doxynbsp,g_doxynbsputf8)); return i+1+l; } } @@ -2174,7 +2175,7 @@ static void writeFencedCodeBlock(GrowBuf &out,const char *data,const char *lng, { out.addStr("{"+lang+"}"); } - out.addStr(data+blockStart,blockEnd-blockStart); + out.addStr(substitute(QCString(data+blockStart).left(blockEnd-blockStart),g_doxynbsp,g_doxynbsputf8)); out.addStr("\n"); out.addStr("@endcode"); } @@ -2484,7 +2485,7 @@ static QCString detab(const QCString &s,int &refIndent) // special handling of the UTF-8 nbsp character 0xc2 0xa0 if (c == '\xc2' && data[i] == '\xa0') { - out.addStr(" "); + out.addStr(g_doxynbsp); i++; } else @@ -2561,7 +2562,7 @@ QCString processMarkdown(const QCString &fileName,const int lineNr,Entry *e,cons processInline(out,s,s.length()); out.addChar(0); Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n=========\n",qPrint(input),qPrint(out.get())); - return out.get(); + return substitute(out.get(),g_doxynbsp," "); } //--------------------------------------------------------------------------- -- cgit v0.12 From def222ab7fa1ad9e51dff1b11b610c9e1e4af067 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 27 Aug 2019 19:06:59 +0200 Subject: issue #7228 Using markdown causes wrong error and warning line numbers - v. 1.8.16 Sacrificing some readability of the debug `-d markdown` output for a better approximation of the line numbers by keeping the rows of a markdown table on one line when translating to a HTML table. --- src/markdown.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/markdown.cpp b/src/markdown.cpp index 2cbdcb5..888f161 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -1828,7 +1828,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) } - out.addStr("\n"); + out.addStr("
"); QCString cellTag("th"), cellClass("class=\"markdownTableHead"); for (unsigned row = 0; row < tableContents.size(); row++) { @@ -1836,16 +1836,16 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) { if (row % 2) { - out.addStr("\n"); + out.addStr(""); } else { - out.addStr("\n"); + out.addStr(""); } } else { - out.addStr(" \n"); + out.addStr(" "); } for (int c = 0; c < columns; c++) { @@ -1900,7 +1900,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) } // need at least one space on either side of the cell text in // order for doxygen to do other formatting - out.addStr("> " + cellText + "\n\n"); + out.addStr("> " + cellText + ""); } cellTag = "td"; cellClass = "class=\"markdownTableBody"; -- cgit v0.12 From a3093ff24ec75b70d6d7dc37ca2c7e68f36161fe Mon Sep 17 00:00:00 2001 From: albert-github Date: Thu, 29 Aug 2019 16:42:44 +0200 Subject: Problem with `
` in LaTeX multicolumn cell In case we have a `
` in a table cell then it is displayed as a horizontal line (in LaTeX) unless it is in a multicolumn cell. In the later case it throws an error: ``` ! You can't use `\hrule' here except with leaders. \DoxyHorRuler ... }{0ex plus 0ex minus 0ex}\hrule ``` We have to use use `\hrulefill` in a table but in combination with the table option of xcolor this gives some problems so a new command has to be defined for this. See also: - horizontal rule / line inside a multicolumn field (https://tex.stackexchange.com/questions/506211/horizontal-rule-line-inside-a-multicolumn-field) - interaction between \usepackage[table]{xcolor} and \hrulefill (https://tex.stackexchange.com/questions/506221/interaction-between-usepackagetablexcolor-and-hrulefill) --- src/latexdocvisitor.cpp | 5 ++++- templates/latex/doxygen.sty | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index a0bbf73..5e424b0 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -280,7 +280,10 @@ void LatexDocVisitor::visit(DocLineBreak *) void LatexDocVisitor::visit(DocHorRuler *) { if (m_hide) return; - m_t << "\\DoxyHorRuler\n"; + if (insideTable()) + m_t << "\\DoxyHorRuler{1}\n"; + else + m_t << "\\DoxyHorRuler{0}\n"; } void LatexDocVisitor::visit(DocStyleChange *s) diff --git a/templates/latex/doxygen.sty b/templates/latex/doxygen.sty index bf19901..d28554b 100644 --- a/templates/latex/doxygen.sty +++ b/templates/latex/doxygen.sty @@ -35,9 +35,19 @@ \endgroup% } -\newcommand{\DoxyHorRuler}{% +\makeatletter +\newcommand\hrulefilll{\leavevmode\leaders\hrule\hskip 0pt plus 1filll\kern\z@} +\makeatother + +\newcommand{\DoxyHorRuler}[1]{% \setlength{\parskip}{0ex plus 0ex minus 0ex}% - \hrule% + \ifthenelse{#1=0}% + {% + \hrule% + }% + {% + \hrulefilll% + }% } \newcommand{\DoxyLabelFont}{} \newcommand{\entrylabel}[1]{% -- cgit v0.12 From 416ee572ba35b4d0cf30ccca66f0691c658f2e53 Mon Sep 17 00:00:00 2001 From: albert-github Date: Thu, 29 Aug 2019 18:06:51 +0200 Subject: Problem with `
` in LaTeX multicolumn cell Small problem with defining `\hrulefilll`, moved code. --- doc/doxygen_manual.tex | 5 +++++ src/latexgen.cpp | 5 +++++ templates/latex/doxygen.sty | 4 ---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/doxygen_manual.tex b/doc/doxygen_manual.tex index 8ff3c66..e350013 100644 --- a/doc/doxygen_manual.tex +++ b/doc/doxygen_manual.tex @@ -66,6 +66,11 @@ \usepackage{doxygen} \usepackage{manual} %% +%gave problems when in doxygen.sty +\makeatletter +\newcommand\hrulefilll{\leavevmode\leaders\hrule\hskip 0pt plus 1filll\kern\z@} +\makeatother +%% % unfortunately constructs like: % \renewcommand{\doxysection}[1]{\doxysubsection{##1}} % using values from book.cls (see also doxygen.sty) and redefining sections to correct level. diff --git a/src/latexgen.cpp b/src/latexgen.cpp index e6c6861..1792f15 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -623,6 +623,11 @@ static void writeDefaultHeaderPart1(FTextStream &t) "}\n" "\\makeatother\n" "\n"; + // + t << "\\makeatletter\n" + "\\newcommand\\hrulefilll{\\leavevmode\\leaders\\hrule\\hskip 0pt plus 1filll\\kern\\z@}\n" + "\\makeatother\n" + "\n"; // Headers & footers QGString genString; diff --git a/templates/latex/doxygen.sty b/templates/latex/doxygen.sty index d28554b..83891a5 100644 --- a/templates/latex/doxygen.sty +++ b/templates/latex/doxygen.sty @@ -35,10 +35,6 @@ \endgroup% } -\makeatletter -\newcommand\hrulefilll{\leavevmode\leaders\hrule\hskip 0pt plus 1filll\kern\z@} -\makeatother - \newcommand{\DoxyHorRuler}[1]{% \setlength{\parskip}{0ex plus 0ex minus 0ex}% \ifthenelse{#1=0}% -- cgit v0.12 From 4a72a9b07e805b4ba27560e8e921bcee0002ef4c Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 9 Sep 2019 13:28:28 +0200 Subject: issue #7248: Including external tag files with TOC produces a broken index.qhp Ignore automatically generated anchor names when importing a tag file. --- src/tagreader.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/tagreader.cpp b/src/tagreader.cpp index 56dbe7d..d79d9b5 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -494,6 +494,23 @@ class TagFileParser : public QXmlDefaultHandler void endDocAnchor() { + // Check whether or not the tag is automatically generate, in that case ignore the tag. + switch(m_state) + { + case InClass: + case InFile: + case InNamespace: + case InGroup: + case InPage: + case InMember: + case InPackage: + case InDir: + if (QString(m_curString).startsWith("autotoc_md")) return; + break; + default: + warn("Unexpected tag 'docanchor' found"); + return; + } switch(m_state) { case InClass: m_curClass->docAnchors.append(new TagAnchorInfo(m_fileName,m_curString,m_title)); break; @@ -504,7 +521,7 @@ class TagFileParser : public QXmlDefaultHandler case InMember: m_curMember->docAnchors.append(new TagAnchorInfo(m_fileName,m_curString,m_title)); break; case InPackage: m_curPackage->docAnchors.append(new TagAnchorInfo(m_fileName,m_curString,m_title)); break; case InDir: m_curDir->docAnchors.append(new TagAnchorInfo(m_fileName,m_curString,m_title)); break; - default: warn("Unexpected tag 'docanchor' found"); break; + default: warn("Unexpected tag 'docanchor' found"); break; // Not really necessary anymore } } -- cgit v0.12 From 4ab73bb872b443ad798be384171c5ff222cb2ba2 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sun, 6 Oct 2019 13:40:14 +0200 Subject: Textual error Correcting textual error --- doc/commands.doc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/commands.doc b/doc/commands.doc index 4e0a6f9..5c6d067 100644 --- a/doc/commands.doc +++ b/doc/commands.doc @@ -2277,8 +2277,8 @@ Commands for displaying examples The `option` `lineno` can be used to enable line numbers for the included code if desired. The `option` `doc` can be used to treat the file as documentation rather than code. - \note Some that when using the `{doc}` option, - commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with + \note When using the `{doc}` option, + some commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with this command due to the moment of parsing. \note The included documentation should not have comment signs in it as they will appear @@ -2409,8 +2409,8 @@ Commands for displaying examples The `option` `lineno` can be used to enable line numbers for the included code if desired. The `option` `doc` can be used to treat the file as documentation rather than code. - \note Some that when using the `{doc}` option, - commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with + \note When using the `{doc}` option, + some commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with this command due to the moment of parsing. \note The included documentation should not have comment signs in it as they will appear -- cgit v0.12 From 27188292dfb9df6eaa5523d14e723cd1049afe9d Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 7 Oct 2019 12:59:41 +0200 Subject: Bug 550158 - EXTRACT_ALL=YES parses non doxygen comments Part of the problem has already been solved by means of "Bug 616379 - doxygen result by nested comment incorrectly" (pull request #6649. The missing part (start of comment) has been added here. --- src/commentcnv.l | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/commentcnv.l b/src/commentcnv.l index f144aec..4feee30 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -841,6 +841,9 @@ void replaceComment(int offset); g_inRoseComment=FALSE; BEGIN(Scan); } +"/**" { + copyToOutput("/‍**",8); + } "*/" { copyToOutput("*‍/",7); } -- cgit v0.12 From a6da9a48ad520206462632496fc4c83d72bffe5a Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 7 Oct 2019 13:22:19 +0200 Subject: Bug 550158 - EXTRACT_ALL=YES parses non doxygen comments Forgot to add the `/` to the not "normal" characters in the ReadLine --- src/commentcnv.l | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commentcnv.l b/src/commentcnv.l index 4feee30..341ea42 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -850,10 +850,10 @@ void replaceComment(int offset); "*" { copyToOutput(yytext,(int)yyleng); } -[^\\@\n\*]* { +[^\\@\n\*/]* { copyToOutput(yytext,(int)yyleng); } -[^\\@\n\*]*/\n { +[^\\@\n\*/]*/\n { copyToOutput(yytext,(int)yyleng); BEGIN(g_readLineCtx); } -- cgit v0.12 From f17438620e08b245bcf133c422bed433fb46bc13 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 18 Oct 2019 10:20:27 +0200 Subject: issue #7313 VHDL attribute 'subtype is not supported and breaks parser Add the `'subtype` construct for variables etc. --- vhdlparser/vhdlparser.jj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vhdlparser/vhdlparser.jj b/vhdlparser/vhdlparser.jj index 126118c..2f0c466 100644 --- a/vhdlparser/vhdlparser.jj +++ b/vhdlparser/vhdlparser.jj @@ -1614,6 +1614,9 @@ QCString name_ext1() : {QCString s,s1,s2;} { ( + LOOKAHEAD() + {s+="'subtype";} +| LOOKAHEAD( suffix()) s1=suffix(){s+=".";s+=s1;} | -- cgit v0.12 From ce4b7363932c1152060ba4b24d9a7e7bf438d4e4 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 5 Nov 2019 18:52:56 +0100 Subject: Simple nospam email address When having a simple nospam email address coded like: ``` /** \file * Big Unknown */ ``` this results in the warning: ``` aa.c:2: warning: Unsupported xml/html tag found ``` and in the HTML output it looks like: ``` Big Unknown ``` instead of: ``` Big Unknown ``` (Found in a couple of open source projects). --- src/doctokenizer.l | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 22b14a0..59a0a9d 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -345,6 +345,7 @@ 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}*)*"\"" MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+ +MAILADR2 {BLANK}*[a-z_A-Z0-9+-]+({BLANK}*[Dd][Oo][Tt]{BLANK}*[a-z_A-Z0-9+-]+)?{BLANK}*[Aa][Tt]{BLANK}*[a-z_A-Z0-9-]+({BLANK}*[Dd][Oo][Tt]{BLANK}*[a-z_A-Z0-9\-]+)+{BLANK}*[a-z_A-Z0-9\-]+{BLANK}* OPTSTARS ("//"{BLANK}*)?"*"*{BLANK}* LISTITEM {BLANK}*[-]("#")?{WS} MLISTITEM {BLANK}*[+*]{WS} @@ -655,6 +656,10 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} g_token->isEMailAddr=TRUE; return TK_URL; } +"<"{MAILADR2}">" { // anti spame mail address + g_token->name=yytext; + return TK_WORD; + } "$"{ID}":"[^:\n$][^\n$]*"$" { /* RCS tag */ QCString tagName(yytext+1); int index=tagName.find(':'); -- cgit v0.12 From 2001c933292d3dd25ebc6634dab62aab7389c5bc Mon Sep 17 00:00:00 2001 From: albert-github Date: Wed, 6 Nov 2019 18:46:24 +0100 Subject: Output of unknown xml/html tag When having a problem like: ``` /** \file - Just name - name plus subname - name plus twice subname - name plus subname subname="" */ ``` we get correctly the warnings: ``` .../aa.h:3: warning: Unsupported xml/html tag found .../aa.h:4: warning: Unsupported xml/html tag found .../aa.h:5: warning: Unsupported xml/html tag found .../aa.h:6: warning: Unsupported xml/html tag found ``` but the output doesn't look good as there is `=""` added: ``` Just name name plus subname name plus twice subname name plus subname subname="" ``` This patch fixes this output. --- src/docparser.cpp | 2 +- src/doctokenizer.h | 1 + src/doctokenizer.l | 31 +++++++++++++++++++++---------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index a22087e..f3ccbf5 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -6286,7 +6286,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta break; case HTML_UNKNOWN: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported xml/html tag <%s> found", qPrint(tagName)); - m_children.append(new DocWord(this, "<"+tagName+tagHtmlAttribs.toString()+">")); + m_children.append(new DocWord(this, "<"+tagName+g_token->attribsStr+">")); break; case XML_INHERITDOC: handleInheritDoc(); diff --git a/src/doctokenizer.h b/src/doctokenizer.h index f89069c..e95c4c0 100644 --- a/src/doctokenizer.h +++ b/src/doctokenizer.h @@ -100,6 +100,7 @@ struct TokenInfo HtmlAttribList attribs; bool endTag; bool emptyTag; + QCString attribsStr; // whitespace QCString chars; diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 22b14a0..016b621 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -39,6 +39,7 @@ #include "doxygen.h" #include "portable.h" #include "cite.h" +#include "growbuf.h" #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 @@ -177,6 +178,10 @@ static void processSection() static void handleHtmlTag() { + static GrowBuf growBuf; + growBuf.clear(); + g_token->attribsStr=""; + QCString tagText=yytext; g_token->attribs.clear(); g_token->endTag = FALSE; @@ -207,54 +212,58 @@ static void handleHtmlTag() { char c=tagText.at(i); // skip spaces - while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); } + while (i<(int)yyleng && isspace((uchar)c)) { growBuf.addChar(c);c=tagText.at(++i); } // check for end of the tag if (c == '>') break; // Check for XML style "empty" tag. if (c == '/') { + growBuf.addChar(c); g_token->emptyTag = TRUE; break; } startName=i; // search for end of name - while (i<(int)yyleng && !isspace((uchar)c) && c!='=' && c!= '>') { c=tagText.at(++i); } + while (i<(int)yyleng && !isspace((uchar)c) && c!='=' && c!= '>') { growBuf.addChar(c);c=tagText.at(++i); } endName=i; HtmlAttrib opt; opt.name = tagText.mid(startName,endName-startName).lower(); // skip spaces - while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); } + while (i<(int)yyleng && isspace((uchar)c)) { growBuf.addChar(c);c=tagText.at(++i); } if (tagText.at(i)=='=') // option has value { + growBuf.addChar(c); c=tagText.at(++i); // skip spaces - while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); } + while (i<(int)yyleng && isspace((uchar)c)) { growBuf.addChar(c);c=tagText.at(++i); } if (tagText.at(i)=='\'') // option '...' { + growBuf.addChar(c); c=tagText.at(++i); startAttrib=i; // search for matching quote - while (i<(int)yyleng && c!='\'') { c=tagText.at(++i); } + while (i<(int)yyleng && c!='\'') { growBuf.addChar(c);c=tagText.at(++i); } endAttrib=i; - if (i<(int)yyleng) c=tagText.at(++i); + if (i<(int)yyleng) {growBuf.addChar(c);c=tagText.at(++i);} } else if (tagText.at(i)=='"') // option "..." { + growBuf.addChar(c); c=tagText.at(++i); startAttrib=i; // search for matching quote - while (i<(int)yyleng && c!='"') { c=tagText.at(++i); } + while (i<(int)yyleng && c!='"') { growBuf.addChar(c);c=tagText.at(++i); } endAttrib=i; - if (i<(int)yyleng) c=tagText.at(++i); + if (i<(int)yyleng) {growBuf.addChar(c);c=tagText.at(++i);} } else // value without any quotes { startAttrib=i; // search for separator or end symbol - while (i<(int)yyleng && !isspace((uchar)c) && c!='>') { c=tagText.at(++i); } + while (i<(int)yyleng && !isspace((uchar)c) && c!='>') { growBuf.addChar(c);c=tagText.at(++i); } endAttrib=i; - if (i<(int)yyleng) c=tagText.at(++i); + if (i<(int)yyleng) {growBuf.addChar(c);c=tagText.at(++i);} } opt.value = tagText.mid(startAttrib,endAttrib-startAttrib); if (opt.name == "align") opt.value = opt.value.lower(); @@ -271,6 +280,8 @@ static void handleHtmlTag() // opt.name.data(),opt.value.data()); g_token->attribs.append(&opt); } + growBuf.addChar(0); + g_token->attribsStr = growBuf.get(); } static QCString stripEmptyLines(const QCString &s) -- cgit v0.12 From f08e87623368134c6541af12995b811ef9aff069 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 12 Nov 2019 11:42:22 +0100 Subject: issue #7290 error: Problem running ghostscript gs -q -g562x56 -r384x384x -sDEVICE=ppmraw -sOutputFile=_form0.pnm -dNOPAUSE -dBATCH -- _form0.ps. Check your installation! @maehr had a talk with Robin Watts and Ken Sharp at IRC and there seem to be basically 3 different problems: * `-r%dx%d` (the dimension for `r` shouldn't be `-r384x384x`, but `-r384x384`), * misuse / unnecessary use of `--` and * since 9.50 the command needs more control access (that might be worked around by either whitelisting the file via `--permit-file-read=_form0.eps` (only works from 9.50 and upwards) or generally accepting any file with `-dNOSAFER` (works since quite some time). The second option is considered to be unsafe if we would process any file, but in this case we process self produced / controlled files. I don't know if doxygen has any threat model that it assumes. ). > Ken Sharp: Yeah the %dx is wrong, as Robin says its sheer luck that works the -- isn't needed and is what's causing the first problem and file control is the new bugbear The suggestions have been implemented and test / docs works now with old and new version. --- src/formula.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/formula.cpp b/src/formula.cpp index 534f56a..3d8e6ce 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -193,8 +193,8 @@ void FormulaList::generateBitmaps(const char *path) // used. char gsArgs[4096]; - sprintf(gsArgs,"-q -g%dx%d -r%dx%dx -sDEVICE=ppmraw " - "-sOutputFile=%s.pnm -dNOPAUSE -dBATCH -- %s.ps", + sprintf(gsArgs,"-q -g%dx%d -r%dx%d -sDEVICE=ppmraw " + "-sOutputFile=%s.pnm -dNOPAUSE -dBATCH -dNOSAFER %s.ps", gx,gy,(int)(scaleFactor*72),(int)(scaleFactor*72), formBase.data(),formBase.data() ); -- cgit v0.12 From 0809acf9d38525578080e50a4b23b61127706ebe Mon Sep 17 00:00:00 2001 From: Roel Standaert Date: Tue, 12 Nov 2019 14:23:57 +0100 Subject: Fix line count after multiline close group Fix for issue #7393 When closing a group on multiple lines, like: /*! @} */ The line count of subsequent lines is wrong (it's one line less than it should be). --- src/scanner.l | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scanner.l b/src/scanner.l index abc0c3b..393d6d4 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -2852,6 +2852,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) "//"([!/]){B}*{CMD}"}".*|"/*"([!*]){B}*{CMD}"}"[^*]*"*/" { bool insideEnum = YY_START==FindFields || (YY_START==ReadInitializer && lastInitializerContext==FindFields); // see bug746226 Doxygen::docGroup.close(current.get(),yyFileName,yyLineNr,insideEnum); + lineCount(); } "=" { // in PHP code this could also be due to "bodyLine = yyLineNr; -- cgit v0.12 From 6b821a1da54e558947b631a7d2b836c8aa6935e7 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 12 Nov 2019 18:08:22 +0100 Subject: Problem with horizontal ruler directly after fenced code section When having a fenced code block directly followed by a horizontal ruler like: ``` ~~~ B ~~~ --- ``` we get the warning: ``` bb.md:5: warning: unexpected command endcode ``` due to the fact that the markdown parser replaces the `~~~` by a `@code` / `endcode` block and then handles the horizontal ruler `---` but this is seen as a level 2 header on the previous part resulting in the markdown code: ``` @page md_bb bb @subsection autotoc_md0 @code B @endcode ``` The problem also occurs when a fenced code block is created with back tics. By adding a `\n` this problem is fixed. --- src/markdown.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdown.cpp b/src/markdown.cpp index f6720ea..e054941 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -2176,7 +2176,7 @@ static void writeFencedCodeBlock(GrowBuf &out,const char *data,const char *lng, } out.addStr(data+blockStart,blockEnd-blockStart); out.addStr("\n"); - out.addStr("@endcode"); + out.addStr("@endcode\n"); } static QCString processQuotations(const QCString &s,int refIndent) -- cgit v0.12 From 82e952f272b285b641a1980143826bf8816c70c1 Mon Sep 17 00:00:00 2001 From: albert-github Date: Wed, 13 Nov 2019 11:50:45 +0100 Subject: Illegal Character in XML output The usage of, the unusual, `&` in a filename caused troubles as the filenames in the file strings in the location element were not translated to XML. --- src/xmlgen.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 9e76d6f..83e97b2 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -980,7 +980,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream if (md->getDefLine()!=-1) { t << " getDefFileName()) << "\" line=\"" + << convertToXML(stripFromPath(md->getDefFileName())) << "\" line=\"" << md->getDefLine() << "\" column=\"" << md->getDefColumn() << "\"" ; if (md->getStartBodyLine()!=-1) @@ -988,14 +988,14 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream FileDef *bodyDef = md->getBodyDef(); if (bodyDef) { - t << " bodyfile=\"" << stripFromPath(bodyDef->absFilePath()) << "\""; + t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\""; } t << " bodystart=\"" << md->getStartBodyLine() << "\" bodyend=\"" << md->getEndBodyLine() << "\""; } if (md->getDeclLine()!=-1) { - t << " declfile=\"" << stripFromPath(md->getDeclFileName()) << "\" declline=\"" + t << " declfile=\"" << convertToXML(stripFromPath(md->getDeclFileName())) << "\" declline=\"" << md->getDeclLine() << "\" declcolumn=\"" << md->getDeclColumn() << "\""; } @@ -1418,7 +1418,7 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) t << " " << endl; } t << " getDefFileName()) << "\" line=\"" + << convertToXML(stripFromPath(cd->getDefFileName())) << "\" line=\"" << cd->getDefLine() << "\"" << " column=\"" << cd->getDefColumn() << "\"" ; if (cd->getStartBodyLine()!=-1) @@ -1426,7 +1426,7 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) FileDef *bodyDef = cd->getBodyDef(); if (bodyDef) { - t << " bodyfile=\"" << stripFromPath(bodyDef->absFilePath()) << "\""; + t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\""; } t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\"" << cd->getEndBodyLine() << "\""; @@ -1506,7 +1506,7 @@ static void generateXMLForNamespace(const NamespaceDef *nd,FTextStream &ti) writeXMLDocBlock(t,nd->docFile(),nd->docLine(),nd,0,nd->documentation()); t << " " << endl; t << " getDefFileName()) << "\" line=\"" + << convertToXML(stripFromPath(nd->getDefFileName())) << "\" line=\"" << nd->getDefLine() << "\"" << " column=\"" << nd->getDefColumn() << "\"/>" << endl ; t << " " << endl; @@ -1648,7 +1648,7 @@ static void generateXMLForFile(FileDef *fd,FTextStream &ti) writeXMLCodeBlock(t,fd); t << " " << endl; } - t << " getDefFileName()) << "\"/>" << endl; + t << " getDefFileName())) << "\"/>" << endl; t << " " << endl; t << "" << endl; @@ -1762,7 +1762,7 @@ static void generateXMLForDir(DirDef *dd,FTextStream &ti) t << " " << endl; writeXMLDocBlock(t,dd->docFile(),dd->docLine(),dd,0,dd->documentation()); t << " " << endl; - t << " name()) << "\"/>" << endl; + t << " name())) << "\"/>" << endl; t << " " << endl; t << "" << endl; -- cgit v0.12 From d4a0825b1d00ead2ce441c3407d1983f80401353 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Thu, 14 Nov 2019 22:27:39 +0100 Subject: issue #7325: Endless loop in preprocessor due to #define A() --- src/pre.l | 63 +++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/src/pre.l b/src/pre.l index 0aa54b9..1ee57a9 100644 --- a/src/pre.l +++ b/src/pre.l @@ -379,6 +379,7 @@ struct preYY_state bool ccomment; QCString delimiter; QDict allIncludes; + QDict expansionDict; DefineManager defineManager; ConstExpressionParser constExpParser; }; @@ -1933,7 +1934,7 @@ static QCString extractTrailingComment(const char *s) static int getNextChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos); static int getCurrentChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint pos); static void unputChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos,char c); -static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos); +static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level); static QCString stringize(const QCString &s) { @@ -2068,10 +2069,10 @@ static inline void addTillEndOfString(yyscan_t yyscanner,const QCString &expr,QC * The replacement string will be returned in \a result and the * length of the (unexpanded) argument list is stored in \a len. */ -static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCString *rest,int pos,int &len,const Define *def,QCString &result) +static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCString *rest,int pos,int &len,const Define *def,QCString &result,int level) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - //printf("replaceFunctionMacro(expr=%s,rest=%s,pos=%d,def=%s) level=%d\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),state->level); + //printf(">replaceFunctionMacro(expr='%s',rest='%s',pos=%d,def='%s') level=%d\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),state->level); uint j=pos; len=0; result.resize(0); @@ -2225,7 +2226,7 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin // substitution of all formal arguments QCString resExpr; const QCString d=def->definition.stripWhiteSpace(); - //printf("Macro definition: %s\n",d.data()); + //printf("Macro definition: '%s'\n",d.data()); bool inString=FALSE; while (kdata()); @@ -2311,10 +2315,10 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin } len=j-pos; result=resExpr; - //printf("result after substitution '%s' expr='%s'\n", - // result.data(),expr.mid(pos,len).data()); + //printf("data() : 0,pos,def->name.data(),result.data(),state->level); return TRUE; } + //printf("data() : 0,pos,def->name.data(),result.data(),state->level); return FALSE; } @@ -2380,13 +2384,19 @@ static int getNextId(const QCString &expr,int p,int *l) /*! performs recursive macro expansion on the string \a expr * starting at position \a pos. * May read additional characters from the input while re-scanning! - * If \a expandAll is \c TRUE then all macros in the expression are - * expanded, otherwise only the first is expanded. */ -static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos) +static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - //printf("expandExpression(%s,%s)\n",expr.data(),rest ? rest->data() : 0); + printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); + if (state->expansionDict.find(expr)!=0) // check for recursive expansions + { + return; + } + else + { + state->expansionDict.insert(expr,(void*)0x8); + } QCString macroName; QCString expMacro; bool definedTest=FALSE; @@ -2395,7 +2405,7 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in { bool replaced=FALSE; macroName=expr.mid(p,l); - //printf("macroName=%s\n",macroName.data()); + //printf(" p=%d macroName=%s\n",p,macroName.data()); if (p<2 || !(expr.at(p-2)=='@' && expr.at(p-1)=='-')) // no-rescan marker? { if (state->expandedDict->find(macroName)==0) // expand macro @@ -2432,29 +2442,33 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in } else if (def && def->nargs>=0) // function macro { - replaced=replaceFunctionMacro(yyscanner,expr,rest,p+l,len,def,expMacro); + //printf(" >>>> call replaceFunctionMacro\n"); + replaced=replaceFunctionMacro(yyscanner,expr,rest,p+l,len,def,expMacro,level); + //printf(" <<<< call replaceFunctionMacro: replaced=%d\n",replaced); len+=l; } + //printf(" macroName='%s' expMacro='%s' replaced=%d\n",macroName.data(),expMacro.data(),replaced); if (replaced) // expand the macro and rescan the expression { - //printf("replacing '%s'->'%s'\n",expr.mid(p,len).data(),expMacro.data()); + //printf(" replacing '%s'->'%s'\n",expr.mid(p,len).data(),expMacro.data()); QCString resultExpr=expMacro; QCString restExpr=expr.right(expr.length()-len-p); processConcatOperators(resultExpr); + //printf(" macroName=%s def->nonRecursive=%d\n",macroName.data(),def->nonRecursive); if (def && !def->nonRecursive) { state->expandedDict->insert(macroName,def); - expandExpression(yyscanner,resultExpr,&restExpr,0); + expandExpression(yyscanner,resultExpr,&restExpr,0,level+1); state->expandedDict->remove(macroName); } expr=expr.left(p)+resultExpr+restExpr; + //printf(" new expression: '%s' old i=%d new i=%d\n",expr.data(),i,p); i=p; - //printf("new expression: %s\n",expr.data()); } else // move to the next macro name { - //printf("moving to the next macro old=%d new=%d\n",i,p+l); + //printf(" moving to the next macro old i=%d new i=%d\n",i,p+l); i=p+l; } } @@ -2472,6 +2486,7 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in i=p+l; } } + printf("data() : 0, pos,level); } /*! @brief Process string or character literal. @@ -2700,7 +2715,8 @@ static bool computeExpression(yyscan_t yyscanner,const QCString &expr) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); QCString e=expr; - expandExpression(yyscanner,e,0,0); + state->expansionDict.clear(); + expandExpression(yyscanner,e,0,0,0); //printf("after expansion '%s'\n",e.data()); e = removeIdsAndMarkers(e); if (e.isEmpty()) return FALSE; @@ -2714,8 +2730,10 @@ static bool computeExpression(yyscan_t yyscanner,const QCString &expr) static QCString expandMacro(yyscan_t yyscanner,const QCString &name) { + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); QCString n=name; - expandExpression(yyscanner,n,0,0); + state->expansionDict.clear(); + expandExpression(yyscanner,n,0,0,0); n=removeMarkers(n); //printf("expandMacro '%s'->'%s'\n",name.data(),n.data()); return n; @@ -2750,7 +2768,7 @@ static void addDefine(yyscan_t yyscanner) // conditional section (cond command) that is disabled. if (!Doxygen::gatherDefines) return; - //printf("addDefine %s %s\n",state->defName.data(),state->defArgsStr.data()); + //printf("addDefine '%s' '%s'\n",state->defName.data(),state->defArgsStr.data()); //ArgumentList *al = new ArgumentList; //stringToArgumentList(state->defArgsStr,al); MemberDef *md=createMemberDef( @@ -3180,6 +3198,11 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output yyscan_t yyscanner = p->yyscanner; YY_EXTRA_TYPE state = preYYget_extra(p->yyscanner); struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; + +#ifdef FLEX_DEBUG + preYYset_debug(1,yyscanner); +#endif + printlex(yy_flex_debug, TRUE, __FILE__, fileName); uint orgOffset=output.curPos(); //printf("##########################\n%s\n####################\n", -- cgit v0.12 From 4d173a0b2e13b2cd26c996894480afc65d50cd87 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 15 Nov 2019 15:39:42 +0100 Subject: HHC and directory elements starting with "." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on the question 'Doxygen failed to run html help compiler, hhc.exe error HHC5010 when running from folder that has a parent folder that starts with “.”/ (https://stackoverflow.com/questions/58861908/doxygen-failed-to-run-html-help-compiler-hhc-exe-error-hhc5010-when-running-fro). In we https://social.msdn.microsoft.com/Forums/en-US/0681145c-223b-498c-b7bf-be83209cbf4e/issue-with-html-workshop-in-a-windows-container?forum=visualstudiogeneral see: HTML Help 1.x command line compiler hhc.exe cannot compile CHM file to folder whose full path contains folder name starting with dot. If you have that problem, you probably specified output path with folder starting with dot, e.g. "d:\My files.NET\documentation". You can use dots in folder names but not at the beginning. We first convert the current path to a short name path and set this as current directory, this is only done on Windows other systems are not touched. --- src/doxygen.cpp | 1 + src/portable.cpp | 17 +++++++++++++++++ src/portable.h | 2 ++ 3 files changed, 20 insertions(+) diff --git a/src/doxygen.cpp b/src/doxygen.cpp index c622f78..b4a4deb 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -11862,6 +11862,7 @@ void generateOutput() g_s.begin("Running html help compiler...\n"); QString oldDir = QDir::currentDirPath(); QDir::setCurrent(Config_getString(HTML_OUTPUT)); + portable_setShortDir(); portable_sysTimerStart(); if (portable_system(Config_getString(HHC_LOCATION), "index.hhp", Debug::isFlagSet(Debug::ExtCmd))!=1) { diff --git a/src/portable.cpp b/src/portable.cpp index c6e829d..b447adc 100644 --- a/src/portable.cpp +++ b/src/portable.cpp @@ -478,3 +478,20 @@ void portable_unlink(const char *fileName) #endif } +void portable_setShortDir(void) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + long length = 0; + TCHAR* buffer = NULL; + // First obtain the size needed by passing NULL and 0. + length = GetShortPathName(QDir::currentDirPath().data(), NULL, 0); + // Dynamically allocate the correct size + // (terminating null char was included in length) + buffer = new TCHAR[length]; + // Now simply call again using same (long) path. + length = GetShortPathName(QDir::currentDirPath().data(), buffer, length); + // Set the correct directory (short name) + QDir::setCurrent(buffer); + delete [] buffer; +#endif +} diff --git a/src/portable.h b/src/portable.h index 83f90ef..c1b8c29 100644 --- a/src/portable.h +++ b/src/portable.h @@ -4,6 +4,7 @@ #include #include #include +#include #if defined(_WIN32) typedef __int64 portable_off_t; @@ -37,6 +38,7 @@ double portable_getSysElapsedTime(); void portable_sleep(int ms); bool portable_isAbsolutePath(const char *fileName); void portable_correct_path(void); +void portable_setShortDir(void); extern "C" { void * portable_iconv_open(const char* tocode, const char* fromcode); -- cgit v0.12 From caea19d73d20faadddeab5ea23199fb3d6e306de Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 16 Nov 2019 12:46:40 +0100 Subject: remove debug prints --- src/pre.l | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pre.l b/src/pre.l index 1ee57a9..0652dbb 100644 --- a/src/pre.l +++ b/src/pre.l @@ -2388,7 +2388,7 @@ static int getNextId(const QCString &expr,int p,int *l) static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); + //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); if (state->expansionDict.find(expr)!=0) // check for recursive expansions { return; @@ -2486,7 +2486,7 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in i=p+l; } } - printf("data() : 0, pos,level); + //printf("data() : 0, pos,level); } /*! @brief Process string or character literal. -- cgit v0.12 From 15a47ccc703c44d1355146a2744f1ccc38ee136f Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 16 Nov 2019 12:54:42 +0100 Subject: Fixed issue with "QGDict::hashAsciiKey: Invalid null key" in pre.l --- src/pre.l | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pre.l b/src/pre.l index 0652dbb..8bde725 100644 --- a/src/pre.l +++ b/src/pre.l @@ -2389,6 +2389,10 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); + if (expr.isEmpty()) + { + return; + } if (state->expansionDict.find(expr)!=0) // check for recursive expansions { return; -- cgit v0.12 From bc17f30dd77812177ec872f79e53d0556871d343 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 16 Nov 2019 13:45:21 +0100 Subject: issue #7403: xref versus namespace in multiple file --- src/definition.cpp | 2 +- src/membergroup.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/definition.cpp b/src/definition.cpp index f2b9018..80060ba 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -1606,7 +1606,7 @@ void DefinitionImpl::makePartOfGroup(GroupDef *gd) void DefinitionImpl::setRefItems(const std::vector &sli) { - m_impl->xrefListItems = sli; + m_impl->xrefListItems.insert(m_impl->xrefListItems.end(), sli.cbegin(), sli.cend()); } void DefinitionImpl::mergeRefItems(Definition *d) diff --git a/src/membergroup.cpp b/src/membergroup.cpp index da52d64..05c38c3 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -358,7 +358,7 @@ void MemberGroup::findSectionsInDocumentation(const Definition *d) void MemberGroup::setRefItems(const std::vector &sli) { - m_xrefListItems = sli; + m_xrefListItems.insert(m_xrefListItems.end(), sli.cbegin(), sli.cend()); } void MemberGroup::writeTagFile(FTextStream &tagFile) @@ -370,5 +370,5 @@ void MemberGroup::writeTagFile(FTextStream &tagFile) void MemberGroupInfo::setRefItems(const std::vector &sli) { - m_sli = sli; + m_sli.insert(m_sli.end(), sli.cbegin(), sli.cend()); } -- cgit v0.12 From 7acba2f316a6e8f02364d76ab96b7ff9e739aec1 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 16 Nov 2019 15:49:20 +0100 Subject: issue #7348 Better warning in case a graph would have been to large --- src/classdef.cpp | 3 ++- src/dotcallgraph.cpp | 9 +++++++-- src/dotcallgraph.h | 1 + src/dotclassgraph.cpp | 7 ++++++- src/dotclassgraph.h | 1 + src/dotincldepgraph.cpp | 8 ++++++-- src/dotincldepgraph.h | 1 + src/filedef.cpp | 6 ++++-- src/memberdef.cpp | 6 ++++-- 9 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/classdef.cpp b/src/classdef.cpp index cee8be9..fd24f0b 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -1706,7 +1706,8 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const DotClassGraph inheritanceGraph(this,Inheritance); if (inheritanceGraph.isTooBig()) { - warn_uncond("Inheritance graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); + warn_uncond("Inheritance graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + name().data(), inheritanceGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!inheritanceGraph.isTrivial()) { diff --git a/src/dotcallgraph.cpp b/src/dotcallgraph.cpp index 15d408a..b024f09 100644 --- a/src/dotcallgraph.cpp +++ b/src/dotcallgraph.cpp @@ -212,6 +212,11 @@ bool DotCallGraph::isTrivial() const bool DotCallGraph::isTooBig() const { - int numNodes = m_startNode->children() ? m_startNode->children()->count() : 0; - return numNodes>=DOT_GRAPH_MAX_NODES; + return numNodes()>=DOT_GRAPH_MAX_NODES; } + +int DotCallGraph::numNodes() const +{ + return m_startNode->children() ? m_startNode->children()->count() : 0; +} + diff --git a/src/dotcallgraph.h b/src/dotcallgraph.h index c96b9cf..bba976c 100644 --- a/src/dotcallgraph.h +++ b/src/dotcallgraph.h @@ -28,6 +28,7 @@ class DotCallGraph : public DotGraph ~DotCallGraph(); bool isTrivial() const; bool isTooBig() const; + int numNodes() const; QCString writeGraph(FTextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path,const char *fileName, const char *relPath,bool writeImageMap=TRUE, diff --git a/src/dotclassgraph.cpp b/src/dotclassgraph.cpp index 3f5d228..da272b4 100644 --- a/src/dotclassgraph.cpp +++ b/src/dotclassgraph.cpp @@ -420,13 +420,18 @@ bool DotClassGraph::isTrivial() const bool DotClassGraph::isTooBig() const { + return numNodes()>=DOT_GRAPH_MAX_NODES; +} + +int DotClassGraph::numNodes() const +{ int numNodes = 0; numNodes+= m_startNode->children() ? m_startNode->children()->count() : 0; if (m_graphType==Inheritance) { numNodes+= m_startNode->parents() ? m_startNode->parents()->count() : 0; } - return numNodes>=DOT_GRAPH_MAX_NODES; + return numNodes; } DotClassGraph::~DotClassGraph() diff --git a/src/dotclassgraph.h b/src/dotclassgraph.h index b3b9291..1874f54 100644 --- a/src/dotclassgraph.h +++ b/src/dotclassgraph.h @@ -28,6 +28,7 @@ public: ~DotClassGraph(); bool isTrivial() const; bool isTooBig() const; + int numNodes() const; QCString writeGraph(FTextStream &t,GraphOutputFormat gf,EmbeddedOutputFormat ef, const char *path, const char *fileName, const char *relPath, bool TBRank=TRUE,bool imageMap=TRUE,int graphId=-1); diff --git a/src/dotincldepgraph.cpp b/src/dotincldepgraph.cpp index 23588db..05a96d9 100644 --- a/src/dotincldepgraph.cpp +++ b/src/dotincldepgraph.cpp @@ -213,8 +213,12 @@ bool DotInclDepGraph::isTrivial() const bool DotInclDepGraph::isTooBig() const { - int numNodes = m_startNode->children() ? m_startNode->children()->count() : 0; - return numNodes>=Config_getInt(DOT_GRAPH_MAX_NODES); + return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES); +} + +int DotInclDepGraph::numNodes() const +{ + return m_startNode->children() ? m_startNode->children()->count() : 0; } void DotInclDepGraph::writeXML(FTextStream &t) diff --git a/src/dotincldepgraph.h b/src/dotincldepgraph.h index b664ccb..5807ce8 100644 --- a/src/dotincldepgraph.h +++ b/src/dotincldepgraph.h @@ -32,6 +32,7 @@ class DotInclDepGraph : public DotGraph bool writeImageMap=TRUE,int graphId=-1); bool isTrivial() const; bool isTooBig() const; + int numNodes() const; void writeXML(FTextStream &t); void writeDocbook(FTextStream &t); diff --git a/src/filedef.cpp b/src/filedef.cpp index f00c82b..346fb62 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -664,7 +664,8 @@ void FileDefImpl::writeIncludeGraph(OutputList &ol) DotInclDepGraph incDepGraph(this,FALSE); if (incDepGraph.isTooBig()) { - warn_uncond("Include graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); + warn_uncond("Include graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + name().data(), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!incDepGraph.isTrivial()) { @@ -688,7 +689,8 @@ void FileDefImpl::writeIncludedByGraph(OutputList &ol) DotInclDepGraph incDepGraph(this,TRUE); if (incDepGraph.isTooBig()) { - warn_uncond("Included by graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); + warn_uncond("Included by graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + name().data(), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!incDepGraph.isTrivial()) { diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 9b6967b..840dd78 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -2877,7 +2877,8 @@ void MemberDefImpl::_writeCallGraph(OutputList &ol) const DotCallGraph callGraph(this,FALSE); if (callGraph.isTooBig()) { - warn_uncond("Call graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",qPrint(qualifiedName())); + warn_uncond("Call graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + qPrint(qualifiedName()), callGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!callGraph.isTrivial()) { @@ -2900,7 +2901,8 @@ void MemberDefImpl::_writeCallerGraph(OutputList &ol) const DotCallGraph callerGraph(this, TRUE); if (callerGraph.isTooBig()) { - warn_uncond("Caller graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",qPrint(qualifiedName())); + warn_uncond("Caller graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + qPrint(qualifiedName()), callerGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!callerGraph.isTrivial()) { -- cgit v0.12 From 2972f6ddc491f615f814b1277ec715b6f707c419 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 17 Nov 2019 13:15:09 +0100 Subject: Made commentcnv.l reentrant --- src/commentcnv.l | 959 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 493 insertions(+), 466 deletions(-) diff --git a/src/commentcnv.l b/src/commentcnv.l index 3e5faba..14abb8f 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -16,6 +16,8 @@ */ %option never-interactive %option prefix="commentcnvYY" +%option reentrant +%option extra-type="struct commentcnvYY_state *" %{ @@ -41,8 +43,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 -#define ADDCHAR(c) g_outBuf->addChar(c) -#define ADDARRAY(a,s) g_outBuf->addArray(a,s) +#define ADDCHAR(c) yyextra->outBuf->addChar(c) +#define ADDARRAY(a,s) yyextra->outBuf->addArray(a,s) struct CondCtx { @@ -60,182 +62,60 @@ struct CommentCtx int lineNr; }; -static BufStr * g_inBuf; -static BufStr * g_outBuf; -static int g_inBufPos; -static int g_col; -static int g_blockHeadCol; -static bool g_mlBrief; -static int g_readLineCtx; -static bool g_skip; -static QCString g_fileName; -static int g_lineNr; -static int g_condCtx; -static QStack g_condStack; -static QStack g_commentStack; -static QCString g_blockName; -static int g_lastCommentContext; -static bool g_inSpecialComment; -static bool g_inRoseComment; -static int g_stringContext; -static int g_charContext; -static int g_javaBlock; -static bool g_specialComment; +struct commentcnvYY_state +{ + BufStr * inBuf = 0; + BufStr * outBuf = 0; + int inBufPos = 0; + int col = 0; + int blockHeadCol = 0; + bool mlBrief = FALSE; + int readLineCtx = 0; + bool skip = FALSE; + QCString fileName; + int lineNr = 0; + int condCtx = 0; + QStack condStack; + QStack commentStack; + QCString blockName; + int lastCommentContext = 0; + bool inSpecialComment = FALSE; + bool inRoseComment= FALSE; + int stringContext = 0; + int charContext = 0; + int javaBlock = 0; + bool specialComment = FALSE; -static QCString g_aliasString; -static int g_blockCount; -static bool g_lastEscaped; -static int g_lastBlockContext; -static bool g_pythonDocString; -static int g_nestingCount; + QCString aliasString; + int blockCount = 0; + bool lastEscaped = FALSE; + int lastBlockContext= 0; + bool pythonDocString = FALSE; + int nestingCount= 0; -static bool g_vhdl; // for VHDL old style --! comment + bool vhdl = FALSE; // for VHDL old style --! comment -static SrcLangExt g_lang; -static bool isFixedForm; // For Fortran + SrcLangExt lang = SrcLangExt_Unknown; + bool isFixedForm = FALSE; // For Fortran +}; static const char *stateToString(int state); +static inline int computeIndent(const char *s); -static void replaceCommentMarker(const char *s,int len) -{ - const char *p=s; - char c; - // copy leading blanks - while ((c=*p) && (c==' ' || c=='\t' || c=='\n')) - { - ADDCHAR(c); - g_lineNr += c=='\n'; - p++; - } - // replace start of comment marker by blanks and the last character by a * - int blanks=0; - while ((c=*p) && (c=='/' || c=='!' || c=='#')) - { - blanks++; - p++; - if (*p=='<') // comment-after-item marker - { - blanks++; - p++; - } - if (c=='!') // end after first ! - { - break; - } - } - if (blanks>0) - { - while (blanks>2) - { - ADDCHAR(' '); - blanks--; - } - if (blanks>1) ADDCHAR('*'); - ADDCHAR(' '); - } - // copy comment line to output - ADDARRAY(p,len-(int)(p-s)); -} +static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len); +static inline void copyToOutput(yyscan_t yyscanner,const char *s,int len); +static void startCondSection(yyscan_t yyscanner,const char *sectId); +static void endCondSection(yyscan_t yyscanner); +static void replaceAliases(yyscan_t yyscanner,const char *s); +static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static void replaceComment(yyscan_t yyscanner,int offset); -static inline int computeIndent(const char *s) -{ - int col=0; - static int tabSize=Config_getInt(TAB_SIZE); - const char *p=s; - char c; - while ((c=*p++)) - { - if (c==' ') col++; - else if (c=='\t') col+=tabSize-(col%tabSize); - else break; - } - return col; -} -static inline void copyToOutput(const char *s,int len) -{ - int i; - if (g_skip) // only add newlines. - { - for (i=0;i skip %d\n",g_lineNr); - g_lineNr++; - } - } - } - else if (len>0) - { - ADDARRAY(s,len); - static int tabSize=Config_getInt(TAB_SIZE); - for (i=0;i copy %d\n",g_lineNr); - g_lineNr++; break; - case '\t': g_col+=tabSize-(g_col%tabSize); break; - default: g_col++; break; - } - } - } -} - -static void startCondSection(const char *sectId) -{ - //printf("startCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); - CondParser prs; - bool expResult = prs.parse(g_fileName,g_lineNr,sectId); - g_condStack.push(new CondCtx(g_lineNr,sectId,g_skip)); - if (!expResult) // not enabled - { - g_skip=TRUE; - } -} - -static void endCondSection() -{ - if (g_condStack.isEmpty()) - { - warn(g_fileName,g_lineNr,"Found \\endcond command without matching \\cond"); - g_skip=FALSE; - } - else - { - CondCtx *ctx = g_condStack.pop(); - g_skip=ctx->skip; - } - //printf("endCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); -} - -/** copies string \a s with length \a len to the output, while - * replacing any alias commands found in the string. - */ -static void replaceAliases(const char *s) -{ - QCString result = resolveAliasCmd(s); - //printf("replaceAliases(%s)->'%s'\n",s,result.data()); - copyToOutput(result,result.length()); -} #undef YY_INPUT -#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); +#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size); -static int yyread(char *buf,int max_size) -{ - int bytesInBuf = g_inBuf->curPos()-g_inBufPos; - int bytesToCopy = QMIN(max_size,bytesInBuf); - memcpy(buf,g_inBuf->data()+g_inBufPos,bytesToCopy); - g_inBufPos+=bytesToCopy; - return bytesToCopy; -} - -void replaceComment(int offset); %} @@ -255,55 +135,55 @@ void replaceComment(int offset); %% [^"'!\/\n\\#,\-]* { /* eat anything that is not " / , or \n */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [,] { /* eat , so we have a nice separator in long initialization lines */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } "\"\"\""! { /* start of python long comment */ - if (g_lang!=SrcLangExt_Python) + if (yyextra->lang!=SrcLangExt_Python) { REJECT; } else { - g_pythonDocString = TRUE; - g_nestingCount=1; - g_commentStack.clear(); /* to be on the save side */ - copyToOutput(yytext,(int)yyleng); + yyextra->pythonDocString = TRUE; + yyextra->nestingCount=1; + yyextra->commentStack.clear(); /* to be on the save side */ + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } ![>lang!=SrcLangExt_Fortran) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); - g_nestingCount=0; // Fortran doesn't have an end comment - g_commentStack.clear(); /* to be on the save side */ + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount=0; // Fortran doesn't have an end comment + yyextra->commentStack.clear(); /* to be on the save side */ BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } [Cc\*][>lang!=SrcLangExt_Fortran) { REJECT; } else { /* check for fixed format; we might have some conditional as part of multiline if like C<5 .and. & */ - if (isFixedForm && (g_col == 0)) + if (yyextra->isFixedForm && (yyextra->col == 0)) { - copyToOutput(yytext,(int)yyleng); - g_nestingCount=0; // Fortran doesn't have an end comment - g_commentStack.clear(); /* to be on the safe side */ + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount=0; // Fortran doesn't have an end comment + yyextra->commentStack.clear(); /* to be on the safe side */ BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } else { @@ -312,25 +192,25 @@ void replaceComment(int offset); } } !.*\n { - if (g_lang!=SrcLangExt_Fortran) + if (yyextra->lang!=SrcLangExt_Fortran) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } } [Cc\*].*\n { - if (g_lang!=SrcLangExt_Fortran) + if (yyextra->lang!=SrcLangExt_Fortran) { REJECT; } else { - if (g_col == 0) + if (yyextra->col == 0) { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } else { @@ -339,24 +219,24 @@ void replaceComment(int offset); } } "\"" { /* start of a string */ - copyToOutput(yytext,(int)yyleng); - g_stringContext = YY_START; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->stringContext = YY_START; BEGIN(SkipString); } ' { - copyToOutput(yytext,(int)yyleng); - g_charContext = YY_START; - if (g_lang!=SrcLangExt_VHDL) + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->charContext = YY_START; + if (yyextra->lang!=SrcLangExt_VHDL) { BEGIN(SkipChar); } } \n { /* new line */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } "//!"/.*\n[ \t]*"//"[\/!][^\/] | /* start C++ style special comment block */ ("///"[/]*)/[^/].*\n[ \t]*"//"[\/!][^\/] { /* start C++ style special comment block */ - if (g_mlBrief) + if (yyextra->mlBrief) { REJECT; // bail out if we do not need to convert } @@ -367,190 +247,190 @@ void replaceComment(int offset); { while (i<(int)yyleng && yytext[i]=='/') i++; } - g_blockHeadCol=g_col; - copyToOutput("/**",3); - replaceAliases(yytext+i); - g_inSpecialComment=TRUE; + yyextra->blockHeadCol=yyextra->col; + copyToOutput(yyscanner,"/**",3); + replaceAliases(yyscanner,yytext+i); + yyextra->inSpecialComment=TRUE; //BEGIN(SComment); - g_readLineCtx=SComment; + yyextra->readLineCtx=SComment; BEGIN(ReadLine); } } "//##Documentation".*/\n { /* Start of Rational Rose ANSI C++ comment block */ - if (g_mlBrief) REJECT; + if (yyextra->mlBrief) REJECT; int i=17; //=strlen("//##Documentation"); - g_blockHeadCol=g_col; - copyToOutput("/**",3); - replaceAliases(yytext+i); - g_inRoseComment=TRUE; + yyextra->blockHeadCol=yyextra->col; + copyToOutput(yyscanner,"/**",3); + replaceAliases(yyscanner,yytext+i); + yyextra->inRoseComment=TRUE; BEGIN(SComment); } "//"[!\/]/.*\n[ \t]*"//"[|\/][ \t]*[@\\]"}" { // next line contains an end marker, see bug 752712 - g_inSpecialComment=yytext[2]=='/' || yytext[2]=='!'; - copyToOutput(yytext,(int)yyleng); - g_readLineCtx=YY_START; + yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!'; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } "//"/.*\n { /* one line C++ comment */ - g_inSpecialComment=yytext[2]=='/' || yytext[2]=='!'; - copyToOutput(yytext,(int)yyleng); - g_readLineCtx=YY_START; + yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!'; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } "/**/" { /* avoid matching next rule for empty C comment, see bug 711723 */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } "/*"[*!]? { /* start of a C comment */ - if ((g_lang==SrcLangExt_Python) || (g_lang==SrcLangExt_Tcl)) + if ((yyextra->lang==SrcLangExt_Python) || (yyextra->lang==SrcLangExt_Tcl)) { REJECT; } - g_specialComment=(int)yyleng==3; - g_nestingCount=1; - g_commentStack.clear(); /* to be on the save side */ - copyToOutput(yytext,(int)yyleng); + yyextra->specialComment=(int)yyleng==3; + yyextra->nestingCount=1; + yyextra->commentStack.clear(); /* to be on the save side */ + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } "#"("#")? { - if (g_lang!=SrcLangExt_Python) + if (yyextra->lang!=SrcLangExt_Python) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); - g_nestingCount=0; // Python doesn't have an end comment for # - g_commentStack.clear(); /* to be on the save side */ + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount=0; // Python doesn't have an end comment for # + yyextra->commentStack.clear(); /* to be on the save side */ BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } "--!" { - if (g_lang!=SrcLangExt_VHDL) + if (yyextra->lang!=SrcLangExt_VHDL) { REJECT; } else { - g_vhdl = TRUE; - copyToOutput(yytext,(int)yyleng); - g_nestingCount=0; // VHDL doesn't have an end comment - g_commentStack.clear(); /* to be on the save side */ + yyextra->vhdl = TRUE; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount=0; // VHDL doesn't have an end comment + yyextra->commentStack.clear(); /* to be on the save side */ BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } ![>lang!=SrcLangExt_Fortran) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); - g_nestingCount=0; // Fortran doesn't have an end comment - g_commentStack.clear(); /* to be on the save side */ + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount=0; // Fortran doesn't have an end comment + yyextra->commentStack.clear(); /* to be on the save side */ BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } "{@code"/[ \t\n] { - copyToOutput("@code",5); - g_lastCommentContext = YY_START; - g_javaBlock=1; - g_blockName=&yytext[1]; + copyToOutput(yyscanner,"@code",5); + yyextra->lastCommentContext = YY_START; + yyextra->javaBlock=1; + yyextra->blockName=&yytext[1]; BEGIN(VerbatimCode); } [\\@]("dot"|"code"|"msc"|"startuml")/[^a-z_A-Z0-9] { /* start of a verbatim block */ - copyToOutput(yytext,(int)yyleng); - g_lastCommentContext = YY_START; - g_javaBlock=0; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->lastCommentContext = YY_START; + yyextra->javaBlock=0; if (qstrcmp(&yytext[1],"startuml")==0) { - g_blockName="uml"; + yyextra->blockName="uml"; } else { - g_blockName=&yytext[1]; + yyextra->blockName=&yytext[1]; } BEGIN(VerbatimCode); } [\\@]("f$"|"f["|"f{") { - copyToOutput(yytext,(int)yyleng); - g_blockName=&yytext[1]; - if (g_blockName.at(1)=='[') + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->blockName=&yytext[1]; + if (yyextra->blockName.at(1)=='[') { - g_blockName.at(1)=']'; + yyextra->blockName.at(1)=']'; } - else if (g_blockName.at(1)=='{') + else if (yyextra->blockName.at(1)=='{') { - g_blockName.at(1)='}'; + yyextra->blockName.at(1)='}'; } - g_lastCommentContext = YY_START; + yyextra->lastCommentContext = YY_START; BEGIN(Verbatim); } [\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly")/[^a-z_A-Z0-9] { /* start of a verbatim block */ - copyToOutput(yytext,(int)yyleng); - g_blockName=&yytext[1]; - g_lastCommentContext = YY_START; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->blockName=&yytext[1]; + yyextra->lastCommentContext = YY_START; BEGIN(Verbatim); } . { /* any other character */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}") { /* end of verbatim block */ - copyToOutput(yytext,(int)yyleng); - if (&yytext[1]==g_blockName) // end of formula + copyToOutput(yyscanner,yytext,(int)yyleng); + if (&yytext[1]==yyextra->blockName) // end of formula { - BEGIN(g_lastCommentContext); + BEGIN(yyextra->lastCommentContext); } - else if (&yytext[4]==g_blockName) + else if (&yytext[4]==yyextra->blockName) { - BEGIN(g_lastCommentContext); + BEGIN(yyextra->lastCommentContext); } } "{" { - if (g_javaBlock==0) + if (yyextra->javaBlock==0) { REJECT; } else { - g_javaBlock++; - copyToOutput(yytext,(int)yyleng); + yyextra->javaBlock++; + copyToOutput(yyscanner,yytext,(int)yyleng); } } "}" { - if (g_javaBlock==0) + if (yyextra->javaBlock==0) { REJECT; } else { - g_javaBlock--; - if (g_javaBlock==0) + yyextra->javaBlock--; + if (yyextra->javaBlock==0) { - copyToOutput(" @endcode ",10); - BEGIN(g_lastCommentContext); + copyToOutput(yyscanner," @endcode ",10); + BEGIN(yyextra->lastCommentContext); } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } } } [\\@]("enddot"|"endcode"|"endmsc"|"enduml") { /* end of verbatim block */ - copyToOutput(yytext,(int)yyleng); - if (&yytext[4]==g_blockName) + copyToOutput(yyscanner,yytext,(int)yyleng); + if (&yytext[4]==yyextra->blockName) { - BEGIN(g_lastCommentContext); + BEGIN(yyextra->lastCommentContext); } } ^[ \t]*"//"[\!\/]? { /* skip leading comments */ - if (!g_inSpecialComment) + if (!yyextra->inSpecialComment) { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } else { @@ -559,25 +439,25 @@ void replaceComment(int offset); { l++; } - copyToOutput(yytext,l); + copyToOutput(yyscanner,yytext,l); if (yyleng-l==3) // ends with //! or /// { - copyToOutput(" * ",3); + copyToOutput(yyscanner," * ",3); } else // ends with // { - copyToOutput("//",2); + copyToOutput(yyscanner,"//",2); } } } [^@\/\\\n{}]* { /* any character not a backslash or new line or } */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } \n { /* new line in verbatim block */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } ^[ \t]*"///" { - if (g_blockName=="dot" || g_blockName=="msc" || g_blockName=="uml" || g_blockName.at(0)=='f') + if (yyextra->blockName=="dot" || yyextra->blockName=="msc" || yyextra->blockName=="uml" || yyextra->blockName.at(0)=='f') { // see bug 487871, strip /// from dot images and formulas. int l=0; @@ -585,8 +465,8 @@ void replaceComment(int offset); { l++; } - copyToOutput(yytext,l); - copyToOutput(" ",3); + copyToOutput(yyscanner,yytext,l); + copyToOutput(yyscanner," ",3); } else // even slashes are verbatim (e.g. \verbatim, \code) { @@ -594,119 +474,119 @@ void replaceComment(int offset); } } . { /* any other character */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } \\. { /* escaped character in string */ - if (g_lang==SrcLangExt_Fortran) + if (yyextra->lang==SrcLangExt_Fortran) { unput(yytext[1]); - copyToOutput(yytext,1); + copyToOutput(yyscanner,yytext,1); } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } } "\"" { /* end of string */ - copyToOutput(yytext,(int)yyleng); - BEGIN(g_stringContext); + copyToOutput(yyscanner,yytext,(int)yyleng); + BEGIN(yyextra->stringContext); } . { /* any other string character */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } \n { /* new line inside string (illegal for some compilers) */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } \\. { /* escaped character */ - if (g_lang==SrcLangExt_Fortran) + if (yyextra->lang==SrcLangExt_Fortran) { unput(yytext[1]); - copyToOutput(yytext,1); + copyToOutput(yyscanner,yytext,1); } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } } ' { /* end of character literal */ - copyToOutput(yytext,(int)yyleng); - BEGIN(g_charContext); + copyToOutput(yyscanner,yytext,(int)yyleng); + BEGIN(yyextra->charContext); } . { /* any other string character */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } \n { /* new line character */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [^\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } "*"+[^*/\\@\n{\"]* { /* stars without slashes */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } "\"\"\"" { /* end of Python docstring */ - if (g_lang!=SrcLangExt_Python) + if (yyextra->lang!=SrcLangExt_Python) { REJECT; } else { - g_nestingCount--; - g_pythonDocString = FALSE; - copyToOutput(yytext,(int)yyleng); + yyextra->nestingCount--; + yyextra->pythonDocString = FALSE; + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } } \n { /* new line in comment */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); /* in case of Fortran always end of comment */ - if (g_lang==SrcLangExt_Fortran) + if (yyextra->lang==SrcLangExt_Fortran) { BEGIN(Scan); } } "/"+"*" { /* nested C comment */ - if ((g_lang==SrcLangExt_Python) || (g_lang==SrcLangExt_Tcl)) + if ((yyextra->lang==SrcLangExt_Python) || (yyextra->lang==SrcLangExt_Tcl)) { REJECT; } - g_nestingCount++; - g_commentStack.push(new CommentCtx(g_lineNr)); - copyToOutput(yytext,(int)yyleng); + yyextra->nestingCount++; + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); + copyToOutput(yyscanner,yytext,(int)yyleng); } "*"+"/" { /* end of C comment */ - if ((g_lang==SrcLangExt_Python) || (g_lang==SrcLangExt_Tcl)) + if ((yyextra->lang==SrcLangExt_Python) || (yyextra->lang==SrcLangExt_Tcl)) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); - g_nestingCount--; - if (g_nestingCount<=0) + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount--; + if (yyextra->nestingCount<=0) { BEGIN(Scan); } else { - //g_nestingCount--; - delete g_commentStack.pop(); + //yyextra->nestingCount--; + delete yyextra->commentStack.pop(); } } } /* Python an VHDL share CComment, so special attention for ending comments is required */ "\n"/[ \t]*"#" { - if (g_lang!=SrcLangExt_VHDL) + if (yyextra->lang!=SrcLangExt_VHDL) { REJECT; } else { - if (g_vhdl) // inside --! comment + if (yyextra->vhdl) // inside --! comment { - g_vhdl = FALSE; - copyToOutput(yytext,(int)yyleng); + yyextra->vhdl = FALSE; + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } else // C-type comment @@ -716,35 +596,35 @@ void replaceComment(int offset); } } "\n"/[ \t]*"-" { - if (g_lang!=SrcLangExt_Python || g_pythonDocString) + if (yyextra->lang!=SrcLangExt_Python || yyextra->pythonDocString) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } } "\n"/[ \t]*[^ \t#\-] { - if (g_lang==SrcLangExt_Python) + if (yyextra->lang==SrcLangExt_Python) { - if (g_pythonDocString) + if (yyextra->pythonDocString) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } } - else if (g_lang==SrcLangExt_VHDL) + else if (yyextra->lang==SrcLangExt_VHDL) { - if (g_vhdl) // inside --! comment + if (yyextra->vhdl) // inside --! comment { - g_vhdl = FALSE; - copyToOutput(yytext,(int)yyleng); + yyextra->vhdl = FALSE; + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } else // C-type comment @@ -759,122 +639,122 @@ void replaceComment(int offset); } /* removed for bug 674842 (bug was introduced in rev 768) "'" { - g_charContext = YY_START; - copyToOutput(yytext,(int)yyleng); + yyextra->charContext = YY_START; + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(SkipChar); } "\"" { - g_stringContext = YY_START; - copyToOutput(yytext,(int)yyleng); + yyextra->stringContext = YY_START; + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(SkipString); } */ . { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } ^[ \t]*"///"[\/]*/\n { - replaceComment(0); + replaceComment(yyscanner,0); } \n[ \t]*"///"[\/]*/\n { - replaceComment(1); + replaceComment(yyscanner,1); } ^[ \t]*"///"[^\/\n]/.*\n { - replaceComment(0); - g_readLineCtx=YY_START; + replaceComment(yyscanner,0); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } \n[ \t]*"//"[\/!]("<")?[ \t]*[\\@]"}".*\n { /* See Bug 752712: end the multiline comment when finding a @} or \} command */ - copyToOutput(" */",3); - copyToOutput(yytext,(int)yyleng); - g_inSpecialComment=FALSE; - g_inRoseComment=FALSE; + copyToOutput(yyscanner," */",3); + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->inSpecialComment=FALSE; + yyextra->inRoseComment=FALSE; BEGIN(Scan); } \n[ \t]*"///"[^\/\n]/.*\n { - replaceComment(1); - g_readLineCtx=YY_START; + replaceComment(yyscanner,1); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } ^[ \t]*"//!" | // just //! ^[ \t]*"//!<"/.*\n | // or //!< something ^[ \t]*"//!"[^<]/.*\n { // or //!something - replaceComment(0); - g_readLineCtx=YY_START; + replaceComment(yyscanner,0); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } \n[ \t]*"//!" | \n[ \t]*"//!<"/.*\n | \n[ \t]*"//!"[^<\n]/.*\n { - replaceComment(1); - g_readLineCtx=YY_START; + replaceComment(yyscanner,1); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } ^[ \t]*"//##"/.*\n { - if (!g_inRoseComment) + if (!yyextra->inRoseComment) { REJECT; } else { - replaceComment(0); - g_readLineCtx=YY_START; + replaceComment(yyscanner,0); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } } \n[ \t]*"//##"/.*\n { - if (!g_inRoseComment) + if (!yyextra->inRoseComment) { REJECT; } else { - replaceComment(1); - g_readLineCtx=YY_START; + replaceComment(yyscanner,1); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } } \n { /* end of special comment */ - copyToOutput(" */",3); - copyToOutput(yytext,(int)yyleng); - g_inSpecialComment=FALSE; - g_inRoseComment=FALSE; + copyToOutput(yyscanner," */",3); + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->inSpecialComment=FALSE; + yyextra->inRoseComment=FALSE; BEGIN(Scan); } "*/" { - copyToOutput("*‍/",7); + copyToOutput(yyscanner,"*‍/",7); } "*" { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [^\\@\n\*]* { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [^\\@\n\*]*/\n { - copyToOutput(yytext,(int)yyleng); - BEGIN(g_readLineCtx); + copyToOutput(yyscanner,yytext,(int)yyleng); + BEGIN(yyextra->readLineCtx); } [\\@][\\@][~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [\\@]"cond"/[^a-z_A-Z0-9] { // conditional section - g_condCtx = YY_START; + yyextra->condCtx = YY_START; BEGIN(CondLine); } [\\@]"endcond"/[^a-z_A-Z0-9] { // end of conditional section - bool oldSkip=g_skip; - endCondSection(); - if (YY_START==CComment && oldSkip && !g_skip) + bool oldSkip=yyextra->skip; + endCondSection(yyscanner); + if (YY_START==CComment && oldSkip && !yyextra->skip) { //printf("** Adding start of comment!\n"); - if (g_lang!=SrcLangExt_Python && - g_lang!=SrcLangExt_VHDL && - g_lang!=SrcLangExt_Markdown && - g_lang!=SrcLangExt_Fortran) + if (yyextra->lang!=SrcLangExt_Python && + yyextra->lang!=SrcLangExt_VHDL && + yyextra->lang!=SrcLangExt_Markdown && + yyextra->lang!=SrcLangExt_Fortran) { ADDCHAR('/'); ADDCHAR('*'); - if (g_specialComment) + if (yyextra->specialComment) { ADDCHAR('*'); } @@ -882,142 +762,284 @@ void replaceComment(int offset); } } [!()&| \ta-z_A-Z0-9.\-]+ { - bool oldSkip=g_skip; - startCondSection(yytext); - if ((g_condCtx==CComment || g_readLineCtx==SComment) && - !oldSkip && g_skip) + bool oldSkip=yyextra->skip; + startCondSection(yyscanner,yytext); + if ((yyextra->condCtx==CComment || yyextra->readLineCtx==SComment) && + !oldSkip && yyextra->skip) { - if (g_lang!=SrcLangExt_Python && - g_lang!=SrcLangExt_VHDL && - g_lang!=SrcLangExt_Markdown && - g_lang!=SrcLangExt_Fortran) + if (yyextra->lang!=SrcLangExt_Python && + yyextra->lang!=SrcLangExt_VHDL && + yyextra->lang!=SrcLangExt_Markdown && + yyextra->lang!=SrcLangExt_Fortran) { ADDCHAR('*'); ADDCHAR('/'); } } - if (g_readLineCtx==SComment) + if (yyextra->readLineCtx==SComment) { BEGIN(SComment); } else { - BEGIN(g_condCtx); + BEGIN(yyextra->condCtx); } } [ \t]* [\\@]"cond"[ \t\r]*/\n | . { // forgot section id? - if (YY_START!=CondLine) g_condCtx=YY_START; - bool oldSkip=g_skip; - startCondSection(" "); // fake section id causing the section to be hidden unconditionally - if ((g_condCtx==CComment || g_readLineCtx==SComment) && - !oldSkip && g_skip) + if (YY_START!=CondLine) yyextra->condCtx=YY_START; + bool oldSkip=yyextra->skip; + startCondSection(yyscanner," "); // fake section id causing the section to be hidden unconditionally + if ((yyextra->condCtx==CComment || yyextra->readLineCtx==SComment) && + !oldSkip && yyextra->skip) { //printf("** Adding terminator for comment!\n"); - if (g_lang!=SrcLangExt_Python && - g_lang!=SrcLangExt_VHDL && - g_lang!=SrcLangExt_Markdown && - g_lang!=SrcLangExt_Fortran) + if (yyextra->lang!=SrcLangExt_Python && + yyextra->lang!=SrcLangExt_VHDL && + yyextra->lang!=SrcLangExt_Markdown && + yyextra->lang!=SrcLangExt_Fortran) { ADDCHAR('*'); ADDCHAR('/'); } } - if (*yytext=='\n') g_lineNr++; - if (g_readLineCtx==SComment) + if (*yytext=='\n') yyextra->lineNr++; + if (yyextra->readLineCtx==SComment) { BEGIN(SComment); } else { - BEGIN(g_condCtx); + BEGIN(yyextra->condCtx); } } [\\@][a-z_A-Z][a-z_A-Z0-9]* { // expand alias without arguments - replaceAliases(yytext); + replaceAliases(yyscanner,yytext); } [\\@][a-z_A-Z][a-z_A-Z0-9]*"{" { // expand alias with arguments - g_lastBlockContext=YY_START; - g_blockCount=1; - g_aliasString=yytext; - g_lastEscaped=0; + yyextra->lastBlockContext=YY_START; + yyextra->blockCount=1; + yyextra->aliasString=yytext; + yyextra->lastEscaped=0; BEGIN( ReadAliasArgs ); } ^[ \t]*"//"[/!]/[^\n]+ { // skip leading special comments (see bug 618079) } "*/" { // oops, end of comment in the middle of an alias? - if (g_lang==SrcLangExt_Python) + if (yyextra->lang==SrcLangExt_Python) { REJECT; } else // abort the alias, restart scanning { - copyToOutput(g_aliasString,g_aliasString.length()); - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yyextra->aliasString,yyextra->aliasString.length()); + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } } [^{}\n\\\*]+ { - g_aliasString+=yytext; - g_lastEscaped=FALSE; + yyextra->aliasString+=yytext; + yyextra->lastEscaped=FALSE; } "\\" { - if (g_lastEscaped) g_lastEscaped=FALSE; - else g_lastEscaped=TRUE; - g_aliasString+=yytext; + if (yyextra->lastEscaped) yyextra->lastEscaped=FALSE; + else yyextra->lastEscaped=TRUE; + yyextra->aliasString+=yytext; } \n { - g_aliasString+=yytext; - g_lineNr++; - g_lastEscaped=FALSE; + yyextra->aliasString+=yytext; + yyextra->lineNr++; + yyextra->lastEscaped=FALSE; } "{" { - g_aliasString+=yytext; - if (!g_lastEscaped) g_blockCount++; - g_lastEscaped=FALSE; + yyextra->aliasString+=yytext; + if (!yyextra->lastEscaped) yyextra->blockCount++; + yyextra->lastEscaped=FALSE; } "}" { - g_aliasString+=yytext; - if (!g_lastEscaped) g_blockCount--; - if (g_blockCount==0) + yyextra->aliasString+=yytext; + if (!yyextra->lastEscaped) yyextra->blockCount--; + if (yyextra->blockCount==0) { - replaceAliases(g_aliasString); - BEGIN( g_lastBlockContext ); + replaceAliases(yyscanner,yyextra->aliasString); + BEGIN( yyextra->lastBlockContext ); } - g_lastEscaped=FALSE; + yyextra->lastEscaped=FALSE; } . { - g_aliasString+=yytext; - g_lastEscaped=FALSE; + yyextra->aliasString+=yytext; + yyextra->lastEscaped=FALSE; } . { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } %% -void replaceComment(int offset) +static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len) { - if (g_mlBrief || g_skip) + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + const char *p=s; + char c; + // copy leading blanks + while ((c=*p) && (c==' ' || c=='\t' || c=='\n')) + { + ADDCHAR(c); + yyextra->lineNr += c=='\n'; + p++; + } + // replace start of comment marker by blanks and the last character by a * + int blanks=0; + while ((c=*p) && (c=='/' || c=='!' || c=='#')) + { + blanks++; + p++; + if (*p=='<') // comment-after-item marker + { + blanks++; + p++; + } + if (c=='!') // end after first ! + { + break; + } + } + if (blanks>0) + { + while (blanks>2) + { + ADDCHAR(' '); + blanks--; + } + if (blanks>1) ADDCHAR('*'); + ADDCHAR(' '); + } + // copy comment line to output + ADDARRAY(p,len-(int)(p-s)); +} + +static inline int computeIndent(const char *s) +{ + int col=0; + static int tabSize=Config_getInt(TAB_SIZE); + const char *p=s; + char c; + while ((c=*p++)) + { + if (c==' ') col++; + else if (c=='\t') col+=tabSize-(col%tabSize); + else break; + } + return col; +} + +static inline void copyToOutput(yyscan_t yyscanner,const char *s,int len) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int i; + if (yyextra->skip) // only add newlines. + { + for (i=0;i skip %d\n",g_lineNr); + yyextra->lineNr++; + } + } + } + else if (len>0) + { + ADDARRAY(s,len); + static int tabSize=Config_getInt(TAB_SIZE); + for (i=0;icol=0; + //fprintf(stderr,"---> copy %d\n",g_lineNr); + yyextra->lineNr++; break; + case '\t': yyextra->col+=tabSize-(yyextra->col%tabSize); break; + default: yyextra->col++; break; + } + } + } +} + +static void startCondSection(yyscan_t yyscanner,const char *sectId) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("startCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); + CondParser prs; + bool expResult = prs.parse(yyextra->fileName,yyextra->lineNr,sectId); + yyextra->condStack.push(new CondCtx(yyextra->lineNr,sectId,yyextra->skip)); + if (!expResult) // not enabled { - copyToOutput(yytext,(int)yyleng); + yyextra->skip=TRUE; + } +} + +static void endCondSection(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->condStack.isEmpty()) + { + warn(yyextra->fileName,yyextra->lineNr,"Found \\endcond command without matching \\cond"); + yyextra->skip=FALSE; + } + else + { + CondCtx *ctx = yyextra->condStack.pop(); + yyextra->skip=ctx->skip; + } + //printf("endCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); +} + +/** copies string \a s with length \a len to the output, while + * replacing any alias commands found in the string. + */ +static void replaceAliases(yyscan_t yyscanner,const char *s) +{ + QCString result = resolveAliasCmd(s); + //printf("replaceAliases(%s)->'%s'\n",s,result.data()); + copyToOutput(yyscanner,result,result.length()); +} + + +static int yyread(yyscan_t yyscanner,char *buf,int max_size) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int bytesInBuf = yyextra->inBuf->curPos()-yyextra->inBufPos; + int bytesToCopy = QMIN(max_size,bytesInBuf); + memcpy(buf,yyextra->inBuf->data()+yyextra->inBufPos,bytesToCopy); + yyextra->inBufPos+=bytesToCopy; + return bytesToCopy; +} + +static void replaceComment(yyscan_t yyscanner,int offset) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->mlBrief || yyextra->skip) + { + copyToOutput(yyscanner,yytext,(int)yyleng); } else { //printf("replaceComment(%s)\n",yytext); int i=computeIndent(&yytext[offset]); - if (i==g_blockHeadCol) + if (i==yyextra->blockHeadCol) { - replaceCommentMarker(yytext,(int)yyleng); + replaceCommentMarker(yyscanner,yytext,(int)yyleng); } else { - copyToOutput(" */",3); + copyToOutput(yyscanner," */",3); int i;for (i=(int)yyleng-1;i>=0;i--) unput(yytext[i]); - g_inSpecialComment=FALSE; - BEGIN(Scan); - } + yyextra->inSpecialComment=FALSE; + BEGIN(Scan); + } } } @@ -1068,75 +1090,80 @@ static bool recognizeFixedForm(const char* contents) */ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) { + yyscan_t yyscanner; + commentcnvYY_state extra; + commentcnvYYlex_init_extra(&extra,&yyscanner); + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("convertCppComments(%s)\n",fileName); - g_inBuf = inBuf; - g_outBuf = outBuf; - g_inBufPos = 0; - g_col = 0; - g_mlBrief = Config_getBool(MULTILINE_CPP_IS_BRIEF); - g_skip = FALSE; - g_fileName = fileName; - g_lang = getLanguageFromFileName(fileName); - g_pythonDocString = FALSE; - g_lineNr = 1; - g_condStack.clear(); - g_condStack.setAutoDelete(TRUE); - g_commentStack.clear(); - g_commentStack.setAutoDelete(TRUE); - g_vhdl = FALSE; + yyextra->inBuf = inBuf; + yyextra->outBuf = outBuf; + yyextra->inBufPos = 0; + yyextra->col = 0; + yyextra->mlBrief = Config_getBool(MULTILINE_CPP_IS_BRIEF); + yyextra->skip = FALSE; + yyextra->fileName = fileName; + yyextra->lang = getLanguageFromFileName(fileName); + yyextra->pythonDocString = FALSE; + yyextra->lineNr = 1; + yyextra->condStack.clear(); + yyextra->condStack.setAutoDelete(TRUE); + yyextra->commentStack.clear(); + yyextra->commentStack.setAutoDelete(TRUE); + yyextra->vhdl = FALSE; printlex(yy_flex_debug, TRUE, __FILE__, fileName); - isFixedForm = FALSE; - if (g_lang==SrcLangExt_Fortran) + yyextra->isFixedForm = FALSE; + if (yyextra->lang==SrcLangExt_Fortran) { - isFixedForm = recognizeFixedForm(inBuf->data()); + yyextra->isFixedForm = recognizeFixedForm(inBuf->data()); } - if (g_lang==SrcLangExt_Markdown) + if (yyextra->lang==SrcLangExt_Markdown) { - g_nestingCount=0; + yyextra->nestingCount=0; BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } else { BEGIN(Scan); } - yylex(); - while (!g_condStack.isEmpty()) + yylex(yyscanner); + while (!yyextra->condStack.isEmpty()) { - CondCtx *ctx = g_condStack.pop(); + CondCtx *ctx = yyextra->condStack.pop(); QCString sectionInfo = " "; if (ctx->sectionId!=" ") sectionInfo.sprintf(" with label '%s' ",ctx->sectionId.stripWhiteSpace().data()); - warn(g_fileName,ctx->lineNr,"Conditional section%sdoes not have " + warn(yyextra->fileName,ctx->lineNr,"Conditional section%sdoes not have " "a corresponding \\endcond command within this file.",sectionInfo.data()); } - if (g_nestingCount>0 && g_lang!=SrcLangExt_Markdown) + if (yyextra->nestingCount>0 && yyextra->lang!=SrcLangExt_Markdown) { QCString tmp= "(probable line reference: "; bool first = TRUE; - while (!g_commentStack.isEmpty()) + while (!yyextra->commentStack.isEmpty()) { - CommentCtx *ctx = g_commentStack.pop(); + CommentCtx *ctx = yyextra->commentStack.pop(); if (!first) tmp += ", "; tmp += QCString().setNum(ctx->lineNr); first = FALSE; delete ctx; } tmp += ")"; - warn(g_fileName,g_lineNr,"Reached end of file while still inside a (nested) comment. " - "Nesting level %d %s",g_nestingCount,tmp.data()); + warn(yyextra->fileName,yyextra->lineNr,"Reached end of file while still inside a (nested) comment. " + "Nesting level %d %s",yyextra->nestingCount,tmp.data()); } - g_commentStack.clear(); - g_nestingCount = 0; + yyextra->commentStack.clear(); + yyextra->nestingCount = 0; if (Debug::isFlagSet(Debug::CommentCnv)) { - g_outBuf->at(g_outBuf->curPos())='\0'; + yyextra->outBuf->at(yyextra->outBuf->curPos())='\0'; Debug::print(Debug::CommentCnv,0,"-----------\nCommentCnv: %s\n" - "output=[\n%s]\n-----------\n",fileName,g_outBuf->data() + "output=[\n%s]\n-----------\n",fileName,yyextra->outBuf->data() ); } printlex(yy_flex_debug, FALSE, __FILE__, fileName); + commentcnvYYlex_destroy(yyscanner); } -- cgit v0.12 From c5854f5a8e819de82b73d14bbbd8583a36842fd5 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Mon, 18 Nov 2019 20:26:29 +0100 Subject: Replace set of g_inside* booleans with a single g_lang variable --- src/code.l | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/code.l b/src/code.l index c73911a..7c159ec 100644 --- a/src/code.l +++ b/src/code.l @@ -116,13 +116,9 @@ static int g_memCallContext; static int g_lastCContext; static int g_skipInlineInitContext; -static bool g_insideCpp; +static SrcLangExt g_lang; static bool g_insideObjC; -static bool g_insideJava; -static bool g_insideCS; -static bool g_insidePHP; static bool g_insideProtocolList; -static bool g_insideSlice; static bool g_lexInit = FALSE; @@ -951,11 +947,11 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName { className+="-p"; } - if (g_insidePHP) + if (g_lang==SrcLangExt_PHP) { className = substitute(className,"\\","::"); // for PHP namespaces } - else if (g_insideCS || g_insideJava) + else if (g_lang==SrcLangExt_CSharp || g_lang==SrcLangExt_Java) { className = substitute(className,".","::"); // for PHP namespaces } @@ -1324,7 +1320,7 @@ static void generateFunctionLink(CodeOutputInterface &ol,const char *funcName) ClassDef *ccd=0; QCString locScope=g_classScope; QCString locFunc=removeRedundantWhiteSpace(funcName); - if (g_insidePHP && locFunc.startsWith("self::")) locFunc=locFunc.mid(4); + if (g_lang==SrcLangExt_PHP && locFunc.startsWith("self::")) locFunc=locFunc.mid(4); QCString funcScope; QCString funcWithScope=locFunc; QCString funcWithFullScope=locFunc; @@ -1799,7 +1795,7 @@ static QCString escapeComment(const char *s) static bool skipLanguageSpecificKeyword(const QCString &kw) { - return g_insideCpp && (kw == "remove" || kw == "set" || kw == "get"); + return g_lang==SrcLangExt_Cpp && (kw == "remove" || kw == "set" || kw == "get"); } static bool isCastKeyword(const QCString &s) @@ -2181,7 +2177,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } {ID}("."{ID})* | {ID}("::"{ID})* { - if(g_insideCS) + if (g_lang==SrcLangExt_CSharp) g_curClassName=substitute(yytext,".","::"); else g_curClassName=yytext; @@ -2443,7 +2439,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_prefixed_with_this_keyword = TRUE; } {KEYWORD}/([^a-z_A-Z0-9]) { - if (g_insideJava && qstrcmp("internal",yytext) ==0) REJECT; + if (g_lang==SrcLangExt_Java && qstrcmp("internal",yytext) ==0) REJECT; if (skipLanguageSpecificKeyword(yytext)) REJECT; startFontClass("keyword"); codifyLines(yytext); @@ -2559,7 +2555,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_name+=yytext; } {TYPEKWSL}/{B}* { - if (!g_insideSlice) + if (g_lang!=SrcLangExt_Slice) { REJECT; } @@ -3045,7 +3041,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" endFontClass(); } {TYPEKWSL}/([^a-z_A-Z0-9]) { - if (!g_insideSlice) + if (g_lang!=SrcLangExt_Slice) { REJECT; } @@ -3825,12 +3821,8 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, g_sourceFileDef = createFileDef("",(exName?exName:"generated")); cleanupSourceDef = TRUE; } + g_lang = lang; g_insideObjC = lang==SrcLangExt_ObjC; - g_insideJava = lang==SrcLangExt_Java; - g_insideCS = lang==SrcLangExt_CSharp; - g_insidePHP = lang==SrcLangExt_PHP; - g_insideCpp = lang==SrcLangExt_Cpp; - g_insideSlice = lang==SrcLangExt_Slice; if (g_sourceFileDef) { setCurrentDoc("l00001"); -- cgit v0.12 From 26f6f1aec1be0361eac7c6ebc4de93904bf42a98 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Mon, 18 Nov 2019 20:37:37 +0100 Subject: Remove bogus flex code --- src/code.l | 10 ---------- src/commentcnv.l | 5 ----- src/commentscan.l | 9 --------- src/declinfo.l | 11 ----------- src/defargs.l | 6 ------ src/doctokenizer.l | 5 ----- src/fortrancode.l | 12 ------------ src/fortranscanner.l | 7 ------- src/pre.l | 6 ------ src/pycode.l | 9 --------- src/pyscanner.l | 7 ------- src/scanner.l | 7 ------- src/sqlcode.l | 8 -------- src/tclscanner.l | 7 ------- src/vhdlcode.l | 8 -------- src/xmlcode.l | 8 -------- 16 files changed, 125 deletions(-) diff --git a/src/code.l b/src/code.l index 7c159ec..4998421 100644 --- a/src/code.l +++ b/src/code.l @@ -3877,14 +3877,4 @@ void codeFreeScanner() #endif } - - -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void codeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." -#endif - #include "code.l.h" diff --git a/src/commentcnv.l b/src/commentcnv.l index 14abb8f..940f1a5 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -1168,10 +1168,5 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) //---------------------------------------------------------------------------- -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void commentcnvYYdummy() { yy_flex_realloc(0,0); } -} -#endif #include "commentcnv.l.h" diff --git a/src/commentscan.l b/src/commentscan.l index a1ce096..2b10f87 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -3281,13 +3281,4 @@ static void handleGuard(const QCString &expr) } } - - -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void commentscanYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "commentscan.l.h" diff --git a/src/declinfo.l b/src/declinfo.l index c27af39..37d0449 100644 --- a/src/declinfo.l +++ b/src/declinfo.l @@ -347,11 +347,6 @@ void parseFuncDecl(const QCString &decl,const SrcLangExt lang,QCString &cl,QCStr return; } -//extern "C" { // some bogus code to keep the compiler happy -// int declinfoYYwrap() { return 1 ; } -// void declinfoYYdummy() { yy_flex_realloc(0,0); } -//} - #if 0 void dumpDecl(const char *s) { @@ -385,11 +380,5 @@ int main() } #endif -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void declinfoYYdummy() { yy_flex_realloc(0,0); } -} -#endif #include "declinfo.l.h" diff --git a/src/defargs.l b/src/defargs.l index a213688..eb454ce 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -635,10 +635,4 @@ void stringToArgumentList(const char *argsString,ArgumentList& al,QCString *extr printlex(yy_flex_debug, FALSE, __FILE__, NULL); } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void defargsYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "defargs.l.h" diff --git a/src/doctokenizer.l b/src/doctokenizer.l index f0a6a83..c079c04 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -1611,10 +1611,5 @@ void doctokenizerYYendAutoList() // printlex(yy_flex_debug, FALSE, __FILE__, g_fileName); // return retval; //} -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void doctokenizerYYdummy() { yy_flex_realloc(0,0); } -} -#endif #include "doctokenizer.l.h" diff --git a/src/fortrancode.l b/src/fortrancode.l index 72feb3d..3bbecd8 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -1395,16 +1395,4 @@ void parseFortranCode(CodeOutputInterface &od,const char *,const QCString &s, return; } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void fortrancodeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4 but older than 2.5.33. These versions do NOT work with doxygen! Please use version <=2.5.4 or >=2.5.33 or expect things to be parsed wrongly!" -#else -extern "C" { // some bogus code to keep the compiler happy - void fortrancodeYYdummy() { yy_top_state(); } -} -#endif - #include "fortrancode.l.h" diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 39c45e7..e0d6d63 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -2836,11 +2836,4 @@ static void scanner_abort() //---------------------------------------------------------------------------- -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void fortranscannernerYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "fortranscanner.l.h" diff --git a/src/pre.l b/src/pre.l index 8bde725..cf13764 100644 --- a/src/pre.l +++ b/src/pre.l @@ -3426,11 +3426,5 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output printlex(yy_flex_debug, FALSE, __FILE__, fileName); } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy -// int preYYwrap() { return 1 ; } - void preYYdummy() { yy_flex_realloc(0,0); } -} -#endif #include "pre.l.h" diff --git a/src/pycode.l b/src/pycode.l index 4ff4fc1..4e53a27 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -1638,13 +1638,4 @@ void parsePythonCode(CodeOutputInterface &od,const char * /*className*/, return; } - -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void pycodeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." -#endif - #include "pycode.l.h" diff --git a/src/pyscanner.l b/src/pyscanner.l index 63f11e3..5d6b303 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -1940,11 +1940,4 @@ void PythonLanguageScanner::resetCodeParserState() //---------------------------------------------------------------------------- -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void pyscannerYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "pyscanner.l.h" diff --git a/src/scanner.l b/src/scanner.l index 393d6d4..37fcb1c 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -7402,11 +7402,4 @@ void CLanguageScanner::parsePrototype(const char *text) //---------------------------------------------------------------------------- -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void scannerYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "scanner.l.h" diff --git a/src/sqlcode.l b/src/sqlcode.l index 2685c46..a9e88a7 100644 --- a/src/sqlcode.l +++ b/src/sqlcode.l @@ -454,12 +454,4 @@ void resetSqlCodeParserState() yyextra->currentMemberDef = 0; } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void sqlcodeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." -#endif - #include "sqlcode.l.h" diff --git a/src/tclscanner.l b/src/tclscanner.l index 37eef0d..d22c5d6 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -3138,11 +3138,4 @@ void tclDummy() yy_top_state(); } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void tclscannerYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "tclscanner.l.h" diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 9f128ea..53e1ed8 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -1634,13 +1634,5 @@ void codeFreeVhdlScanner() #endif } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void vhdlcodeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4 but older than 2.5.33. These versions do NOT work with doxygen! Please use version <=2.5.4 or >=2.5.33 or expect things to be parsed wrongly!" -#endif - #include "vhdlcode.l.h" diff --git a/src/xmlcode.l b/src/xmlcode.l index bd6e8a8..2fedf2d 100644 --- a/src/xmlcode.l +++ b/src/xmlcode.l @@ -407,12 +407,4 @@ void resetXmlCodeParserState() g_currentMemberDef = 0; } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void xmlcodeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." -#endif - #include "xmlcode.l.h" -- cgit v0.12 From 844159503ac32293f1a11761687843b1ecf5fb3e Mon Sep 17 00:00:00 2001 From: albert-github Date: Thu, 21 Nov 2019 13:50:03 +0100 Subject: Correct style in table header in case of paragraph is used In case a paragraph is used in a table header (quite unusual but can happen with 2 lines and an empty line in between), a `

` tag is added and therewith the layout is incorrect. This problem was detected based on #7409 This has been corrected (and tested with some available browsers FF, IE, Chrome, Opera). --- templates/html/doxygen.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/html/doxygen.css b/templates/html/doxygen.css index ffba793..2c9dfd5 100644 --- a/templates/html/doxygen.css +++ b/templates/html/doxygen.css @@ -66,6 +66,11 @@ p.startli, p.startdd { margin-top: 2px; } +th p.starttd, p.intertd, p.endtd { + font-size: 100%; + font-weight: 700; +} + p.starttd { margin-top: 0px; } -- cgit v0.12 From e7d47ec23ba1b109754d6e47b1eb4d341efc3b36 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Thu, 21 Nov 2019 20:55:57 +0100 Subject: Made code.l scanner reentrant --- src/code.h | 14 +- src/code.l | 5860 ++++++++++++++++++++++++++++--------------------------- src/doxygen.cpp | 4 +- src/scanner.l | 7 +- 4 files changed, 3009 insertions(+), 2876 deletions(-) diff --git a/src/code.h b/src/code.h index da6b80e..a86ecc0 100644 --- a/src/code.h +++ b/src/code.h @@ -26,12 +26,20 @@ class MemberDef; class QCString; class Definition; -void parseCCode(CodeOutputInterface &,const char *,const QCString &, +class CodeScanner +{ + public: + CodeScanner(); + virtual ~CodeScanner(); + void parseCCode(CodeOutputInterface &,const char *,const QCString &, SrcLangExt lang, bool isExample, const char *exName,FileDef *fd, int startLine,int endLine,bool inlineFragment, const MemberDef *memberDef,bool showLineNumbers,const Definition *searchCtx, bool collectXRefs); -void resetCCodeParserState(); -void codeFreeScanner(); + void reset(); + private: + struct Private; + Private *p; +}; #endif diff --git a/src/code.l b/src/code.l index 4998421..32a0f7e 100644 --- a/src/code.l +++ b/src/code.l @@ -16,6 +16,8 @@ */ %option never-interactive %option prefix="codeYY" +%option reentrant +%option extra-type="struct codeYY_state *" %{ @@ -28,6 +30,7 @@ #include #include +#include "code.h" #include "entry.h" #include "doxygen.h" #include "message.h" @@ -58,76 +61,6 @@ * statics */ -static CodeOutputInterface * g_code; - -static ClassSDict *g_codeClassSDict = 0; -static QCString g_curClassName; -static QStrList g_curClassBases; - -static QCString g_parmType; -static QCString g_parmName; - -static const char * g_inputString; //!< the code fragment as text -static int g_inputPosition; //!< read offset during parsing -static int g_inputLines; //!< number of line in the code fragment -static int g_yyLineNr; //!< current line number -static int g_yyColNr; //!< current column number -static bool g_needsTermination; - -static bool g_exampleBlock; -static QCString g_exampleName; -static QCString g_exampleFile; - -static bool g_insideTemplate = FALSE; -static QCString g_type; -static QCString g_name; -static QCString g_args; -static QCString g_classScope; -static QCString g_realScope; -static QStack g_scopeStack; //!< 1 if bracket starts a scope, - // 2 for internal blocks -static int g_anchorCount; -static FileDef * g_sourceFileDef; -static bool g_lineNumbers; -static Definition * g_currentDefinition; -static MemberDef * g_currentMemberDef; -static bool g_includeCodeFragment; -static const char * g_currentFontClass; -static bool g_searchingForBody; -static bool g_insideBody; -static int g_bodyCurlyCount; -static QCString g_saveName; -static QCString g_saveType; -static QCString g_delimiter; - -static int g_bracketCount = 0; -static int g_curlyCount = 0; -static int g_sharpCount = 0; -static bool g_inFunctionTryBlock = FALSE; -static bool g_inForEachExpression = FALSE; - -static int g_lastTemplCastContext; -static int g_lastSpecialCContext; -static int g_lastStringContext; -static int g_lastSkipCppContext; -static int g_lastVerbStringContext; -static int g_lastObjCCallContext; -static int g_memCallContext; -static int g_lastCContext; -static int g_skipInlineInitContext; - -static SrcLangExt g_lang; -static bool g_insideObjC; -static bool g_insideProtocolList; - -static bool g_lexInit = FALSE; - -static QStack g_classScopeLengthStack; - -static int g_prefixed_with_this_keyword = FALSE; -static const Definition *g_searchCtx; -static bool g_collectXRefs; - // context for an Objective-C method call struct ObjCCallCtx { @@ -143,31 +76,6 @@ struct ObjCCallCtx int braceCount; }; -// globals for objective-C method calls -static ObjCCallCtx *g_currentCtx=0; -static int g_currentCtxId=0; -static int g_currentNameId=0; -static int g_currentObjId=0; -static int g_currentWordId=0; -static int g_currentCommentId=0; -static QStack g_contextStack; -static QIntDict g_contextDict; -static QIntDict g_nameDict; -static QIntDict g_objectDict; -static QIntDict g_wordDict; -static QIntDict g_commentDict; -static int g_braceCount=0; - -static void saveObjCContext(); -static void restoreObjCContext(); - -static const char *stateToString(int state); - -static QCString g_forceTagReference; - - -//------------------------------------------------------------------- - /*! Represents a stack of variable to class mappings as found in the * code. Each scope is enclosed in pushScope() and popScope() calls. * Variables are added by calling addVariables() and one can search @@ -223,7 +131,7 @@ class VariableContext m_scopes.clear(); } - void addVariable(const QCString &type,const QCString &name); + void addVariable(yyscan_t yyscanner,const QCString &type,const QCString &name); ClassDef *findVariable(const QCString &name); int count() const { return m_scopes.count(); } @@ -233,102 +141,6 @@ class VariableContext QList m_scopes; }; -void VariableContext::addVariable(const QCString &type,const QCString &name) -{ - //printf("VariableContext::addVariable(%s,%s)\n",type.data(),name.data()); - QCString ltype = type.simplifyWhiteSpace(); - QCString lname = name.simplifyWhiteSpace(); - if (ltype.left(7)=="struct ") - { - ltype = ltype.right(ltype.length()-7); - } - else if (ltype.left(6)=="union ") - { - ltype = ltype.right(ltype.length()-6); - } - if (ltype.isEmpty() || lname.isEmpty()) return; - DBG_CTX((stderr,"** addVariable trying: type='%s' name='%s' g_currentDefinition=%s\n", - ltype.data(),lname.data(),g_currentDefinition?g_currentDefinition->name().data():"")); - Scope *scope = m_scopes.count()==0 ? &m_globalScope : m_scopes.getLast(); - const ClassDef *varType; - int i=0; - if ( - (varType=g_codeClassSDict->find(ltype)) || // look for class definitions inside the code block - (varType=getResolvedClass(g_currentDefinition,g_sourceFileDef,ltype)) // look for global class definitions - ) - { - DBG_CTX((stderr,"** addVariable type='%s' name='%s'\n",ltype.data(),lname.data())); - scope->append(lname,varType); // add it to a list - } - else if ((i=ltype.find('<'))!=-1) - { - // probably a template class - QCString typeName(ltype.left(i)); - ClassDef* newDef = 0; - QCString templateArgs(ltype.right(ltype.length() - i)); - if ( !typeName.isEmpty() && - ( // look for class definitions inside the code block - (varType=g_codeClassSDict->find(typeName)) || - // otherwise look for global class definitions - (varType=getResolvedClass(g_currentDefinition,g_sourceFileDef,typeName,0,0,TRUE,TRUE)) - ) && // and it must be a template - !varType->templateArguments().empty()) - { - newDef = varType->getVariableInstance( templateArgs ); - } - if (newDef) - { - DBG_CTX((stderr,"** addVariable type='%s' templ='%s' name='%s'\n",typeName.data(),templateArgs.data(),lname.data())); - scope->append(lname, newDef); - } - else - { - // Doesn't seem to be a template. Try just the base name. - addVariable(typeName,name); - } - } - else - { - if (m_scopes.count()>0) // for local variables add a dummy entry so the name - // is hidden to avoid false links to global variables with the same name - // TODO: make this work for namespaces as well! - { - DBG_CTX((stderr,"** addVariable: dummy context for '%s'\n",lname.data())); - scope->append(lname,dummyContext); - } - else - { - DBG_CTX((stderr,"** addVariable: not adding variable!\n")); - } - } -} - -ClassDef *VariableContext::findVariable(const QCString &name) -{ - if (name.isEmpty()) return 0; - ClassDef *result = 0; - QListIterator sli(m_scopes); - Scope *scope; - QCString key = name; - // search from inner to outer scope - for (sli.toLast();(scope=sli.current());--sli) - { - result = scope->find(key); - if (result) - { - DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result)); - return result; - } - } - // nothing found -> also try the global scope - result=m_globalScope.find(name); - DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result)); - return result; -} - -static VariableContext g_theVarContext; -const ClassDef *VariableContext::dummyContext = (ClassDef*)0x8; - //------------------------------------------------------------------- class CallContext @@ -396,2266 +208,997 @@ class CallContext QList m_defList; }; -static CallContext g_theCallContext; - -//------------------------------------------------------------------- -/*! add class/namespace name s to the scope */ -static void pushScope(const char *s) +struct codeYY_state { - g_classScopeLengthStack.push(new int(g_classScope.length())); - if (g_classScope.isEmpty() || leftScopeMatch(s,g_classScope)) - { - g_classScope = s; - } - else - { - g_classScope += "::"; - g_classScope += s; - } - //printf("pushScope(%s) result: '%s'\n",s,g_classScope.data()); -} + CodeOutputInterface * code = 0; + + ClassSDict *codeClassSDict = 0; + QCString curClassName; + QStrList curClassBases; + + QCString parmType; + QCString parmName; + + const char * inputString = 0; //!< the code fragment as text + int inputPosition = 0; //!< read offset during parsing + int inputLines = 0; //!< number of line in the code fragment + int yyLineNr = 0; //!< current line number + int yyColNr = 0; //!< current column number + bool needsTermination = FALSE; + + bool exampleBlock = FALSE; + QCString exampleName; + QCString exampleFile; + + bool insideTemplate = FALSE; + QCString type; + QCString name; + QCString args; + QCString classScope; + QCString realScope; + QStack scopeStack; //!< 1 if bracket starts a scope, + // 2 for internal blocks + int anchorCount = 0; + FileDef * sourceFileDef = 0; + bool lineNumbers = FALSE; + Definition * currentDefinition = 0; + MemberDef * currentMemberDef = 0; + bool includeCodeFragment = FALSE; + const char * currentFontClass = 0; + bool searchingForBody = FALSE; + bool insideBody = FALSE; + int bodyCurlyCount = 0; + QCString saveName; + QCString saveType; + QCString delimiter; + + int bracketCount = 0; + int curlyCount = 0; + int sharpCount = 0; + bool inFunctionTryBlock = FALSE; + bool inForEachExpression = FALSE; + + int lastTemplCastContext = 0; + int lastSpecialCContext = 0; + int lastStringContext = 0; + int lastSkipCppContext = 0; + int lastVerbStringContext = 0; + int lastObjCCallContext = 0; + int memCallContext = 0; + int lastCContext = 0; + int skipInlineInitContext = 0; + + SrcLangExt lang = SrcLangExt_Unknown; + bool insideObjC = FALSE; + bool insideProtocolList = FALSE; + + bool lexInit = FALSE; + + QStack classScopeLengthStack; + + int prefixed_with_this_keyword = FALSE; + const Definition *searchCtx = 0; + bool collectXRefs = FALSE; + + ObjCCallCtx * currentCtx=0; + int currentCtxId=0; + int currentNameId=0; + int currentObjId=0; + int currentWordId=0; + int currentCommentId=0; + QStack contextStack; + QIntDict contextDict; + QIntDict nameDict; + QIntDict objectDict; + QIntDict wordDict; + QIntDict commentDict; + int braceCount=0; + + QCString forceTagReference; + VariableContext theVarContext; + CallContext theCallContext; +}; -/*! remove the top class/namespace name from the scope */ -static void popScope() -{ - if (!g_classScopeLengthStack.isEmpty()) - { - int *pLength = g_classScopeLengthStack.pop(); - g_classScope.truncate(*pLength); - delete pLength; - } - else - { - //err("Too many end of scopes found!\n"); - } - //printf("popScope() result: '%s'\n",g_classScope.data()); -} +static bool isCastKeyword(const QCString &s); -static void setCurrentDoc(const QCString &anchor) -{ - if (Doxygen::searchIndex) - { - if (g_searchCtx) - { - g_code->setCurrentDoc(g_searchCtx,g_searchCtx->anchor(),FALSE); - } - else - { - g_code->setCurrentDoc(g_sourceFileDef,anchor,TRUE); - } - } -} +//------------------------------------------------------------------- -static void addToSearchIndex(const char *text) -{ - if (Doxygen::searchIndex) - { - g_code->addWord(text,FALSE); - } -} +static void saveObjCContext(yyscan_t yyscanner); +static void restoreObjCContext(yyscan_t yyscanner); +static const char *stateToString(yyscan_t yyscanner,int state); +static void addUsingDirective(yyscan_t yyscanner,const char *name); +static void pushScope(yyscan_t yyscanner,const char *s); +static void popScope(yyscan_t yyscanner); +static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor); +static void addToSearchIndex(yyscan_t yyscanner,const char *text); +static void setClassScope(yyscan_t yyscanner,const QCString &name); +static void startCodeLine(yyscan_t yyscanner); +static void endCodeLine(yyscan_t yyscanner); +static void nextCodeLine(yyscan_t yyscanner); +static void startFontClass(yyscan_t yyscanner,const char *s); +static void endFontClass(yyscan_t yyscanner); +static void codifyLines(yyscan_t yyscanner,const char *text); +static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, + const Definition *d, + const char *text); +static void addType(yyscan_t yyscanner); +static void addParmType(yyscan_t yyscanner); +static void addUsingDirective(yyscan_t yyscanner,const char *name); +static void setParameterList(yyscan_t yyscanner,const MemberDef *md); +static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,Definition *d); +static MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &name); +static void updateCallContextForSmartPointer(yyscan_t yyscanner); +static bool getLinkInScope(yyscan_t yyscanner,const QCString &c, // scope + const QCString &m, // member + const char *memberText, // exact text + CodeOutputInterface &ol, + const char *text, + bool varOnly=FALSE + ); +static bool getLink(yyscan_t yyscanner,const char *className, + const char *memberName, + CodeOutputInterface &ol, + const char *text=0, + bool varOnly=FALSE); +static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *clName, + bool typeOnly=FALSE,bool varOnly=FALSE); +static bool generateClassMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,MemberDef *xmd,const char *memName); +static bool generateClassMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,const Definition *def,const char *memName); +static void generateMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,const QCString &varName, + const char *memName); +static void generatePHPVariableLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *varName); +static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *funcName); +static int countLines(yyscan_t yyscanner); +static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx); +static QCString escapeName(yyscan_t yyscanner,const char *s); +static QCString escapeObject(yyscan_t yyscanner,const char *s); +static QCString escapeWord(yyscan_t yyscanner,const char *s); +static QCString escapeComment(yyscan_t yyscanner,const char *s); +static bool skipLanguageSpecificKeyword(yyscan_t yyscanner,const QCString &kw); +static int yyread(yyscan_t yyscanner,char *buf,int max_size); -static void setClassScope(const QCString &name) -{ - //printf("setClassScope(%s)\n",name.data()); - QCString n=name; - n=n.simplifyWhiteSpace(); - int ts=n.find('<'); // start of template - int te=n.findRev('>'); // end of template - //printf("ts=%d te=%d\n",ts,te); - if (ts!=-1 && te!=-1 && te>ts) - { - // remove template from scope - n=n.left(ts)+n.right(n.length()-te-1); - } - while (!g_classScopeLengthStack.isEmpty()) - { - popScope(); - } - g_classScope.resize(0); - int i; - while ((i=n.find("::"))!=-1) - { - pushScope(n.left(i)); - n = n.mid(i+2); - } - pushScope(n); - //printf("--->New class scope '%s'\n",g_classScope.data()); -} -/*! start a new line of code, inserting a line number if g_sourceFileDef - * is TRUE. If a definition starts at the current line, then the line - * number is linked to the documentation of that definition. +/* ----------------------------------------------------------------- */ -static void startCodeLine() -{ - //if (g_currentFontClass) { g_code->endFontClass(); } - if (g_sourceFileDef && g_lineNumbers) - { - //QCString lineNumber,lineAnchor; - //lineNumber.sprintf("%05d",g_yyLineNr); - //lineAnchor.sprintf("l%05d",g_yyLineNr); - - Definition *d = g_sourceFileDef->getSourceDefinition(g_yyLineNr); - //printf("%s:startCodeLine(%d)=%p\n",g_sourceFileDef->name().data(),g_yyLineNr,d); - if (!g_includeCodeFragment && d) - { - g_currentDefinition = d; - g_currentMemberDef = g_sourceFileDef->getSourceMember(g_yyLineNr); - g_insideBody = FALSE; - g_searchingForBody = TRUE; - g_realScope = d->name(); - //g_classScope = ""; - g_type.resize(0); - g_name.resize(0); - g_args.resize(0); - g_parmType.resize(0); - g_parmName.resize(0); - //printf("Real scope: '%s'\n",g_realScope.data()); - g_bodyCurlyCount = 0; - QCString lineAnchor; - lineAnchor.sprintf("l%05d",g_yyLineNr); - if (g_currentMemberDef) - { - g_code->writeLineNumber(g_currentMemberDef->getReference(), - g_currentMemberDef->getOutputFileBase(), - g_currentMemberDef->anchor(),g_yyLineNr); - setCurrentDoc(lineAnchor); - } - else if (d->isLinkableInProject()) - { - g_code->writeLineNumber(d->getReference(), - d->getOutputFileBase(), - 0,g_yyLineNr); - setCurrentDoc(lineAnchor); - } - } - else - { - g_code->writeLineNumber(0,0,0,g_yyLineNr); - } - } - DBG_CTX((stderr,"startCodeLine(%d)\n",g_yyLineNr)); - g_code->startCodeLine(g_sourceFileDef && g_lineNumbers); - if (g_currentFontClass) - { - g_code->startFontClass(g_currentFontClass); - } -} - +#undef YY_INPUT +#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size); -static void endFontClass(); -static void startFontClass(const char *s); -static void endCodeLine() -{ - DBG_CTX((stderr,"endCodeLine(%d)\n",g_yyLineNr)); - endFontClass(); - g_code->endCodeLine(); -} +%} -static void nextCodeLine() -{ - const char * fc = g_currentFontClass; - endCodeLine(); - if (g_yyLineNr]*">" +SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID}) +SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+ +KEYWORD_OBJC ("@public"|"@private"|"@protected"|"@class"|"@implementation"|"@interface"|"@end"|"@selector"|"@protocol"|"@optional"|"@required"|"@throw"|"@synthesize"|"@property") +KEYWORD ("asm"|"__assume"|"auto"|"class"|"const"|"delete"|"enum"|"explicit"|"extern"|"false"|"friend"|"gcnew"|"gcroot"|"set"|"get"|"inline"|"internal"|"mutable"|"namespace"|"new"|"null"|"nullptr"|"override"|"operator"|"pin_ptr"|"private"|"protected"|"public"|"raise"|"register"|"remove"|"self"|"sizeof"|"static"|"struct"|"__super"|"function"|"template"|"generic"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile"|"abstract"|"final"|"import"|"synchronized"|"transient"|"alignas"|"alignof"|{KEYWORD_OBJC}) +FLOWKW ("break"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"return"|"switch"|"throw"|"throws"|"@catch"|"@finally") +FLOWCONDITION ("case"|"for"|"foreach"|"for each"|"goto"|"if"|"try"|"while"|"@try") +TYPEKW ("bool"|"byte"|"char"|"double"|"float"|"int"|"long"|"object"|"short"|"signed"|"unsigned"|"void"|"wchar_t"|"size_t"|"boolean"|"id"|"SEL"|"string"|"nullptr") +TYPEKWSL ("LocalObject"|"Object"|"Value") +CASTKW ("const_cast"|"dynamic_cast"|"reinterpret_cast"|"static_cast") +CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'")) +ARITHOP "+"|"-"|"/"|"*"|"%"|"--"|"++" +ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|=" +LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!" +BITOP "&"|"|"|"^"|"<<"|">>"|"~" +OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} +RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"(" +RAWEND ")"[^ \t\(\)\\]{0,16}\" -/*! write a code fragment 'text' that may span multiple lines, inserting - * line numbers for each line. - */ -static void codifyLines(const char *text) -{ - //printf("codifyLines(%d,\"%s\")\n",g_yyLineNr,text); - const char *p=text,*sp=p; - char c; - bool done=FALSE; - while (!done) - { - sp=p; - while ((c=*p++) && c!='\n') { g_yyColNr++; } - if (c=='\n') - { - g_yyLineNr++; - g_yyColNr=1; - //*(p-1)='\0'; - int l = (int)(p-sp-1); - char *tmp = (char*)malloc(l+1); - memcpy(tmp,sp,l); - tmp[l]='\0'; - g_code->codify(tmp); - free(tmp); - nextCodeLine(); - } - else - { - g_code->codify(sp); - done=TRUE; - } - } -} +%option noyywrap -/*! writes a link to a fragment \a text that may span multiple lines, inserting - * line numbers for each line. If \a text contains newlines, the link will be - * split into multiple links with the same destination, one for each line. - */ -static void writeMultiLineCodeLink(CodeOutputInterface &ol, - const Definition *d, - const char *text) -{ - static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS); - TooltipManager::instance()->addTooltip(d); - QCString ref = d->getReference(); - QCString file = d->getOutputFileBase(); - QCString anchor = d->anchor(); - QCString tooltip; - if (!sourceTooltips) // fall back to simple "title" tooltips - { - tooltip = d->briefDescriptionAsTooltip(); - } - bool done=FALSE; - char *p=(char *)text; - while (!done) - { - char *sp=p; - char c; - while ((c=*p++) && c!='\n') { } - if (c=='\n') - { - g_yyLineNr++; - *(p-1)='\0'; - //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp); - ol.writeCodeLink(ref,file,anchor,sp,tooltip); - nextCodeLine(); - } - else - { - //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp); - ol.writeCodeLink(ref,file,anchor,sp,tooltip); - done=TRUE; - } - } -} +%x SkipString +%x SkipStringS +%x SkipVerbString +%x SkipCPP +%x SkipComment +%x SkipCxxComment +%x RemoveSpecialCComment +%x StripSpecialCComment +%x Body +%x FuncCall +%x MemberCall +%x MemberCall2 +%x SkipInits +%x ClassName +%x AlignAs +%x AlignAsEnd +%x PackageName +%x ClassVar +%x CppCliTypeModifierFollowup +%x Bases +%x SkipSharp +%x ReadInclude +%x TemplDecl +%x TemplCast +%x CallEnd +%x ObjCMethod +%x ObjCParams +%x ObjCParamType +%x ObjCCall +%x ObjCMName +%x ObjCSkipStr +%x ObjCCallComment +%x OldStyleArgs +%x UsingName +%x RawString +%x InlineInit -static void addType() -{ - if (g_name=="const") { g_name.resize(0); return; } - if (!g_type.isEmpty()) g_type += ' ' ; - g_type += g_name ; - g_name.resize(0) ; - if (!g_type.isEmpty()) g_type += ' ' ; - g_type += g_args ; - g_args.resize(0) ; -} +%% -static void addParmType() -{ - if (g_parmName=="const") { g_parmName.resize(0); return; } - if (!g_parmType.isEmpty()) g_parmType += ' ' ; - g_parmType += g_parmName ; - g_parmName.resize(0) ; -} +<*>\x0d +^([ \t]*"#"[ \t]*("include"|"import")[ \t]*)("<"|"\"") { + startFontClass(yyscanner,"preprocessor"); + yyextra->code->codify(yytext); + BEGIN( ReadInclude ); + } +("@interface"|"@implementation"|"@protocol")[ \t\n]+ { + yyextra->insideObjC=TRUE; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + if (!yyextra->insideTemplate) + BEGIN( ClassName ); + } +(("public"|"private"){B}+)?("ref"|"value"|"interface"|"enum"){B}+("class"|"struct") { + if (yyextra->insideTemplate) REJECT; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + BEGIN( ClassName ); + } +"property"|"event"/{BN}* { + if (yyextra->insideTemplate) REJECT; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + } +(KEYWORD_CPPCLI_DATATYPE|("partial"{B}+)?"class"|"struct"|"union"|"namespace"|"interface"){B}+ { + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + if (!yyextra->insideTemplate) + BEGIN( ClassName ); + } +("package")[ \t\n]+ { + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + BEGIN( PackageName ); + } +\n { + if (!yyextra->insideObjC) REJECT; + codifyLines(yyscanner,yytext); + BEGIN(Body); + } +"-"|"+" { + if (!yyextra->insideObjC || yyextra->insideBody) + { + yyextra->code->codify(yytext); + } + else // Start of Objective-C method + { + //printf("Method!\n"); + yyextra->code->codify(yytext); + BEGIN(ObjCMethod); + } + } +":" { + yyextra->code->codify(yytext); + BEGIN(ObjCParams); + } +"(" { + yyextra->code->codify(yytext); + BEGIN(ObjCParamType); + } +";"|"{" { + yyextra->code->codify(yytext); + if (*yytext=='{') + { + if (yyextra->searchingForBody) + { + yyextra->searchingForBody=FALSE; + yyextra->insideBody=TRUE; + } + if (yyextra->insideBody) yyextra->bodyCurlyCount++; + if (!yyextra->curClassName.isEmpty()) // valid class name + { + pushScope(yyscanner,yyextra->curClassName); + DBG_CTX((stderr,"** scope stack push SCOPEBLOCK\n")); + yyextra->scopeStack.push(SCOPEBLOCK); + } + } + yyextra->type.resize(0); + yyextra->name.resize(0); + BEGIN(Body); + } +{ID}{B}*":" { + yyextra->code->codify(yytext); + } +{TYPEKW} { + startFontClass(yyscanner,"keywordtype"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + yyextra->parmType=yytext; + } +{ID} { + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + yyextra->parmType=yytext; + } +")" { + yyextra->code->codify(yytext); + BEGIN(ObjCParams); + } +{ID} { + yyextra->code->codify(yytext); + yyextra->parmName=yytext; + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + yyextra->parmType.resize(0);yyextra->parmName.resize(0); + } +{ID} { + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + } +. { + yyextra->code->codify(yytext); + } +\n { + codifyLines(yyscanner,yytext); + } +[^\n\"\>]+/(">"|"\"") { + //FileInfo *f; + bool ambig; + bool found=FALSE; + //QCString absPath = yytext; + //if (yyextra->sourceFileDef && QDir::isRelativePath(absPath)) + //{ + // absPath = QDir::cleanDirPath(yyextra->sourceFileDef->getPath()+"/"+absPath); + //} -static void addUsingDirective(const char *name) -{ - if (g_sourceFileDef && name) - { - NamespaceDef *nd = Doxygen::namespaceSDict->find(name); - if (nd) - { - g_sourceFileDef->addUsingDirective(nd); - } - } -} + FileDef *fd=findFileDef(Doxygen::inputNameDict,yytext,ambig); + //printf("looking for include %s -> %s fd=%p\n",yytext,absPath.data(),fd); + if (fd && fd->isLinkable()) + { + if (ambig) // multiple input files match the name + { + //printf("===== yes %s is ambiguous\n",yytext); + QCString name = QDir::cleanDirPath(yytext).utf8(); + if (!name.isEmpty() && yyextra->sourceFileDef) + { + FileName *fn = Doxygen::inputNameDict->find(name); + if (fn) + { + FileNameIterator fni(*fn); + // for each include name + for (fni.toFirst();!found && (fd=fni.current());++fni) + { + // see if this source file actually includes the file + found = yyextra->sourceFileDef->isIncluded(fd->absFilePath()); + //printf(" include file %s found=%d\n",fd->absFilePath().data(),found); + } + } + } + } + else // not ambiguous + { + found = TRUE; + } + } + //printf(" include file %s found=%d\n",fd ? fd->absFilePath().data() : "",found); + if (found) + { + writeMultiLineCodeLink(yyscanner,*yyextra->code,fd,yytext); + } + else + { + yyextra->code->codify(yytext); + } + char c=yyinput(yyscanner); + QCString text; + text+=c; + yyextra->code->codify(text); + endFontClass(yyscanner); + BEGIN( Body ); + } +^[ \t]*"#" { + startFontClass(yyscanner,"preprocessor"); + yyextra->lastSkipCppContext = YY_START; + yyextra->code->codify(yytext); + BEGIN( SkipCPP ) ; + } +. { + yyextra->code->codify(yytext); + } +[^\n\/\\]+ { + yyextra->code->codify(yytext); + } +\\[\r]?\n { + codifyLines(yyscanner,yytext); + } +"//" { + yyextra->code->codify(yytext); + } +"{" { + yyextra->theVarContext.pushScope(); -static void setParameterList(const MemberDef *md) -{ - g_classScope = md->getClassDef() ? md->getClassDef()->name().data() : ""; - for (const Argument &a : md->argumentList()) - { - g_parmName = a.name; - g_parmType = a.type; - int i = g_parmType.find('*'); - if (i!=-1) g_parmType = g_parmType.left(i); - i = g_parmType.find('&'); - if (i!=-1) g_parmType = g_parmType.left(i); - g_parmType.stripPrefix("const "); - g_parmType=g_parmType.stripWhiteSpace(); - g_theVarContext.addVariable(g_parmType,g_parmName); - } -} + DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); + yyextra->scopeStack.push(INNERBLOCK); -static const ClassDef *stripClassName(const char *s,Definition *d=g_currentDefinition) -{ - int pos=0; - QCString type = s; - QCString className; - QCString templSpec; - while (extractClassNameFromType(type,pos,className,templSpec)!=-1) - { - QCString clName=className+templSpec; - const ClassDef *cd=0; - if (!g_classScope.isEmpty()) - { - cd=getResolvedClass(d,g_sourceFileDef,g_classScope+"::"+clName); - } - if (cd==0) - { - cd=getResolvedClass(d,g_sourceFileDef,clName); - } - //printf("stripClass trying '%s' = %p\n",clName.data(),cd); - if (cd) - { - return cd; - } - } + if (yyextra->searchingForBody) + { + yyextra->searchingForBody=FALSE; + yyextra->insideBody=TRUE; + } + yyextra->code->codify(yytext); + if (yyextra->insideBody) + { + yyextra->bodyCurlyCount++; + } + yyextra->type.resize(0); + yyextra->name.resize(0); + BEGIN( Body ); + } +"}" { + yyextra->theVarContext.popScope(); + yyextra->type.resize(0); + yyextra->name.resize(0); - return 0; -} + int *scope = yyextra->scopeStack.pop(); + DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK)); + if (scope==SCOPEBLOCK || scope==CLASSBLOCK) + { + popScope(yyscanner); + } -static MemberDef *setCallContextForVar(const QCString &name) -{ - if (name.isEmpty()) return 0; - DBG_CTX((stderr,"setCallContextForVar(%s) g_classScope=%s\n",name.data(),g_classScope.data())); + yyextra->code->codify(yytext); - int scopeEnd = name.findRev("::"); - if (scopeEnd!=-1) // name with explicit scope - { - QCString scope = name.left(scopeEnd); - QCString locName = name.right(name.length()-scopeEnd-2); - //printf("explicit scope: name=%s scope=%s\n",locName.data(),scope.data()); - ClassDef *mcd = getClass(scope); - if (mcd && !locName.isEmpty()) - { - MemberDef *md=mcd->getMemberByName(locName); - if (md) - { - //printf("name=%s scope=%s\n",locName.data(),scope.data()); - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - return md; - } - } - else // check namespace as well - { - const NamespaceDef *mnd = getResolvedNamespace(scope); - if (mnd && !locName.isEmpty()) - { - MemberDef *md=mnd->getMemberByName(locName); - if (md) - { - //printf("name=%s scope=%s\n",locName.data(),scope.data()); - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - return md; - } - } - } - } - - MemberName *mn; - ClassDef *mcd = g_theVarContext.findVariable(name); - if (mcd) // local variable - { - DBG_CTX((stderr,"local variable?\n")); - if (mcd!=VariableContext::dummyContext) - { - DBG_CTX((stderr,"local var '%s' mcd=%s\n",name.data(),mcd->name().data())); - g_theCallContext.setScope(mcd); - } - } - else - { - DBG_CTX((stderr,"class member? scope=%s\n",g_classScope.data())); - // look for a class member - mcd = getClass(g_classScope); - if (mcd) - { - DBG_CTX((stderr,"Inside class %s\n",mcd->name().data())); - MemberDef *md=mcd->getMemberByName(name); - if (md) - { - DBG_CTX((stderr,"Found member %s\n",md->name().data())); - if (g_scopeStack.top()!=CLASSBLOCK) - { - DBG_CTX((stderr,"class member '%s' mcd=%s\n",name.data(),mcd->name().data())); - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - } - return md; - } - } - } - - // look for a global member - if ((mn=Doxygen::functionNameSDict->find(name))) - { - //printf("global var '%s'\n",name.data()); - if (mn->count()==1) // global defined only once - { - MemberDef *md=mn->getFirst(); - if (!md->isStatic() || md->getBodyDef()==g_sourceFileDef) - { - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - return md; - } - return 0; - } - else if (mn->count()>1) // global defined more than once - { - MemberNameIterator it(*mn); - MemberDef *md; - for (;(md=it.current());++it) - { - //printf("mn=%p md=%p md->getBodyDef()=%p g_sourceFileDef=%p\n", - // mn,md, - // md->getBodyDef(),g_sourceFileDef); - - // in case there are multiple members we could link to, we - // only link to members if defined in the same file or - // defined as external. - if ((!md->isStatic() || md->getBodyDef()==g_sourceFileDef) && - (g_forceTagReference.isEmpty() || g_forceTagReference==md->getReference()) - ) - { - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - //printf("returning member %s in source file %s\n",md->name().data(),g_sourceFileDef->name().data()); - return md; - } - } - return 0; - } - } - return 0; -} - -static void updateCallContextForSmartPointer() -{ - const Definition *d = g_theCallContext.getScope(); - //printf("updateCallContextForSmartPointer() cd=%s\n",cd ? d->name().data() : ""); - MemberDef *md; - if (d && d->definitionType()==Definition::TypeClass && (md=(dynamic_cast(d))->isSmartPointer())) - { - const ClassDef *ncd = stripClassName(md->typeString(),md->getOuterScope()); - if (ncd) - { - g_theCallContext.setScope(ncd); - //printf("Found smart pointer call %s->%s!\n",cd->name().data(),ncd->name().data()); - } - } -} + DBG_CTX((stderr,"yyextra->bodyCurlyCount=%d\n",yyextra->bodyCurlyCount)); + if (--yyextra->bodyCurlyCount<=0) + { + yyextra->insideBody=FALSE; + yyextra->currentMemberDef=0; + if (yyextra->currentDefinition) + yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope(); + } + BEGIN(Body); + } +"@end" { + //printf("End of objc scope fd=%s\n",yyextra->sourceFileDef->name().data()); + if (yyextra->sourceFileDef) + { + FileDef *fd=yyextra->sourceFileDef; + yyextra->insideObjC = fd->name().lower().right(2)==".m" || + fd->name().lower().right(3)==".mm"; + //printf("insideObjC=%d\n",yyextra->insideObjC); + } + else + { + yyextra->insideObjC = FALSE; + } + if (yyextra->insideBody) + { + yyextra->theVarContext.popScope(); -static bool getLinkInScope(const QCString &c, // scope - const QCString &m, // member - const char *memberText, // exact text - CodeOutputInterface &ol, - const char *text, - bool varOnly=FALSE - ) -{ - const MemberDef *md = 0; - const ClassDef *cd = 0; - const FileDef *fd = 0; - const NamespaceDef *nd = 0; - const GroupDef *gd = 0; - DBG_CTX((stderr,"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",c.data(),m.data(),varOnly)); - if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,g_sourceFileDef,FALSE,g_forceTagReference) && - (!varOnly || md->isVariable())) - { - if (md->isLinkable()) - { - //printf("found it %s!\n",md->qualifiedName().data()); - if (g_exampleBlock) - { - QCString anchor; - anchor.sprintf("a%d",g_anchorCount); - //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),g_exampleName.data(), - // g_exampleFile.data()); - if (const_cast(md)->addExample(anchor,g_exampleName,g_exampleFile)) - { - ol.writeCodeAnchor(anchor); - g_anchorCount++; - } - } + int *scope = yyextra->scopeStack.pop(); + DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK)); + if (scope==SCOPEBLOCK || scope==CLASSBLOCK) + { + popScope(yyscanner); + } + yyextra->insideBody=FALSE; + } - const Definition *d = md->getOuterScope()==Doxygen::globalScope ? - md->resolveAlias()->getFileDef() : md->getOuterScope(); - if (md->resolveAlias()->getGroupDef()) d = md->resolveAlias()->getGroupDef(); - if (d && d->isLinkable()) - { - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - //printf("g_currentDefinition=%p g_currentMemberDef=%p g_insideBody=%d\n", - // g_currentDefinition,g_currentMemberDef,g_insideBody); + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); - if (g_currentDefinition && g_currentMemberDef && - md!=g_currentMemberDef && g_insideBody && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,const_cast(md)); - } - //printf("d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data()); - - writeMultiLineCodeLink(ol,md, text ? text : memberText); - addToSearchIndex(text ? text : memberText); - return TRUE; - } - } - else // found member, but it is not linkable, so make sure content inside is not assigned - // to the previous member, see bug762760 - { - DBG_CTX((stderr,"unlinkable member %s\n",md->name().data())); - g_currentMemberDef = 0; - } - } - return FALSE; -} - -static bool getLink(const char *className, - const char *memberName, - CodeOutputInterface &ol, - const char *text=0, - bool varOnly=FALSE) -{ - //printf("getLink(%s,%s) g_curClassName=%s\n",className,memberName,g_curClassName.data()); - QCString m=removeRedundantWhiteSpace(memberName); - QCString c=className; - if (!getLinkInScope(c,m,memberName,ol,text,varOnly)) - { - if (!g_curClassName.isEmpty()) - { - if (!c.isEmpty()) c.prepend("::"); - c.prepend(g_curClassName); - return getLinkInScope(c,m,memberName,ol,text,varOnly); - } - return FALSE; - } - return TRUE; -} - -static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName, - bool typeOnly=FALSE,bool varOnly=FALSE) -{ - int i=0; - if (*clName=='~') // correct for matching negated values i.s.o. destructors. - { - g_code->codify("~"); - clName++; - } - QCString className=clName; - if (className.isEmpty()) return; - if (g_insideProtocolList) // for Obj-C - { - className+="-p"; - } - if (g_lang==SrcLangExt_PHP) - { - className = substitute(className,"\\","::"); // for PHP namespaces - } - else if (g_lang==SrcLangExt_CSharp || g_lang==SrcLangExt_Java) - { - className = substitute(className,".","::"); // for PHP namespaces - } - const ClassDef *cd=0,*lcd=0; - const MemberDef *md=0; - bool isLocal=FALSE; - - //printf("generateClassOrGlobalLink(className=%s)\n",className.data()); - if (!g_prefixed_with_this_keyword || (lcd=g_theVarContext.findVariable(className))==0) // not a local variable - { - Definition *d = g_currentDefinition; - //printf("d=%s g_sourceFileDef=%s\n",d?d->name().data():"",g_sourceFileDef?g_sourceFileDef->name().data():""); - cd = getResolvedClass(d,g_sourceFileDef,className,&md); - DBG_CTX((stderr,"non-local variable name=%s context=%d cd=%s md=%s!\n", - className.data(),g_theVarContext.count(),cd?cd->name().data():"", - md?md->name().data():"")); - if (cd==0 && md==0 && (i=className.find('<'))!=-1) - { - QCString bareName = className.left(i); //stripTemplateSpecifiersFromScope(className); - DBG_CTX((stderr,"bareName=%s\n",bareName.data())); - if (bareName!=className) - { - cd=getResolvedClass(d,g_sourceFileDef,bareName,&md); // try unspecialized version - } - } - const NamespaceDef *nd = getResolvedNamespace(className); - if (nd && nd->isLinkable()) - { - g_theCallContext.setScope(nd); - addToSearchIndex(className); - writeMultiLineCodeLink(*g_code,nd,clName); - return; - } - //printf("md=%s\n",md?md->name().data():""); - DBG_CTX((stderr,"is found as a type cd=%s nd=%s\n", - cd?cd->name().data():"", - nd?nd->name().data():"")); - if (cd==0 && md==0) // also see if it is variable or enum or enum value - { - if (getLink(g_classScope,clName,ol,clName,varOnly)) - { - return; - } - } - } - else - { - //printf("local variable!\n"); - if (lcd!=VariableContext::dummyContext) - { - //printf("non-dummy context lcd=%s!\n",lcd->name().data()); - g_theCallContext.setScope(lcd); - - // to following is needed for links to a global variable, but is - // no good for a link to a local variable that is also a global symbol. - - //if (getLink(g_classScope,clName,ol,clName)) - //{ - //return; - //} - } - isLocal=TRUE; - DBG_CTX((stderr,"is a local variable cd=%p!\n",cd)); - } - g_prefixed_with_this_keyword = FALSE; // discard the "this" prefix for the next calls - - if (cd && cd->isLinkable()) // is it a linkable class - { - DBG_CTX((stderr,"is linkable class %s\n",clName)); - if (g_exampleBlock) - { - QCString anchor; - anchor.sprintf("_a%d",g_anchorCount); - //printf("addExampleClass(%s,%s,%s)\n",anchor.data(),g_exampleName.data(), - // g_exampleFile.data()); - if (const_cast(cd)->addExample(anchor,g_exampleName,g_exampleFile)) - { - ol.writeCodeAnchor(anchor); - g_anchorCount++; - } - } - writeMultiLineCodeLink(ol,cd,clName); - addToSearchIndex(className); - g_theCallContext.setScope(cd); - if (md) - { - const Definition *d = md->getOuterScope()==Doxygen::globalScope ? - md->getFileDef() : md->getOuterScope(); - if (md->getGroupDef()) d = md->getGroupDef(); - if (d && d->isLinkable() && md->isLinkable() && - g_currentMemberDef && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,const_cast(md)); - } - } - } - else // not a class, maybe a global member - { - DBG_CTX((stderr,"class %s not linkable! cd=%p md=%p typeOnly=%d\n",clName,cd,md,typeOnly)); - if (!isLocal && (md!=0 || (cd==0 && !typeOnly))) // not a class, see if it is a global enum/variable/typedef. - { - if (md==0) // not found as a typedef - { - md = setCallContextForVar(clName); - //printf("setCallContextForVar(%s) md=%p g_currentDefinition=%p\n",clName,md,g_currentDefinition); - if (md && g_currentDefinition) - { - DBG_CTX((stderr,"%s accessible from %s? %d md->getOuterScope=%s\n", - md->name().data(),g_currentDefinition->name().data(), - isAccessibleFrom(g_currentDefinition,g_sourceFileDef,md), - md->getOuterScope()->name().data())); - } - - if (md && g_currentDefinition && - isAccessibleFrom(g_currentDefinition,g_sourceFileDef,md)==-1) - { - md=0; // variable not accessible - } - } - if (md && (!varOnly || md->isVariable())) - { - DBG_CTX((stderr,"is a global md=%p g_currentDefinition=%s linkable=%d\n",md,g_currentDefinition?g_currentDefinition->name().data():"",md->isLinkable())); - if (md->isLinkable()) - { - QCString text; - if (!g_forceTagReference.isEmpty()) // explicit reference to symbol in tag file - { - text=g_forceTagReference; - if (text.right(4)==".tag") // strip .tag if present - { - text=text.left(text.length()-4); - } - text+=getLanguageSpecificSeparator(md->getLanguage()); - text+=clName; - const_cast(md)->setName(text); - const_cast(md)->setLocalName(text); - } - else // normal reference - { - text=clName; - } - writeMultiLineCodeLink(ol,md,text); - addToSearchIndex(clName); - if (g_currentMemberDef && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,const_cast(md)); - } - return; - } - } - } - - // nothing found, just write out the word - DBG_CTX((stderr,"not found!\n")); - codifyLines(clName); - addToSearchIndex(clName); - } -} - -static bool generateClassMemberLink(CodeOutputInterface &ol,MemberDef *xmd,const char *memName) -{ - // extract class definition of the return type in order to resolve - // a->b()->c() like call chains - - //printf("type='%s' args='%s' class=%s\n", - // xmd->typeString(),xmd->argsString(), - // xmd->getClassDef()->name().data()); - - if (g_exampleBlock) - { - QCString anchor; - anchor.sprintf("a%d",g_anchorCount); - //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),g_exampleName.data(), - // g_exampleFile.data()); - if (xmd->addExample(anchor,g_exampleName,g_exampleFile)) - { - ol.writeCodeAnchor(anchor); - g_anchorCount++; - } - } - - const ClassDef *typeClass = stripClassName(removeAnonymousScopes(xmd->typeString()),xmd->getOuterScope()); - DBG_CTX((stderr,"%s -> typeName=%p\n",xmd->typeString(),typeClass)); - g_theCallContext.setScope(typeClass); - - const Definition *xd = xmd->getOuterScope()==Doxygen::globalScope ? - xmd->getFileDef() : xmd->getOuterScope(); - if (xmd->getGroupDef()) xd = xmd->getGroupDef(); - if (xd && xd->isLinkable()) - { - - //printf("g_currentDefinition=%p g_currentMemberDef=%p xmd=%p g_insideBody=%d\n",g_currentDefinition,g_currentMemberDef,xmd,g_insideBody); - - if (xmd->templateMaster()) xmd = xmd->templateMaster(); - - if (xmd->isLinkable()) - { - // add usage reference - if (g_currentDefinition && g_currentMemberDef && - /*xmd!=g_currentMemberDef &&*/ g_insideBody && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,xmd); - } - - // write the actual link - writeMultiLineCodeLink(ol,xmd,memName); - addToSearchIndex(memName); - return TRUE; - } - } - - return FALSE; -} - -static bool generateClassMemberLink(CodeOutputInterface &ol,const Definition *def,const char *memName) -{ - if (def && def->definitionType()==Definition::TypeClass) - { - const ClassDef *cd = dynamic_cast(def); - MemberDef *xmd = cd->getMemberByName(memName); - //printf("generateClassMemberLink(class=%s,member=%s)=%p\n",def->name().data(),memName,xmd); - if (xmd) - { - return generateClassMemberLink(ol,xmd,memName); - } - else - { - Definition *innerDef = cd->findInnerCompound(memName); - if (innerDef) - { - g_theCallContext.setScope(innerDef); - addToSearchIndex(memName); - writeMultiLineCodeLink(*g_code,innerDef,memName); - return TRUE; - } - } - } - else if (def && def->definitionType()==Definition::TypeNamespace) - { - const NamespaceDef *nd = dynamic_cast(def); - //printf("Looking for %s inside namespace %s\n",memName,nd->name().data()); - Definition *innerDef = nd->findInnerCompound(memName); - if (innerDef) - { - g_theCallContext.setScope(innerDef); - addToSearchIndex(memName); - writeMultiLineCodeLink(*g_code,innerDef,memName); - return TRUE; - } - } - return FALSE; -} - -static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName, - char *memName) -{ - //printf("generateMemberLink(object=%s,mem=%s) classScope=%s\n", - // varName.data(),memName,g_classScope.data()); - - if (varName.isEmpty()) return; - - // look for the variable in the current context - const ClassDef *vcd = g_theVarContext.findVariable(varName); - if (vcd) - { - if (vcd!=VariableContext::dummyContext) - { - //printf("Class found!\n"); - if (getLink(vcd->name(),memName,ol)) - { - //printf("Found result!\n"); - return; - } - if (vcd->baseClasses()) - { - BaseClassListIterator bcli(*vcd->baseClasses()); - for ( ; bcli.current() ; ++bcli) - { - if (getLink(bcli.current()->classDef->name(),memName,ol)) - { - //printf("Found result!\n"); - return; - } - } - } - } - } - else // variable not in current context, maybe it is in a parent context - { - vcd = getResolvedClass(g_currentDefinition,g_sourceFileDef,g_classScope); - if (vcd && vcd->isLinkable()) - { - //printf("Found class %s for variable '%s'\n",g_classScope.data(),varName.data()); - MemberName *vmn=Doxygen::memberNameSDict->find(varName); - if (vmn==0) - { - int vi; - QCString vn=varName; - if ((vi=vn.findRev("::"))!=-1 || (vi=vn.findRev('.'))!=-1) // explicit scope A::b(), probably static member - { - ClassDef *jcd = getClass(vn.left(vi)); - vn=vn.right(vn.length()-vi-2); - vmn=Doxygen::memberNameSDict->find(vn); - //printf("Trying name '%s' scope=%s\n",vn.data(),scope.data()); - if (vmn) - { - MemberNameIterator vmni(*vmn); - const MemberDef *vmd; - for (;(vmd=vmni.current());++vmni) - { - if (/*(vmd->isVariable() || vmd->isFunction()) && */ - vmd->getClassDef()==jcd) - { - //printf("Found variable type=%s\n",vmd->typeString()); - const ClassDef *mcd=stripClassName(vmd->typeString(),vmd->getOuterScope()); - if (mcd && mcd->isLinkable()) - { - if (generateClassMemberLink(ol,mcd,memName)) return; - } - } - } - } - } - } - if (vmn) - { - //printf("There is a variable with name '%s'\n",varName); - MemberNameIterator vmni(*vmn); - const MemberDef *vmd; - for (;(vmd=vmni.current());++vmni) - { - if (/*(vmd->isVariable() || vmd->isFunction()) && */ - vmd->getClassDef()==vcd) - { - //printf("Found variable type=%s\n",vmd->typeString()); - const ClassDef *mcd=stripClassName(vmd->typeString(),vmd->getOuterScope()); - if (mcd && mcd->isLinkable()) - { - if (generateClassMemberLink(ol,mcd,memName)) return; - } - } - } - } - } - } - // nothing found -> write result as is - codifyLines(memName); - addToSearchIndex(memName); - return; -} - -static void generatePHPVariableLink(CodeOutputInterface &ol,const char *varName) -{ - QCString name = varName+7; // strip $this-> - name.prepend("$"); - //printf("generatePHPVariableLink(%s) name=%s scope=%s\n",varName,name.data(),g_classScope.data()); - if (!getLink(g_classScope,name,ol,varName)) - { - codifyLines(varName); - } -} - -static void generateFunctionLink(CodeOutputInterface &ol,const char *funcName) -{ - //CodeClassDef *ccd=0; - ClassDef *ccd=0; - QCString locScope=g_classScope; - QCString locFunc=removeRedundantWhiteSpace(funcName); - if (g_lang==SrcLangExt_PHP && locFunc.startsWith("self::")) locFunc=locFunc.mid(4); - QCString funcScope; - QCString funcWithScope=locFunc; - QCString funcWithFullScope=locFunc; - QCString fullScope=locScope; - DBG_CTX((stdout,"*** locScope=%s locFunc=%s\n",locScope.data(),locFunc.data())); - int len=2; - int i=locFunc.findRev("::"); - if (g_currentMemberDef && g_currentMemberDef->resolveAlias()->getClassDef() && - funcName==g_currentMemberDef->localName() && - g_currentMemberDef->getDefLine()==g_yyLineNr && - generateClassMemberLink(ol,g_currentMemberDef,funcName) - ) - { - // special case where funcName is the name of a method that is also - // defined on this line. In this case we can directly link to - // g_currentMemberDef, which is not only faster, but - // in case of overloaded methods, this will make sure that we link to - // the correct method, and thereby get the correct reimplemented relations. - // See also bug 549022. - goto exit; - } - if (i==-1) i=locFunc.findRev("."),len=1; - if (i==-1) i=locFunc.findRev("\\"),len=1; // for PHP - if (i>0) - { - funcScope=locFunc.left(i); - locFunc=locFunc.right(locFunc.length()-i-len).stripWhiteSpace(); - int ts=locScope.find('<'); // start of template - int te=locScope.findRev('>'); // end of template - //printf("ts=%d te=%d\n",ts,te); - if (ts!=-1 && te!=-1 && te>ts) - { - // remove template from scope - locScope=locScope.left(ts)+locScope.right(locScope.length()-te-1); - } - ts=funcScope.find('<'); // start of template - te=funcScope.findRev('>'); // end of template - //printf("ts=%d te=%d\n",ts,te); - if (ts!=-1 && te!=-1 && te>ts) - { - // remove template from scope - funcScope=funcScope.left(ts)+funcScope.right(funcScope.length()-te-1); - } - if (!funcScope.isEmpty()) - { - funcWithScope = funcScope+"::"+locFunc; - if (!locScope.isEmpty()) - { - fullScope=locScope+"::"+funcScope; - } - } - if (!locScope.isEmpty()) - { - funcWithFullScope = locScope+"::"+funcWithScope; - } - } - if (!fullScope.isEmpty() && (ccd=g_codeClassSDict->find(fullScope))) - { - //printf("using classScope %s\n",g_classScope.data()); - if (ccd->baseClasses()) - { - BaseClassListIterator bcli(*ccd->baseClasses()); - for ( ; bcli.current() ; ++bcli) - { - if (getLink(bcli.current()->classDef->name(),locFunc,ol,funcName)) - { - goto exit; - } - } - } - } - if (!locScope.isEmpty() && fullScope!=locScope && (ccd=g_codeClassSDict->find(locScope))) - { - //printf("using classScope %s\n",g_classScope.data()); - if (ccd->baseClasses()) - { - BaseClassListIterator bcli(*ccd->baseClasses()); - for ( ; bcli.current() ; ++bcli) - { - if (getLink(bcli.current()->classDef->name(),funcWithScope,ol,funcName)) - { - goto exit; - } - } - } - } - if (!getLink(locScope,funcWithScope,ol,funcName)) - { - generateClassOrGlobalLink(ol,funcName); - } -exit: - g_forceTagReference.resize(0); - return; -} - -/*! counts the number of lines in the input */ -static int countLines() -{ - const char *p=g_inputString; - char c; - int count=1; - while ((c=*p)) - { - p++ ; - if (c=='\n') count++; - } - if (p>g_inputString && *(p-1)!='\n') - { // last line does not end with a \n, so we add an extra - // line and explicitly terminate the line after parsing. - count++, - g_needsTermination=TRUE; - } - return count; -} - -static void endFontClass() -{ - if (g_currentFontClass) - { - g_code->endFontClass(); - g_currentFontClass=0; - } -} - -static void startFontClass(const char *s) -{ - endFontClass(); - g_code->startFontClass(s); - g_currentFontClass=s; -} - -//---------------------------------------------------------------------------- - -// recursively writes a linkified Objective-C method call -static void writeObjCMethodCall(ObjCCallCtx *ctx) -{ - if (ctx==0) return; - char c; - const char *p = ctx->format.data(); - if (!ctx->methodName.isEmpty()) - { - //printf("writeObjCMethodCall(%s) obj=%s method=%s\n", - // ctx->format.data(),ctx->objectTypeOrName.data(),ctx->methodName.data()); - if (!ctx->objectTypeOrName.isEmpty() && ctx->objectTypeOrName.at(0)!='$') - { - //printf("Looking for object=%s method=%s\n",ctx->objectTypeOrName.data(), - // ctx->methodName.data()); - ClassDef *cd = g_theVarContext.findVariable(ctx->objectTypeOrName); - if (cd==0) // not a local variable - { - if (ctx->objectTypeOrName=="self") - { - if (g_currentDefinition && - g_currentDefinition->definitionType()==Definition::TypeClass) - { - ctx->objectType = dynamic_cast(g_currentDefinition); - } - } - else - { - ctx->objectType = getResolvedClass( - g_currentDefinition, - g_sourceFileDef, - ctx->objectTypeOrName, - &ctx->method); - } - //printf(" object is class? %p\n",ctx->objectType); - if (ctx->objectType) // found class - { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - //printf(" yes->method=%s\n",ctx->method?ctx->method->name().data():""); - } - else if (ctx->method==0) // search for class variable with the same name - { - //printf(" no\n"); - //printf("g_currentDefinition=%p\n",g_currentDefinition); - if (g_currentDefinition && - g_currentDefinition->definitionType()==Definition::TypeClass) - { - ctx->objectVar = (dynamic_cast(g_currentDefinition))->getMemberByName(ctx->objectTypeOrName); - //printf(" ctx->objectVar=%p\n",ctx->objectVar); - if (ctx->objectVar) - { - ctx->objectType = stripClassName(ctx->objectVar->typeString()); - //printf(" ctx->objectType=%p\n",ctx->objectType); - if (ctx->objectType && !ctx->methodName.isEmpty()) - { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - //printf(" ctx->method=%p\n",ctx->method); - } - } - } - } - } - else // local variable - { - //printf(" object is local variable\n"); - if (cd!=VariableContext::dummyContext && !ctx->methodName.isEmpty()) - { - ctx->method = cd->getMemberByName(ctx->methodName); - //printf(" class=%p method=%p\n",cd,ctx->method); - } - } - } - } - - //printf("["); - while ((c=*p++)) // for each character in ctx->format - { - if (c=='$') - { - char nc=*p++; - if (nc=='$') // escaped $ - { - g_code->codify("$"); - } - else // name fragment or reference to a nested call - { - if (nc=='n') // name fragment - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - QCString *pName = g_nameDict.find(refId); - if (pName) - { - if (ctx->method && ctx->method->isLinkable()) - { - writeMultiLineCodeLink(*g_code,ctx->method,pName->data()); - if (g_currentMemberDef && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,const_cast(ctx->method)); - } - } - else - { - codifyLines(pName->data()); - } - } - else - { - //printf("Invalid name: id=%d\n",refId); - } - } - else if (nc=='o') // reference to potential object name - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - QCString *pObject = g_objectDict.find(refId); - if (pObject) - { - if (*pObject=="self") - { - if (g_currentDefinition && - g_currentDefinition->definitionType()==Definition::TypeClass) - { - ctx->objectType = dynamic_cast(g_currentDefinition); - if (ctx->objectType->categoryOf()) - { - ctx->objectType = ctx->objectType->categoryOf(); - } - if (ctx->objectType && !ctx->methodName.isEmpty()) - { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - } - } - startFontClass("keyword"); - codifyLines(pObject->data()); - endFontClass(); - } - else if (*pObject=="super") - { - if (g_currentDefinition && - g_currentDefinition->definitionType()==Definition::TypeClass) - { - ClassDef *cd = dynamic_cast(g_currentDefinition); - if (cd->categoryOf()) - { - cd = cd->categoryOf(); - } - BaseClassList *bcd = cd->baseClasses(); - if (bcd) // get direct base class (there should be only one) - { - BaseClassListIterator bli(*bcd); - BaseClassDef *bclass; - for (bli.toFirst();(bclass=bli.current());++bli) - { - if (bclass->classDef->compoundType()!=ClassDef::Protocol) - { - ctx->objectType = bclass->classDef; - if (ctx->objectType && !ctx->methodName.isEmpty()) - { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - } - } - } - } - } - startFontClass("keyword"); - codifyLines(pObject->data()); - endFontClass(); - } - else if (ctx->objectVar && ctx->objectVar->isLinkable()) // object is class variable - { - writeMultiLineCodeLink(*g_code,ctx->objectVar,pObject->data()); - if (g_currentMemberDef && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,const_cast(ctx->objectVar)); - } - } - else if (ctx->objectType && - ctx->objectType!=VariableContext::dummyContext && - ctx->objectType->isLinkable() - ) // object is class name - { - const ClassDef *cd = ctx->objectType; - writeMultiLineCodeLink(*g_code,cd,pObject->data()); - } - else // object still needs to be resolved - { - const ClassDef *cd = getResolvedClass(g_currentDefinition, - g_sourceFileDef, *pObject); - if (cd && cd->isLinkable()) - { - if (ctx->objectType==0) ctx->objectType=cd; - writeMultiLineCodeLink(*g_code,cd,pObject->data()); - } - else - { - codifyLines(pObject->data()); - } - } - } - else - { - //printf("Invalid object: id=%d\n",refId); - } - } - else if (nc=='c') // reference to nested call - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - ObjCCallCtx *ictx = g_contextDict.find(refId); - if (ictx) // recurse into nested call - { - writeObjCMethodCall(ictx); - if (ictx->method) // link to nested call successfully - { - // get the ClassDef representing the method's return type - if (QCString(ictx->method->typeString())=="id") - { - // see if the method name is unique, if so we link to it - MemberName *mn=Doxygen::memberNameSDict->find(ctx->methodName); - //printf("mn->count=%d ictx->method=%s ctx->methodName=%s\n", - // mn==0?-1:(int)mn->count(), - // ictx->method->name().data(), - // ctx->methodName.data()); - if (mn && mn->count()==1) // member name unique - { - ctx->method = mn->getFirst(); - } - } - else - { - ctx->objectType = stripClassName(ictx->method->typeString()); - if (ctx->objectType && !ctx->methodName.isEmpty()) - { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - } - } - //printf(" ***** method=%s -> object=%p\n",ictx->method->name().data(),ctx->objectType); - } - } - else - { - //printf("Invalid context: id=%d\n",refId); - } - } - else if (nc=='w') // some word - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - QCString *pWord = g_wordDict.find(refId); - if (pWord) - { - codifyLines(pWord->data()); - } - } - else if (nc=='d') // comment block - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - QCString *pComment = g_commentDict.find(refId); - if (pComment) - { - startFontClass("comment"); - codifyLines(pComment->data()); - endFontClass(); - } - } - else // illegal marker - { - ASSERT(!"invalid escape sequence"); - } - } - } - else // normal non-marker character - { - char s[2]; - s[0]=c;s[1]=0; - codifyLines(s); - } - } - //printf("%s %s]\n",ctx->objectTypeOrName.data(),ctx->methodName.data()); - //printf("}=(type='%s',name='%s')", - // ctx->objectTypeOrName.data(), - // ctx->methodName.data()); -} - -// Replaces an Objective-C method name fragment s by a marker of the form -// $n12, the number (12) can later be used as a key for obtaining the name -// fragment, from g_nameDict -static QCString escapeName(const char *s) -{ - QCString result; - result.sprintf("$n%d",g_currentNameId); - g_nameDict.insert(g_currentNameId,new QCString(s)); - g_currentNameId++; - return result; -} - -static QCString escapeObject(const char *s) -{ - QCString result; - result.sprintf("$o%d",g_currentObjId); - g_objectDict.insert(g_currentObjId,new QCString(s)); - g_currentObjId++; - return result; -} - -static QCString escapeWord(const char *s) -{ - QCString result; - result.sprintf("$w%d",g_currentWordId); - g_wordDict.insert(g_currentWordId,new QCString(s)); - g_currentWordId++; - return result; -} - -static QCString escapeComment(const char *s) -{ - QCString result; - result.sprintf("$d%d",g_currentCommentId); - g_commentDict.insert(g_currentCommentId,new QCString(s)); - g_currentCommentId++; - return result; -} - -static bool skipLanguageSpecificKeyword(const QCString &kw) -{ - return g_lang==SrcLangExt_Cpp && (kw == "remove" || kw == "set" || kw == "get"); -} - -static bool isCastKeyword(const QCString &s) -{ - int i=s.find('<'); - if (i==-1) return FALSE; - QCString kw = s.left(i).stripWhiteSpace(); - return kw=="const_cast" || kw=="static_cast" || kw=="dynamic_cast" || kw=="reinterpret_cast"; -} - -/* ----------------------------------------------------------------- - */ -#undef YY_INPUT -#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); - -static int yyread(char *buf,int max_size) -{ - int c=0; - while( c < max_size && g_inputString[g_inputPosition] ) - { - *buf = g_inputString[g_inputPosition++] ; - c++; buf++; - } - return c; -} - -%} - -B [ \t] -BN [ \t\n\r] -ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]* -SEP ("::"|"\\") -SCOPENAME ({SEP}{BN}*)?({ID}{BN}*{SEP}{BN}*)*("~"{BN}*)?{ID} -TEMPLIST "<"[^\"\}\{\(\)\/\n\>]*">" -SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID}) -SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+ -KEYWORD_OBJC ("@public"|"@private"|"@protected"|"@class"|"@implementation"|"@interface"|"@end"|"@selector"|"@protocol"|"@optional"|"@required"|"@throw"|"@synthesize"|"@property") -KEYWORD ("asm"|"__assume"|"auto"|"class"|"const"|"delete"|"enum"|"explicit"|"extern"|"false"|"friend"|"gcnew"|"gcroot"|"set"|"get"|"inline"|"internal"|"mutable"|"namespace"|"new"|"null"|"nullptr"|"override"|"operator"|"pin_ptr"|"private"|"protected"|"public"|"raise"|"register"|"remove"|"self"|"sizeof"|"static"|"struct"|"__super"|"function"|"template"|"generic"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile"|"abstract"|"final"|"import"|"synchronized"|"transient"|"alignas"|"alignof"|{KEYWORD_OBJC}) -FLOWKW ("break"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"return"|"switch"|"throw"|"throws"|"@catch"|"@finally") -FLOWCONDITION ("case"|"for"|"foreach"|"for each"|"goto"|"if"|"try"|"while"|"@try") -TYPEKW ("bool"|"byte"|"char"|"double"|"float"|"int"|"long"|"object"|"short"|"signed"|"unsigned"|"void"|"wchar_t"|"size_t"|"boolean"|"id"|"SEL"|"string"|"nullptr") -TYPEKWSL ("LocalObject"|"Object"|"Value") -CASTKW ("const_cast"|"dynamic_cast"|"reinterpret_cast"|"static_cast") -CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'")) -ARITHOP "+"|"-"|"/"|"*"|"%"|"--"|"++" -ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|=" -LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!" -BITOP "&"|"|"|"^"|"<<"|">>"|"~" -OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} -RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"(" -RAWEND ")"[^ \t\(\)\\]{0,16}\" - -%option noyywrap - -%x SkipString -%x SkipStringS -%x SkipVerbString -%x SkipCPP -%x SkipComment -%x SkipCxxComment -%x RemoveSpecialCComment -%x StripSpecialCComment -%x Body -%x FuncCall -%x MemberCall -%x MemberCall2 -%x SkipInits -%x ClassName -%x AlignAs -%x AlignAsEnd -%x PackageName -%x ClassVar -%x CppCliTypeModifierFollowup -%x Bases -%x SkipSharp -%x ReadInclude -%x TemplDecl -%x TemplCast -%x CallEnd -%x ObjCMethod -%x ObjCParams -%x ObjCParamType -%x ObjCCall -%x ObjCMName -%x ObjCSkipStr -%x ObjCCallComment -%x OldStyleArgs -%x UsingName -%x RawString -%x InlineInit - -%% - -<*>\x0d -^([ \t]*"#"[ \t]*("include"|"import")[ \t]*)("<"|"\"") { - startFontClass("preprocessor"); - g_code->codify(yytext); - BEGIN( ReadInclude ); - } -("@interface"|"@implementation"|"@protocol")[ \t\n]+ { - g_insideObjC=TRUE; - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - if (!g_insideTemplate) - BEGIN( ClassName ); - } -(("public"|"private"){B}+)?("ref"|"value"|"interface"|"enum"){B}+("class"|"struct") { - if (g_insideTemplate) REJECT; - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - BEGIN( ClassName ); - } -"property"|"event"/{BN}* { - if (g_insideTemplate) REJECT; - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - } -(KEYWORD_CPPCLI_DATATYPE|("partial"{B}+)?"class"|"struct"|"union"|"namespace"|"interface"){B}+ { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - if (!g_insideTemplate) - BEGIN( ClassName ); - } -("package")[ \t\n]+ { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - BEGIN( PackageName ); - } -\n { - if (!g_insideObjC) REJECT; - codifyLines(yytext); - BEGIN(Body); - } -"-"|"+" { - if (!g_insideObjC || g_insideBody) - { - g_code->codify(yytext); - } - else // Start of Objective-C method - { - //printf("Method!\n"); - g_code->codify(yytext); - BEGIN(ObjCMethod); - } - } -":" { - g_code->codify(yytext); - BEGIN(ObjCParams); - } -"(" { - g_code->codify(yytext); - BEGIN(ObjCParamType); - } -";"|"{" { - g_code->codify(yytext); - if (*yytext=='{') - { - if (g_searchingForBody) - { - g_searchingForBody=FALSE; - g_insideBody=TRUE; - } - if (g_insideBody) g_bodyCurlyCount++; - if (!g_curClassName.isEmpty()) // valid class name - { - pushScope(g_curClassName); - DBG_CTX((stderr,"** scope stack push SCOPEBLOCK\n")); - g_scopeStack.push(SCOPEBLOCK); - } - } - g_type.resize(0); - g_name.resize(0); - BEGIN(Body); - } -{ID}{B}*":" { - g_code->codify(yytext); - } -{TYPEKW} { - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); - g_parmType=yytext; - } -{ID} { - generateClassOrGlobalLink(*g_code,yytext); - g_parmType=yytext; - } -")" { - g_code->codify(yytext); - BEGIN(ObjCParams); - } -{ID} { - g_code->codify(yytext); - g_parmName=yytext; - g_theVarContext.addVariable(g_parmType,g_parmName); - g_parmType.resize(0);g_parmName.resize(0); - } -{ID} { - generateClassOrGlobalLink(*g_code,yytext); - } -. { - g_code->codify(yytext); - } -\n { - codifyLines(yytext); - } -[^\n\"\>]+/(">"|"\"") { - //FileInfo *f; - bool ambig; - bool found=FALSE; - //QCString absPath = yytext; - //if (g_sourceFileDef && QDir::isRelativePath(absPath)) - //{ - // absPath = QDir::cleanDirPath(g_sourceFileDef->getPath()+"/"+absPath); - //} - - FileDef *fd=findFileDef(Doxygen::inputNameDict,yytext,ambig); - //printf("looking for include %s -> %s fd=%p\n",yytext,absPath.data(),fd); - if (fd && fd->isLinkable()) - { - if (ambig) // multiple input files match the name - { - //printf("===== yes %s is ambiguous\n",yytext); - QCString name = QDir::cleanDirPath(yytext).utf8(); - if (!name.isEmpty() && g_sourceFileDef) - { - FileName *fn = Doxygen::inputNameDict->find(name); - if (fn) - { - FileNameIterator fni(*fn); - // for each include name - for (fni.toFirst();!found && (fd=fni.current());++fni) - { - // see if this source file actually includes the file - found = g_sourceFileDef->isIncluded(fd->absFilePath()); - //printf(" include file %s found=%d\n",fd->absFilePath().data(),found); - } - } - } - } - else // not ambiguous - { - found = TRUE; - } - } - //printf(" include file %s found=%d\n",fd ? fd->absFilePath().data() : "",found); - if (found) - { - writeMultiLineCodeLink(*g_code,fd,yytext); - } - else - { - g_code->codify(yytext); - } - char c=yyinput(); - QCString text; - text+=c; - g_code->codify(text); - endFontClass(); - BEGIN( Body ); - } -^[ \t]*"#" { - startFontClass("preprocessor"); - g_lastSkipCppContext = YY_START; - g_code->codify(yytext); - BEGIN( SkipCPP ) ; - } -. { - g_code->codify(yytext); - } -[^\n\/\\]+ { - g_code->codify(yytext); - } -\\[\r]?\n { - codifyLines(yytext); - } -"//" { - g_code->codify(yytext); - } -"{" { - g_theVarContext.pushScope(); - - DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); - g_scopeStack.push(INNERBLOCK); - - if (g_searchingForBody) - { - g_searchingForBody=FALSE; - g_insideBody=TRUE; - } - g_code->codify(yytext); - if (g_insideBody) - { - g_bodyCurlyCount++; - } - g_type.resize(0); - g_name.resize(0); - BEGIN( Body ); - } -"}" { - g_theVarContext.popScope(); - g_type.resize(0); - g_name.resize(0); - - int *scope = g_scopeStack.pop(); - DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK)); - if (scope==SCOPEBLOCK || scope==CLASSBLOCK) - { - popScope(); - } - - g_code->codify(yytext); - - DBG_CTX((stderr,"g_bodyCurlyCount=%d\n",g_bodyCurlyCount)); - if (--g_bodyCurlyCount<=0) - { - g_insideBody=FALSE; - g_currentMemberDef=0; - if (g_currentDefinition) - g_currentDefinition=g_currentDefinition->getOuterScope(); - } - BEGIN(Body); - } -"@end" { - //printf("End of objc scope fd=%s\n",g_sourceFileDef->name().data()); - if (g_sourceFileDef) - { - FileDef *fd=g_sourceFileDef; - g_insideObjC = fd->name().lower().right(2)==".m" || - fd->name().lower().right(3)==".mm"; - //printf("insideObjC=%d\n",g_insideObjC); - } - else - { - g_insideObjC = FALSE; - } - if (g_insideBody) - { - g_theVarContext.popScope(); - - int *scope = g_scopeStack.pop(); - DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK)); - if (scope==SCOPEBLOCK || scope==CLASSBLOCK) - { - popScope(); - } - g_insideBody=FALSE; - } - - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - - g_currentMemberDef=0; - if (g_currentDefinition) - g_currentDefinition=g_currentDefinition->getOuterScope(); - BEGIN(Body); - } -";" { - g_code->codify(yytext); - g_searchingForBody=FALSE; - BEGIN( Body ); - } -[*&^%]+ { - g_type=g_curClassName.copy(); - g_name.resize(0); - g_code->codify(yytext); - BEGIN( Body ); // variable of type struct * - } -"__declspec"{B}*"("{B}*{ID}{B}*")" { - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - } -{ID}("."{ID})* | -{ID}("::"{ID})* { - if (g_lang==SrcLangExt_CSharp) - g_curClassName=substitute(yytext,".","::"); - else - g_curClassName=yytext; - addType(); - if (g_curClassName=="alignas") - { - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - BEGIN( AlignAs ); - } - else - { - generateClassOrGlobalLink(*g_code,yytext); - BEGIN( ClassVar ); - } - } -"(" { - g_bracketCount=1; - g_code->codify(yytext); - BEGIN( AlignAsEnd ); - } -\n { g_yyLineNr++; - codifyLines(yytext); - } -. { g_code->codify(yytext); } -"(" { g_code->codify(yytext); - g_bracketCount++; - } -")" { - g_code->codify(yytext); - if (--g_bracketCount<=0) - { - BEGIN(ClassName); - } - } -\n { g_yyLineNr++; - codifyLines(yytext); - } -. { g_code->codify(yytext); } -{ID}("\\"{ID})* { // PHP namespace - g_curClassName=substitute(yytext,"\\","::"); - g_scopeStack.push(CLASSBLOCK); - pushScope(g_curClassName); - addType(); - generateClassOrGlobalLink(*g_code,yytext); - BEGIN( ClassVar ); - } -{ID}{B}*"("{ID}")" { // Obj-C category - g_curClassName=removeRedundantWhiteSpace(yytext); - g_scopeStack.push(CLASSBLOCK); - pushScope(g_curClassName); - addType(); - generateClassOrGlobalLink(*g_code,yytext); - BEGIN( ClassVar ); - } -{ID}("."{ID})* { - g_curClassName=substitute(yytext,".","::"); - //printf("found package: %s\n",g_curClassName.data()); - addType(); - codifyLines(yytext); - } -"=" { - unput(*yytext); - BEGIN( Body ); - } -("extends"|"implements") { // Java, Slice - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - g_curClassBases.clear(); - BEGIN( Bases ); - } -("sealed"|"abstract")/{BN}*(":"|"{") { - DBG_CTX((stderr,"***** C++/CLI modifier %s on g_curClassName=%s\n",yytext,g_curClassName.data())); - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - BEGIN( CppCliTypeModifierFollowup ); - } -{ID} { - g_type = g_curClassName.copy(); - g_name = yytext; - if (g_insideBody) - { - g_theVarContext.addVariable(g_type,g_name); - } - generateClassOrGlobalLink(*g_code,yytext); - } -{B}*":"{B}* { - codifyLines(yytext); - g_curClassBases.clear(); - BEGIN( Bases ); - } -[ \t]*";" | -^{B}*/"@"{ID} | // Objective-C interface -{B}*"{"{B}* { - g_theVarContext.pushScope(); - g_code->codify(yytext); - if (YY_START==ClassVar && g_curClassName.isEmpty()) - { - g_curClassName = g_name.copy(); - } - if (g_searchingForBody) - { - g_searchingForBody=FALSE; - g_insideBody=TRUE; - } - if (g_insideBody) g_bodyCurlyCount++; - if (!g_curClassName.isEmpty()) // valid class name - { - DBG_CTX((stderr,"** scope stack push CLASSBLOCK\n")); - g_scopeStack.push(CLASSBLOCK); - pushScope(g_curClassName); - DBG_CTX((stderr,"***** g_curClassName=%s\n",g_curClassName.data())); - if (getResolvedClass(g_currentDefinition,g_sourceFileDef,g_curClassName)==0) - { - DBG_CTX((stderr,"Adding new class %s\n",g_curClassName.data())); - ClassDef *ncd=createClassDef("",1,1, - g_curClassName,ClassDef::Class,0,0,FALSE); - g_codeClassSDict->append(g_curClassName,ncd); - // insert base classes. - char *s=g_curClassBases.first(); - while (s) - { - const ClassDef *bcd=g_codeClassSDict->find(s); - if (bcd==0) bcd=getResolvedClass(g_currentDefinition,g_sourceFileDef,s); - if (bcd && bcd!=ncd) - { - ncd->insertBaseClass(const_cast(bcd),s,Public,Normal); - } - s=g_curClassBases.next(); - } - } - //printf("g_codeClassList.count()=%d\n",g_codeClassList.count()); - } - else // not a class name -> assume inner block - { - DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); - g_scopeStack.push(INNERBLOCK); - } - g_curClassName.resize(0); - g_curClassBases.clear(); - BEGIN( Body ); - } -"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" { - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - } -{SEP}?({ID}{SEP})*{ID} { - DBG_CTX((stderr,"%s:addBase(%s)\n",g_curClassName.data(),yytext)); - g_curClassBases.inSort(yytext); - generateClassOrGlobalLink(*g_code,yytext); - } -"<" { - g_code->codify(yytext); - if (!g_insideObjC) - { - g_sharpCount=1; - BEGIN ( SkipSharp ); - } - else - { - g_insideProtocolList=TRUE; - } - } -">" { - g_code->codify(yytext); - g_insideProtocolList=FALSE; - } -"<" { - g_code->codify(yytext); - ++g_sharpCount; - } -">" { - g_code->codify(yytext); - if (--g_sharpCount<=0) - BEGIN ( Bases ); - } -"\"" { - g_code->codify(yytext); - g_lastStringContext=YY_START; - BEGIN(SkipString); - } -"\'" { - g_code->codify(yytext); - g_lastStringContext=YY_START; - BEGIN(SkipStringS); - } -"(" { - g_code->codify(yytext); - g_sharpCount=1; - BEGIN ( SkipSharp ); - } -"(" { - g_code->codify(yytext); - ++g_sharpCount; - } -")" { - g_code->codify(yytext); - if (--g_sharpCount<=0) - BEGIN ( Bases ); - } - - -"," { - g_code->codify(yytext); - } - + yyextra->currentMemberDef=0; + if (yyextra->currentDefinition) + yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope(); + BEGIN(Body); + } +";" { + yyextra->code->codify(yytext); + yyextra->searchingForBody=FALSE; + BEGIN( Body ); + } +[*&^%]+ { + yyextra->type=yyextra->curClassName.copy(); + yyextra->name.resize(0); + yyextra->code->codify(yytext); + BEGIN( Body ); // variable of type struct * + } +"__declspec"{B}*"("{B}*{ID}{B}*")" { + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + } +{ID}("."{ID})* | +{ID}("::"{ID})* { + if (yyextra->lang==SrcLangExt_CSharp) + yyextra->curClassName=substitute(yytext,".","::"); + else + yyextra->curClassName=yytext; + addType(yyscanner); + if (yyextra->curClassName=="alignas") + { + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + BEGIN( AlignAs ); + } + else + { + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + BEGIN( ClassVar ); + } + } +"(" { + yyextra->bracketCount=1; + yyextra->code->codify(yytext); + BEGIN( AlignAsEnd ); + } +\n { yyextra->yyLineNr++; + codifyLines(yyscanner,yytext); + } +. { yyextra->code->codify(yytext); } +"(" { yyextra->code->codify(yytext); + yyextra->bracketCount++; + } +")" { + yyextra->code->codify(yytext); + if (--yyextra->bracketCount<=0) + { + BEGIN(ClassName); + } + } +\n { yyextra->yyLineNr++; + codifyLines(yyscanner,yytext); + } +. { yyextra->code->codify(yytext); } +{ID}("\\"{ID})* { // PHP namespace + yyextra->curClassName=substitute(yytext,"\\","::"); + yyextra->scopeStack.push(CLASSBLOCK); + pushScope(yyscanner,yyextra->curClassName); + addType(yyscanner); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + BEGIN( ClassVar ); + } +{ID}{B}*"("{ID}")" { // Obj-C category + yyextra->curClassName=removeRedundantWhiteSpace(yytext); + yyextra->scopeStack.push(CLASSBLOCK); + pushScope(yyscanner,yyextra->curClassName); + addType(yyscanner); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + BEGIN( ClassVar ); + } +{ID}("."{ID})* { + yyextra->curClassName=substitute(yytext,".","::"); + //printf("found package: %s\n",yyextra->curClassName.data()); + addType(yyscanner); + codifyLines(yyscanner,yytext); + } +"=" { + unput(*yytext); + BEGIN( Body ); + } +("extends"|"implements") { // Java, Slice + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->curClassBases.clear(); + BEGIN( Bases ); + } +("sealed"|"abstract")/{BN}*(":"|"{") { + DBG_CTX((stderr,"***** C++/CLI modifier %s on yyextra->curClassName=%s\n",yytext,yyextra->curClassName.data())); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + BEGIN( CppCliTypeModifierFollowup ); + } +{ID} { + yyextra->type = yyextra->curClassName.copy(); + yyextra->name = yytext; + if (yyextra->insideBody) + { + yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name); + } + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + } +{B}*":"{B}* { + codifyLines(yyscanner,yytext); + yyextra->curClassBases.clear(); + BEGIN( Bases ); + } +[ \t]*";" | +^{B}*/"@"{ID} | // Objective-C interface +{B}*"{"{B}* { + yyextra->theVarContext.pushScope(); + yyextra->code->codify(yytext); + if (YY_START==ClassVar && yyextra->curClassName.isEmpty()) + { + yyextra->curClassName = yyextra->name.copy(); + } + if (yyextra->searchingForBody) + { + yyextra->searchingForBody=FALSE; + yyextra->insideBody=TRUE; + } + if (yyextra->insideBody) yyextra->bodyCurlyCount++; + if (!yyextra->curClassName.isEmpty()) // valid class name + { + DBG_CTX((stderr,"** scope stack push CLASSBLOCK\n")); + yyextra->scopeStack.push(CLASSBLOCK); + pushScope(yyscanner,yyextra->curClassName); + DBG_CTX((stderr,"***** yyextra->curClassName=%s\n",yyextra->curClassName.data())); + if (getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,yyextra->curClassName)==0) + { + DBG_CTX((stderr,"Adding new class %s\n",yyextra->curClassName.data())); + ClassDef *ncd=createClassDef("",1,1, + yyextra->curClassName,ClassDef::Class,0,0,FALSE); + yyextra->codeClassSDict->append(yyextra->curClassName,ncd); + // insert base classes. + char *s=yyextra->curClassBases.first(); + while (s) + { + const ClassDef *bcd=yyextra->codeClassSDict->find(s); + if (bcd==0) bcd=getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,s); + if (bcd && bcd!=ncd) + { + ncd->insertBaseClass(const_cast(bcd),s,Public,Normal); + } + s=yyextra->curClassBases.next(); + } + } + //printf("yyextra->codeClassList.count()=%d\n",yyextra->codeClassList.count()); + } + else // not a class name -> assume inner block + { + DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); + yyextra->scopeStack.push(INNERBLOCK); + } + yyextra->curClassName.resize(0); + yyextra->curClassBases.clear(); + BEGIN( Body ); + } +"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" { + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + } +{SEP}?({ID}{SEP})*{ID} { + DBG_CTX((stderr,"%s:addBase(%s)\n",yyextra->curClassName.data(),yytext)); + yyextra->curClassBases.inSort(yytext); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + } +"<" { + yyextra->code->codify(yytext); + if (!yyextra->insideObjC) + { + yyextra->sharpCount=1; + BEGIN ( SkipSharp ); + } + else + { + yyextra->insideProtocolList=TRUE; + } + } +">" { + yyextra->code->codify(yytext); + yyextra->insideProtocolList=FALSE; + } +"<" { + yyextra->code->codify(yytext); + ++yyextra->sharpCount; + } +">" { + yyextra->code->codify(yytext); + if (--yyextra->sharpCount<=0) + BEGIN ( Bases ); + } +"\"" { + yyextra->code->codify(yytext); + yyextra->lastStringContext=YY_START; + BEGIN(SkipString); + } +"\'" { + yyextra->code->codify(yytext); + yyextra->lastStringContext=YY_START; + BEGIN(SkipStringS); + } +"(" { + yyextra->code->codify(yytext); + yyextra->sharpCount=1; + BEGIN ( SkipSharp ); + } +"(" { + yyextra->code->codify(yytext); + ++yyextra->sharpCount; + } +")" { + yyextra->code->codify(yytext); + if (--yyextra->sharpCount<=0) + BEGIN ( Bases ); + } + + +"," { + yyextra->code->codify(yytext); + } + {SCOPEPREFIX}?"operator"{B}*"()"{B}*/"(" { - addType(); - generateFunctionLink(*g_code,yytext); - g_bracketCount=0; - g_args.resize(0); - g_name+=yytext; + addType(yyscanner); + generateFunctionLink(yyscanner,*yyextra->code,yytext); + yyextra->bracketCount=0; + yyextra->args.resize(0); + yyextra->name+=yytext; BEGIN( FuncCall ); } {SCOPEPREFIX}?"operator"/"(" { - addType(); - generateFunctionLink(*g_code,yytext); - g_bracketCount=0; - g_args.resize(0); - g_name+=yytext; + addType(yyscanner); + generateFunctionLink(yyscanner,*yyextra->code,yytext); + yyextra->bracketCount=0; + yyextra->args.resize(0); + yyextra->name+=yytext; BEGIN( FuncCall ); } {SCOPEPREFIX}?"operator"[^a-z_A-Z0-9\(\n]+/"(" { - addType(); - generateFunctionLink(*g_code,yytext); - g_bracketCount=0; - g_args.resize(0); - g_name+=yytext; + addType(yyscanner); + generateFunctionLink(yyscanner,*yyextra->code,yytext); + yyextra->bracketCount=0; + yyextra->args.resize(0); + yyextra->name+=yytext; BEGIN( FuncCall ); } ("template"|"generic")/([^a-zA-Z0-9]) { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - g_insideTemplate=TRUE; - g_sharpCount=0; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->insideTemplate=TRUE; + yyextra->sharpCount=0; } "using"{BN}+"namespace"{BN}+ { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); BEGIN(UsingName); } -{ID}("::"{ID})* { addUsingDirective(yytext); - generateClassOrGlobalLink(*g_code,yytext); +{ID}("::"{ID})* { addUsingDirective(yyscanner,yytext); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); DBG_CTX((stderr,"** scope stack push CLASSBLOCK\n")); - g_scopeStack.push(CLASSBLOCK); - pushScope(yytext); + yyextra->scopeStack.push(CLASSBLOCK); + pushScope(yyscanner,yytext); BEGIN(Body); } -\n { codifyLines(yytext); BEGIN(Body); } -. { codifyLines(yytext); BEGIN(Body); } -"$"?"this"("->"|".") { g_code->codify(yytext); // this-> for C++, this. for C# - g_prefixed_with_this_keyword = TRUE; +\n { codifyLines(yyscanner,yytext); BEGIN(Body); } +. { codifyLines(yyscanner,yytext); BEGIN(Body); } +"$"?"this"("->"|".") { yyextra->code->codify(yytext); // this-> for C++, this. for C# + yyextra->prefixed_with_this_keyword = TRUE; } {KEYWORD}/([^a-z_A-Z0-9]) { - if (g_lang==SrcLangExt_Java && qstrcmp("internal",yytext) ==0) REJECT; - if (skipLanguageSpecificKeyword(yytext)) REJECT; - startFontClass("keyword"); - codifyLines(yytext); + if (yyextra->lang==SrcLangExt_Java && qstrcmp("internal",yytext) ==0) REJECT; + if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); if (QCString(yytext)=="typedef") { - addType(); - g_name+=yytext; + addType(yyscanner); + yyextra->name+=yytext; } - endFontClass(); + endFontClass(yyscanner); } {KEYWORD}/{B}* { - if (skipLanguageSpecificKeyword(yytext)) REJECT; - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } {KEYWORD}/{BN}*"(" { - if (skipLanguageSpecificKeyword(yytext)) REJECT; - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - g_name.resize(0);g_type.resize(0); + if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->name.resize(0);yyextra->type.resize(0); } "in"/{BN}* { - if (!g_inForEachExpression) REJECT; - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); + if (!yyextra->inForEachExpression) REJECT; + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); // insert the variable in the parent scope, see bug 546158 - g_theVarContext.popScope(); - g_theVarContext.addVariable(g_parmType,g_parmName); - g_theVarContext.pushScope(); - g_name.resize(0);g_type.resize(0); + yyextra->theVarContext.popScope(); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + yyextra->theVarContext.pushScope(); + yyextra->name.resize(0);yyextra->type.resize(0); } {FLOWKW}/{BN}*"(" { - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); - g_name.resize(0);g_type.resize(0); - g_inForEachExpression = (qstrcmp(yytext,"for each")==0 || qstrcmp(yytext, "foreach")==0); + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->name.resize(0);yyextra->type.resize(0); + yyextra->inForEachExpression = (qstrcmp(yytext,"for each")==0 || qstrcmp(yytext, "foreach")==0); BEGIN(FuncCall); } {FLOWCONDITION}/{BN}*"(" { - if (g_currentMemberDef && g_currentMemberDef->isFunction()) + if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction()) { - g_currentMemberDef->incrementFlowKeyWordCount(); + yyextra->currentMemberDef->incrementFlowKeyWordCount(); } - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); - g_name.resize(0);g_type.resize(0); - g_inForEachExpression = (strcmp(yytext,"for each")==0 || strcmp(yytext, "foreach")==0); + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->name.resize(0);yyextra->type.resize(0); + yyextra->inForEachExpression = (strcmp(yytext,"for each")==0 || strcmp(yytext, "foreach")==0); BEGIN(FuncCall); } {FLOWKW}/([^a-z_A-Z0-9]) { - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); - if (g_inFunctionTryBlock && (qstrcmp(yytext,"catch")==0 || qstrcmp(yytext,"finally")==0)) + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + if (yyextra->inFunctionTryBlock && (qstrcmp(yytext,"catch")==0 || qstrcmp(yytext,"finally")==0)) { - g_inFunctionTryBlock=FALSE; + yyextra->inFunctionTryBlock=FALSE; } } {FLOWCONDITION}/([^a-z_A-Z0-9]) { - if (g_currentMemberDef && g_currentMemberDef->isFunction()) + if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction()) { - g_currentMemberDef->incrementFlowKeyWordCount(); + yyextra->currentMemberDef->incrementFlowKeyWordCount(); } - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); - if (g_inFunctionTryBlock && (strcmp(yytext,"catch")==0 || strcmp(yytext,"finally")==0)) + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + if (yyextra->inFunctionTryBlock && (strcmp(yytext,"catch")==0 || strcmp(yytext,"finally")==0)) { - g_inFunctionTryBlock=FALSE; + yyextra->inFunctionTryBlock=FALSE; } } {FLOWKW}/{B}* { - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } {FLOWCONDITION}/{B}* { - if (g_currentMemberDef && g_currentMemberDef->isFunction()) + if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction()) { - g_currentMemberDef->incrementFlowKeyWordCount(); + yyextra->currentMemberDef->incrementFlowKeyWordCount(); } - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } "*"{B}*")" { // end of cast? - g_code->codify(yytext); - g_theCallContext.popScope(g_name, g_type); - g_bracketCount--; - g_parmType = g_name; + yyextra->code->codify(yytext); + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->bracketCount--; + yyextra->parmType = yyextra->name; BEGIN(FuncCall); } [\\|\)\+\-\/\%\~\!] { - g_code->codify(yytext); - g_name.resize(0);g_type.resize(0); + yyextra->code->codify(yytext); + yyextra->name.resize(0);yyextra->type.resize(0); if (*yytext==')') { - g_theCallContext.popScope(g_name, g_type); - g_bracketCount--; + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->bracketCount--; BEGIN(FuncCall); } } {TYPEKW}/{B}* { - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); - addType(); - g_name+=yytext; + startFontClass(yyscanner,"keywordtype"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + addType(yyscanner); + yyextra->name+=yytext; } {TYPEKWSL}/{B}* { - if (g_lang!=SrcLangExt_Slice) + if (yyextra->lang!=SrcLangExt_Slice) { REJECT; } else { - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); - addType(); - g_name+=yytext; + startFontClass(yyscanner,"keywordtype"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + addType(yyscanner); + yyextra->name+=yytext; } } "generic"/{B}*"<"[^\n\/\-\.\{\"\>]*">"{B}* { - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - g_sharpCount=0; + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + yyextra->sharpCount=0; BEGIN(TemplDecl); } "template"/{B}*"<"[^\n\/\-\.\{\"\>]*">"{B}* { // template<...> - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - g_sharpCount=0; + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + yyextra->sharpCount=0; BEGIN(TemplDecl); } "class"|"typename" { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } "<" { - g_code->codify(yytext); - g_sharpCount++; + yyextra->code->codify(yytext); + yyextra->sharpCount++; } ">" { - g_code->codify(yytext); - g_sharpCount--; - if (g_sharpCount<=0) + yyextra->code->codify(yytext); + yyextra->sharpCount--; + if (yyextra->sharpCount<=0) { BEGIN(Body); } } ">" { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - BEGIN( g_lastTemplCastContext ); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + BEGIN( yyextra->lastTemplCastContext ); } {ID}("::"{ID})* { - generateClassOrGlobalLink(*g_code,yytext); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); } ("const"|"volatile"){B}* { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } [*^]* { - codifyLines(yytext); + codifyLines(yyscanner,yytext); } {CASTKW}{B}*"<" { // static_cast( - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - g_lastTemplCastContext = YY_START; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->lastTemplCastContext = YY_START; BEGIN(TemplCast); } "$this->"{SCOPENAME}/{BN}*[;,)\]] { // PHP member variable - addType(); - generatePHPVariableLink(*g_code,yytext); - g_name+=yytext+7; + addType(yyscanner); + generatePHPVariableLink(yyscanner,*yyextra->code,yytext); + yyextra->name+=yytext+7; } {SCOPENAME}{B}*"<"[^\n\/\-\.\{\"\>\(]*">"("::"{ID})*/{B}* { // A *pt; if (isCastKeyword(yytext) && YY_START==Body) { REJECT; } - addType(); - generateClassOrGlobalLink(*g_code,yytext); - g_name+=yytext; + addType(yyscanner); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + yyextra->name+=yytext; } {SCOPENAME}/{BN}*[:;,)\]] { // "int var;" or "var, var2" or "debug(f) macro" , or int var : 5; - addType(); + addType(yyscanner); // changed this to generateFunctionLink, see bug 624514 - //generateClassOrGlobalLink(*g_code,yytext,FALSE,TRUE); - generateFunctionLink(*g_code,yytext); - g_name+=yytext; + //generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,FALSE,TRUE); + generateFunctionLink(yyscanner,*yyextra->code,yytext); + yyextra->name+=yytext; } {SCOPENAME}/{B}* { // p->func() - addType(); - generateClassOrGlobalLink(*g_code,yytext); - g_name+=yytext; + addType(yyscanner); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + yyextra->name+=yytext; } "("{B}*("*"{B}*)+{SCOPENAME}*{B}*")"/{B}* { // (*p)->func() but not "if (p) ..." - g_code->codify(yytext); + yyextra->code->codify(yytext); int s=0;while (s<(int)yyleng && !isId(yytext[s])) s++; int e=(int)yyleng-1;while (e>=0 && !isId(yytext[e])) e--; QCString varname = ((QCString)yytext).mid(s,e-s+1); - addType(); - g_name=varname; + addType(yyscanner); + yyextra->name=varname; } {SCOPETNAME}{B}*"<"[^\n\/\-\.\{\"\>]*">"/{BN}*"(" | {SCOPETNAME}/{BN}*"(" { // a() or c::a() or t::a() or A\B\foo() @@ -2663,223 +1206,223 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" { REJECT; } - addType(); - generateFunctionLink(*g_code,yytext); - g_bracketCount=0; - g_args.resize(0); - g_name+=yytext; + addType(yyscanner); + generateFunctionLink(yyscanner,*yyextra->code,yytext); + yyextra->bracketCount=0; + yyextra->args.resize(0); + yyextra->name+=yytext; BEGIN( FuncCall ); } {RAWBEGIN} { QCString text=yytext; int i=text.find('R'); - g_code->codify(text.left(i+1)); - startFontClass("stringliteral"); - g_code->codify(yytext+i+1); - g_lastStringContext=YY_START; - g_inForEachExpression = FALSE; - g_delimiter = yytext+i+2; - g_delimiter=g_delimiter.left(g_delimiter.length()-1); + yyextra->code->codify(text.left(i+1)); + startFontClass(yyscanner,"stringliteral"); + yyextra->code->codify(yytext+i+1); + yyextra->lastStringContext=YY_START; + yyextra->inForEachExpression = FALSE; + yyextra->delimiter = yytext+i+2; + yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1); BEGIN( RawString ); } \" { - startFontClass("stringliteral"); - g_code->codify(yytext); - g_lastStringContext=YY_START; - g_inForEachExpression = FALSE; + startFontClass(yyscanner,"stringliteral"); + yyextra->code->codify(yytext); + yyextra->lastStringContext=YY_START; + yyextra->inForEachExpression = FALSE; BEGIN( SkipString ); } \' { - startFontClass("stringliteral"); - g_code->codify(yytext); - g_lastStringContext=YY_START; - g_inForEachExpression = FALSE; + startFontClass(yyscanner,"stringliteral"); + yyextra->code->codify(yytext); + yyextra->lastStringContext=YY_START; + yyextra->inForEachExpression = FALSE; BEGIN( SkipStringS ); } [^\"\\\r\n]* { - g_code->codify(yytext); + yyextra->code->codify(yytext); } [^\'\\\r\n]* { - g_code->codify(yytext); + yyextra->code->codify(yytext); } "//"|"/*" { - g_code->codify(yytext); + yyextra->code->codify(yytext); } @?\" { - g_code->codify(yytext); - endFontClass(); - BEGIN( g_lastStringContext ); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + BEGIN( yyextra->lastStringContext ); } \' { - g_code->codify(yytext); - endFontClass(); - BEGIN( g_lastStringContext ); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + BEGIN( yyextra->lastStringContext ); } \\. { - g_code->codify(yytext); + yyextra->code->codify(yytext); } {RAWEND} { - g_code->codify(yytext); + yyextra->code->codify(yytext); QCString delimiter = yytext+1; delimiter=delimiter.left(delimiter.length()-1); - if (delimiter==g_delimiter) + if (delimiter==yyextra->delimiter) { - BEGIN( g_lastStringContext ); + BEGIN( yyextra->lastStringContext ); } } -[^)\n]+ { g_code->codify(yytext); } -. { g_code->codify(yytext); } -\n { codifyLines(yytext); } +[^)\n]+ { yyextra->code->codify(yytext); } +. { yyextra->code->codify(yytext); } +\n { codifyLines(yyscanner,yytext); } [^"\n]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } \"\" { // escaped quote - g_code->codify(yytext); + yyextra->code->codify(yytext); } \" { // end of string - g_code->codify(yytext); - endFontClass(); - BEGIN( g_lastVerbStringContext ); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + BEGIN( yyextra->lastVerbStringContext ); } . { - g_code->codify(yytext); + yyextra->code->codify(yytext); } \n { - codifyLines(yytext); + codifyLines(yyscanner,yytext); } ":" { - g_code->codify(yytext); - g_name.resize(0);g_type.resize(0); + yyextra->code->codify(yytext); + yyextra->name.resize(0);yyextra->type.resize(0); } "<" { - if (g_insideTemplate) + if (yyextra->insideTemplate) { - g_sharpCount++; + yyextra->sharpCount++; } - g_code->codify(yytext); + yyextra->code->codify(yytext); } ">" { - if (g_insideTemplate) + if (yyextra->insideTemplate) { - if (--g_sharpCount<=0) + if (--yyextra->sharpCount<=0) { - g_insideTemplate=FALSE; + yyextra->insideTemplate=FALSE; } } - g_code->codify(yytext); + yyextra->code->codify(yytext); } "'"((\\0[Xx0-9]+)|(\\.)|(.))"'" { - startFontClass("charliteral"); - g_code->codify(yytext); - endFontClass(); + startFontClass(yyscanner,"charliteral"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } "."|"->" { if (yytext[0]=='-') // -> could be overloaded { - updateCallContextForSmartPointer(); + updateCallContextForSmartPointer(yyscanner); } - g_code->codify(yytext); - g_memCallContext = YY_START; + yyextra->code->codify(yytext); + yyextra->memCallContext = YY_START; BEGIN( MemberCall ); } {SCOPETNAME}/{BN}*"(" { - if (g_theCallContext.getScope()) + if (yyextra->theCallContext.getScope()) { - if (!generateClassMemberLink(*g_code,g_theCallContext.getScope(),yytext)) + if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getScope(),yytext)) { - g_code->codify(yytext); - addToSearchIndex(yytext); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yytext); } - g_name.resize(0); + yyextra->name.resize(0); } else { - g_code->codify(yytext); - addToSearchIndex(yytext); - g_name.resize(0); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yytext); + yyextra->name.resize(0); } - g_type.resize(0); - if (g_memCallContext==Body) + yyextra->type.resize(0); + if (yyextra->memCallContext==Body) { BEGIN(FuncCall); } else { - BEGIN(g_memCallContext); + BEGIN(yyextra->memCallContext); } } {SCOPENAME}/{B}* { - if (g_theCallContext.getScope()) + if (yyextra->theCallContext.getScope()) { - DBG_CTX((stderr,"g_theCallContext.getClass()=%p\n",g_theCallContext.getScope())); - if (!generateClassMemberLink(*g_code,g_theCallContext.getScope(),yytext)) + DBG_CTX((stderr,"yyextra->theCallContext.getClass()=%p\n",yyextra->theCallContext.getScope())); + if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getScope(),yytext)) { - g_code->codify(yytext); - addToSearchIndex(yytext); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yytext); } - g_name.resize(0); + yyextra->name.resize(0); } else { DBG_CTX((stderr,"no class context!\n")); - g_code->codify(yytext); - addToSearchIndex(yytext); - g_name.resize(0); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yytext); + yyextra->name.resize(0); } - g_type.resize(0); - BEGIN(g_memCallContext); + yyextra->type.resize(0); + BEGIN(yyextra->memCallContext); } [,=;\[] { - if (g_insideObjC && *yytext=='[') + if (yyextra->insideObjC && *yytext=='[') { //printf("Found start of ObjC call!\n"); // start of a method call - g_contextDict.setAutoDelete(TRUE); - g_nameDict.setAutoDelete(TRUE); - g_objectDict.setAutoDelete(TRUE); - g_wordDict.setAutoDelete(TRUE); - g_commentDict.setAutoDelete(TRUE); - g_contextDict.clear(); - g_nameDict.clear(); - g_objectDict.clear(); - g_wordDict.clear(); - g_commentDict.clear(); - g_currentCtxId = 0; - g_currentNameId = 0; - g_currentObjId = 0; - g_currentCtx = 0; - g_braceCount = 0; + yyextra->contextDict.setAutoDelete(TRUE); + yyextra->nameDict.setAutoDelete(TRUE); + yyextra->objectDict.setAutoDelete(TRUE); + yyextra->wordDict.setAutoDelete(TRUE); + yyextra->commentDict.setAutoDelete(TRUE); + yyextra->contextDict.clear(); + yyextra->nameDict.clear(); + yyextra->objectDict.clear(); + yyextra->wordDict.clear(); + yyextra->commentDict.clear(); + yyextra->currentCtxId = 0; + yyextra->currentNameId = 0; + yyextra->currentObjId = 0; + yyextra->currentCtx = 0; + yyextra->braceCount = 0; unput('['); BEGIN(ObjCCall); } else { - g_code->codify(yytext); - g_saveName = g_name.copy(); - g_saveType = g_type.copy(); - if (*yytext!='[' && !g_type.isEmpty()) + yyextra->code->codify(yytext); + yyextra->saveName = yyextra->name.copy(); + yyextra->saveType = yyextra->type.copy(); + if (*yytext!='[' && !yyextra->type.isEmpty()) { - //printf("g_scopeStack.bottom()=%p\n",g_scopeStack.bottom()); - //if (g_scopeStack.top()!=CLASSBLOCK) // commented out for bug731363 + //printf("yyextra->scopeStack.bottom()=%p\n",yyextra->scopeStack.bottom()); + //if (yyextra->scopeStack.top()!=CLASSBLOCK) // commented out for bug731363 { //printf("AddVariable: '%s' '%s' context=%d\n", - // g_type.data(),g_name.data(),g_theVarContext.count()); - g_theVarContext.addVariable(g_type,g_name); + // yyextra->type.data(),yyextra->name.data(),yyextra->theVarContext.count()); + yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name); } - g_name.resize(0); + yyextra->name.resize(0); } if (*yytext==';' || *yytext=='=') { - g_type.resize(0); - g_name.resize(0); + yyextra->type.resize(0); + yyextra->name.resize(0); } else if (*yytext=='[') { - g_theCallContext.pushScope(g_name, g_type); + yyextra->theCallContext.pushScope(yyextra->name, yyextra->type); } - g_args.resize(0); - g_parmType.resize(0); - g_parmName.resize(0); + yyextra->args.resize(0); + yyextra->parmType.resize(0); + yyextra->parmName.resize(0); } } /* @@ -2887,216 +1430,216 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" if (qstrcmp(yytext,"self")==0 || qstrcmp(yytext,"super")==0) { // TODO: get proper base class for "super" - g_theCallContext.setClass(getClass(g_curClassName)); - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); + yyextra->theCallContext.setClass(getClass(yyextra->curClassName)); + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } else { - generateClassOrGlobalLink(*g_code,yytext); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); } - g_name.resize(0); + yyextra->name.resize(0); BEGIN(ObjCMemberCall2); } "[" { - g_code->codify(yytext); - g_theCallContext.pushScope(g_name, g_type); + yyextra->code->codify(yytext); + yyextra->theCallContext.pushScope(yyscanner,yyextra->name, yyextra->type); } {ID}":"? { - g_name+=yytext; - if (g_theCallContext.getClass()) + yyextra->name+=yytext; + if (yyextra->theCallContext.getClass()) { - //printf("Calling method %s\n",g_name.data()); - if (!generateClassMemberLink(*g_code,g_theCallContext.getClass(),g_name)) + //printf("Calling method %s\n",yyextra->name.data()); + if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getClass(),yyextra->name)) { - g_code->codify(yytext); - addToSearchIndex(g_name); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yyextra->name); } } else { - g_code->codify(yytext); - addToSearchIndex(g_name); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yyextra->name); } - g_name.resize(0); + yyextra->name.resize(0); BEGIN(ObjCMemberCall3); } "]" { - g_theCallContext.popScope(g_name, g_type); - g_code->codify(yytext); + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->code->codify(yytext); BEGIN(Body); } */ "["|"{" { - saveObjCContext(); - g_currentCtx->format+=*yytext; + saveObjCContext(yyscanner); + yyextra->currentCtx->format+=*yytext; BEGIN(ObjCCall); //printf("open\n"); } "]"|"}" { - g_currentCtx->format+=*yytext; - restoreObjCContext(); + yyextra->currentCtx->format+=*yytext; + restoreObjCContext(yyscanner); BEGIN(ObjCMName); - if (g_currentCtx==0) + if (yyextra->currentCtx==0) { // end of call - writeObjCMethodCall(g_contextDict.find(0)); + writeObjCMethodCall(yyscanner,yyextra->contextDict.find(0)); BEGIN(Body); } //printf("close\n"); } "//".* { - g_currentCtx->format+=escapeComment(yytext); + yyextra->currentCtx->format+=escapeComment(yyscanner,yytext); } "/*" { - g_lastObjCCallContext = YY_START; - g_currentCtx->comment=yytext; + yyextra->lastObjCCallContext = YY_START; + yyextra->currentCtx->comment=yytext; BEGIN(ObjCCallComment); } "*/" { - g_currentCtx->comment+=yytext; - g_currentCtx->format+=escapeComment(g_currentCtx->comment); - BEGIN(g_lastObjCCallContext); + yyextra->currentCtx->comment+=yytext; + yyextra->currentCtx->format+=escapeComment(yyscanner,yyextra->currentCtx->comment); + BEGIN(yyextra->lastObjCCallContext); } -[^*\n]+ { g_currentCtx->comment+=yytext; } -"//"|"/*" { g_currentCtx->comment+=yytext; } -\n { g_currentCtx->comment+=*yytext; } -. { g_currentCtx->comment+=*yytext; } +[^*\n]+ { yyextra->currentCtx->comment+=yytext; } +"//"|"/*" { yyextra->currentCtx->comment+=yytext; } +\n { yyextra->currentCtx->comment+=*yytext; } +. { yyextra->currentCtx->comment+=*yytext; } {ID} { - g_currentCtx->format+=escapeObject(yytext); - if (g_braceCount==0) + yyextra->currentCtx->format+=escapeObject(yyscanner,yytext); + if (yyextra->braceCount==0) { - g_currentCtx->objectTypeOrName=yytext; - //printf("new type=%s\n",g_currentCtx->objectTypeOrName.data()); + yyextra->currentCtx->objectTypeOrName=yytext; + //printf("new type=%s\n",yyextra->currentCtx->objectTypeOrName.data()); BEGIN(ObjCMName); } } {ID}/{BN}*"]" { - if (g_braceCount==0 && - g_currentCtx->methodName.isEmpty()) + if (yyextra->braceCount==0 && + yyextra->currentCtx->methodName.isEmpty()) { - g_currentCtx->methodName=yytext; - g_currentCtx->format+=escapeName(yytext); + yyextra->currentCtx->methodName=yytext; + yyextra->currentCtx->format+=escapeName(yyscanner,yytext); } else { - g_currentCtx->format+=escapeWord(yytext); + yyextra->currentCtx->format+=escapeWord(yyscanner,yytext); } } {ID}/{BN}*":" { - if (g_braceCount==0) + if (yyextra->braceCount==0) { - g_currentCtx->methodName+=yytext; - g_currentCtx->methodName+=":"; + yyextra->currentCtx->methodName+=yytext; + yyextra->currentCtx->methodName+=":"; } - g_currentCtx->format+=escapeName(yytext); + yyextra->currentCtx->format+=escapeName(yyscanner,yytext); } -[^\n\"$\\]* { g_currentCtx->format+=yytext; } -\\. { g_currentCtx->format+=yytext; } -"\"" { g_currentCtx->format+=yytext; - BEGIN(g_lastStringContext); +[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; } +\\. { yyextra->currentCtx->format+=yytext; } +"\"" { yyextra->currentCtx->format+=yytext; + BEGIN(yyextra->lastStringContext); } -{CHARLIT} { g_currentCtx->format+=yytext; } -"@"?"\"" { g_currentCtx->format+=yytext; - g_lastStringContext=YY_START; +{CHARLIT} { yyextra->currentCtx->format+=yytext; } +"@"?"\"" { yyextra->currentCtx->format+=yytext; + yyextra->lastStringContext=YY_START; BEGIN(ObjCSkipStr); } -"$" { g_currentCtx->format+="$$"; } -"(" { g_currentCtx->format+=*yytext; g_braceCount++; } -")" { g_currentCtx->format+=*yytext; g_braceCount--; } +"$" { yyextra->currentCtx->format+="$$"; } +"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; } +")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; } "@"/"\"" { // needed to prevent matching the global rule (for C#) - g_currentCtx->format+=yytext; + yyextra->currentCtx->format+=yytext; } -{ID} { g_currentCtx->format+=escapeWord(yytext); } -. { g_currentCtx->format+=*yytext; } -\n { g_currentCtx->format+=*yytext; } +{ID} { yyextra->currentCtx->format+=escapeWord(yyscanner,yytext); } +. { yyextra->currentCtx->format+=*yytext; } +\n { yyextra->currentCtx->format+=*yytext; } "]" { - g_theCallContext.popScope(g_name, g_type); - g_code->codify(yytext); + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->code->codify(yytext); // TODO: nested arrays like: a[b[0]->func()]->func() - g_name = g_saveName.copy(); - g_type = g_saveType.copy(); + yyextra->name = yyextra->saveName.copy(); + yyextra->type = yyextra->saveType.copy(); } [0-9]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } [0-9]+[xX][0-9A-Fa-f]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } {KEYWORD}/([^a-z_A-Z0-9]) { - //addParmType(); - //g_parmName=yytext; - if (skipLanguageSpecificKeyword(yytext)) REJECT; - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); + //addParmType(yyscanner); + //yyextra->parmName=yytext; + if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT; + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } {TYPEKW}/([^a-z_A-Z0-9]) { - addParmType(); - g_parmName=yytext; - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); + addParmType(yyscanner); + yyextra->parmName=yytext; + startFontClass(yyscanner,"keywordtype"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } {TYPEKWSL}/([^a-z_A-Z0-9]) { - if (g_lang!=SrcLangExt_Slice) + if (yyextra->lang!=SrcLangExt_Slice) { REJECT; } else { - addParmType(); - g_parmName=yytext; - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); + addParmType(yyscanner); + yyextra->parmName=yytext; + startFontClass(yyscanner,"keywordtype"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } } {FLOWKW}/([^a-z_A-Z0-9]) { - addParmType(); - g_parmName=yytext; - startFontClass("keywordflow"); - g_code->codify(yytext); - endFontClass(); + addParmType(yyscanner); + yyextra->parmName=yytext; + startFontClass(yyscanner,"keywordflow"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } {FLOWCONDITION}/([^a-z_A-Z0-9]) { - if (g_currentMemberDef && g_currentMemberDef->isFunction()) + if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction()) { - g_currentMemberDef->incrementFlowKeyWordCount(); + yyextra->currentMemberDef->incrementFlowKeyWordCount(); } - addParmType(); - g_parmName=yytext; - startFontClass("keywordflow"); - g_code->codify(yytext); - endFontClass(); + addParmType(yyscanner); + yyextra->parmName=yytext; + startFontClass(yyscanner,"keywordflow"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } {ID}(({B}*"<"[^\n\[\](){}<>]*">")?({B}*"::"{B}*{ID})?)* { if (isCastKeyword(yytext)) { REJECT; } - addParmType(); - g_parmName=yytext; - generateClassOrGlobalLink(*g_code,yytext,!g_insideBody); + addParmType(yyscanner); + yyextra->parmName=yytext; + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody); } ";" { // probably a cast, not a function call - g_code->codify(yytext); - g_inForEachExpression = FALSE; + yyextra->code->codify(yytext); + yyextra->inForEachExpression = FALSE; BEGIN( Body ); } , { - g_code->codify(yytext); - g_theVarContext.addVariable(g_parmType,g_parmName); - g_parmType.resize(0);g_parmName.resize(0); + yyextra->code->codify(yytext); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + yyextra->parmType.resize(0);yyextra->parmName.resize(0); } "{" { - if (g_bracketCount>0) + if (yyextra->bracketCount>0) { - g_code->codify(yytext); - g_skipInlineInitContext=YY_START; - g_curlyCount=0; + yyextra->code->codify(yytext); + yyextra->skipInlineInitContext=YY_START; + yyextra->curlyCount=0; BEGIN(InlineInit); } else @@ -3104,30 +1647,30 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" REJECT; } } -"{" { g_curlyCount++; - g_code->codify(yytext); +"{" { yyextra->curlyCount++; + yyextra->code->codify(yytext); } "}" { - g_code->codify(yytext); - if (--g_curlyCount<=0) + yyextra->code->codify(yytext); + if (--yyextra->curlyCount<=0) { - BEGIN(g_skipInlineInitContext); + BEGIN(yyextra->skipInlineInitContext); } } \n { - codifyLines(yytext); + codifyLines(yyscanner,yytext); } . { - g_code->codify(yytext); + yyextra->code->codify(yytext); } "(" { - g_parmType.resize(0);g_parmName.resize(0); - g_code->codify(yytext); - g_bracketCount++; - g_theCallContext.pushScope(g_name, g_type); - if (YY_START==FuncCall && !g_insideBody) + yyextra->parmType.resize(0);yyextra->parmName.resize(0); + yyextra->code->codify(yytext); + yyextra->bracketCount++; + yyextra->theCallContext.pushScope(yyextra->name, yyextra->type); + if (YY_START==FuncCall && !yyextra->insideBody) { - g_theVarContext.pushScope(); + yyextra->theVarContext.pushScope(); } } {OPERATOR} { // operator @@ -3137,34 +1680,34 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" qstrcmp(yytext,"%")) // typically a pointer or reference { // not a * or &, or C++/CLI's ^ or % - g_parmType.resize(0);g_parmName.resize(0); + yyextra->parmType.resize(0);yyextra->parmName.resize(0); } - g_code->codify(yytext); + yyextra->code->codify(yytext); } ("*"{B}*)?")" { if (yytext[0]==')') // no a pointer cast { - //printf("addVariable(%s,%s)\n",g_parmType.data(),g_parmName.data()); - if (g_parmType.isEmpty()) + //printf("addVariable(%s,%s)\n",yyextra->parmType.data(),yyextra->parmName.data()); + if (yyextra->parmType.isEmpty()) { - g_parmType=g_parmName; - g_parmName.resize(0); + yyextra->parmType=yyextra->parmName; + yyextra->parmName.resize(0); } - g_theVarContext.addVariable(g_parmType,g_parmName); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); } else { - g_parmType = g_parmName; - g_parmName.resize(0); - g_theVarContext.addVariable(g_parmType,g_parmName); + yyextra->parmType = yyextra->parmName; + yyextra->parmName.resize(0); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); } - g_theCallContext.popScope(g_name, g_type); - g_inForEachExpression = FALSE; - //g_theCallContext.setClass(0); // commented out, otherwise a()->b() does not work for b(). - g_code->codify(yytext); - if (--g_bracketCount<=0) + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->inForEachExpression = FALSE; + //yyextra->theCallContext.setClass(0); // commented out, otherwise a()->b() does not work for b(). + yyextra->code->codify(yytext); + if (--yyextra->bracketCount<=0) { - if (g_name.isEmpty()) + if (yyextra->name.isEmpty()) { BEGIN( Body ); } @@ -3174,319 +1717,319 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } } } -[ \t\n]* { codifyLines(yytext); } +[ \t\n]* { codifyLines(yyscanner,yytext); } /* ")"[ \t\n]*[;:] { */ [;:] { - codifyLines(yytext); - g_bracketCount=0; - if (*yytext==';') g_searchingForBody=FALSE; - if (!g_type.isEmpty()) + codifyLines(yyscanner,yytext); + yyextra->bracketCount=0; + if (*yytext==';') yyextra->searchingForBody=FALSE; + if (!yyextra->type.isEmpty()) { - DBG_CTX((stderr,"add variable g_type=%s g_name=%s)\n",g_type.data(),g_name.data())); - g_theVarContext.addVariable(g_type,g_name); + DBG_CTX((stderr,"add variable yyextra->type=%s yyextra->name=%s)\n",yyextra->type.data(),yyextra->name.data())); + yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name); } - g_parmType.resize(0);g_parmName.resize(0); - g_theCallContext.setScope(0); - if (*yytext==';' || g_insideBody) + yyextra->parmType.resize(0);yyextra->parmName.resize(0); + yyextra->theCallContext.setScope(0); + if (*yytext==';' || yyextra->insideBody) { - if (!g_insideBody) + if (!yyextra->insideBody) { - g_theVarContext.popScope(); + yyextra->theVarContext.popScope(); } - g_name.resize(0);g_type.resize(0); + yyextra->name.resize(0);yyextra->type.resize(0); BEGIN( Body ); } else { - g_bracketCount=0; + yyextra->bracketCount=0; BEGIN( SkipInits ); } } ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"sealed"|"override"))*/{BN}*(";"|"="|"throw"{BN}*"(") { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } ("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" { - if (g_insideBody) + if (yyextra->insideBody) { - g_theVarContext.pushScope(); + yyextra->theVarContext.pushScope(); } - g_theVarContext.addVariable(g_parmType,g_parmName); - //g_theCallContext.popScope(g_name, g_type); - g_parmType.resize(0);g_parmName.resize(0); - int index = g_name.findRev("::"); - DBG_CTX((stderr,"g_name=%s\n",g_name.data())); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + //yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->parmType.resize(0);yyextra->parmName.resize(0); + int index = yyextra->name.findRev("::"); + DBG_CTX((stderr,"yyextra->name=%s\n",yyextra->name.data())); if (index!=-1) { - QCString scope = g_name.left(index); - if (!g_classScope.isEmpty()) scope.prepend(g_classScope+"::"); - const ClassDef *cd=getResolvedClass(Doxygen::globalScope,g_sourceFileDef,scope); + QCString scope = yyextra->name.left(index); + if (!yyextra->classScope.isEmpty()) scope.prepend(yyextra->classScope+"::"); + const ClassDef *cd=getResolvedClass(Doxygen::globalScope,yyextra->sourceFileDef,scope); if (cd) { - setClassScope(cd->name()); - g_scopeStack.push(SCOPEBLOCK); + setClassScope(yyscanner,cd->name()); + yyextra->scopeStack.push(SCOPEBLOCK); DBG_CTX((stderr,"** scope stack push SCOPEBLOCK\n")); } else { - //setClassScope(g_realScope); - g_scopeStack.push(INNERBLOCK); + //setClassScope(yyscanner,yyextra->realScope); + yyextra->scopeStack.push(INNERBLOCK); DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); } } else { DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); - g_scopeStack.push(INNERBLOCK); + yyextra->scopeStack.push(INNERBLOCK); } yytext[yyleng-1]='\0'; QCString cv(yytext); if (!cv.stripWhiteSpace().isEmpty()) { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } else // just whitespace { - codifyLines(yytext); + codifyLines(yyscanner,yytext); } - g_code->codify("{"); - if (g_searchingForBody) + yyextra->code->codify("{"); + if (yyextra->searchingForBody) { - g_searchingForBody=FALSE; - g_insideBody=TRUE; + yyextra->searchingForBody=FALSE; + yyextra->insideBody=TRUE; } - if (g_insideBody) g_bodyCurlyCount++; - g_type.resize(0); g_name.resize(0); + if (yyextra->insideBody) yyextra->bodyCurlyCount++; + yyextra->type.resize(0); yyextra->name.resize(0); BEGIN( Body ); } "try" { // function-try-block - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - g_inFunctionTryBlock=TRUE; + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + yyextra->inFunctionTryBlock=TRUE; } {ID} { - if (g_insideBody || !g_parmType.isEmpty()) + if (yyextra->insideBody || !yyextra->parmType.isEmpty()) { REJECT; } // could be K&R style definition - addParmType(); - g_parmName=yytext; - generateClassOrGlobalLink(*g_code,yytext,!g_insideBody); + addParmType(yyscanner); + yyextra->parmName=yytext; + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody); BEGIN(OldStyleArgs); } {ID} { - addParmType(); - g_parmName=yytext; - generateClassOrGlobalLink(*g_code,yytext,!g_insideBody); + addParmType(yyscanner); + yyextra->parmName=yytext; + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody); } [,;] { - g_code->codify(yytext); - g_theVarContext.addVariable(g_parmType,g_parmName); - if (*yytext==';') g_parmType.resize(0); - g_parmName.resize(0); + yyextra->code->codify(yytext); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + if (*yytext==';') yyextra->parmType.resize(0); + yyextra->parmName.resize(0); } "#" { - startFontClass("preprocessor"); - g_lastSkipCppContext = Body; - g_code->codify(yytext); + startFontClass(yyscanner,"preprocessor"); + yyextra->lastSkipCppContext = Body; + yyextra->code->codify(yytext); BEGIN( SkipCPP ); } . { unput(*yytext); - if (!g_insideBody) + if (!yyextra->insideBody) { - g_theVarContext.popScope(); + yyextra->theVarContext.popScope(); } - g_name.resize(0);g_args.resize(0); - g_parmType.resize(0);g_parmName.resize(0); + yyextra->name.resize(0);yyextra->args.resize(0); + yyextra->parmType.resize(0);yyextra->parmName.resize(0); BEGIN( Body ); } ";" { - g_code->codify(yytext); - g_type.resize(0); g_name.resize(0); + yyextra->code->codify(yytext); + yyextra->type.resize(0); yyextra->name.resize(0); BEGIN( Body ); } "{" { - g_code->codify(yytext); - if (g_searchingForBody) + yyextra->code->codify(yytext); + if (yyextra->searchingForBody) { - g_searchingForBody=FALSE; - g_insideBody=TRUE; + yyextra->searchingForBody=FALSE; + yyextra->insideBody=TRUE; } - if (g_insideBody) g_bodyCurlyCount++; - if (g_name.find("::")!=-1) + if (yyextra->insideBody) yyextra->bodyCurlyCount++; + if (yyextra->name.find("::")!=-1) { DBG_CTX((stderr,"** scope stack push SCOPEBLOCK\n")); - g_scopeStack.push(SCOPEBLOCK); - setClassScope(g_realScope); + yyextra->scopeStack.push(SCOPEBLOCK); + setClassScope(yyscanner,yyextra->realScope); } else { DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); - g_scopeStack.push(INNERBLOCK); + yyextra->scopeStack.push(INNERBLOCK); } - g_type.resize(0); g_name.resize(0); + yyextra->type.resize(0); yyextra->name.resize(0); BEGIN( Body ); } {ID} { - generateClassOrGlobalLink(*g_code,yytext); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); } {ID}/"(" { - generateFunctionLink(*g_code,yytext); + generateFunctionLink(yyscanner,*yyextra->code,yytext); } {ID}/("."|"->") { - g_name=yytext; - generateClassOrGlobalLink(*g_code,yytext); + yyextra->name=yytext; + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); BEGIN( MemberCall2 ); } ("("{B}*("*"{B}*)+{ID}*{B}*")"{B}*)/("."|"->") { - g_code->codify(yytext); + yyextra->code->codify(yytext); int s=0;while (!isId(yytext[s])) s++; int e=(int)yyleng-1;while (!isId(yytext[e])) e--; - g_name=((QCString)yytext).mid(s,e-s+1); + yyextra->name=((QCString)yytext).mid(s,e-s+1); BEGIN( MemberCall2 ); } {ID}/([ \t\n]*"(") { - if (!g_args.isEmpty()) - generateMemberLink(*g_code,g_args,yytext); + if (!yyextra->args.isEmpty()) + generateMemberLink(yyscanner,*yyextra->code,yyextra->args,yytext); else - generateClassOrGlobalLink(*g_code,yytext); - g_args.resize(0); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + yyextra->args.resize(0); BEGIN( FuncCall ); } {ID}/([ \t\n]*("."|"->")) { - //g_code->codify(yytext); - g_name=yytext; - generateClassOrGlobalLink(*g_code,yytext); + //yyextra->code->codify(yytext); + yyextra->name=yytext; + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); BEGIN( MemberCall2 ); } "->"|"." { if (yytext[0]=='-') // -> could be overloaded { - updateCallContextForSmartPointer(); + updateCallContextForSmartPointer(yyscanner); } - g_code->codify(yytext); - g_memCallContext = YY_START; + yyextra->code->codify(yytext); + yyextra->memCallContext = YY_START; BEGIN( MemberCall ); } "/*"("!"?)"*/" { - g_code->codify(yytext); - endFontClass(); - BEGIN( g_lastCContext ) ; + yyextra->code->codify(yytext); + endFontClass(yyscanner); + BEGIN( yyextra->lastCContext ) ; } "//"|"/*" { - g_code->codify(yytext); + yyextra->code->codify(yytext); } [^*/\n]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } [ \t]*"*/" { - g_code->codify(yytext); - endFontClass(); - if (g_lastCContext==SkipCPP) + yyextra->code->codify(yytext); + endFontClass(yyscanner); + if (yyextra->lastCContext==SkipCPP) { - startFontClass("preprocessor"); + startFontClass(yyscanner,"preprocessor"); } - BEGIN( g_lastCContext ) ; + BEGIN( yyextra->lastCContext ) ; } [^\r\n]*"\\"[\r]?\n { // line continuation - codifyLines(yytext); + codifyLines(yyscanner,yytext); } [^\r\n]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } \r \n { unput('\n'); - endFontClass(); - BEGIN( g_lastCContext ) ; + endFontClass(yyscanner); + BEGIN( yyextra->lastCContext ) ; } . { - g_code->codify(yytext); + yyextra->code->codify(yytext); } "*/"{B}*\n({B}*\n)*({B}*(("//@"[{}])|("/*@"[{}]"*/")){B}*\n)?{B}*"/*"[*!]/[^/*] { - g_yyLineNr+=QCString(yytext).contains('\n'); + yyextra->yyLineNr+=QCString(yytext).contains('\n'); } "*/"{B}*\n({B}*\n)*({B}*(("//@"[{}])|("/*@"[{}]"*/")){B}*\n)? { - g_yyLineNr+=QCString(yytext).contains('\n'); - nextCodeLine(); - if (g_lastSpecialCContext==SkipCxxComment) + yyextra->yyLineNr+=QCString(yytext).contains('\n'); + nextCodeLine(yyscanner); + if (yyextra->lastSpecialCContext==SkipCxxComment) { // force end of C++ comment here - endFontClass(); - BEGIN( g_lastCContext ) ; + endFontClass(yyscanner); + BEGIN( yyextra->lastCContext ) ; } else { - BEGIN(g_lastSpecialCContext); + BEGIN(yyextra->lastSpecialCContext); } } "*/" { - BEGIN(g_lastSpecialCContext); + BEGIN(yyextra->lastSpecialCContext); } [^*\n]+ "//"|"/*" -\n { g_yyLineNr++; } +\n { yyextra->yyLineNr++; } . [^a-z_A-Z0-9(\n] { - g_code->codify(yytext); - g_type.resize(0); - g_name.resize(0); - BEGIN(g_memCallContext); + yyextra->code->codify(yytext); + yyextra->type.resize(0); + yyextra->name.resize(0); + BEGIN(yyextra->memCallContext); } <*>\n({B}*"//"[!/][^\n]*\n)+ { // remove special one-line comment if (YY_START==SkipCPP) REJECT; if (Config_getBool(STRIP_CODE_COMMENTS)) { - g_yyLineNr+=((QCString)yytext).contains('\n'); - nextCodeLine(); + yyextra->yyLineNr+=((QCString)yytext).contains('\n'); + nextCodeLine(yyscanner); } else { - startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } if (YY_START==SkipCxxComment) { - endFontClass(); - BEGIN( g_lastCContext ) ; + endFontClass(yyscanner); + BEGIN( yyextra->lastCContext ) ; } } \n/.*\n { - endFontClass(); - codifyLines(yytext); - BEGIN( g_lastSkipCppContext ) ; + endFontClass(yyscanner); + codifyLines(yyscanner,yytext); + BEGIN( yyextra->lastSkipCppContext ) ; } <*>\n{B}*"//@"[{}].*\n { // remove one-line group marker if (Config_getBool(STRIP_CODE_COMMENTS)) { - g_yyLineNr+=2; - nextCodeLine(); + yyextra->yyLineNr+=2; + nextCodeLine(yyscanner); } else { - startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } if (YY_START==SkipCxxComment) { - endFontClass(); - BEGIN( g_lastCContext ) ; + endFontClass(yyscanner); + BEGIN( yyextra->lastCContext ) ; } } <*>\n{B}*"/*@"[{}] { // remove one-line group marker if (Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; - g_yyLineNr++; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; + yyextra->yyLineNr++; BEGIN(RemoveSpecialCComment); } else @@ -3494,30 +2037,30 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - codifyLines(yytext); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); BEGIN(SkipComment); } } <*>^{B}*"//@"[{}].*\n { // remove one-line group marker if (Config_getBool(STRIP_CODE_COMMENTS)) { - g_yyLineNr++; - nextCodeLine(); + yyextra->yyLineNr++; + nextCodeLine(yyscanner); } else { - startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } } <*>^{B}*"/*@"[{}] { // remove multi-line group marker if (Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; BEGIN(RemoveSpecialCComment); } else @@ -3525,24 +2068,24 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - g_code->codify(yytext); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); BEGIN(SkipComment); } } <*>^{B}*"//"[!/][^\n]*\n { // remove special one-line comment if (Config_getBool(STRIP_CODE_COMMENTS)) { - g_yyLineNr++; - //nextCodeLine(); + yyextra->yyLineNr++; + //nextCodeLine(yyscanner); } else { - startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } } <*>"//"[!/][^\n]*\n { // strip special one-line comment @@ -3550,26 +2093,26 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" if (Config_getBool(STRIP_CODE_COMMENTS)) { char c[2]; c[0]='\n'; c[1]=0; - codifyLines(c); + codifyLines(yyscanner,c); } else { - startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } } <*>"/*[tag:"[^\]\n]*"]*/"{B}* { // special pattern /*[tag:filename]*/ to force linking to a tag file - g_forceTagReference=yytext; - int s=g_forceTagReference.find(':'); - int e=g_forceTagReference.findRev(']'); - g_forceTagReference = g_forceTagReference.mid(s+1,e-s-1); + yyextra->forceTagReference=yytext; + int s=yyextra->forceTagReference.find(':'); + int e=yyextra->forceTagReference.findRev(']'); + yyextra->forceTagReference = yyextra->forceTagReference.mid(s+1,e-s-1); } <*>\n{B}*"/*"[!*]/[^/*] { if (Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; - g_yyLineNr++; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; + yyextra->yyLineNr++; BEGIN(RemoveSpecialCComment); } else @@ -3577,17 +2120,17 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - codifyLines(yytext); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); BEGIN(SkipComment); } } <*>^{B}*"/**"[*]+/[^/] { // special C "banner" comment block at a new line if (Config_getBool(JAVADOC_BANNER) && Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; BEGIN(RemoveSpecialCComment); } else @@ -3595,17 +2138,17 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - g_code->codify(yytext); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); BEGIN(SkipComment); } } <*>^{B}*"/*"[!*]/[^/*] { // special C comment block at a new line if (Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; BEGIN(RemoveSpecialCComment); } else @@ -3613,10 +2156,10 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - g_code->codify(yytext); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); BEGIN(SkipComment); } } @@ -3624,7 +2167,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" if (YY_START==SkipString) REJECT; if (Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; BEGIN(RemoveSpecialCComment); } else @@ -3632,10 +2175,10 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - g_code->codify(yytext); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); BEGIN(SkipComment); } } @@ -3643,134 +2186,1724 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" if (YY_START==SkipString) REJECT; if (!Config_getBool(STRIP_CODE_COMMENTS)) { - startFontClass("comment"); - g_code->codify(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } } [^\*\n]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } <*>"/*" { - startFontClass("comment"); - g_code->codify(yytext); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } BEGIN( SkipComment ) ; } <*>@\" { // C# verbatim string - startFontClass("stringliteral"); - g_code->codify(yytext); - g_lastVerbStringContext=YY_START; + startFontClass(yyscanner,"stringliteral"); + yyextra->code->codify(yytext); + yyextra->lastVerbStringContext=YY_START; BEGIN(SkipVerbString); } <*>"//" { - startFontClass("comment"); - g_code->codify(yytext); - g_lastCContext = YY_START ; + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); + yyextra->lastCContext = YY_START ; BEGIN( SkipCxxComment ) ; } <*>"("|"[" { - g_code->codify(yytext); - g_theCallContext.pushScope(g_name, g_type); + yyextra->code->codify(yytext); + yyextra->theCallContext.pushScope(yyextra->name, yyextra->type); } <*>")"|"]" { - g_code->codify(yytext); - g_theCallContext.popScope(g_name, g_type); + yyextra->code->codify(yytext); + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); } <*>\n { - g_yyColNr++; - codifyLines(yytext); + yyextra->yyColNr++; + codifyLines(yyscanner,yytext); } <*>. { - g_yyColNr++; - g_code->codify(yytext); + yyextra->yyColNr++; + yyextra->code->codify(yytext); } /* <*>([ \t\n]*"\n"){2,} { // combine multiple blank lines //QCString sepLine=yytext; - //g_code->codify("\n\n"); - //g_yyLineNr+=sepLine.contains('\n'); + //yyextra->code->codify("\n\n"); + //yyextra->yyLineNr+=sepLine.contains('\n'); //char sepLine[3]="\n\n"; - codifyLines(yytext); + codifyLines(yyscanner,yytext); } */ -%% +%% + +/*@ ---------------------------------------------------------------------------- + */ + +void VariableContext::addVariable(yyscan_t yyscanner,const QCString &type,const QCString &name) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("VariableContext::addVariable(%s,%s)\n",type.data(),name.data()); + QCString ltype = type.simplifyWhiteSpace(); + QCString lname = name.simplifyWhiteSpace(); + if (ltype.left(7)=="struct ") + { + ltype = ltype.right(ltype.length()-7); + } + else if (ltype.left(6)=="union ") + { + ltype = ltype.right(ltype.length()-6); + } + if (ltype.isEmpty() || lname.isEmpty()) return; + DBG_CTX((stderr,"** addVariable trying: type='%s' name='%s' g_currentDefinition=%s\n", + ltype.data(),lname.data(),g_currentDefinition?g_currentDefinition->name().data():"")); + Scope *scope = m_scopes.count()==0 ? &m_globalScope : m_scopes.getLast(); + const ClassDef *varType; + int i=0; + if ( + (varType=yyextra->codeClassSDict->find(ltype)) || // look for class definitions inside the code block + (varType=getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,ltype)) // look for global class definitions + ) + { + DBG_CTX((stderr,"** addVariable type='%s' name='%s'\n",ltype.data(),lname.data())); + scope->append(lname,varType); // add it to a list + } + else if ((i=ltype.find('<'))!=-1) + { + // probably a template class + QCString typeName(ltype.left(i)); + ClassDef* newDef = 0; + QCString templateArgs(ltype.right(ltype.length() - i)); + if ( !typeName.isEmpty() && + ( // look for class definitions inside the code block + (varType=yyextra->codeClassSDict->find(typeName)) || + // otherwise look for global class definitions + (varType=getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,typeName,0,0,TRUE,TRUE)) + ) && // and it must be a template + !varType->templateArguments().empty()) + { + newDef = varType->getVariableInstance( templateArgs ); + } + if (newDef) + { + DBG_CTX((stderr,"** addVariable type='%s' templ='%s' name='%s'\n",typeName.data(),templateArgs.data(),lname.data())); + scope->append(lname, newDef); + } + else + { + // Doesn't seem to be a template. Try just the base name. + addVariable(yyscanner,typeName,name); + } + } + else + { + if (m_scopes.count()>0) // for local variables add a dummy entry so the name + // is hidden to avoid false links to global variables with the same name + // TODO: make this work for namespaces as well! + { + DBG_CTX((stderr,"** addVariable: dummy context for '%s'\n",lname.data())); + scope->append(lname,dummyContext); + } + else + { + DBG_CTX((stderr,"** addVariable: not adding variable!\n")); + } + } +} + +ClassDef *VariableContext::findVariable(const QCString &name) +{ + if (name.isEmpty()) return 0; + ClassDef *result = 0; + QListIterator sli(m_scopes); + Scope *scope; + QCString key = name; + // search from inner to outer scope + for (sli.toLast();(scope=sli.current());--sli) + { + result = scope->find(key); + if (result) + { + DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result)); + return result; + } + } + // nothing found -> also try the global scope + result=m_globalScope.find(name); + DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result)); + return result; +} + +const ClassDef *VariableContext::dummyContext = (ClassDef*)0x8; + +//------------------------------------------------------------------- + +/*! add class/namespace name s to the scope */ +static void pushScope(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + yyextra->classScopeLengthStack.push(new int(yyextra->classScope.length())); + if (yyextra->classScope.isEmpty() || leftScopeMatch(s,yyextra->classScope)) + { + yyextra->classScope = s; + } + else + { + yyextra->classScope += "::"; + yyextra->classScope += s; + } + //printf("pushScope(%s) result: '%s'\n",s,yyextra->classScope.data()); +} + + +/*! remove the top class/namespace name from the scope */ +static void popScope(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (!yyextra->classScopeLengthStack.isEmpty()) + { + int *pLength = yyextra->classScopeLengthStack.pop(); + yyextra->classScope.truncate(*pLength); + delete pLength; + } + else + { + //err("Too many end of scopes found!\n"); + } + //printf("popScope() result: '%s'\n",yyextra->classScope.data()); +} + +static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (Doxygen::searchIndex) + { + if (yyextra->searchCtx) + { + yyextra->code->setCurrentDoc(yyextra->searchCtx,yyextra->searchCtx->anchor(),FALSE); + } + else + { + yyextra->code->setCurrentDoc(yyextra->sourceFileDef,anchor,TRUE); + } + } +} + +static void addToSearchIndex(yyscan_t yyscanner,const char *text) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (Doxygen::searchIndex) + { + yyextra->code->addWord(text,FALSE); + } +} + +static void setClassScope(yyscan_t yyscanner,const QCString &name) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("setClassScope(%s)\n",name.data()); + QCString n=name; + n=n.simplifyWhiteSpace(); + int ts=n.find('<'); // start of template + int te=n.findRev('>'); // end of template + //printf("ts=%d te=%d\n",ts,te); + if (ts!=-1 && te!=-1 && te>ts) + { + // remove template from scope + n=n.left(ts)+n.right(n.length()-te-1); + } + while (!yyextra->classScopeLengthStack.isEmpty()) + { + popScope(yyscanner); + } + yyextra->classScope.resize(0); + int i; + while ((i=n.find("::"))!=-1) + { + pushScope(yyscanner,n.left(i)); + n = n.mid(i+2); + } + pushScope(yyscanner,n); + //printf("--->New class scope '%s'\n",yyextra->classScope.data()); +} + +/*! start a new line of code, inserting a line number if yyextra->sourceFileDef + * is TRUE. If a definition starts at the current line, then the line + * number is linked to the documentation of that definition. + */ +static void startCodeLine(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //if (yyextra->currentFontClass) { yyextra->code->endFontClass(yyscanner); } + if (yyextra->sourceFileDef && yyextra->lineNumbers) + { + //QCString lineNumber,lineAnchor; + //lineNumber.sprintf("%05d",yyextra->yyLineNr); + //lineAnchor.sprintf("l%05d",yyextra->yyLineNr); + + Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr); + //printf("%s:startCodeLine(%d)=%p\n",yyextra->sourceFileDef->name().data(),yyextra->yyLineNr,d); + if (!yyextra->includeCodeFragment && d) + { + yyextra->currentDefinition = d; + yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr); + yyextra->insideBody = FALSE; + yyextra->searchingForBody = TRUE; + yyextra->realScope = d->name(); + //yyextra->classScope = ""; + yyextra->type.resize(0); + yyextra->name.resize(0); + yyextra->args.resize(0); + yyextra->parmType.resize(0); + yyextra->parmName.resize(0); + //printf("Real scope: '%s'\n",yyextra->realScope.data()); + yyextra->bodyCurlyCount = 0; + QCString lineAnchor; + lineAnchor.sprintf("l%05d",yyextra->yyLineNr); + if (yyextra->currentMemberDef) + { + yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(), + yyextra->currentMemberDef->getOutputFileBase(), + yyextra->currentMemberDef->anchor(),yyextra->yyLineNr); + setCurrentDoc(yyscanner,lineAnchor); + } + else if (d->isLinkableInProject()) + { + yyextra->code->writeLineNumber(d->getReference(), + d->getOutputFileBase(), + 0,yyextra->yyLineNr); + setCurrentDoc(yyscanner,lineAnchor); + } + } + else + { + yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr); + } + } + DBG_CTX((stderr,"startCodeLine(%d)\n",yyextra->yyLineNr)); + yyextra->code->startCodeLine(yyextra->sourceFileDef && yyextra->lineNumbers); + if (yyextra->currentFontClass) + { + yyextra->code->startFontClass(yyextra->currentFontClass); + } +} + + + +static void endCodeLine(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + DBG_CTX((stderr,"endCodeLine(%d)\n",yyextra->yyLineNr)); + endFontClass(yyscanner); + yyextra->code->endCodeLine(); +} + +static void nextCodeLine(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + const char * fc = yyextra->currentFontClass; + endCodeLine(yyscanner); + if (yyextra->yyLineNrinputLines) + { + yyextra->currentFontClass = fc; + startCodeLine(yyscanner); + } +} + +/*! write a code fragment 'text' that may span multiple lines, inserting + * line numbers for each line. + */ +static void codifyLines(yyscan_t yyscanner,const char *text) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,text); + const char *p=text,*sp=p; + char c; + bool done=FALSE; + while (!done) + { + sp=p; + while ((c=*p++) && c!='\n') { yyextra->yyColNr++; } + if (c=='\n') + { + yyextra->yyLineNr++; + yyextra->yyColNr=1; + //*(p-1)='\0'; + int l = (int)(p-sp-1); + char *tmp = (char*)malloc(l+1); + memcpy(tmp,sp,l); + tmp[l]='\0'; + yyextra->code->codify(tmp); + free(tmp); + nextCodeLine(yyscanner); + } + else + { + yyextra->code->codify(sp); + done=TRUE; + } + } +} + +/*! writes a link to a fragment \a text that may span multiple lines, inserting + * line numbers for each line. If \a text contains newlines, the link will be + * split into multiple links with the same destination, one for each line. + */ +static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, + const Definition *d, + const char *text) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS); + TooltipManager::instance()->addTooltip(d); + QCString ref = d->getReference(); + QCString file = d->getOutputFileBase(); + QCString anchor = d->anchor(); + QCString tooltip; + if (!sourceTooltips) // fall back to simple "title" tooltips + { + tooltip = d->briefDescriptionAsTooltip(); + } + bool done=FALSE; + char *p=(char *)text; + while (!done) + { + char *sp=p; + char c; + while ((c=*p++) && c!='\n') { } + if (c=='\n') + { + yyextra->yyLineNr++; + *(p-1)='\0'; + //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp); + ol.writeCodeLink(ref,file,anchor,sp,tooltip); + nextCodeLine(yyscanner); + } + else + { + //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp); + ol.writeCodeLink(ref,file,anchor,sp,tooltip); + done=TRUE; + } + } +} + +static void addType(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->name=="const") { yyextra->name.resize(0); return; } + if (!yyextra->type.isEmpty()) yyextra->type += ' ' ; + yyextra->type += yyextra->name ; + yyextra->name.resize(0) ; + if (!yyextra->type.isEmpty()) yyextra->type += ' ' ; + yyextra->type += yyextra->args ; + yyextra->args.resize(0) ; +} + +static void addParmType(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->parmName=="const") { yyextra->parmName.resize(0); return; } + if (!yyextra->parmType.isEmpty()) yyextra->parmType += ' ' ; + yyextra->parmType += yyextra->parmName ; + yyextra->parmName.resize(0) ; +} + +static void addUsingDirective(yyscan_t yyscanner,const char *name) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->sourceFileDef && name) + { + NamespaceDef *nd = Doxygen::namespaceSDict->find(name); + if (nd) + { + yyextra->sourceFileDef->addUsingDirective(nd); + } + } +} + +static void setParameterList(yyscan_t yyscanner,const MemberDef *md) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + yyextra->classScope = md->getClassDef() ? md->getClassDef()->name().data() : ""; + for (const Argument &a : md->argumentList()) + { + yyextra->parmName = a.name; + yyextra->parmType = a.type; + int i = yyextra->parmType.find('*'); + if (i!=-1) yyextra->parmType = yyextra->parmType.left(i); + i = yyextra->parmType.find('&'); + if (i!=-1) yyextra->parmType = yyextra->parmType.left(i); + yyextra->parmType.stripPrefix("const "); + yyextra->parmType=yyextra->parmType.stripWhiteSpace(); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + } +} + +static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,Definition *d) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int pos=0; + QCString type = s; + QCString className; + QCString templSpec; + while (extractClassNameFromType(type,pos,className,templSpec)!=-1) + { + QCString clName=className+templSpec; + const ClassDef *cd=0; + if (!yyextra->classScope.isEmpty()) + { + cd=getResolvedClass(d,yyextra->sourceFileDef,yyextra->classScope+"::"+clName); + } + if (cd==0) + { + cd=getResolvedClass(d,yyextra->sourceFileDef,clName); + } + //printf("stripClass trying '%s' = %p\n",clName.data(),cd); + if (cd) + { + return cd; + } + } + + return 0; +} + +static MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &name) +{ + if (name.isEmpty()) return 0; + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + DBG_CTX((stderr,"setCallContextForVar(%s) yyextra->classScope=%s\n",name.data(),yyextra->classScope.data())); + + int scopeEnd = name.findRev("::"); + if (scopeEnd!=-1) // name with explicit scope + { + QCString scope = name.left(scopeEnd); + QCString locName = name.right(name.length()-scopeEnd-2); + //printf("explicit scope: name=%s scope=%s\n",locName.data(),scope.data()); + ClassDef *mcd = getClass(scope); + if (mcd && !locName.isEmpty()) + { + MemberDef *md=mcd->getMemberByName(locName); + if (md) + { + //printf("name=%s scope=%s\n",locName.data(),scope.data()); + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + return md; + } + } + else // check namespace as well + { + const NamespaceDef *mnd = getResolvedNamespace(scope); + if (mnd && !locName.isEmpty()) + { + MemberDef *md=mnd->getMemberByName(locName); + if (md) + { + //printf("name=%s scope=%s\n",locName.data(),scope.data()); + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + return md; + } + } + } + } + + MemberName *mn; + ClassDef *mcd = yyextra->theVarContext.findVariable(name); + if (mcd) // local variable + { + DBG_CTX((stderr,"local variable?\n")); + if (mcd!=VariableContext::dummyContext) + { + DBG_CTX((stderr,"local var '%s' mcd=%s\n",name.data(),mcd->name().data())); + yyextra->theCallContext.setScope(mcd); + } + } + else + { + DBG_CTX((stderr,"class member? scope=%s\n",yyextra->classScope.data())); + // look for a class member + mcd = getClass(yyextra->classScope); + if (mcd) + { + DBG_CTX((stderr,"Inside class %s\n",mcd->name().data())); + MemberDef *md=mcd->getMemberByName(name); + if (md) + { + DBG_CTX((stderr,"Found member %s\n",md->name().data())); + if (yyextra->scopeStack.top()!=CLASSBLOCK) + { + DBG_CTX((stderr,"class member '%s' mcd=%s\n",name.data(),mcd->name().data())); + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + } + return md; + } + } + } + + // look for a global member + if ((mn=Doxygen::functionNameSDict->find(name))) + { + //printf("global var '%s'\n",name.data()); + if (mn->count()==1) // global defined only once + { + MemberDef *md=mn->getFirst(); + if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef) + { + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + return md; + } + return 0; + } + else if (mn->count()>1) // global defined more than once + { + MemberNameIterator it(*mn); + MemberDef *md; + for (;(md=it.current());++it) + { + //printf("mn=%p md=%p md->getBodyDef()=%p yyextra->sourceFileDef=%p\n", + // mn,md, + // md->getBodyDef(),yyextra->sourceFileDef); + + // in case there are multiple members we could link to, we + // only link to members if defined in the same file or + // defined as external. + if ((!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef) && + (yyextra->forceTagReference.isEmpty() || yyextra->forceTagReference==md->getReference()) + ) + { + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + //printf("returning member %s in source file %s\n",md->name().data(),yyextra->sourceFileDef->name().data()); + return md; + } + } + return 0; + } + } + return 0; +} + +static void updateCallContextForSmartPointer(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + const Definition *d = yyextra->theCallContext.getScope(); + //printf("updateCallContextForSmartPointer() cd=%s\n",cd ? d->name().data() : ""); + MemberDef *md; + if (d && d->definitionType()==Definition::TypeClass && (md=(dynamic_cast(d))->isSmartPointer())) + { + const ClassDef *ncd = stripClassName(yyscanner,md->typeString(),md->getOuterScope()); + if (ncd) + { + yyextra->theCallContext.setScope(ncd); + //printf("Found smart pointer call %s->%s!\n",cd->name().data(),ncd->name().data()); + } + } +} + +static bool getLinkInScope(yyscan_t yyscanner, + const QCString &c, // scope + const QCString &m, // member + const char *memberText, // exact text + CodeOutputInterface &ol, + const char *text, + bool varOnly + ) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + const MemberDef *md = 0; + const ClassDef *cd = 0; + const FileDef *fd = 0; + const NamespaceDef *nd = 0; + const GroupDef *gd = 0; + DBG_CTX((stderr,"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",c.data(),m.data(),varOnly)); + if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,yyextra->sourceFileDef,FALSE,yyextra->forceTagReference) && + (!varOnly || md->isVariable())) + { + if (md->isLinkable()) + { + //printf("found it %s!\n",md->qualifiedName().data()); + if (yyextra->exampleBlock) + { + QCString anchor; + anchor.sprintf("a%d",yyextra->anchorCount); + //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(), + // yyextra->exampleFile.data()); + if (const_cast(md)->addExample(anchor,yyextra->exampleName,yyextra->exampleFile)) + { + ol.writeCodeAnchor(anchor); + yyextra->anchorCount++; + } + } + + const Definition *d = md->getOuterScope()==Doxygen::globalScope ? + md->resolveAlias()->getFileDef() : md->getOuterScope(); + if (md->resolveAlias()->getGroupDef()) d = md->resolveAlias()->getGroupDef(); + if (d && d->isLinkable()) + { + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + //printf("yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n", + // yyextra->currentDefinition,yyextra->currentMemberDef,yyextra->insideBody); + + if (yyextra->currentDefinition && yyextra->currentMemberDef && + md!=yyextra->currentMemberDef && yyextra->insideBody && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,const_cast(md)); + } + //printf("d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data()); + + writeMultiLineCodeLink(yyscanner,ol,md, text ? text : memberText); + addToSearchIndex(yyscanner,text ? text : memberText); + return TRUE; + } + } + else // found member, but it is not linkable, so make sure content inside is not assigned + // to the previous member, see bug762760 + { + DBG_CTX((stderr,"unlinkable member %s\n",md->name().data())); + yyextra->currentMemberDef = 0; + } + } + return FALSE; +} + +static bool getLink(yyscan_t yyscanner, + const char *className, + const char *memberName, + CodeOutputInterface &ol, + const char *text, + bool varOnly) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("getLink(%s,%s) yyextra->curClassName=%s\n",className,memberName,yyextra->curClassName.data()); + QCString m=removeRedundantWhiteSpace(memberName); + QCString c=className; + if (!getLinkInScope(yyscanner,c,m,memberName,ol,text,varOnly)) + { + if (!yyextra->curClassName.isEmpty()) + { + if (!c.isEmpty()) c.prepend("::"); + c.prepend(yyextra->curClassName); + return getLinkInScope(yyscanner,c,m,memberName,ol,text,varOnly); + } + return FALSE; + } + return TRUE; +} + +static void generateClassOrGlobalLink(yyscan_t yyscanner, + CodeOutputInterface &ol, + const char *clName, + bool typeOnly, + bool varOnly) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int i=0; + if (*clName=='~') // correct for matching negated values i.s.o. destructors. + { + yyextra->code->codify("~"); + clName++; + } + QCString className=clName; + if (className.isEmpty()) return; + if (yyextra->insideProtocolList) // for Obj-C + { + className+="-p"; + } + if (yyextra->lang==SrcLangExt_PHP) + { + className = substitute(className,"\\","::"); // for PHP namespaces + } + else if (yyextra->lang==SrcLangExt_CSharp || yyextra->lang==SrcLangExt_Java) + { + className = substitute(className,".","::"); // for PHP namespaces + } + const ClassDef *cd=0,*lcd=0; + const MemberDef *md=0; + bool isLocal=FALSE; + + //printf("generateClassOrGlobalLink(className=%s)\n",className.data()); + if (!yyextra->prefixed_with_this_keyword || (lcd=yyextra->theVarContext.findVariable(className))==0) // not a local variable + { + Definition *d = yyextra->currentDefinition; + //printf("d=%s yyextra->sourceFileDef=%s\n",d?d->name().data():"",yyextra->sourceFileDef?yyextra->sourceFileDef->name().data():""); + cd = getResolvedClass(d,yyextra->sourceFileDef,className,&md); + DBG_CTX((stderr,"non-local variable name=%s context=%d cd=%s md=%s!\n", + className.data(),yyextra->theVarContext.count(),cd?cd->name().data():"", + md?md->name().data():"")); + if (cd==0 && md==0 && (i=className.find('<'))!=-1) + { + QCString bareName = className.left(i); //stripTemplateSpecifiersFromScope(className); + DBG_CTX((stderr,"bareName=%s\n",bareName.data())); + if (bareName!=className) + { + cd=getResolvedClass(d,yyextra->sourceFileDef,bareName,&md); // try unspecialized version + } + } + const NamespaceDef *nd = getResolvedNamespace(className); + if (nd && nd->isLinkable()) + { + yyextra->theCallContext.setScope(nd); + addToSearchIndex(yyscanner,className); + writeMultiLineCodeLink(yyscanner,*yyextra->code,nd,clName); + return; + } + //printf("md=%s\n",md?md->name().data():""); + DBG_CTX((stderr,"is found as a type cd=%s nd=%s\n", + cd?cd->name().data():"", + nd?nd->name().data():"")); + if (cd==0 && md==0) // also see if it is variable or enum or enum value + { + if (getLink(yyscanner,yyextra->classScope,clName,ol,clName,varOnly)) + { + return; + } + } + } + else + { + //printf("local variable!\n"); + if (lcd!=VariableContext::dummyContext) + { + //printf("non-dummy context lcd=%s!\n",lcd->name().data()); + yyextra->theCallContext.setScope(lcd); + + // to following is needed for links to a global variable, but is + // no good for a link to a local variable that is also a global symbol. + + //if (getLink(yyscanner,yyextra->classScope,clName,ol,clName)) + //{ + //return; + //} + } + isLocal=TRUE; + DBG_CTX((stderr,"is a local variable cd=%p!\n",cd)); + } + yyextra->prefixed_with_this_keyword = FALSE; // discard the "this" prefix for the next calls + + if (cd && cd->isLinkable()) // is it a linkable class + { + DBG_CTX((stderr,"is linkable class %s\n",clName)); + if (yyextra->exampleBlock) + { + QCString anchor; + anchor.sprintf("_a%d",yyextra->anchorCount); + //printf("addExampleClass(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(), + // yyextra->exampleFile.data()); + if (const_cast(cd)->addExample(anchor,yyextra->exampleName,yyextra->exampleFile)) + { + ol.writeCodeAnchor(anchor); + yyextra->anchorCount++; + } + } + writeMultiLineCodeLink(yyscanner,ol,cd,clName); + addToSearchIndex(yyscanner,className); + yyextra->theCallContext.setScope(cd); + if (md) + { + const Definition *d = md->getOuterScope()==Doxygen::globalScope ? + md->getFileDef() : md->getOuterScope(); + if (md->getGroupDef()) d = md->getGroupDef(); + if (d && d->isLinkable() && md->isLinkable() && + yyextra->currentMemberDef && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,const_cast(md)); + } + } + } + else // not a class, maybe a global member + { + DBG_CTX((stderr,"class %s not linkable! cd=%p md=%p typeOnly=%d\n",clName,cd,md,typeOnly)); + if (!isLocal && (md!=0 || (cd==0 && !typeOnly))) // not a class, see if it is a global enum/variable/typedef. + { + if (md==0) // not found as a typedef + { + md = setCallContextForVar(yyscanner,clName); + //printf("setCallContextForVar(%s) md=%p yyextra->currentDefinition=%p\n",clName,md,yyextra->currentDefinition); + if (md && yyextra->currentDefinition) + { + DBG_CTX((stderr,"%s accessible from %s? %d md->getOuterScope=%s\n", + md->name().data(),yyextra->currentDefinition->name().data(), + isAccessibleFrom(yyextra->currentDefinition,yyextra->sourceFileDef,md), + md->getOuterScope()->name().data())); + } + + if (md && yyextra->currentDefinition && + isAccessibleFrom(yyextra->currentDefinition,yyextra->sourceFileDef,md)==-1) + { + md=0; // variable not accessible + } + } + if (md && (!varOnly || md->isVariable())) + { + DBG_CTX((stderr,"is a global md=%p yyextra->currentDefinition=%s linkable=%d\n",md,yyextra->currentDefinition?yyextra->currentDefinition->name().data():"",md->isLinkable())); + if (md->isLinkable()) + { + QCString text; + if (!yyextra->forceTagReference.isEmpty()) // explicit reference to symbol in tag file + { + text=yyextra->forceTagReference; + if (text.right(4)==".tag") // strip .tag if present + { + text=text.left(text.length()-4); + } + text+=getLanguageSpecificSeparator(md->getLanguage()); + text+=clName; + const_cast(md)->setName(text); + const_cast(md)->setLocalName(text); + } + else // normal reference + { + text=clName; + } + writeMultiLineCodeLink(yyscanner,ol,md,text); + addToSearchIndex(yyscanner,clName); + if (yyextra->currentMemberDef && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,const_cast(md)); + } + return; + } + } + } + + // nothing found, just write out the word + DBG_CTX((stderr,"not found!\n")); + codifyLines(yyscanner,clName); + addToSearchIndex(yyscanner,clName); + } +} + +static bool generateClassMemberLink(yyscan_t yyscanner, + CodeOutputInterface &ol, + MemberDef *xmd, + const char *memName) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + // extract class definition of the return type in order to resolve + // a->b()->c() like call chains + + //printf("type='%s' args='%s' class=%s\n", + // xmd->typeString(),xmd->argsString(), + // xmd->getClassDef()->name().data()); + + if (yyextra->exampleBlock) + { + QCString anchor; + anchor.sprintf("a%d",yyextra->anchorCount); + //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(), + // yyextra->exampleFile.data()); + if (xmd->addExample(anchor,yyextra->exampleName,yyextra->exampleFile)) + { + ol.writeCodeAnchor(anchor); + yyextra->anchorCount++; + } + } + + const ClassDef *typeClass = stripClassName(yyscanner,removeAnonymousScopes(xmd->typeString()),xmd->getOuterScope()); + DBG_CTX((stderr,"%s -> typeName=%p\n",xmd->typeString(),typeClass)); + yyextra->theCallContext.setScope(typeClass); + + const Definition *xd = xmd->getOuterScope()==Doxygen::globalScope ? + xmd->getFileDef() : xmd->getOuterScope(); + if (xmd->getGroupDef()) xd = xmd->getGroupDef(); + if (xd && xd->isLinkable()) + { + + //printf("yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",yyextra->currentDefinition,yyextra->currentMemberDef,xmd,yyextra->insideBody); + + if (xmd->templateMaster()) xmd = xmd->templateMaster(); + + if (xmd->isLinkable()) + { + // add usage reference + if (yyextra->currentDefinition && yyextra->currentMemberDef && + /*xmd!=yyextra->currentMemberDef &&*/ yyextra->insideBody && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,xmd); + } + + // write the actual link + writeMultiLineCodeLink(yyscanner,ol,xmd,memName); + addToSearchIndex(yyscanner,memName); + return TRUE; + } + } + + return FALSE; +} + +static bool generateClassMemberLink(yyscan_t yyscanner, + CodeOutputInterface &ol, + const Definition *def, + const char *memName) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (def && def->definitionType()==Definition::TypeClass) + { + const ClassDef *cd = dynamic_cast(def); + MemberDef *xmd = cd->getMemberByName(memName); + //printf("generateClassMemberLink(class=%s,member=%s)=%p\n",def->name().data(),memName,xmd); + if (xmd) + { + return generateClassMemberLink(yyscanner,ol,xmd,memName); + } + else + { + Definition *innerDef = cd->findInnerCompound(memName); + if (innerDef) + { + yyextra->theCallContext.setScope(innerDef); + addToSearchIndex(yyscanner,memName); + writeMultiLineCodeLink(yyscanner,*yyextra->code,innerDef,memName); + return TRUE; + } + } + } + else if (def && def->definitionType()==Definition::TypeNamespace) + { + const NamespaceDef *nd = dynamic_cast(def); + //printf("Looking for %s inside namespace %s\n",memName,nd->name().data()); + Definition *innerDef = nd->findInnerCompound(memName); + if (innerDef) + { + yyextra->theCallContext.setScope(innerDef); + addToSearchIndex(yyscanner,memName); + writeMultiLineCodeLink(yyscanner,*yyextra->code,innerDef,memName); + return TRUE; + } + } + return FALSE; +} + +static void generateMemberLink(yyscan_t yyscanner, + CodeOutputInterface &ol, + const QCString &varName, + const char *memName) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("generateMemberLink(object=%s,mem=%s) classScope=%s\n", + // varName.data(),memName,yyextra->classScope.data()); + + if (varName.isEmpty()) return; + + // look for the variable in the current context + const ClassDef *vcd = yyextra->theVarContext.findVariable(varName); + if (vcd) + { + if (vcd!=VariableContext::dummyContext) + { + //printf("Class found!\n"); + if (getLink(yyscanner,vcd->name(),memName,ol)) + { + //printf("Found result!\n"); + return; + } + if (vcd->baseClasses()) + { + BaseClassListIterator bcli(*vcd->baseClasses()); + for ( ; bcli.current() ; ++bcli) + { + if (getLink(yyscanner,bcli.current()->classDef->name(),memName,ol)) + { + //printf("Found result!\n"); + return; + } + } + } + } + } + else // variable not in current context, maybe it is in a parent context + { + vcd = getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,yyextra->classScope); + if (vcd && vcd->isLinkable()) + { + //printf("Found class %s for variable '%s'\n",yyextra->classScope.data(),varName.data()); + MemberName *vmn=Doxygen::memberNameSDict->find(varName); + if (vmn==0) + { + int vi; + QCString vn=varName; + if ((vi=vn.findRev("::"))!=-1 || (vi=vn.findRev('.'))!=-1) // explicit scope A::b(), probably static member + { + ClassDef *jcd = getClass(vn.left(vi)); + vn=vn.right(vn.length()-vi-2); + vmn=Doxygen::memberNameSDict->find(vn); + //printf("Trying name '%s' scope=%s\n",vn.data(),scope.data()); + if (vmn) + { + MemberNameIterator vmni(*vmn); + const MemberDef *vmd; + for (;(vmd=vmni.current());++vmni) + { + if (/*(vmd->isVariable() || vmd->isFunction()) && */ + vmd->getClassDef()==jcd) + { + //printf("Found variable type=%s\n",vmd->typeString()); + const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope()); + if (mcd && mcd->isLinkable()) + { + if (generateClassMemberLink(yyscanner,ol,mcd,memName)) return; + } + } + } + } + } + } + if (vmn) + { + //printf("There is a variable with name '%s'\n",varName); + MemberNameIterator vmni(*vmn); + const MemberDef *vmd; + for (;(vmd=vmni.current());++vmni) + { + if (/*(vmd->isVariable() || vmd->isFunction()) && */ + vmd->getClassDef()==vcd) + { + //printf("Found variable type=%s\n",vmd->typeString()); + const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope()); + if (mcd && mcd->isLinkable()) + { + if (generateClassMemberLink(yyscanner,ol,mcd,memName)) return; + } + } + } + } + } + } + // nothing found -> write result as is + codifyLines(yyscanner,memName); + addToSearchIndex(yyscanner,memName); + return; +} + +static void generatePHPVariableLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *varName) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + QCString name = varName+7; // strip $this-> + name.prepend("$"); + //printf("generatePHPVariableLink(%s) name=%s scope=%s\n",varName,name.data(),yyextra->classScope.data()); + if (!getLink(yyscanner,yyextra->classScope,name,ol,varName)) + { + codifyLines(yyscanner,varName); + } +} + +static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *funcName) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //CodeClassDef *ccd=0; + ClassDef *ccd=0; + QCString locScope=yyextra->classScope; + QCString locFunc=removeRedundantWhiteSpace(funcName); + if (yyextra->lang==SrcLangExt_PHP && locFunc.startsWith("self::")) locFunc=locFunc.mid(4); + QCString funcScope; + QCString funcWithScope=locFunc; + QCString funcWithFullScope=locFunc; + QCString fullScope=locScope; + DBG_CTX((stdout,"*** locScope=%s locFunc=%s\n",locScope.data(),locFunc.data())); + int len=2; + int i=locFunc.findRev("::"); + if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() && + funcName==yyextra->currentMemberDef->localName() && + yyextra->currentMemberDef->getDefLine()==yyextra->yyLineNr && + generateClassMemberLink(yyscanner,ol,yyextra->currentMemberDef,funcName) + ) + { + // special case where funcName is the name of a method that is also + // defined on this line. In this case we can directly link to + // yyextra->currentMemberDef, which is not only faster, but + // in case of overloaded methods, this will make sure that we link to + // the correct method, and thereby get the correct reimplemented relations. + // See also bug 549022. + goto exit; + } + if (i==-1) i=locFunc.findRev("."),len=1; + if (i==-1) i=locFunc.findRev("\\"),len=1; // for PHP + if (i>0) + { + funcScope=locFunc.left(i); + locFunc=locFunc.right(locFunc.length()-i-len).stripWhiteSpace(); + int ts=locScope.find('<'); // start of template + int te=locScope.findRev('>'); // end of template + //printf("ts=%d te=%d\n",ts,te); + if (ts!=-1 && te!=-1 && te>ts) + { + // remove template from scope + locScope=locScope.left(ts)+locScope.right(locScope.length()-te-1); + } + ts=funcScope.find('<'); // start of template + te=funcScope.findRev('>'); // end of template + //printf("ts=%d te=%d\n",ts,te); + if (ts!=-1 && te!=-1 && te>ts) + { + // remove template from scope + funcScope=funcScope.left(ts)+funcScope.right(funcScope.length()-te-1); + } + if (!funcScope.isEmpty()) + { + funcWithScope = funcScope+"::"+locFunc; + if (!locScope.isEmpty()) + { + fullScope=locScope+"::"+funcScope; + } + } + if (!locScope.isEmpty()) + { + funcWithFullScope = locScope+"::"+funcWithScope; + } + } + if (!fullScope.isEmpty() && (ccd=yyextra->codeClassSDict->find(fullScope))) + { + //printf("using classScope %s\n",yyextra->classScope.data()); + if (ccd->baseClasses()) + { + BaseClassListIterator bcli(*ccd->baseClasses()); + for ( ; bcli.current() ; ++bcli) + { + if (getLink(yyscanner,bcli.current()->classDef->name(),locFunc,ol,funcName)) + { + goto exit; + } + } + } + } + if (!locScope.isEmpty() && fullScope!=locScope && (ccd=yyextra->codeClassSDict->find(locScope))) + { + //printf("using classScope %s\n",yyextra->classScope.data()); + if (ccd->baseClasses()) + { + BaseClassListIterator bcli(*ccd->baseClasses()); + for ( ; bcli.current() ; ++bcli) + { + if (getLink(yyscanner,bcli.current()->classDef->name(),funcWithScope,ol,funcName)) + { + goto exit; + } + } + } + } + if (!getLink(yyscanner,locScope,funcWithScope,ol,funcName)) + { + generateClassOrGlobalLink(yyscanner,ol,funcName); + } +exit: + yyextra->forceTagReference.resize(0); + return; +} + +/*! counts the number of lines in the input */ +static int countLines(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + const char *p=yyextra->inputString; + char c; + int count=1; + while ((c=*p)) + { + p++ ; + if (c=='\n') count++; + } + if (p>yyextra->inputString && *(p-1)!='\n') + { // last line does not end with a \n, so we add an extra + // line and explicitly terminate the line after parsing. + count++, + yyextra->needsTermination=TRUE; + } + return count; +} + +static void endFontClass(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->currentFontClass) + { + yyextra->code->endFontClass(); + yyextra->currentFontClass=0; + } +} + +static void startFontClass(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + endFontClass(yyscanner); + yyextra->code->startFontClass(s); + yyextra->currentFontClass=s; +} + +//---------------------------------------------------------------------------- + +// recursively writes a linkified Objective-C method call +static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx) +{ + if (ctx==0) return; + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + char c; + const char *p = ctx->format.data(); + if (!ctx->methodName.isEmpty()) + { + //printf("writeObjCMethodCall(%s) obj=%s method=%s\n", + // ctx->format.data(),ctx->objectTypeOrName.data(),ctx->methodName.data()); + if (!ctx->objectTypeOrName.isEmpty() && ctx->objectTypeOrName.at(0)!='$') + { + //printf("Looking for object=%s method=%s\n",ctx->objectTypeOrName.data(), + // ctx->methodName.data()); + ClassDef *cd = yyextra->theVarContext.findVariable(ctx->objectTypeOrName); + if (cd==0) // not a local variable + { + if (ctx->objectTypeOrName=="self") + { + if (yyextra->currentDefinition && + yyextra->currentDefinition->definitionType()==Definition::TypeClass) + { + ctx->objectType = dynamic_cast(yyextra->currentDefinition); + } + } + else + { + ctx->objectType = getResolvedClass( + yyextra->currentDefinition, + yyextra->sourceFileDef, + ctx->objectTypeOrName, + &ctx->method); + } + //printf(" object is class? %p\n",ctx->objectType); + if (ctx->objectType) // found class + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + //printf(" yes->method=%s\n",ctx->method?ctx->method->name().data():""); + } + else if (ctx->method==0) // search for class variable with the same name + { + //printf(" no\n"); + //printf("yyextra->currentDefinition=%p\n",yyextra->currentDefinition); + if (yyextra->currentDefinition && + yyextra->currentDefinition->definitionType()==Definition::TypeClass) + { + ctx->objectVar = (dynamic_cast(yyextra->currentDefinition))->getMemberByName(ctx->objectTypeOrName); + //printf(" ctx->objectVar=%p\n",ctx->objectVar); + if (ctx->objectVar) + { + ctx->objectType = stripClassName(yyscanner,ctx->objectVar->typeString(),yyextra->currentDefinition); + //printf(" ctx->objectType=%p\n",ctx->objectType); + if (ctx->objectType && !ctx->methodName.isEmpty()) + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + //printf(" ctx->method=%p\n",ctx->method); + } + } + } + } + } + else // local variable + { + //printf(" object is local variable\n"); + if (cd!=VariableContext::dummyContext && !ctx->methodName.isEmpty()) + { + ctx->method = cd->getMemberByName(ctx->methodName); + //printf(" class=%p method=%p\n",cd,ctx->method); + } + } + } + } + + //printf("["); + while ((c=*p++)) // for each character in ctx->format + { + if (c=='$') + { + char nc=*p++; + if (nc=='$') // escaped $ + { + yyextra->code->codify("$"); + } + else // name fragment or reference to a nested call + { + if (nc=='n') // name fragment + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + QCString *pName = yyextra->nameDict.find(refId); + if (pName) + { + if (ctx->method && ctx->method->isLinkable()) + { + writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->method,pName->data()); + if (yyextra->currentMemberDef && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,const_cast(ctx->method)); + } + } + else + { + codifyLines(yyscanner,pName->data()); + } + } + else + { + //printf("Invalid name: id=%d\n",refId); + } + } + else if (nc=='o') // reference to potential object name + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + QCString *pObject = yyextra->objectDict.find(refId); + if (pObject) + { + if (*pObject=="self") + { + if (yyextra->currentDefinition && + yyextra->currentDefinition->definitionType()==Definition::TypeClass) + { + ctx->objectType = dynamic_cast(yyextra->currentDefinition); + if (ctx->objectType->categoryOf()) + { + ctx->objectType = ctx->objectType->categoryOf(); + } + if (ctx->objectType && !ctx->methodName.isEmpty()) + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + } + } + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,pObject->data()); + endFontClass(yyscanner); + } + else if (*pObject=="super") + { + if (yyextra->currentDefinition && + yyextra->currentDefinition->definitionType()==Definition::TypeClass) + { + ClassDef *cd = dynamic_cast(yyextra->currentDefinition); + if (cd->categoryOf()) + { + cd = cd->categoryOf(); + } + BaseClassList *bcd = cd->baseClasses(); + if (bcd) // get direct base class (there should be only one) + { + BaseClassListIterator bli(*bcd); + BaseClassDef *bclass; + for (bli.toFirst();(bclass=bli.current());++bli) + { + if (bclass->classDef->compoundType()!=ClassDef::Protocol) + { + ctx->objectType = bclass->classDef; + if (ctx->objectType && !ctx->methodName.isEmpty()) + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + } + } + } + } + } + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,pObject->data()); + endFontClass(yyscanner); + } + else if (ctx->objectVar && ctx->objectVar->isLinkable()) // object is class variable + { + writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->objectVar,pObject->data()); + if (yyextra->currentMemberDef && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,const_cast(ctx->objectVar)); + } + } + else if (ctx->objectType && + ctx->objectType!=VariableContext::dummyContext && + ctx->objectType->isLinkable() + ) // object is class name + { + const ClassDef *cd = ctx->objectType; + writeMultiLineCodeLink(yyscanner,*yyextra->code,cd,pObject->data()); + } + else // object still needs to be resolved + { + const ClassDef *cd = getResolvedClass(yyextra->currentDefinition, + yyextra->sourceFileDef, *pObject); + if (cd && cd->isLinkable()) + { + if (ctx->objectType==0) ctx->objectType=cd; + writeMultiLineCodeLink(yyscanner,*yyextra->code,cd,pObject->data()); + } + else + { + codifyLines(yyscanner,pObject->data()); + } + } + } + else + { + //printf("Invalid object: id=%d\n",refId); + } + } + else if (nc=='c') // reference to nested call + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + ObjCCallCtx *ictx = yyextra->contextDict.find(refId); + if (ictx) // recurse into nested call + { + writeObjCMethodCall(yyscanner,ictx); + if (ictx->method) // link to nested call successfully + { + // get the ClassDef representing the method's return type + if (QCString(ictx->method->typeString())=="id") + { + // see if the method name is unique, if so we link to it + MemberName *mn=Doxygen::memberNameSDict->find(ctx->methodName); + //printf("mn->count=%d ictx->method=%s ctx->methodName=%s\n", + // mn==0?-1:(int)mn->count(), + // ictx->method->name().data(), + // ctx->methodName.data()); + if (mn && mn->count()==1) // member name unique + { + ctx->method = mn->getFirst(); + } + } + else + { + ctx->objectType = stripClassName(yyscanner,ictx->method->typeString(),yyextra->currentDefinition); + if (ctx->objectType && !ctx->methodName.isEmpty()) + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + } + } + //printf(" ***** method=%s -> object=%p\n",ictx->method->name().data(),ctx->objectType); + } + } + else + { + //printf("Invalid context: id=%d\n",refId); + } + } + else if (nc=='w') // some word + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + QCString *pWord = yyextra->wordDict.find(refId); + if (pWord) + { + codifyLines(yyscanner,pWord->data()); + } + } + else if (nc=='d') // comment block + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + QCString *pComment = yyextra->commentDict.find(refId); + if (pComment) + { + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,pComment->data()); + endFontClass(yyscanner); + } + } + else // illegal marker + { + ASSERT(!"invalid escape sequence"); + } + } + } + else // normal non-marker character + { + char s[2]; + s[0]=c;s[1]=0; + codifyLines(yyscanner,s); + } + } + //printf("%s %s]\n",ctx->objectTypeOrName.data(),ctx->methodName.data()); + //printf("}=(type='%s',name='%s')", + // ctx->objectTypeOrName.data(), + // ctx->methodName.data()); +} + +// Replaces an Objective-C method name fragment s by a marker of the form +// $n12, the number (12) can later be used as a key for obtaining the name +// fragment, from yyextra->nameDict +static QCString escapeName(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + QCString result; + result.sprintf("$n%d",yyextra->currentNameId); + yyextra->nameDict.insert(yyextra->currentNameId,new QCString(s)); + yyextra->currentNameId++; + return result; +} + +static QCString escapeObject(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + QCString result; + result.sprintf("$o%d",yyextra->currentObjId); + yyextra->objectDict.insert(yyextra->currentObjId,new QCString(s)); + yyextra->currentObjId++; + return result; +} + +static QCString escapeWord(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + QCString result; + result.sprintf("$w%d",yyextra->currentWordId); + yyextra->wordDict.insert(yyextra->currentWordId,new QCString(s)); + yyextra->currentWordId++; + return result; +} + +static QCString escapeComment(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + QCString result; + result.sprintf("$d%d",yyextra->currentCommentId); + yyextra->commentDict.insert(yyextra->currentCommentId,new QCString(s)); + yyextra->currentCommentId++; + return result; +} + +static bool skipLanguageSpecificKeyword(yyscan_t yyscanner,const QCString &kw) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + return yyextra->lang==SrcLangExt_Cpp && (kw == "remove" || kw == "set" || kw == "get"); +} + +static bool isCastKeyword(const QCString &s) +{ + int i=s.find('<'); + if (i==-1) return FALSE; + QCString kw = s.left(i).stripWhiteSpace(); + return kw=="const_cast" || kw=="static_cast" || kw=="dynamic_cast" || kw=="reinterpret_cast"; +} + +static int yyread(yyscan_t yyscanner,char *buf,int max_size) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int inputPosition = yyextra->inputPosition; + const char *s = yyextra->inputString + yyextra->inputPosition; + int c=0; + while( c < max_size && *s ) + { + *buf++ = *s++; + c++; + } + yyextra->inputPosition += c; + return c; +} -/*@ ---------------------------------------------------------------------------- - */ -static void saveObjCContext() +static void saveObjCContext(yyscan_t yyscanner) { - if (g_currentCtx) + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->currentCtx) { - g_currentCtx->format+=QCString().sprintf("$c%d",g_currentCtxId); - if (g_braceCount==0 && YY_START==ObjCCall) + yyextra->currentCtx->format+=QCString().sprintf("$c%d",yyextra->currentCtxId); + if (yyextra->braceCount==0 && YY_START==ObjCCall) { - g_currentCtx->objectTypeOrName=g_currentCtx->format.mid(1); - //printf("new type=%s\n",g_currentCtx->objectTypeOrName.data()); + yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1); + //printf("new type=%s\n",yyextra->currentCtx->objectTypeOrName.data()); } - g_contextStack.push(g_currentCtx); + yyextra->contextStack.push(yyextra->currentCtx); } else { //printf("Trying to save NULL context!\n"); } ObjCCallCtx *newCtx = new ObjCCallCtx; - newCtx->id = g_currentCtxId; + newCtx->id = yyextra->currentCtxId; newCtx->lexState = YY_START; - newCtx->braceCount = g_braceCount; + newCtx->braceCount = yyextra->braceCount; newCtx->objectType = 0; newCtx->objectVar = 0; newCtx->method = 0; //printf("save state=%d\n",YY_START); - g_contextDict.insert(g_currentCtxId,newCtx); - g_currentCtx = newCtx; - g_braceCount = 0; - g_currentCtxId++; + yyextra->contextDict.insert(yyextra->currentCtxId,newCtx); + yyextra->currentCtx = newCtx; + yyextra->braceCount = 0; + yyextra->currentCtxId++; } -static void restoreObjCContext() +static void restoreObjCContext(yyscan_t yyscanner) { - //printf("restore state=%d->%d\n",YY_START,g_currentCtx->lexState); - BEGIN(g_currentCtx->lexState); - g_braceCount = g_currentCtx->braceCount; - if (!g_contextStack.isEmpty()) + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState); + BEGIN(yyextra->currentCtx->lexState); + yyextra->braceCount = yyextra->currentCtx->braceCount; + if (!yyextra->contextStack.isEmpty()) { - g_currentCtx = g_contextStack.pop(); + yyextra->currentCtx = yyextra->contextStack.pop(); } else { - g_currentCtx = 0; - //printf("Trying to pop context while g_contextStack is empty!\n"); + yyextra->currentCtx = 0; + //printf("Trying to pop context while yyextra->contextStack is empty!\n"); } } -void resetCCodeParserState() +struct CodeScanner::Private +{ + yyscan_t yyscanner; + codeYY_state state; +}; + +CodeScanner::CodeScanner() +{ + p = new Private; + codeYYlex_init_extra(&p->state,&p->yyscanner); + YY_EXTRA_TYPE state = codeYYget_extra(p->yyscanner); +} + +CodeScanner::~CodeScanner() { - //printf("***initParseCodeContext()\n"); - g_forceTagReference.resize(0); - g_theVarContext.clear(); - g_classScopeLengthStack.setAutoDelete(TRUE); - g_classScopeLengthStack.clear(); - delete g_codeClassSDict; - g_codeClassSDict = new ClassSDict(17); - g_codeClassSDict->setAutoDelete(TRUE); - g_codeClassSDict->clear(); - g_curClassBases.clear(); - g_anchorCount = 0; + codeYYlex_destroy(p->yyscanner); + delete p; } -void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, +void CodeScanner::reset() +{ + struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; + //printf("***CodeParser::reset()\n"); + yyextra->forceTagReference.resize(0); + yyextra->theVarContext.clear(); + yyextra->classScopeLengthStack.setAutoDelete(TRUE); + yyextra->classScopeLengthStack.clear(); + delete yyextra->codeClassSDict; + yyextra->codeClassSDict = new ClassSDict(17); + yyextra->codeClassSDict->setAutoDelete(TRUE); + yyextra->codeClassSDict->clear(); + yyextra->curClassBases.clear(); + yyextra->anchorCount = 0; +} + +void CodeScanner::parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, SrcLangExt lang,bool exBlock, const char *exName,FileDef *fd, int startLine,int endLine,bool inlineFragment, const MemberDef *memberDef,bool showLineNumbers,const Definition *searchCtx, bool collectXRefs) { + yyscan_t yyscanner = p->yyscanner; + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("***parseCode() exBlock=%d exName=%s fd=%p className=%s searchCtx=%s\n", // exBlock,exName,fd,className,searchCtx?searchCtx->name().data():""); @@ -3778,103 +3911,92 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL); - if (g_codeClassSDict==0) + if (yyextra->codeClassSDict==0) { - resetCCodeParserState(); + reset(); } - g_code = &od; - g_inputString = s; - g_inputPosition = 0; - g_currentFontClass = 0; - g_needsTermination = FALSE; - g_searchCtx = searchCtx; - g_collectXRefs = collectXRefs; - g_inFunctionTryBlock = FALSE; + yyextra->code = &od; + yyextra->inputString = s; + yyextra->inputPosition = 0; + yyextra->currentFontClass = 0; + yyextra->needsTermination = FALSE; + yyextra->searchCtx = searchCtx; + yyextra->collectXRefs = collectXRefs; + yyextra->inFunctionTryBlock = FALSE; if (startLine!=-1) - g_yyLineNr = startLine; + yyextra->yyLineNr = startLine; else - g_yyLineNr = 1; + yyextra->yyLineNr = 1; if (endLine!=-1) - g_inputLines = endLine+1; + yyextra->inputLines = endLine+1; else - g_inputLines = g_yyLineNr + countLines() - 1; - - g_curlyCount = 0; - g_bodyCurlyCount = 0; - g_bracketCount = 0; - g_sharpCount = 0; - g_insideTemplate = FALSE; - g_theCallContext.clear(); - g_scopeStack.clear(); - g_classScope = className; + yyextra->inputLines = yyextra->yyLineNr + countLines(yyscanner) - 1; + + yyextra->curlyCount = 0; + yyextra->bodyCurlyCount = 0; + yyextra->bracketCount = 0; + yyextra->sharpCount = 0; + yyextra->insideTemplate = FALSE; + yyextra->theCallContext.clear(); + yyextra->scopeStack.clear(); + yyextra->classScope = className; //printf("parseCCode %s\n",className); - g_exampleBlock = exBlock; - g_exampleName = exName; - g_sourceFileDef = fd; - g_lineNumbers = fd!=0 && showLineNumbers; + yyextra->exampleBlock = exBlock; + yyextra->exampleName = exName; + yyextra->sourceFileDef = fd; + yyextra->lineNumbers = fd!=0 && showLineNumbers; bool cleanupSourceDef = FALSE; if (fd==0) { // create a dummy filedef for the example - g_sourceFileDef = createFileDef("",(exName?exName:"generated")); + yyextra->sourceFileDef = createFileDef("",(exName?exName:"generated")); cleanupSourceDef = TRUE; } - g_lang = lang; - g_insideObjC = lang==SrcLangExt_ObjC; - if (g_sourceFileDef) + yyextra->lang = lang; + yyextra->insideObjC = lang==SrcLangExt_ObjC; + if (yyextra->sourceFileDef) { - setCurrentDoc("l00001"); + setCurrentDoc(yyscanner,"l00001"); } - g_currentDefinition = 0; - g_currentMemberDef = 0; - g_searchingForBody = exBlock; - g_insideBody = FALSE; - g_bracketCount = 0; - if (!g_exampleName.isEmpty()) + yyextra->currentDefinition = 0; + yyextra->currentMemberDef = 0; + yyextra->searchingForBody = exBlock; + yyextra->insideBody = FALSE; + yyextra->bracketCount = 0; + if (!yyextra->exampleName.isEmpty()) { - g_exampleFile = convertNameToFile(g_exampleName+"-example",FALSE,TRUE); - //printf("g_exampleFile=%s\n",g_exampleFile.data()); + yyextra->exampleFile = convertNameToFile(yyextra->exampleName+"-example",FALSE,TRUE); + //printf("yyextra->exampleFile=%s\n",yyextra->exampleFile.data()); } - g_includeCodeFragment = inlineFragment; + yyextra->includeCodeFragment = inlineFragment; //printf("** exBlock=%d exName=%s include=%d\n",exBlock,exName,inlineFragment); - startCodeLine(); - g_type.resize(0); - g_name.resize(0); - g_args.resize(0); - g_parmName.resize(0); - g_parmType.resize(0); - if (memberDef) setParameterList(memberDef); - codeYYrestart( codeYYin ); + startCodeLine(yyscanner); + yyextra->type.resize(0); + yyextra->name.resize(0); + yyextra->args.resize(0); + yyextra->parmName.resize(0); + yyextra->parmType.resize(0); + if (memberDef) setParameterList(yyscanner,memberDef); BEGIN( Body ); - codeYYlex(); - g_lexInit=TRUE; - if (g_needsTermination) + codeYYlex(yyscanner); + yyextra->lexInit=TRUE; + if (yyextra->needsTermination) { - endFontClass(); - DBG_CTX((stderr,"endCodeLine(%d)\n",g_yyLineNr)); - g_code->endCodeLine(); + endFontClass(yyscanner); + DBG_CTX((stderr,"endCodeLine(%d)\n",yyextra->yyLineNr)); + yyextra->code->endCodeLine(); } if (cleanupSourceDef) { // delete the temporary file definition used for this example - delete g_sourceFileDef; - g_sourceFileDef=0; + delete yyextra->sourceFileDef; + yyextra->sourceFileDef=0; } printlex(yy_flex_debug, FALSE, __FILE__, fd ? fd->fileName().data(): NULL); return; } -void codeFreeScanner() -{ -#if defined(YY_FLEX_SUBMINOR_VERSION) - if (g_lexInit) - { - codeYYlex_destroy(); - } -#endif -} - #include "code.l.h" diff --git a/src/doxygen.cpp b/src/doxygen.cpp index b4a4deb..d4d55e7 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -8992,7 +8992,8 @@ static void generateExampleDocs() for (pdi.toFirst();(pd=pdi.current());++pdi) { msg("Generating docs for example %s...\n",pd->name().data()); - resetCCodeParserState(); + ParserInterface *pIntf = Doxygen::parserManager->getParser(".c"); // TODO: do this on code type + pIntf->resetCodeParserState(); QCString n=pd->getOutputFileBase(); startFile(*g_outputList,n,n,pd->name()); startTitle(*g_outputList,n); @@ -10187,7 +10188,6 @@ void cleanUpDoxygen() delete theTranslator; delete g_outputList; Mappers::freeMappers(); - codeFreeScanner(); if (Doxygen::symbolMap) { diff --git a/src/scanner.l b/src/scanner.l index 37fcb1c..2b277db 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -201,6 +201,8 @@ static bool g_nestedComment=0; static std::vector< std::pair > > g_outerScopeEntries; +static CodeScanner g_codeScanner; + static const char *stateToString(int state); //----------------------------------------------------------------------------- @@ -7359,6 +7361,7 @@ void CLanguageScanner::parseInput(const char *fileName, printlex(yy_flex_debug, FALSE, __FILE__, fileName); } + void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, const char * scopeName, const QCString & input, @@ -7375,7 +7378,7 @@ void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, bool collectXRefs ) { - ::parseCCode(codeOutIntf,scopeName,input,lang,isExampleBlock,exampleName, + g_codeScanner.parseCCode(codeOutIntf,scopeName,input,lang,isExampleBlock,exampleName, fileDef,startLine,endLine,inlineFragment,memberDef, showLineNumbers,searchCtx,collectXRefs); } @@ -7392,7 +7395,7 @@ bool CLanguageScanner::needsPreprocessing(const QCString &extension) const void CLanguageScanner::resetCodeParserState() { - ::resetCCodeParserState(); + g_codeScanner.reset(); } void CLanguageScanner::parsePrototype(const char *text) -- cgit v0.12 From 146bec22e9ff91e8274becd719149f7ab9c7cfb9 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 22 Nov 2019 14:56:50 +0100 Subject: Better termination message In case a `WARN_LOGFILE` is used it in this file no clear whether doxygen finished correctly or exited beforehand in case a fatal error. Now a 'Exiting...' is also given in the warning log file in case an error is a fatal error. --- src/commentscan.l | 3 +- src/configimpl.l | 73 +++++++++++++++++++------------------------- src/defgen.cpp | 3 +- src/diagram.cpp | 3 +- src/docbookgen.cpp | 3 +- src/docsets.cpp | 12 +++----- src/dot.cpp | 4 +-- src/dotgfxhierarchytable.cpp | 2 +- src/dotgraph.cpp | 2 +- src/doxygen.cpp | 24 +++++---------- src/eclipsehelp.cpp | 3 +- src/formula.cpp | 5 ++- src/htmlgen.cpp | 3 +- src/htmlhelp.cpp | 9 ++---- src/latexgen.cpp | 9 ++---- src/mangen.cpp | 6 ++-- src/message.cpp | 28 +++++++++++++++++ src/message.h | 2 ++ src/outputgen.cpp | 3 +- src/perlmodgen.cpp | 3 +- src/qhp.cpp | 3 +- src/rtfgen.cpp | 3 +- src/util.cpp | 6 ++-- 23 files changed, 101 insertions(+), 111 deletions(-) diff --git a/src/commentscan.l b/src/commentscan.l index 2b10f87..9d09fa1 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -327,8 +327,7 @@ class DocCmdMapper { if (m_map.find(p->cmdName)!=0) { - err("DocCmdMapper: command %s already added\n",p->cmdName); - exit(1); + term(1,"DocCmdMapper: command %s already added\n",p->cmdName); } Cmd *cmd = new Cmd; cmd->func = p->handler; diff --git a/src/configimpl.l b/src/configimpl.l index 0cc5c88..ba95dce 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -56,6 +56,16 @@ void config_err(const char *fmt, ...) vfprintf(stderr, (QCString(error_str) + fmt).data(), args); va_end(args); } +void config_term(const int exitVal, const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(stderr, (QCString(error_str) + fmt).data(), args); + va_end(args); + fprintf(stderr, "%s\n", "Exiting..."); + exit(exitVal); +} + void config_warn(const char *fmt, ...) { va_list args; @@ -213,13 +223,11 @@ QCString &ConfigImpl::getString(const char *fileName,int num,const char *name) c ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_String) { - config_err("%s<%d>: Internal error: Requested option %s not of string type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of string type!\n",fileName,num,name); } return *((ConfigString *)opt)->valueRef(); } @@ -229,13 +237,11 @@ QStrList &ConfigImpl::getList(const char *fileName,int num,const char *name) con ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_List) { - config_err("%s<%d>: Internal error: Requested option %s not of list type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of list type!\n",fileName,num,name); } return *((ConfigList *)opt)->valueRef(); } @@ -245,13 +251,11 @@ QCString &ConfigImpl::getEnum(const char *fileName,int num,const char *name) con ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_Enum) { - config_err("%s<%d>: Internal error: Requested option %s not of enum type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of enum type!\n",fileName,num,name); } return *((ConfigEnum *)opt)->valueRef(); } @@ -261,13 +265,11 @@ int &ConfigImpl::getInt(const char *fileName,int num,const char *name) const ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_Int) { - config_err("%s<%d>: Internal error: Requested option %s not of integer type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of integer type!\n",fileName,num,name); } return *((ConfigInt *)opt)->valueRef(); } @@ -277,13 +279,11 @@ bool &ConfigImpl::getBool(const char *fileName,int num,const char *name) const ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_Bool) { - config_err("%s<%d>: Internal error: Requested option %s not of boolean type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of boolean type!\n",fileName,num,name); } return *((ConfigBool *)opt)->valueRef(); } @@ -566,9 +566,8 @@ static QCString configStringRecode( void *cd = portable_iconv_open(outputEncoding,inputEncoding); if (cd==(void *)(-1)) { - fprintf(stderr,"Error: unsupported character conversion: '%s'->'%s'\n", + config_term(1,"Error: unsupported character conversion: '%s'->'%s'\n", inputEncoding.data(),outputEncoding.data()); - exit(1); } size_t iLeft=(size_t)inputSize; size_t oLeft=(size_t)outputSize; @@ -583,9 +582,8 @@ static QCString configStringRecode( } else { - fprintf(stderr,"Error: failed to translate characters from %s to %s: %s\n", + config_term(1,"Error: failed to translate characters from %s to %s: %s\n", inputEncoding.data(),outputEncoding.data(),strerror(errno)); - exit(1); } portable_iconv_close(cd); return output; @@ -638,9 +636,8 @@ static FILE *findFile(const char *fileName) static void readIncludeFile(const char *incName) { if (includeDepth==MAX_INCLUDE_DEPTH) { - config_err("maximum include depth (%d) reached, %s is not included. Aborting...\n", + config_term(1,"maximum include depth (%d) reached, %s is not included. Aborting...\n", MAX_INCLUDE_DEPTH,incName); - exit(1); } QCString inc = incName; @@ -678,8 +675,7 @@ static void readIncludeFile(const char *incName) } else { - config_err("@INCLUDE = %s: not found!\n",inc.data()); - exit(1); + config_term(1,"@INCLUDE = %s: not found!\n",inc.data()); } } @@ -1161,9 +1157,8 @@ void ConfigImpl::init() ConfigOption * opt = ConfigImpl::instance()->get(depName); if (opt==0) { - config_warn("Config option '%s' has invalid depends relation on unknown option '%s'\n", + config_term(1,"Config option '%s' has invalid depends relation on unknown option '%s'\n", option->name().data(),depName.data()); - exit(1); } } } @@ -1229,8 +1224,7 @@ static QCString configFileToString(const char *name) } if (!fileOpened) { - config_err("cannot open file '%s' for reading\n",name); - exit(1); + config_term(1,"cannot open file '%s' for reading\n",name); } return ""; } @@ -1408,9 +1402,8 @@ void Config::checkAndCorrect() QFileInfo fi(headerFile); if (!fi.exists()) { - err("tag HTML_HEADER: header file '%s' " + term(1,"tag HTML_HEADER: header file '%s' " "does not exist\n",headerFile.data()); - exit(1); } } // Test to see if HTML footer is valid @@ -1420,9 +1413,8 @@ void Config::checkAndCorrect() QFileInfo fi(footerFile); if (!fi.exists()) { - err("tag HTML_FOOTER: footer file '%s' " + term(1,"tag HTML_FOOTER: footer file '%s' " "does not exist\n",footerFile.data()); - exit(1); } } @@ -1435,9 +1427,8 @@ void Config::checkAndCorrect() QFileInfo fi(MathJaxCodefile); if (!fi.exists()) { - err("tag MATHJAX_CODEFILE file '%s' " + term(1,"tag MATHJAX_CODEFILE file '%s' " "does not exist\n",MathJaxCodefile.data()); - exit(1); } } QCString &path = Config_getString(MATHJAX_RELPATH); @@ -1455,9 +1446,8 @@ void Config::checkAndCorrect() QFileInfo fi(latexHeaderFile); if (!fi.exists()) { - err("tag LATEX_HEADER: header file '%s' " + term(1,"tag LATEX_HEADER: header file '%s' " "does not exist\n",latexHeaderFile.data()); - exit(1); } } // Test to see if LaTeX footer is valid @@ -1467,9 +1457,8 @@ void Config::checkAndCorrect() QFileInfo fi(latexFooterFile); if (!fi.exists()) { - err("tag LATEX_FOOTER: footer file '%s' " + term(1,"tag LATEX_FOOTER: footer file '%s' " "does not exist\n",latexFooterFile.data()); - exit(1); } } diff --git a/src/defgen.cpp b/src/defgen.cpp index f5e12aa..6ae98a6 100644 --- a/src/defgen.cpp +++ b/src/defgen.cpp @@ -572,9 +572,8 @@ void generateDEF() dir.setPath(QDir::currentDirPath()); if (!dir.mkdir(outputDirectory)) { - err("tag OUTPUT_DIRECTORY: Output directory '%s' does not " + term(1,"tag OUTPUT_DIRECTORY: Output directory '%s' does not " "exist and cannot be created\n",outputDirectory.data()); - exit(1); } else { diff --git a/src/diagram.cpp b/src/diagram.cpp index edc895d..3d0c22a 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -1101,8 +1101,7 @@ void ClassDiagram::writeFigure(FTextStream &output,const char *path, f1.setName(epsName.data()); if (!f1.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",f1.name().data()); - exit(1); + term(1,"Could not open file %s for writing\n",f1.name().data()); } FTextStream t(&f1); diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 083aac3..8040c92 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -289,8 +289,7 @@ void DocbookGenerator::init() QDir d(dir); if (!d.exists() && !d.mkdir(dir)) { - err("Could not create output directory %s\n",dir.data()); - exit(1); + term(1,"Could not create output directory %s\n",dir.data()); } createSubDirs(d); diff --git a/src/docsets.cpp b/src/docsets.cpp index 055532a..b33aea5 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -62,8 +62,7 @@ void DocSets::initialize() QFile makefile(mfName); if (!makefile.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",mfName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",mfName.data()); } FTextStream ts(&makefile); @@ -113,8 +112,7 @@ void DocSets::initialize() QFile plist(plName); if (!plist.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",plName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",plName.data()); } FTextStream ts(&plist); @@ -149,8 +147,7 @@ void DocSets::initialize() m_nf = new QFile(notes); if (!m_nf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",notes.data()); - exit(1); + term(1,"Could not open file %s for writing\n",notes.data()); } //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index"; QCString indexName="index"; @@ -170,8 +167,7 @@ void DocSets::initialize() m_tf = new QFile(tokens); if (!m_tf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",tokens.data()); - exit(1); + term(1,"Could not open file %s for writing\n",tokens.data()); } m_tts.setDevice(m_tf); m_tts << "" << endl; diff --git a/src/dot.cpp b/src/dot.cpp index 5ad3916..2fb3b3e 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -272,7 +272,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir, QDir d(outDir); if (!d.exists()) { - err("Output dir %s does not exist!\n",outDir); exit(1); + term(1,"Output dir %s does not exist!\n",outDir); } QCString imgExt = getDotImageExtension(); @@ -325,7 +325,7 @@ void writeDotImageMapFromFile(FTextStream &t, QDir d(outDir); if (!d.exists()) { - err("Output dir %s does not exist!\n",outDir.data()); exit(1); + term(1,"Output dir %s does not exist!\n",outDir.data()); } QCString mapName = baseName+".map"; diff --git a/src/dotgfxhierarchytable.cpp b/src/dotgfxhierarchytable.cpp index 0a7942f..df9f48f 100644 --- a/src/dotgfxhierarchytable.cpp +++ b/src/dotgfxhierarchytable.cpp @@ -86,7 +86,7 @@ void DotGfxHierarchyTable::writeGraph(FTextStream &out, // store the original directory if (!d.exists()) { - err("Output dir %s does not exist!\n",path); exit(1); + term(1,"Output dir %s does not exist!\n",path); } // put each connected subgraph of the hierarchy in a row of the HTML output diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp index 9b7ddb7..c17523b 100644 --- a/src/dotgraph.cpp +++ b/src/dotgraph.cpp @@ -147,7 +147,7 @@ bool DotGraph::prepareDotFile() { if (!m_dir.exists()) { - err("Output dir %s does not exist!\n", m_dir.path().data()); exit(1); + term(1,"Output dir %s does not exist!\n", m_dir.path().data()); } QCString sigStr(33); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index d4d55e7..52381b8 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -8800,10 +8800,9 @@ static void computePageRelations(Entry *root) PageDef *subPd = Doxygen::pageSDict->find(bi.name); if (pd==subPd) { - err("page defined at line %d of file %s with label %s is a direct " + term(1,"page defined at line %d of file %s with label %s is a direct " "subpage of itself! Please remove this cyclic dependency.\n", pd->docLine(),pd->docFile().data(),pd->name().data()); - exit(1); } else if (subPd) { @@ -8828,10 +8827,9 @@ static void checkPageRelations() { if (ppd==pd) { - err("page defined at line %d of file %s with label %s is a subpage " + term(1,"page defined at line %d of file %s with label %s is a subpage " "of itself! Please remove this cyclic dependency.\n", pd->docLine(),pd->docFile().data(),pd->name().data()); - exit(1); } ppd=ppd->getOuterScope(); } @@ -9164,8 +9162,7 @@ static void generateConfigFile(const char *configFile,bool shortList, } else { - err("Cannot open file %s for writing\n",configFile); - exit(1); + term(1,"Cannot open file %s for writing\n",configFile); } } static void compareDoxyfile() @@ -9182,8 +9179,7 @@ static void compareDoxyfile() } else { - err("Cannot open file %s for writing\n",configFile); - exit(1); + term(1,"Cannot open file %s for writing\n",configFile); } } //---------------------------------------------------------------------------- @@ -9821,17 +9817,15 @@ void readFormulaRepository(QCString dir, bool cmp) { if ((f=Doxygen::formulaDict->find(formText))==0) { - err("discrepancy between formula repositories! Remove " + term(1,"discrepancy between formula repositories! Remove " "formula.repository and from_* files from output directories."); - exit(1); } QCString formLabel; formLabel.sprintf("\\form#%d",f->getId()); if (formLabel != formName) { - err("discrepancy between formula repositories! Remove " + term(1,"discrepancy between formula repositories! Remove " "formula.repository and from_* files from output directories."); - exit(1); } new_repository++; } @@ -9848,9 +9842,8 @@ void readFormulaRepository(QCString dir, bool cmp) } if (cmp && (current_repository != new_repository)) { - err("size discrepancy between formula repositories! Remove " + term(1,"size discrepancy between formula repositories! Remove " "formula.repository and from_* files from output directories."); - exit(1); } } @@ -11661,9 +11654,8 @@ void generateOutput() QDir searchDir(searchDirName); if (!searchDir.exists() && !searchDir.mkdir(searchDirName)) { - err("Could not create search results directory '%s' $PWD='%s'\n", + term(1,"Could not create search results directory '%s' $PWD='%s'\n", searchDirName.data(),QDir::currentDirPath().data()); - exit(1); } HtmlGenerator::writeSearchData(searchDirName); if (!serverBasedSearch) // client side search index diff --git a/src/eclipsehelp.cpp b/src/eclipsehelp.cpp index 2757308..04f2947 100644 --- a/src/eclipsehelp.cpp +++ b/src/eclipsehelp.cpp @@ -72,8 +72,7 @@ void EclipseHelp::initialize() m_tocfile = new QFile(name); if (!m_tocfile->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n", name.data()); - exit(1); + term(1,"Could not open file %s for writing\n", name.data()); } // -- initialize its text stream diff --git a/src/formula.cpp b/src/formula.cpp index 3d8e6ce..a17b9b7 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -51,7 +51,10 @@ void FormulaList::generateBitmaps(const char *path) int x1,y1,x2,y2; QDir d(path); // store the original directory - if (!d.exists()) { err("Output dir %s does not exist!\n",path); exit(1); } + if (!d.exists()) + { + term(1,"Output dir %s does not exist!\n",path); + } QCString oldDir = QDir::currentDirPath().utf8(); // go to the html output directory (i.e. path) QDir::setCurrent(d.absPath()); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index df39d32..ab3bfa4 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -733,8 +733,7 @@ void HtmlGenerator::init() QDir d(dname); if (!d.exists() && !d.mkdir(dname)) { - err("Could not create output directory %s\n",dname.data()); - exit(1); + term(1,"Could not create output directory %s\n",dname.data()); } //writeLogo(dname); if (!Config_getString(HTML_HEADER).isEmpty()) diff --git a/src/htmlhelp.cpp b/src/htmlhelp.cpp index c514102..6101984 100644 --- a/src/htmlhelp.cpp +++ b/src/htmlhelp.cpp @@ -308,8 +308,7 @@ void HtmlHelp::initialize() m_fromUtf8 = portable_iconv_open(str,"UTF-8"); if (m_fromUtf8==(void *)(-1)) { - err("unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n", str); - exit(1); + term(1,"unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n", str); } /* open the contents file */ @@ -317,8 +316,7 @@ void HtmlHelp::initialize() cf = new QFile(fName); if (!cf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fName.data()); } /* Write the header of the contents file */ cts.setDevice(cf); @@ -334,8 +332,7 @@ void HtmlHelp::initialize() kf = new QFile(fName); if (!kf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fName.data()); } /* Write the header of the contents file */ kts.setDevice(kf); diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 094232f..bd86038 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -288,8 +288,7 @@ static void writeLatexMakefile() QFile file(fileName); if (!file.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fileName.data()); } // inserted by KONNO Akihisa 2002-03-05 QCString latex_command = theTranslator->latexCommandName(); @@ -387,8 +386,7 @@ static void writeMakeBat() bool generateBib = !Doxygen::citeDict->isEmpty(); if (!file.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fileName.data()); } FTextStream t(&file); t << "set Dir_Old=%cd%\n"; @@ -468,8 +466,7 @@ void LatexGenerator::init() QDir d(dir); if (!d.exists() && !d.mkdir(dir)) { - err("Could not create output directory %s\n",dir.data()); - exit(1); + term(1,"Could not create output directory %s\n",dir.data()); } writeLatexMakefile(); diff --git a/src/mangen.cpp b/src/mangen.cpp index 06d3c4a..f4eba20 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -112,14 +112,12 @@ void ManGenerator::init() QDir d(manOutput); if (!d.exists() && !d.mkdir(manOutput)) { - err("Could not create output directory %s\n",manOutput.data()); - exit(1); + term(1,"Could not create output directory %s\n",manOutput.data()); } d.setPath(manOutput + "/" + getSubdir()); if (!d.exists() && !d.mkdir(manOutput + "/" + getSubdir())) { - err("Could not create output directory %s/%s\n",manOutput.data(), getSubdir().data()); - exit(1); + term(1,"Could not create output directory %s/%s\n",manOutput.data(), getSubdir().data()); } createSubDirs(d); } diff --git a/src/message.cpp b/src/message.cpp index ddf757a..4b430da 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -251,6 +251,34 @@ extern void err_full(const char *file,int line,const char *fmt, ...) va_end(args); } +void term(const int exitVal, const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(warnFile, (QCString(error_str) + fmt).data(), args); + va_end(args); + if (warnFile != stderr) + { + for (int i = 0; i < strlen(error_str); i++) fprintf(warnFile, " "); + fprintf(warnFile, "%s\n", "Exiting..."); + } + exit(exitVal); +} + +extern void term_full(const int exitVal, const char *file,int line,const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + do_warn(TRUE, file, line, error_str, fmt, args); + va_end(args); + if (warnFile != stderr) + { + for (int i = 0; i < strlen(error_str); i++) fprintf(warnFile, " "); + fprintf(warnFile, "%s\n", "Exiting..."); + } + exit(exitVal); +} + void printlex(int dbg, bool enter, const char *lexName, const char *fileName) { const char *enter_txt = "entering"; diff --git a/src/message.h b/src/message.h index 3b1a294..56e7e27 100644 --- a/src/message.h +++ b/src/message.h @@ -30,6 +30,8 @@ extern void warn_doc_error(const char *file,int line,const char *fmt, ...); extern void warn_uncond(const char *fmt, ...); extern void err(const char *fmt, ...); extern void err_full(const char *file,int line,const char *fmt, ...); +extern void term(const int exitVal, const char *fmt, ...); +extern void term_full(const int exitVal, const char *file,int line,const char *fmt, ...); void initWarningFormat(); extern void printlex(int dbg, bool enter, const char *lexName, const char *fileName); diff --git a/src/outputgen.cpp b/src/outputgen.cpp index 53d2d7f..ea8fd5e 100644 --- a/src/outputgen.cpp +++ b/src/outputgen.cpp @@ -46,8 +46,7 @@ void OutputGenerator::startPlainFile(const char *name) file = new QFile(fileName); if (!file->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fileName.data()); } t.setDevice(file); } diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index be226b7..bf20d45 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -2271,9 +2271,8 @@ bool PerlModGenerator::createOutputDir(QDir &perlModDir) dir.setPath(QDir::currentDirPath()); if (!dir.mkdir(outputDirectory)) { - err("tag OUTPUT_DIRECTORY: Output directory '%s' does not " + term(1,"tag OUTPUT_DIRECTORY: Output directory '%s' does not " "exist and cannot be created\n",outputDirectory.data()); - exit(1); } else { diff --git a/src/qhp.cpp b/src/qhp.cpp index 6260d09..484475c 100644 --- a/src/qhp.cpp +++ b/src/qhp.cpp @@ -168,8 +168,7 @@ void Qhp::finalize() QFile file(fileName); if (!file.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n", fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n", fileName.data()); } m_doc.dumpTo(file); } diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 92740f4..2702cca 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -175,8 +175,7 @@ void RTFGenerator::init() QDir d(dir); if (!d.exists() && !d.mkdir(dir)) { - err("Could not create output directory %s\n",dir.data()); - exit(1); + term(1,"Could not create output directory %s\n",dir.data()); } rtf_Style.setAutoDelete(TRUE); diff --git a/src/util.cpp b/src/util.cpp index f58a630..92b97b6 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -7950,10 +7950,9 @@ static int transcodeCharacterBuffer(const char *fileName,BufStr &srcBuf,int size void *cd = portable_iconv_open(outputEncoding,inputEncoding); if (cd==(void *)(-1)) { - err("unsupported character conversion: '%s'->'%s': %s\n" + term(1,"unsupported character conversion: '%s'->'%s': %s\n" "Check the INPUT_ENCODING setting in the config file!\n", inputEncoding,outputEncoding,strerror(errno)); - exit(1); } int tmpBufSize=size*4+1; BufStr tmpBuf(tmpBufSize); @@ -7971,9 +7970,8 @@ static int transcodeCharacterBuffer(const char *fileName,BufStr &srcBuf,int size } else { - err("%s: failed to translate characters from %s to %s: check INPUT_ENCODING\n", + term(1,"%s: failed to translate characters from %s to %s: check INPUT_ENCODING\n", fileName,inputEncoding,outputEncoding); - exit(1); } portable_iconv_close(cd); return newSize; -- cgit v0.12 From 42355ace21f6fb72fba49316c73c025a12482b09 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 22 Nov 2019 16:50:03 +0100 Subject: Problem converting UCS big endian file When having a file with a Big Endian BOM this is not always handled in a correct way when using the generic UCS-2 approach, using the explicit version works well. (problems see with a gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] and glibc-2.26-lp151.18.7.x86_64). --- src/util.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index f58a630..5868b62 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -8033,13 +8033,18 @@ bool readInputFile(const char *fileName,BufStr &inBuf,bool filter,bool isSourceC int start=0; if (size>=2 && - (((uchar)inBuf.at(0)==0xFF && (uchar)inBuf.at(1)==0xFE) || // Little endian BOM - ((uchar)inBuf.at(0)==0xFE && (uchar)inBuf.at(1)==0xFF) // big endian BOM - ) - ) // UCS-2 encoded file + ((uchar)inBuf.at(0)==0xFF && (uchar)inBuf.at(1)==0xFE) // Little endian BOM + ) // UCS-2LE encoded file + { + transcodeCharacterBuffer(fileName,inBuf,inBuf.curPos(), + "UCS-2LE","UTF-8"); + } + else if (size>=2 && + ((uchar)inBuf.at(0)==0xFE && (uchar)inBuf.at(1)==0xFF) // big endian BOM + ) // UCS-2BE encoded file { transcodeCharacterBuffer(fileName,inBuf,inBuf.curPos(), - "UCS-2","UTF-8"); + "UCS-2BE","UTF-8"); } else if (size>=3 && (uchar)inBuf.at(0)==0xEF && -- cgit v0.12 From d29c0e80865c70d1afceeef5e611aac8aa4f079f Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 24 Nov 2019 13:28:28 +0100 Subject: Cleanup scanner.l code and naming --- src/scanner.l | 5479 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 2723 insertions(+), 2756 deletions(-) diff --git a/src/scanner.l b/src/scanner.l index 2b277db..e0095ba 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -59,149 +59,137 @@ * statics */ static ParserInterface *g_thisParser; -static const char * inputString; -static int inputPosition; -static QFile inputFile; -static int lastContext; -static int lastCContext; -static int lastDocContext; -static int lastCPPContext; -static int lastSkipSharpContext; -static int lastSkipRoundContext; -static int lastStringContext; -static int lastCurlyContext; -static int lastRoundContext; -static int lastSquareContext; -static int lastInitializerContext; -static int lastClassTemplSpecContext; -static int lastPreLineCtrlContext; -static int lastSkipVerbStringContext; -static int lastCommentInArgContext; -static int lastRawStringContext; -static int lastCSConstraint; -static int lastHereDocContext; -static int lastDefineContext; -static int lastAlignAsContext; -static int lastC11AttributeContext; -static int lastModifierContext; -static Protection protection; -static Protection baseProt; -static int sharpCount = 0 ; -static int roundCount = 0 ; -static int curlyCount = 0 ; -static int squareCount = 0 ; -static int padCount = 0 ; -static std::unique_ptr current; -static Entry* current_root = 0 ; -static Entry* global_root = 0 ; -static Entry* previous = 0 ; -static std::unique_ptr tempEntry; -static Entry* firstTypedefEntry = 0 ; -static Entry* memspecEntry = 0 ; -static int yyLineNr = 1 ; -static int yyBegLineNr = yyLineNr ; -static int yyColNr = 1 ; -static int yyBegColNr = yyColNr ; -static int anonCount = 0 ; -static int anonNSCount = 0 ; -static QCString yyFileName; -static MethodTypes mtype; -static bool gstat; -static bool removeSlashes; -static Specifier virt; -static Specifier baseVirt; -static QCString msType,msName,msArgs; -static bool isTypedef; -static int tmpDocType; -static QCString sectionLabel; -static QCString sectionTitle; -static QCString funcPtrType; -static QCString templateStr; -static QCString aliasName; -static QCString baseName; -static QCString* specName; -static QCString formulaText; -static bool useOverrideCommands = FALSE; - -static SrcLangExt language; -static bool insideIDL = FALSE; //!< processing IDL code? -static bool insideJava = FALSE; //!< processing Java code? -static bool insideCS = FALSE; //!< processing C# code? -static bool insideD = FALSE; //!< processing D code? -static bool insidePHP = FALSE; //!< processing PHP code? -static bool insideObjC = FALSE; //!< processing Objective C code? -static bool insideCli = FALSE; //!< processing C++/CLI code? -static bool insideJS = FALSE; //!< processing JavaScript code? -static bool insideSlice = FALSE; //!< processing Slice code? -static bool insideCpp = TRUE; //!< processing C/C++ code - -static bool sliceOpt = FALSE; - -static bool insideCppQuote = FALSE; -static bool insideProtocolList = FALSE; - -static int argRoundCount; -static int argSharpCount; -static int currentArgumentContext; -static int lastCopyArgStringContext; -static int lastCopyArgContext; -static QCString *copyArgString; -static QCString fullArgString; -static QCString dummyRawString; - -static ArgumentList *currentArgumentList; -static char lastCopyArgChar; - -static QCString *pCopyQuotedString; -static QCString *pCopyRoundString; -static QCString *pCopyCurlyString; -static QCString *pCopyRawString; - -static QGString *pCopyCurlyGString; -static QGString *pCopyRoundGString; -static QGString *pCopySquareGString; -static QGString *pCopyQuotedGString; -static QGString *pCopyHereDocGString; -static QGString *pCopyRawGString; -static QGString *pSkipVerbString; -static QStack autoGroupStack; - -static bool insideFormula; -static bool insideTryBlock=FALSE; -static bool insideCode; -static bool needsSemi; - -//static int depthIf; -static int initBracketCount; - -static QCString oldStyleArgType; -static QCString docBackup; -static QCString briefBackup; - -static int docBlockContext; -static QGString docBlock; -static QCString docBlockName; -static bool docBlockInBody; -static bool docBlockAutoBrief; -static char docBlockTerm; - -static QCString idlAttr; -static QCString idlProp; -static bool odlProp; - -static bool g_lexInit = FALSE; -static bool externC; +static const char * g_inputString = 0; +static int g_inputPosition = 0; +static int g_lastContext = 0; +static int g_lastCContext = 0; +static int g_lastDocContext = 0; +static int g_lastCPPContext = 0; +static int g_lastSkipSharpContext = 0; +static int g_lastSkipRoundContext = 0; +static int g_lastStringContext = 0; +static int g_lastCurlyContext = 0; +static int g_lastRoundContext = 0; +static int g_lastSquareContext = 0; +static int g_lastInitializerContext = 0; +static int g_lastClassTemplSpecContext = 0; +static int g_lastPreLineCtrlContext = 0; +static int g_lastSkipVerbStringContext = 0; +static int g_lastCommentInArgContext = 0; +static int g_lastRawStringContext = 0; +static int g_lastCSConstraint = 0; +static int g_lastHereDocContext = 0; +static int g_lastDefineContext = 0; +static int g_lastAlignAsContext = 0; +static int g_lastC11AttributeContext = 0; +static int g_lastModifierContext = 0; +static Protection g_protection = Public; +static Protection g_baseProt = Public; +static int g_sharpCount = 0 ; +static int g_roundCount = 0 ; +static int g_curlyCount = 0 ; +static int g_squareCount = 0 ; +static int g_padCount = 0 ; +static std::unique_ptr g_current; +static Entry* g_current_root = 0 ; +static Entry* g_previous = 0 ; +static std::unique_ptr g_tempEntry; +static Entry* g_firstTypedefEntry = 0 ; +static Entry* g_memspecEntry = 0 ; +static int g_yyLineNr = 1 ; +static int g_yyBegLineNr = 1 ; +static int g_yyColNr = 1 ; +static int g_yyBegColNr = 1 ; +static int g_anonCount = 0 ; +static int g_anonNSCount = 0 ; +static QCString g_yyFileName; +static MethodTypes g_mtype = Method; +static bool g_stat = false; +static Specifier g_virt = Normal; +static Specifier g_baseVirt = Normal; +static QCString g_msType; +static QCString g_msName; +static QCString g_msArgs; +static bool g_isTypedef = false; +static QCString g_funcPtrType; +static QCString g_templateStr; +static QCString g_aliasName; +static QCString g_baseName; +static QCString* g_specName = 0; + +static SrcLangExt g_language = SrcLangExt_Unknown; +static bool g_insideIDL = false; //!< processing IDL code? +static bool g_insideJava = false; //!< processing Java code? +static bool g_insideCS = false; //!< processing C# code? +static bool g_insideD = false; //!< processing D code? +static bool g_insidePHP = false; //!< processing PHP code? +static bool g_insideObjC = false; //!< processing Objective C code? +static bool g_insideCli = false; //!< processing C++/CLI code? +static bool g_insideJS = false; //!< processing JavaScript code? +static bool g_insideSlice = false; //!< processing Slice code? +static bool g_insideCpp = true; //!< processing C/C++ code + +static bool g_insideCppQuote = false; +static bool g_insideProtocolList = false; + +static int g_argRoundCount = 0; +static int g_argSharpCount = 0; +static int g_currentArgumentContext = 0; +static int g_lastCopyArgStringContext = 0; +static int g_lastCopyArgContext = 0; +static QCString *g_copyArgString = 0; +static QCString g_fullArgString; +static QCString g_dummyRawString; + +static ArgumentList *g_currentArgumentList = 0; +static char g_lastCopyArgChar = '\0'; + +static QCString *g_pCopyQuotedString = 0; +static QCString *g_pCopyRoundString = 0; +static QCString *g_pCopyCurlyString = 0; +static QCString *g_pCopyRawString = 0; +static QGString *g_pCopyCurlyGString = 0; +static QGString *g_pCopyRoundGString = 0; +static QGString *g_pCopySquareGString = 0; +static QGString *g_pCopyQuotedGString = 0; +static QGString *g_pCopyHereDocGString = 0; +static QGString *g_pCopyRawGString = 0; +static QGString *g_pSkipVerbString = 0; +static QStack g_autoGroupStack; + +static bool g_insideFormula = false; +static bool g_insideTryBlock = false; +static bool g_insideCode = false; +static bool g_needsSemi = false; + +static int g_initBracketCount = 0; + +static QCString g_oldStyleArgType; +static QCString g_docBackup; +static QCString g_briefBackup; + +static int g_docBlockContext = 0; +static QGString g_docBlock; +static QCString g_docBlockName; +static bool g_docBlockInBody = false; +static bool g_docBlockAutoBrief = false; +static char g_docBlockTerm = '\0'; + +static QCString g_idlAttr; +static QCString g_idlProp; +static bool g_odlProp = false; + +static bool g_lexInit = false; +static bool g_externC = false; static QCString g_delimiter; -static int g_column; - -static int g_fencedSize=0; -static bool g_nestedComment=0; +static int g_column = 0; +static int g_fencedSize = 0; +static bool g_nestedComment = 0; static std::vector< std::pair > > g_outerScopeEntries; - -static CodeScanner g_codeScanner; +static CodeScanner g_codeScanner; static const char *stateToString(int state); //----------------------------------------------------------------------------- @@ -215,46 +203,42 @@ static const char *stateToString(int state); static void initParser() { g_outerScopeEntries.clear(); - sectionLabel.resize(0); - sectionTitle.resize(0); - baseName.resize(0); - formulaText.resize(0); - protection = Public; - baseProt = Public; - sharpCount = 0; - roundCount = 0; - curlyCount = 0; - mtype = Method; - gstat = FALSE; - virt = Normal; - baseVirt = Normal; - isTypedef = FALSE; - autoGroupStack.clear(); - insideTryBlock = FALSE; - autoGroupStack.setAutoDelete(TRUE); - insideFormula = FALSE; - insideCode=FALSE; - insideCli=Config_getBool(CPP_CLI_SUPPORT); - sliceOpt=Config_getBool(OPTIMIZE_OUTPUT_SLICE); - previous = 0; - firstTypedefEntry = 0; - memspecEntry =0; + g_baseName.resize(0); + g_protection = Public; + g_baseProt = Public; + g_sharpCount = 0; + g_roundCount = 0; + g_curlyCount = 0; + g_mtype = Method; + g_stat = FALSE; + g_virt = Normal; + g_baseVirt = Normal; + g_isTypedef = FALSE; + g_autoGroupStack.clear(); + g_insideTryBlock = FALSE; + g_autoGroupStack.setAutoDelete(TRUE); + g_insideFormula = FALSE; + g_insideCode=FALSE; + g_insideCli=Config_getBool(CPP_CLI_SUPPORT); + g_previous = 0; + g_firstTypedefEntry = 0; + g_memspecEntry =0; } static void initEntry() { - if (insideJava) + if (g_insideJava) { - protection = (current_root->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; + g_protection = (g_current_root->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; } - current->protection = protection ; - current->mtype = mtype; - current->virt = virt; - current->stat = gstat; - current->lang = language; - //printf("*** initEntry() language=%d\n",language); - Doxygen::docGroup.initGroupInfo(current.get()); - isTypedef=FALSE; + g_current->protection = g_protection ; + g_current->mtype = g_mtype; + g_current->virt = g_virt; + g_current->stat = g_stat; + g_current->lang = g_language; + //printf("*** initEntry() g_language=%d\n",g_language); + Doxygen::docGroup.initGroupInfo(g_current.get()); + g_isTypedef=FALSE; } @@ -268,7 +252,7 @@ static void lineCount() { if (*p=='\n') { - yyLineNr++,g_column=0,yyColNr=1; + g_yyLineNr++,g_column=0,g_yyColNr=1; } else if (*p=='\t') { @@ -276,7 +260,7 @@ static void lineCount() } else { - g_column++,yyColNr++; + g_column++,g_yyColNr++; } } //printf("lineCount()=%d\n",g_column); @@ -299,21 +283,21 @@ static inline int computeIndent(const char *s,int startIndent) static void addType() { - uint tl=current->type.length(); - if( tl>0 && !current->name.isEmpty() && current->type.at(tl-1)!='.') + uint tl=g_current->type.length(); + if( tl>0 && !g_current->name.isEmpty() && g_current->type.at(tl-1)!='.') { - current->type += ' ' ; + g_current->type += ' ' ; } - current->type += current->name ; - current->name.resize(0) ; - tl=current->type.length(); - if( tl>0 && !current->args.isEmpty() && current->type.at(tl-1)!='.') + g_current->type += g_current->name ; + g_current->name.resize(0) ; + tl=g_current->type.length(); + if( tl>0 && !g_current->args.isEmpty() && g_current->type.at(tl-1)!='.') { - current->type += ' ' ; + g_current->type += ' ' ; } - current->type += current->args ; - current->args.resize(0) ; - current->argList.clear(); + g_current->type += g_current->args ; + g_current->args.resize(0) ; + g_current->argList.clear(); } @@ -350,24 +334,19 @@ static bool nameIsOperator(QCString &name) static void setContext() { - QCString fileName = yyFileName; - language = getLanguageFromFileName(fileName); - insideIDL = language==SrcLangExt_IDL; - insideJava = language==SrcLangExt_Java; - insideCS = language==SrcLangExt_CSharp; - insideD = language==SrcLangExt_D; - insidePHP = language==SrcLangExt_PHP; - insideObjC = language==SrcLangExt_ObjC; - insideJS = language==SrcLangExt_JS; - insideSlice = language==SrcLangExt_Slice; - insideCpp = language==SrcLangExt_Cpp; - if ( insidePHP ) - { - useOverrideCommands = TRUE; - } - //printf("setContext(%s) insideIDL=%d insideJava=%d insideCS=%d " - // "insideD=%d insidePHP=%d insideObjC=%d\n", - // yyFileName.data(),insideIDL,insideJava,insideCS,insideD,insidePHP,insideObjC + g_language = getLanguageFromFileName(g_yyFileName); + g_insideIDL = g_language==SrcLangExt_IDL; + g_insideJava = g_language==SrcLangExt_Java; + g_insideCS = g_language==SrcLangExt_CSharp; + g_insideD = g_language==SrcLangExt_D; + g_insidePHP = g_language==SrcLangExt_PHP; + g_insideObjC = g_language==SrcLangExt_ObjC; + g_insideJS = g_language==SrcLangExt_JS; + g_insideSlice = g_language==SrcLangExt_Slice; + g_insideCpp = g_language==SrcLangExt_Cpp; + //printf("setContext(%s) g_insideIDL=%d g_insideJava=%d g_insideCS=%d " + // "g_insideD=%d g_insidePHP=%d g_insideObjC=%d\n", + // g_yyFileName.data(),g_insideIDL,g_insideJava,g_insideCS,g_insideD,g_insidePHP,g_insideObjC // ); } @@ -375,26 +354,26 @@ static void setContext() static void prependScope() { - if (current_root->section & Entry::SCOPE_MASK) + if (g_current_root->section & Entry::SCOPE_MASK) { - //printf("--- prependScope %s to %s\n",current_root->name.data(),current->name.data()); - current->name.prepend(current_root->name+"::"); - //printf("prependScope #=%d #current=%d\n",current_root->tArgLists->count(),current->tArgLists->count()); - for (const ArgumentList &srcAl : current_root->tArgLists) + //printf("--- prependScope %s to %s\n",g_current_root->name.data(),g_current->name.data()); + g_current->name.prepend(g_current_root->name+"::"); + //printf("prependScope #=%d #g_current=%d\n",g_current_root->tArgLists->count(),g_current->tArgLists->count()); + for (const ArgumentList &srcAl : g_current_root->tArgLists) { - current->tArgLists.insert(current->tArgLists.begin(),srcAl); + g_current->tArgLists.insert(g_current->tArgLists.begin(),srcAl); } } } //----------------------------------------------------------------------------- -/*! Returns TRUE iff the current entry could be a K&R style C function */ +/*! Returns TRUE iff the g_current entry could be a K&R style C function */ static bool checkForKnRstyleC() { - if (((QCString)yyFileName).right(2).lower()!=".c") return FALSE; // must be a C file - if (current->argList.empty()) return FALSE; // must have arguments - for (const Argument &a : current->argList) + if (((QCString)g_yyFileName).right(2).lower()!=".c") return FALSE; // must be a C file + if (g_current->argList.empty()) return FALSE; // must have arguments + for (const Argument &a : g_current->argList) { // in K&R style argument do not have a type, but doxygen expects a type // so it will think the argument has no name @@ -407,56 +386,56 @@ static bool checkForKnRstyleC() static void splitKnRArg(QCString &oldStyleArgPtr,QCString &oldStyleArgName) { - int si = current->args.length(); - if (oldStyleArgType.isEmpty()) // new argument + int si = g_current->args.length(); + if (g_oldStyleArgType.isEmpty()) // new argument { static QRegExp re("([^)]*)"); - int bi1 = current->args.findRev(re); - int bi2 = bi1!=-1 ? current->args.findRev(re,bi1-1) : -1; + int bi1 = g_current->args.findRev(re); + int bi2 = bi1!=-1 ? g_current->args.findRev(re,bi1-1) : -1; char c; if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)" { int s=bi2+1; - oldStyleArgType = current->args.left(s); + g_oldStyleArgType = g_current->args.left(s); int i=s; - while (iargs.at(i))=='*' || isspace((uchar)c))) i++; - oldStyleArgType += current->args.mid(s,i-s); + while (iargs.at(i))=='*' || isspace((uchar)c))) i++; + g_oldStyleArgType += g_current->args.mid(s,i-s); s=i; - while (iargs.at(i))) i++; - oldStyleArgName = current->args.mid(s,i-s); - oldStyleArgType+=current->args.mid(i); + while (iargs.at(i))) i++; + oldStyleArgName = g_current->args.mid(s,i-s); + g_oldStyleArgType+=g_current->args.mid(i); } else if (bi1!=-1) // redundant braces like in "int (*var)" { int s=bi1; - oldStyleArgType = current->args.left(s); + g_oldStyleArgType = g_current->args.left(s); s++; int i=s+1; - while (iargs.at(i))=='*' || isspace((uchar)c))) i++; - oldStyleArgType += current->args.mid(s,i-s); + while (iargs.at(i))=='*' || isspace((uchar)c))) i++; + g_oldStyleArgType += g_current->args.mid(s,i-s); s=i; - while (iargs.at(i))) i++; - oldStyleArgName = current->args.mid(s,i-s); + while (iargs.at(i))) i++; + oldStyleArgName = g_current->args.mid(s,i-s); } else // normal "int *var" { int l=si,i=l-1,j; char c; // look for start of name in "type *name" - while (i>=0 && isId(current->args.at(i))) i--; + while (i>=0 && isId(g_current->args.at(i))) i--; j=i+1; // look for start of *'s - while (i>=0 && ((c=current->args.at(i))=='*' || isspace((uchar)c))) i--; + while (i>=0 && ((c=g_current->args.at(i))=='*' || isspace((uchar)c))) i--; i++; if (i!=l) { - oldStyleArgType=current->args.left(i); - oldStyleArgPtr=current->args.mid(i,j-i); - oldStyleArgName=current->args.mid(j).stripWhiteSpace(); + g_oldStyleArgType=g_current->args.left(i); + oldStyleArgPtr=g_current->args.mid(i,j-i); + oldStyleArgName=g_current->args.mid(j).stripWhiteSpace(); } else { - oldStyleArgName=current->args.copy().stripWhiteSpace(); + oldStyleArgName=g_current->args.copy().stripWhiteSpace(); } } } @@ -464,15 +443,15 @@ static void splitKnRArg(QCString &oldStyleArgPtr,QCString &oldStyleArgName) { int l=si,j=0; char c; - while (jargs.at(j))=='*' || isspace((uchar)c))) j++; + while (jargs.at(j))=='*' || isspace((uchar)c))) j++; if (j>0) { - oldStyleArgPtr=current->args.left(j); - oldStyleArgName=current->args.mid(j).stripWhiteSpace(); + oldStyleArgPtr=g_current->args.left(j); + oldStyleArgName=g_current->args.mid(j).stripWhiteSpace(); } else { - oldStyleArgName=current->args.copy().stripWhiteSpace(); + oldStyleArgName=g_current->args.copy().stripWhiteSpace(); } } } @@ -486,7 +465,7 @@ static void splitKnRArg(QCString &oldStyleArgPtr,QCString &oldStyleArgName) static void addKnRArgInfo(const QCString &type,const QCString &name, const QCString &brief,const QCString &docs) { - for (Argument &a : current->argList) + for (Argument &a : g_current->argList) { if (a.type==name) { @@ -534,9 +513,9 @@ void fixArgumentListForJavaScript(ArgumentList &al) static int yyread(char *buf,int max_size) { int c=0; - while( c < max_size && inputString[inputPosition] ) + while( c < max_size && g_inputString[g_inputPosition] ) { - *buf = inputString[inputPosition++] ; + *buf = g_inputString[g_inputPosition++] ; //printf("%d (%c)\n",*buf,*buf); c++; buf++; } @@ -738,32 +717,32 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) %% "{" { - curlyCount=0; - needsSemi = TRUE; + g_curlyCount=0; + g_needsSemi = TRUE; BEGIN(SkipCurlyBlock); } "(" { - roundCount=0; + g_roundCount=0; BEGIN(SkipRoundBlock); } "(" { - ++roundCount; + ++g_roundCount; } ")" { - if (roundCount ) - --roundCount ; + if (g_roundCount ) + --g_roundCount ; else BEGIN( NextSemi ) ; } "{" { - ++curlyCount ; + ++g_curlyCount ; } "}" { - if( curlyCount ) + if( g_curlyCount ) { - --curlyCount ; + --g_curlyCount ; } - else if (needsSemi) + else if (g_needsSemi) { BEGIN( NextSemi ); } @@ -773,15 +752,15 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } \' { - if (insidePHP) + if (g_insidePHP) { - lastStringContext=NextSemi; + g_lastStringContext=NextSemi; BEGIN(SkipPHPString); } } -{CHARLIT} { if (insidePHP) REJECT; } +{CHARLIT} { if (g_insidePHP) REJECT; } \" { - lastStringContext=NextSemi; + g_lastStringContext=NextSemi; BEGIN(SkipString); } [;,] { @@ -793,12 +772,12 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( FindMembers ); } [{;,] { - current->args = current->args.simplifyWhiteSpace(); + g_current->args = g_current->args.simplifyWhiteSpace(); unput(*yytext); BEGIN( ClassVar ); } """?>"|"" { // PHP code end - if (insidePHP) + if (g_insidePHP) BEGIN( FindMembersPHP ); else REJECT; @@ -820,95 +799,95 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } . { // Non-PHP code text, ignore } -{PHPKW} { if (insidePHP) +{PHPKW} { if (g_insidePHP) BEGIN( NextSemi ); else REJECT; } "%{"[^\n]* { // Mozilla XPIDL lang-specific block - if (!insideIDL) + if (!g_insideIDL) REJECT; } "%}" { // Mozilla XPIDL lang-specific block end - if (!insideIDL) + if (!g_insideIDL) REJECT; } {B}*("properties"){BN}*":"{BN}* { // IDL or Borland C++ builder property - current->mtype = mtype = Property; - current->protection = protection = Public ; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->mtype = g_mtype = Property; + g_current->protection = g_protection = Public ; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } -{B}*"k_dcop"{BN}*":"{BN}* { current->mtype = mtype = DCOP; - current->protection = protection = Public ; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); +{B}*"k_dcop"{BN}*":"{BN}* { g_current->mtype = g_mtype = DCOP; + g_current->protection = g_protection = Public ; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } -{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* { current->mtype = mtype = Signal; +{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* { g_current->mtype = g_mtype = Signal; - current->protection = protection = Public ; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Public ; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"public"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { - current->protection = protection = Public ; - current->mtype = mtype = Slot; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Public ; + g_current->mtype = g_mtype = Slot; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount(); } {B}*"protected"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { - current->protection = protection = Protected ; - current->mtype = mtype = Slot; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Protected ; + g_current->mtype = g_mtype = Slot; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount(); } {B}*"private"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { - current->protection = protection = Private ; - current->mtype = mtype = Slot; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Private ; + g_current->mtype = g_mtype = Slot; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount(); } {B}*("public"|"methods"|"__published"){BN}*":"{BN}* { - current->protection = protection = Public ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Public ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"internal"{BN}*":"{BN}* { // for now treat C++/CLI's internal as package... - if (insideCli) - { - current->protection = protection = Package ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + if (g_insideCli) + { + g_current->protection = g_protection = Package ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } else @@ -917,38 +896,38 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"protected"{BN}*":"{BN}* { - current->protection = protection = Protected ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Protected ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"private"{BN}*":"{BN}* { - current->protection = protection = Private ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Private ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"event"{BN}+ { - if (insideCli) + if (g_insideCli) { // C++/CLI event lineCount() ; - current->mtype = mtype = Event; - current->bodyLine = yyLineNr; - curlyCount=0; + g_current->mtype = g_mtype = Event; + g_current->bodyLine = g_yyLineNr; + g_curlyCount=0; BEGIN( CliPropertyType ); } - else if (insideCS) + else if (g_insideCS) { lineCount() ; - current->mtype = Event; - current->bodyLine = yyLineNr; + g_current->mtype = Event; + g_current->bodyLine = g_yyLineNr; } else { @@ -956,13 +935,13 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"property"{BN}+ { - if (insideCli) + if (g_insideCli) { // C++/CLI property lineCount() ; - current->mtype = mtype = Property; - current->bodyLine = yyLineNr; - curlyCount=0; + g_current->mtype = g_mtype = Property; + g_current->bodyLine = g_yyLineNr; + g_curlyCount=0; BEGIN( CliPropertyType ); } else @@ -972,15 +951,15 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } {ID} { addType(); - current->name = yytext; + g_current->name = yytext; } "[" { // C++/CLI indexed property - current->args = "["; + g_current->args = "["; BEGIN( CliPropertyIndex ); } "{" { - curlyCount=0; - //printf("event: '%s' '%s'\n",current->type.data(),current->name.data()); + g_curlyCount=0; + //printf("event: '%s' '%s'\n",g_current->type.data(),g_current->name.data()); BEGIN( CSAccessorDecl ); } ";" { @@ -994,78 +973,78 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } . { addType(); - current->type += yytext; + g_current->type += yytext; } "]" { BEGIN( CliPropertyType ); - current->args+=yytext; + g_current->args+=yytext; } . { - current->args+=yytext; + g_current->args+=yytext; } /* {B}*"property"{BN}+ { - if (!current->type.isEmpty()) + if (!g_current->type.isEmpty()) { REJECT; } else { - current->mtype = mtype = Property; + g_current->mtype = g_mtype = Property; lineCount(); } } */ {B}*"@private"{BN}+ { - current->protection = protection = Private ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Private ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"@protected"{BN}+ { - current->protection = protection = Protected ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Protected ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"@public"{BN}+ { - current->protection = protection = Public ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Public ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } [\-+]{BN}* { - if (!insideObjC) + if (!g_insideObjC) { REJECT; } else { lineCount(); - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; - current->section = Entry::FUNCTION_SEC; - current->protection = protection = Public ; - language = current->lang = SrcLangExt_ObjC; - insideObjC = TRUE; - current->virt = Virtual; - current->stat=yytext[0]=='+'; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; + g_current->section = Entry::FUNCTION_SEC; + g_current->protection = g_protection = Public ; + g_language = g_current->lang = SrcLangExt_ObjC; + g_insideObjC = TRUE; + g_current->virt = Virtual; + g_current->stat=yytext[0]=='+'; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); BEGIN( ObjCMethod ); } } @@ -1073,24 +1052,24 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( ObjCReturnType ); } {ID} { // found method name - if (current->type.isEmpty()) + if (g_current->type.isEmpty()) { - current->type = "id"; + g_current->type = "id"; } - current->name = yytext; - if (insideCpp || insideObjC) + g_current->name = yytext; + if (g_insideCpp || g_insideObjC) { - current->id = ClangParser::instance()->lookup(yyLineNr,yytext); + g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); } } ":"{B}* { // start of parameter list - current->name += ':'; + g_current->name += ':'; Argument a; - current->argList.push_back(a); + g_current->argList.push_back(a); BEGIN( ObjCParams ); } [^)]* { // TODO: check if nested braches are possible. - current->type = yytext; + g_current->type = yytext; } ")" { BEGIN( ObjCMethod ); @@ -1100,119 +1079,119 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) keyw=keyw.left(keyw.length()-1).stripWhiteSpace(); // strip : if (keyw.isEmpty()) { - current->name += " :"; + g_current->name += " :"; } else { - current->name += keyw+":"; + g_current->name += keyw+":"; } - if (current->argList.back().type.isEmpty()) + if (g_current->argList.back().type.isEmpty()) { - current->argList.back().type="id"; + g_current->argList.back().type="id"; } Argument a; a.attrib=(QCString)"["+keyw+"]"; - current->argList.push_back(a); + g_current->argList.push_back(a); } {ID}{BN}* { // name of parameter lineCount(); - current->argList.back().name=QCString(yytext).stripWhiteSpace(); + g_current->argList.back().name=QCString(yytext).stripWhiteSpace(); } ","{BN}*"..." { // name of parameter lineCount(); // do we want the comma as part of the name? - //current->name += ","; + //g_current->name += ","; Argument a; a.attrib="[,]"; a.type="..."; - current->argList.push_back(a); + g_current->argList.push_back(a); } /* ":" { - current->name += ':'; + g_current->name += ':'; } */ "(" { - roundCount=0; - current->argList.back().type.resize(0); + g_roundCount=0; + g_current->argList.back().type.resize(0); BEGIN( ObjCParamType ); } "(" { - roundCount++; - current->argList.back().type+=yytext; + g_roundCount++; + g_current->argList.back().type+=yytext; } ")"/{B}* { - if (roundCount<=0) + if (g_roundCount<=0) { BEGIN( ObjCParams ); } else { - current->argList.back().type+=yytext; - roundCount--; + g_current->argList.back().type+=yytext; + g_roundCount--; } } [^()]* { - current->argList.back().type+=QCString(yytext).stripWhiteSpace(); + g_current->argList.back().type+=QCString(yytext).stripWhiteSpace(); } ";" { // end of method declaration - if (!current->argList.empty() && current->argList.back().type.isEmpty()) + if (!g_current->argList.empty() && g_current->argList.back().type.isEmpty()) { - current->argList.back().type="id"; + g_current->argList.back().type="id"; } - if (current->argList.empty()) // method without parameters + if (g_current->argList.empty()) // method without parameters { - current->argList.noParameters = TRUE; + g_current->argList.noParameters = TRUE; } - current->args = argListToString(current->argList); - //printf("argList=%s\n",current->args.data()); + g_current->args = argListToString(g_current->argList); + //printf("argList=%s\n",g_current->args.data()); unput(';'); BEGIN( Function ); } (";"{BN}+)?"{" { // start of a method body lineCount(); //printf("Type=%s Name=%s args=%s\n", - // current->type.data(),current->name.data(),argListToString(current->argList).data() + // g_current->type.data(),g_current->name.data(),argListToString(g_current->argList).data() // ); - if (!current->argList.empty() && current->argList.back().type.isEmpty()) + if (!g_current->argList.empty() && g_current->argList.back().type.isEmpty()) { - current->argList.back().type="id"; + g_current->argList.back().type="id"; } - if (current->argList.empty()) // method without parameters + if (g_current->argList.empty()) // method without parameters { - current->argList.noParameters = TRUE; + g_current->argList.noParameters = TRUE; } - current->args = argListToString(current->argList); + g_current->args = argListToString(g_current->argList); unput('{'); BEGIN( Function ); } {B}*"sequence"{BN}*"<"{BN}* { - if (insideSlice) + if (g_insideSlice) { lineCount(); - current->bodyLine = yyLineNr; - current->fileName = yyFileName ; - current->startLine = yyLineNr ; - current->startColumn = yyColNr; - current->args.resize(0); - current->section = Entry::TYPEDEF_SEC ; - isTypedef = TRUE; + g_current->bodyLine = g_yyLineNr; + g_current->fileName = g_yyFileName ; + g_current->startLine = g_yyLineNr ; + g_current->startColumn = g_yyColNr; + g_current->args.resize(0); + g_current->section = Entry::TYPEDEF_SEC ; + g_isTypedef = TRUE; BEGIN( SliceSequence ); } else REJECT; } {B}*"dictionary"{BN}*"<"{BN}* { - if (insideSlice) + if (g_insideSlice) { lineCount(); - current->bodyLine = yyLineNr; - current->fileName = yyFileName ; - current->startLine = yyLineNr ; - current->startColumn = yyColNr; - current->args.resize(0); - current->section = Entry::TYPEDEF_SEC ; - isTypedef = TRUE; + g_current->bodyLine = g_yyLineNr; + g_current->fileName = g_yyFileName ; + g_current->startLine = g_yyLineNr ; + g_current->startColumn = g_yyColNr; + g_current->args.resize(0); + g_current->section = Entry::TYPEDEF_SEC ; + g_isTypedef = TRUE; BEGIN( SliceDictionary ); } else @@ -1222,18 +1201,18 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lineCount(); } "@"({ID}".")*{ID}{BN}*"(" { - if (insideJava) // Java annotation + if (g_insideJava) // Java annotation { lineCount(); - lastSkipRoundContext = YY_START; - roundCount=0; + g_lastSkipRoundContext = YY_START; + g_roundCount=0; BEGIN( SkipRound ); } else if (qstrncmp(yytext,"@property",9)==0) // ObjC 2.0 property { - current->mtype = mtype = Property; - current->spec|=Entry::Readable | Entry::Writable | Entry::Assign; - current->protection = Public ; + g_current->mtype = g_mtype = Property; + g_current->spec|=Entry::Readable | Entry::Writable | Entry::Assign; + g_current->protection = Public ; unput('('); BEGIN( ObjCPropAttr ); } @@ -1243,54 +1222,54 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } "getter="{ID} { - current->read = yytext+7; + g_current->read = yytext+7; } "setter="{ID} { - current->write = yytext+7; + g_current->write = yytext+7; } "readonly" { - current->spec&=~Entry::Writable; + g_current->spec&=~Entry::Writable; } "readwrite" { // default } "assign" { // default } "unsafe_unretained" { - current->spec&=~Entry::Assign; - current->spec|=Entry::Unretained; + g_current->spec&=~Entry::Assign; + g_current->spec|=Entry::Unretained; } "retain" { - current->spec&=~Entry::Assign; - current->spec|=Entry::Retain; + g_current->spec&=~Entry::Assign; + g_current->spec|=Entry::Retain; } "copy" { - current->spec&=~Entry::Assign; - current->spec|=Entry::Copy; + g_current->spec&=~Entry::Assign; + g_current->spec|=Entry::Copy; } "weak" { - current->spec&=~Entry::Assign; - current->spec|=Entry::Weak; + g_current->spec&=~Entry::Assign; + g_current->spec|=Entry::Weak; } "strong" { - current->spec&=~Entry::Assign; - current->spec|=Entry::Strong; + g_current->spec&=~Entry::Assign; + g_current->spec|=Entry::Strong; } "nonatomic" { - current->spec|=Entry::NonAtomic; + g_current->spec|=Entry::NonAtomic; } ")" { BEGIN(FindMembers); } "@"{ID} { - if (insideJava) // Java annotation + if (g_insideJava) // Java annotation { // skip annotation } else if (qstrcmp(yytext,"@property")==0) // ObjC 2.0 property { - current->mtype = mtype = Property; - current->spec|=Entry::Writable | Entry::Readable; - current->protection = Public ; + g_current->mtype = g_mtype = Property; + g_current->spec|=Entry::Writable | Entry::Readable; + g_current->protection = Public ; } else if (qstrcmp(yytext,"@synthesize")==0) { @@ -1309,57 +1288,57 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FindMembers); } {ID}(("."|"\\"){ID})* { - isTypedef=FALSE; - //printf("Found namespace %s lang=%d\n",yytext,current->lang); - current->name = yytext; - current->name = substitute(current->name,".","::"); - current->name = substitute(current->name,"\\","::"); - current->section = Entry::NAMESPACE_SEC; - current->type = "namespace" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_isTypedef=FALSE; + //printf("Found namespace %s lang=%d\n",yytext,g_current->lang); + g_current->name = yytext; + g_current->name = substitute(g_current->name,".","::"); + g_current->name = substitute(g_current->name,"\\","::"); + g_current->section = Entry::NAMESPACE_SEC; + g_current->type = "namespace" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount(); } ";" { - Entry *tmp = current.get(); - current_root->moveToSubEntryAndRefresh(current); - current_root = tmp; + Entry *tmp = g_current.get(); + g_current_root->moveToSubEntryAndRefresh(g_current); + g_current_root = tmp; initEntry(); BEGIN(FindMembers); } "{" { - curlyCount=0; + g_curlyCount=0; BEGIN( ReadNSBody ); } {B}*"initonly"{BN}+ { - current->type += " initonly "; - if (insideCli) current->spec |= Entry::Initonly; + g_current->type += " initonly "; + if (g_insideCli) g_current->spec |= Entry::Initonly; lineCount(); } -{B}*"static"{BN}+ { current->type += " static "; - current->stat = TRUE; +{B}*"static"{BN}+ { g_current->type += " static "; + g_current->stat = TRUE; lineCount(); } {B}*"extern"{BN}+ { - current->stat = FALSE; - current->explicitExternal = TRUE; + g_current->stat = FALSE; + g_current->explicitExternal = TRUE; lineCount(); } -{B}*"const"{BN}+ { current->type += " const "; - if (insideCS) current->stat = TRUE; +{B}*"const"{BN}+ { g_current->type += " const "; + if (g_insideCS) g_current->stat = TRUE; lineCount(); } -{B}*"virtual"{BN}+ { current->type += " virtual "; - current->virt = Virtual; +{B}*"virtual"{BN}+ { g_current->type += " virtual "; + g_current->virt = Virtual; lineCount(); } {B}*"constexpr"{BN}+ { - if (insideCpp) + if (g_insideCpp) { - current->type += " constexpr "; - current->spec |= Entry::ConstExpr; + g_current->type += " constexpr "; + g_current->spec |= Entry::ConstExpr; lineCount(); } else @@ -1368,10 +1347,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"published"{BN}+ { // UNO IDL published keyword - if (insideIDL) + if (g_insideIDL) { lineCount(); - current->spec |= Entry::Published; + g_current->spec |= Entry::Published; } else { @@ -1379,42 +1358,42 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"abstract"{BN}+ { - if (!insidePHP) + if (!g_insidePHP) { - current->type += " abstract "; - if (!insideJava) + g_current->type += " abstract "; + if (!g_insideJava) { - current->virt = Pure; + g_current->virt = Pure; } else { - current->spec|=Entry::Abstract; + g_current->spec|=Entry::Abstract; } } else { - current->spec|=Entry::Abstract; + g_current->spec|=Entry::Abstract; } lineCount(); } -{B}*"inline"{BN}+ { current->spec|=Entry::Inline; +{B}*"inline"{BN}+ { g_current->spec|=Entry::Inline; lineCount(); } -{B}*"mutable"{BN}+ { current->spec|=Entry::Mutable; +{B}*"mutable"{BN}+ { g_current->spec|=Entry::Mutable; lineCount(); } -{B}*"explicit"{BN}+ { current->spec|=Entry::Explicit; +{B}*"explicit"{BN}+ { g_current->spec|=Entry::Explicit; lineCount(); } -{B}*"local"{BN}+ { current->spec|=Entry::Local; +{B}*"local"{BN}+ { g_current->spec|=Entry::Local; lineCount(); } {B}*"@required"{BN}+ { // Objective C 2.0 protocol required section - current->spec=(current->spec & ~Entry::Optional) | Entry::Required; + g_current->spec=(g_current->spec & ~Entry::Optional) | Entry::Required; lineCount(); } {B}*"@optional"{BN}+ { // Objective C 2.0 protocol optional section - current->spec=(current->spec & ~Entry::Required) | Entry::Optional; + g_current->spec=(g_current->spec & ~Entry::Required) | Entry::Optional; lineCount(); } /* @@ -1424,15 +1403,15 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) */ {B}*"typename"{BN}+ { lineCount(); } {B}*"namespace"{BN}*/[^a-z_A-Z0-9] { - isTypedef=FALSE; - current->section = Entry::NAMESPACE_SEC; - current->type = "namespace" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_isTypedef=FALSE; + g_current->section = Entry::NAMESPACE_SEC; + g_current->type = "namespace" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount(); - if (insidePHP) + if (g_insidePHP) { BEGIN( PackageName ); } @@ -1443,18 +1422,18 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } {B}*"module"{BN}+ { lineCount(); - if (insideIDL || insideSlice) - { - isTypedef=FALSE; - current->section = Entry::NAMESPACE_SEC; - current->type = "module" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + if (g_insideIDL || g_insideSlice) + { + g_isTypedef=FALSE; + g_current->section = Entry::NAMESPACE_SEC; + g_current->type = "module" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } - else if (insideD) + else if (g_insideD) { lineCount(); BEGIN(PackageName); @@ -1462,175 +1441,175 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {B}*"library"{BN}+ { lineCount(); - if (insideIDL) - { - isTypedef=FALSE; - current->section = Entry::NAMESPACE_SEC; - current->type = "library" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + if (g_insideIDL) + { + g_isTypedef=FALSE; + g_current->section = Entry::NAMESPACE_SEC; + g_current->type = "library" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } else { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {B}*"constants"{BN}+ { // UNO IDL constant group lineCount(); - if (insideIDL) - { - isTypedef=FALSE; - current->section = Entry::NAMESPACE_SEC; - current->type = "constants"; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + if (g_insideIDL) + { + g_isTypedef=FALSE; + g_current->section = Entry::NAMESPACE_SEC; + g_current->type = "constants"; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } else { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {BN}*("service"){BN}+ { // UNO IDL service lineCount(); - if (insideIDL) + if (g_insideIDL) { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Service | + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Service | // preserve UNO IDL [optional] or published - (current->spec & (Entry::Optional|Entry::Published)); + (g_current->spec & (Entry::Optional|Entry::Published)); addType(); - current->type += " service " ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->bodyLine = yyLineNr; + g_current->type += " service " ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } else // TODO is addType right? just copy/pasted { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {BN}*("singleton"){BN}+ { // UNO IDL singleton lineCount(); - if (insideIDL) + if (g_insideIDL) { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Singleton | - (current->spec & Entry::Published); // preserve + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Singleton | + (g_current->spec & Entry::Published); // preserve addType(); - current->type += " singleton " ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->bodyLine = yyLineNr; + g_current->type += " singleton " ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } else // TODO is addType right? just copy/pasted { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {BN}*((("disp")?"interface")|"valuetype"){BN}+ { // M$/Corba/UNO IDL/Java/Slice interface lineCount(); - if (insideIDL || insideJava || insideCS || insideD || insidePHP || insideSlice) + if (g_insideIDL || g_insideJava || g_insideCS || g_insideD || g_insidePHP || g_insideSlice) { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Interface | + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Interface | // preserve UNO IDL [optional], published, Slice local - (current->spec & (Entry::Optional|Entry::Published|Entry::Local)); + (g_current->spec & (Entry::Optional|Entry::Published|Entry::Local)); addType(); - current->type += " interface" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " interface" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } else { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {B}*"@implementation"{BN}+ { // Objective-C class implementation lineCount(); - isTypedef=FALSE; - current->section = Entry::OBJCIMPL_SEC; - language = current->lang = SrcLangExt_ObjC; - insideObjC = TRUE; - current->protection = protection = Public ; + g_isTypedef=FALSE; + g_current->section = Entry::OBJCIMPL_SEC; + g_language = g_current->lang = SrcLangExt_ObjC; + g_insideObjC = TRUE; + g_current->protection = g_protection = Public ; addType(); - current->type += " implementation" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->bodyLine = yyLineNr; + g_current->type += " implementation" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } {B}*"@interface"{BN}+ { // Objective-C class interface, or Java attribute lineCount(); - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Interface; - if (!insideJava) + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Interface; + if (!g_insideJava) { - language = current->lang = SrcLangExt_ObjC; - insideObjC = TRUE; + g_language = g_current->lang = SrcLangExt_ObjC; + g_insideObjC = TRUE; } - current->protection = protection = Public ; + g_current->protection = g_protection = Public ; addType(); - current->type += " interface" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " interface" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } {B}*"@protocol"{BN}+ { // Objective-C protocol definition lineCount(); - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Protocol; - language = current->lang = SrcLangExt_ObjC; - insideObjC = TRUE; - current->protection = protection = Public ; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Protocol; + g_language = g_current->lang = SrcLangExt_ObjC; + g_insideObjC = TRUE; + g_current->protection = g_protection = Public ; addType(); - current->type += " protocol" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " protocol" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } {B}*"exception"{BN}+ { // Corba IDL/Slice exception - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; // preserve UNO IDL, Slice local - current->spec = Entry::Exception | - (current->spec & Entry::Published) | - (current->spec & Entry::Local); + g_current->spec = Entry::Exception | + (g_current->spec & Entry::Published) | + (g_current->spec & Entry::Local); addType(); - current->type += " exception" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " exception" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount(); BEGIN( CompoundName ); } @@ -1638,38 +1617,38 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {B}*{TYPEDEFPREFIX}"class{" | {B}*{TYPEDEFPREFIX}"class"{BN}+ { QCString decl = yytext; - isTypedef=decl.find("typedef")!=-1; + g_isTypedef=decl.find("typedef")!=-1; bool isConst=decl.find("const")!=-1; bool isVolatile=decl.find("volatile")!=-1; - current->section = Entry::CLASS_SEC; + g_current->section = Entry::CLASS_SEC; addType(); - uint64 spec = current->spec; - if (insidePHP && current->spec&Entry::Abstract) + uint64 spec = g_current->spec; + if (g_insidePHP && g_current->spec&Entry::Abstract) { // convert Abstract to AbstractClass - current->spec=(current->spec&~Entry::Abstract)|Entry::AbstractClass; + g_current->spec=(g_current->spec&~Entry::Abstract)|Entry::AbstractClass; } - if (insideSlice && spec&Entry::Local) + if (g_insideSlice && spec&Entry::Local) { - current->spec|=Entry::Local; + g_current->spec|=Entry::Local; } if (isConst) { - current->type += " const"; + g_current->type += " const"; } else if (isVolatile) { - current->type += " volatile"; + g_current->type += " volatile"; } - current->type += " class" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " class" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; if (yytext[0]=='@') { - language = current->lang = SrcLangExt_ObjC; - insideObjC = TRUE; + g_language = g_current->lang = SrcLangExt_ObjC; + g_insideObjC = TRUE; } lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); @@ -1677,145 +1656,145 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } {B}*"value class{" | // C++/CLI extension {B}*"value class"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Value; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Value; addType(); - current->type += " value class" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " value class" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"ref class{" | // C++/CLI extension {B}*"ref class"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Ref; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Ref; addType(); - current->type += " ref class" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " ref class" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"interface class{" | // C++/CLI extension {B}*"interface class"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Interface; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Interface; addType(); - current->type += " interface class" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " interface class" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"coclass"{BN}+ { - if (insideIDL) + if (g_insideIDL) { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; addType(); - current->type += " coclass" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " coclass" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; BEGIN( CompoundName ) ; } else { addType(); - current->name = yytext; - current->name = current->name.stripWhiteSpace(); + g_current->name = yytext; + g_current->name = g_current->name.stripWhiteSpace(); lineCount(); } } {B}*{TYPEDEFPREFIX}"struct{" | {B}*{TYPEDEFPREFIX}"struct"/{BN}+ { QCString decl = yytext; - isTypedef=decl.find("typedef")!=-1; + g_isTypedef=decl.find("typedef")!=-1; bool isConst=decl.find("const")!=-1; bool isVolatile=decl.find("volatile")!=-1; - uint64 spec = current->spec; - current->section = Entry::CLASS_SEC ; + uint64 spec = g_current->spec; + g_current->section = Entry::CLASS_SEC ; // preserve UNO IDL & Inline attributes, Slice local - current->spec = Entry::Struct | - (current->spec & Entry::Published) | - (current->spec & Entry::Inline) | - (current->spec & Entry::Local); - // bug 582676: can be a struct nested in an interface so keep insideObjC state - //current->objc = insideObjC = FALSE; + g_current->spec = Entry::Struct | + (g_current->spec & Entry::Published) | + (g_current->spec & Entry::Inline) | + (g_current->spec & Entry::Local); + // bug 582676: can be a struct nested in an interface so keep g_insideObjC state + //g_current->objc = g_insideObjC = FALSE; addType(); if (isConst) { - current->type += " const"; + g_current->type += " const"; } else if (isVolatile) { - current->type += " volatile"; + g_current->type += " volatile"; } - current->type += " struct" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " struct" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"value struct{" | // C++/CLI extension {B}*"value struct"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Struct | Entry::Value; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Struct | Entry::Value; addType(); - current->type += " value struct" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " value struct" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"ref struct{" | // C++/CLI extension {B}*"ref struct"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Struct | Entry::Ref; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Struct | Entry::Ref; addType(); - current->type += " ref struct" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " ref struct" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"interface struct{" | // C++/CLI extension {B}*"interface struct"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Struct | Entry::Interface; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Struct | Entry::Interface; addType(); - current->type += " interface struct"; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " interface struct"; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1823,27 +1802,27 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {B}*{TYPEDEFPREFIX}"union{" | {B}*{TYPEDEFPREFIX}"union"{BN}+ { QCString decl=yytext; - isTypedef=decl.find("typedef")!=-1; + g_isTypedef=decl.find("typedef")!=-1; bool isConst=decl.find("const")!=-1; bool isVolatile=decl.find("volatile")!=-1; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Union; - // bug 582676: can be a struct nested in an interface so keep insideObjC state - //current->objc = insideObjC = FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Union; + // bug 582676: can be a struct nested in an interface so keep g_insideObjC state + //g_current->objc = g_insideObjC = FALSE; addType(); if (isConst) { - current->type += " const"; + g_current->type += " const"; } else if (isVolatile) { - current->type += " volatile"; + g_current->type += " volatile"; } - current->type += " union" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " union" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1851,40 +1830,40 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?"{" | {B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?{BN}+ { // for IDL: typedef [something] enum QCString text=yytext; - isTypedef = text.find("typedef")!=-1; - bool isStrongEnum = text.find("struct")!=-1 || text.find("class")!=-1 || insideCS; - if (insideJava) + g_isTypedef = text.find("typedef")!=-1; + bool isStrongEnum = text.find("struct")!=-1 || text.find("class")!=-1 || g_insideCS; + if (g_insideJava) { - current->section = Entry::CLASS_SEC; - current->spec = Entry::Enum; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Enum; } else { - current->section = Entry::ENUM_SEC ; + g_current->section = Entry::ENUM_SEC ; } addType(); - current->type += " enum"; + g_current->type += " enum"; if (isStrongEnum) { - current->spec |= Entry::Strong; + g_current->spec |= Entry::Strong; } - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } "("{BN}*")"({BN}*"<"[^>]*">"){BN}*/"(" { // A::operator()(int arg) lineCount(); - current->name += "()"; + g_current->name += "()"; BEGIN( FindMembers ); } "("{BN}*")"{BN}*/"(" { lineCount(); - current->name += yytext ; - current->name = current->name.simplifyWhiteSpace(); + g_current->name += yytext ; + g_current->name = g_current->name.simplifyWhiteSpace(); BEGIN( FindMembers ) ; } ";" { // can occur when importing members @@ -1893,24 +1872,24 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } [^(] { lineCount(); - current->name += *yytext ; + g_current->name += *yytext ; } "<>" { /* skip guided templ specifiers */ } "(" { - current->name = current->name.simplifyWhiteSpace(); + g_current->name = g_current->name.simplifyWhiteSpace(); unput(*yytext); BEGIN( FindMembers ) ; } ("template"|"generic")({BN}*)"<"/[>]? { // generic is a C++/CLI extension lineCount(); ArgumentList al; - //current->spec |= (yytext[0]=='g') ? Entry::Generic : Entry::Template; - current->tArgLists.push_back(al); - currentArgumentList = ¤t->tArgLists.back(); - templateStr="<"; - fullArgString = templateStr; - copyArgString = &templateStr; - currentArgumentContext = FindMembers; + //g_current->spec |= (yytext[0]=='g') ? Entry::Generic : Entry::Template; + g_current->tArgLists.push_back(al); + g_currentArgumentList = &g_current->tArgLists.back(); + g_templateStr="<"; + g_fullArgString = g_templateStr; + g_copyArgString = &g_templateStr; + g_currentArgumentContext = FindMembers; BEGIN( ReadTempArgs ); } "namespace"{BN}+/{ID}{BN}*"=" { // namespace alias @@ -1918,21 +1897,21 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( NSAliasName ); } {ID} { - aliasName = yytext; + g_aliasName = yytext; BEGIN( NSAliasArg ); } ({ID}"::")*{ID} { - //printf("Inserting namespace alias %s::%s->%s\n",current_root->name.data(),aliasName.data(),yytext); - //if (current_root->name.isEmpty()) + //printf("Inserting namespace alias %s::%s->%s\n",g_current_root->name.data(),g_aliasName.data(),yytext); + //if (g_current_root->name.isEmpty()) //{ // TODO: namespace aliases are now treated as global entities // while they should be aware of the scope they are in - Doxygen::namespaceAliasDict.insert(aliasName,new QCString(yytext)); + Doxygen::namespaceAliasDict.insert(g_aliasName,new QCString(yytext)); //} //else //{ - // Doxygen::namespaceAliasDict.insert(current_root->name+"::"+aliasName, - // new QCString(current_root->name+"::"+yytext)); + // Doxygen::namespaceAliasDict.insert(g_current_root->name+"::"+g_aliasName, + // new QCString(g_current_root->name+"::"+yytext)); //} } ";" { @@ -1940,22 +1919,22 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } ({ID}{BN}*"\\"{BN}*)*{ID}/{BN}+"as" { lineCount(); - aliasName=yytext; + g_aliasName=yytext; BEGIN(PHPUseAs); } ({ID}{BN}*"\\"{BN}*)*{ID} { lineCount(); - current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::")); - //printf("PHP: adding use relation: %s\n",current->name.data()); - current->fileName = yyFileName; + g_current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::")); + //printf("PHP: adding use relation: %s\n",g_current->name.data()); + g_current->fileName = g_yyFileName; // add a using declaration - current->section=Entry::USINGDECL_SEC; - current_root->copyToSubEntry(current); + g_current->section=Entry::USINGDECL_SEC; + g_current_root->copyToSubEntry(g_current); // also add it as a using directive - current->section=Entry::USINGDIR_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->section=Entry::USINGDIR_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); - aliasName.resize(0); + g_aliasName.resize(0); } {BN}+"as"{BN}+ { lineCount(); @@ -1963,14 +1942,14 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {PHPUSEKW} { } {ID} { - //printf("PHP: adding use as relation: %s->%s\n",yytext,aliasName.data()); - if (!aliasName.isEmpty()) + //printf("PHP: adding use as relation: %s->%s\n",yytext,g_aliasName.data()); + if (!g_aliasName.isEmpty()) { Doxygen::namespaceAliasDict.insert(yytext, new QCString(removeRedundantWhiteSpace( - substitute(aliasName,"\\","::")))); + substitute(g_aliasName,"\\","::")))); } - aliasName.resize(0); + g_aliasName.resize(0); } [,;] { if (*yytext==',') @@ -1985,59 +1964,59 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) ({ID}{BN}*"."{BN}*)+"*" { // package import => add as a using directive lineCount(); QCString scope=yytext; - current->name=removeRedundantWhiteSpace(substitute(scope.left(scope.length()-1),".","::")); - current->fileName = yyFileName; - current->section=Entry::USINGDIR_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->name=removeRedundantWhiteSpace(substitute(scope.left(scope.length()-1),".","::")); + g_current->fileName = g_yyFileName; + g_current->section=Entry::USINGDIR_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN(Using); } ({ID}{BN}*"."{BN}*)+{ID} { // class import => add as a using declaration lineCount(); QCString scope=yytext; - current->name=removeRedundantWhiteSpace(substitute(scope,".","::")); - current->fileName = yyFileName; - if (insideD) + g_current->name=removeRedundantWhiteSpace(substitute(scope,".","::")); + g_current->fileName = g_yyFileName; + if (g_insideD) { - current->section=Entry::USINGDIR_SEC; + g_current->section=Entry::USINGDIR_SEC; } else { - //printf("import name = %s -> %s\n",yytext,current->name.data()); - current->section=Entry::USINGDECL_SEC; + //printf("import name = %s -> %s\n",yytext,g_current->name.data()); + g_current->section=Entry::USINGDECL_SEC; } - previous = current.get(); - current_root->moveToSubEntryAndRefresh(current); + g_previous = g_current.get(); + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN(Using); } "using"{BN}+ { - current->startLine=yyLineNr; - current->startColumn = yyColNr; + g_current->startLine=g_yyLineNr; + g_current->startColumn = g_yyColNr; lineCount(); BEGIN(Using); } "namespace"{BN}+ { lineCount(); BEGIN(UsingDirective); } ({ID}{BN}*("::"|"."){BN}*)*({ID}|{OPERATOR}) { lineCount(); - current->name=yytext; - current->fileName = yyFileName; - current->section=Entry::USINGDECL_SEC; - current->startLine = yyLineNr; - previous = current.get(); - current_root->moveToSubEntryAndRefresh(current); + g_current->name=yytext; + g_current->fileName = g_yyFileName; + g_current->section=Entry::USINGDECL_SEC; + g_current->startLine = g_yyLineNr; + g_previous = g_current.get(); + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); - if (insideCS) /* Hack: in C# a using declaration and + if (g_insideCS) /* Hack: in C# a using declaration and directive have the same syntax, so we also add it as a using directive here */ { - current->name=yytext; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->section=Entry::USINGDIR_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->name=yytext; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->section=Entry::USINGDIR_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); } BEGIN(Using); @@ -2046,26 +2025,26 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(UsingAlias); } ";" { - previous->section=Entry::VARIABLE_SEC; - previous->type = "typedef "+previous->args; - previous->type=previous->type.simplifyWhiteSpace(); - previous->args.resize(0); - previous->name=previous->name.stripWhiteSpace(); - previous->bodyLine = yyLineNr; - previous->spec |= Entry::Alias; + g_previous->section=Entry::VARIABLE_SEC; + g_previous->type = "typedef "+g_previous->args; + g_previous->type=g_previous->type.simplifyWhiteSpace(); + g_previous->args.resize(0); + g_previous->name=g_previous->name.stripWhiteSpace(); + g_previous->bodyLine = g_yyLineNr; + g_previous->spec |= Entry::Alias; BEGIN(FindMembers); } ";"{BN}*("/**"|"//!"|"/*!"|"///")"<" { - docBlockContext = UsingAliasEnd; - docBlockInBody = FALSE; - docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + g_docBlockContext = UsingAliasEnd; + g_docBlockInBody = FALSE; + g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; indent.fill(' ',computeIndent(yytext,g_column)); - docBlock=indent; + g_docBlock=indent; lineCount(); - docBlockTerm = ';'; + g_docBlockTerm = ';'; if (yytext[yyleng-3]=='/') { startCommentBlock(TRUE); @@ -2078,27 +2057,27 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } ">>" { - previous->args+="> >"; // see bug769552 + g_previous->args+="> >"; // see bug769552 } . { - previous->args+=yytext; + g_previous->args+=yytext; } \n { - previous->args+=yytext; + g_previous->args+=yytext; lineCount(); } ";" { - previous->doc = current->doc; - previous->brief = current->brief; - current->doc.resize(0); - current->brief.resize(0); + g_previous->doc = g_current->doc; + g_previous->brief = g_current->brief; + g_current->doc.resize(0); + g_current->brief.resize(0); unput(';'); BEGIN(UsingAlias); } -{SCOPENAME} { current->name=removeRedundantWhiteSpace(yytext); - current->fileName = yyFileName; - current->section=Entry::USINGDIR_SEC; - current_root->moveToSubEntryAndRefresh(current); +{SCOPENAME} { g_current->name=removeRedundantWhiteSpace(yytext); + g_current->fileName = g_yyFileName; + g_current->section=Entry::USINGDIR_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN(Using); } @@ -2106,59 +2085,59 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {SCOPENAME}{BN}*"<>" { // guided template decl QCString n=yytext; addType(); - current->name=n.left(n.length()-2); + g_current->name=n.left(n.length()-2); } {SCOPENAME}{BN}*/"<" { // Note: this could be a return type! - roundCount=0; - sharpCount=0; + g_roundCount=0; + g_sharpCount=0; lineCount(); addType(); - current->name=yytext; - current->name=current->name.stripWhiteSpace(); - //current->scopeSpec.resize(0); - // currentTemplateSpec = ¤t->scopeSpec; - if (nameIsOperator(current->name)) + g_current->name=yytext; + g_current->name=g_current->name.stripWhiteSpace(); + //g_current->scopeSpec.resize(0); + // g_currentTemplateSpec = &g_current->scopeSpec; + if (nameIsOperator(g_current->name)) BEGIN( Operator ); else BEGIN( EndTemplate ); } {SCOPENAME}{BN}*/"<" { - sharpCount=0; - roundCount=0; + g_sharpCount=0; + g_roundCount=0; lineCount(); - current->name+=((QCString)yytext).stripWhiteSpace(); - //current->memberSpec.resize(0); - // currentTemplateSpec = ¤t->memberSpec; - if (nameIsOperator(current->name)) + g_current->name+=((QCString)yytext).stripWhiteSpace(); + //g_current->memberSpec.resize(0); + // g_currentTemplateSpec = &g_current->memberSpec; + if (nameIsOperator(g_current->name)) BEGIN( Operator ); else BEGIN( EndTemplate ); } "<<<" { - if (!insidePHP) + if (!g_insidePHP) { REJECT; } else { - lastHereDocContext = YY_START; + g_lastHereDocContext = YY_START; BEGIN(HereDoc); } } "<<" { - current->name+=yytext; - // *currentTemplateSpec+=yytext; + g_current->name+=yytext; + // *g_currentTemplateSpec+=yytext; } "<" { - if (roundCount==0) + if (g_roundCount==0) { - // *currentTemplateSpec+='<'; - sharpCount++; + // *g_currentTemplateSpec+='<'; + g_sharpCount++; } - current->name+=yytext; + g_current->name+=yytext; } ">>" { - if (insideJava || insideCS || insideCli || roundCount==0) + if (g_insideJava || g_insideCS || g_insideCli || g_roundCount==0) { unput('>'); unput(' '); @@ -2166,65 +2145,65 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - current->name+=yytext; + g_current->name+=yytext; } - // *currentTemplateSpec+=yytext; + // *g_currentTemplateSpec+=yytext; } ">" { - current->name+='>'; - // *currentTemplateSpec+='>'; - if (roundCount==0 && --sharpCount<=0) + g_current->name+='>'; + // *g_currentTemplateSpec+='>'; + if (g_roundCount==0 && --g_sharpCount<=0) { - //printf("Found %s\n",current->name.data()); + //printf("Found %s\n",g_current->name.data()); BEGIN(FindMembers); } } ">"{BN}*"(" { lineCount(); - current->name+='>'; - // *currentTemplateSpec+='>'; - if (roundCount==0 && --sharpCount<=0) - { - current->bodyLine = yyLineNr; - current->args = "("; - currentArgumentContext = FuncQual; - fullArgString = current->args.copy(); - copyArgString = ¤t->args; - //printf("Found %s\n",current->name.data()); + g_current->name+='>'; + // *g_currentTemplateSpec+='>'; + if (g_roundCount==0 && --g_sharpCount<=0) + { + g_current->bodyLine = g_yyLineNr; + g_current->args = "("; + g_currentArgumentContext = FuncQual; + g_fullArgString = g_current->args.copy(); + g_copyArgString = &g_current->args; + //printf("Found %s\n",g_current->name.data()); BEGIN( ReadFuncArgType ) ; } } ">"{BN}*/"("({BN}*{ID}{BN}*"::")*({BN}*"*"{BN}*)+ { // function pointer returning a template instance lineCount(); - current->name+='>'; - if (roundCount==0) + g_current->name+='>'; + if (g_roundCount==0) { BEGIN(FindMembers); } } ">"{BN}*/"::" { lineCount(); - current->name+='>'; - // *currentTemplateSpec+='>'; - if (roundCount==0 && --sharpCount<=0) + g_current->name+='>'; + // *g_currentTemplateSpec+='>'; + if (g_roundCount==0 && --g_sharpCount<=0) { BEGIN(FindMemberName); } } -"(" { current->name+=*yytext; - roundCount++; +"(" { g_current->name+=*yytext; + g_roundCount++; } -")" { current->name+=*yytext; - if (roundCount>0) roundCount--; +")" { g_current->name+=*yytext; + if (g_roundCount>0) g_roundCount--; } . { - current->name+=*yytext; - // *currentTemplateSpec+=*yytext; + g_current->name+=*yytext; + // *g_currentTemplateSpec+=*yytext; } "define"{BN}*"("{BN}*["'] { - if (insidePHP) + if (g_insidePHP) { - current->bodyLine = yyLineNr; + g_current->bodyLine = g_yyLineNr; BEGIN( DefinePHP ); } else @@ -2232,12 +2211,12 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } {ID} { // PHP heredoc g_delimiter = yytext; - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; BEGIN(CopyHereDocEnd); } "'"{ID}/"'" { // PHP nowdoc g_delimiter = &yytext[1]; - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; BEGIN(CopyHereDocEnd); } {ID} { // PHP heredoc @@ -2251,32 +2230,32 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) ^{ID} { // id at start of the line could mark the end of the block if (g_delimiter==yytext) // it is the end marker { - BEGIN(lastHereDocContext); + BEGIN(g_lastHereDocContext); } } . { } ^{ID} { // id at start of the line could mark the end of the block - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; if (g_delimiter==yytext) // it is the end marker { - BEGIN(lastHereDocContext); + BEGIN(g_lastHereDocContext); } } \n { - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; } {ID} { - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; } . { - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; } "Q_OBJECT" { // Qt object macro } "Q_PROPERTY" { // Qt property declaration - current->protection = Public ; // see bug734245 & bug735462 - current->mtype = mtype = Property; - current->type.resize(0); + g_current->protection = Public ; // see bug734245 & bug735462 + g_current->mtype = g_mtype = Property; + g_current->type.resize(0); BEGIN(QtPropType); } "(" { // start of property arguments @@ -2286,25 +2265,25 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FindMembers); } "const"|"volatile"|"unsigned"|"signed"|"long"|"short" { - current->type+=yytext; + g_current->type+=yytext; } {B}+ { - current->type+=yytext; + g_current->type+=yytext; } ({TSCOPE}"::")*{TSCOPE} { - current->type+=yytext; + g_current->type+=yytext; BEGIN(QtPropName); } {ID} { - current->name=yytext; + g_current->name=yytext; BEGIN(QtPropAttr); } "READ" { - current->spec |= Entry::Readable; + g_current->spec |= Entry::Readable; BEGIN(QtPropRead); } "WRITE" { - current->spec |= Entry::Writable; + g_current->spec |= Entry::Writable; BEGIN(QtPropWrite); } "RESET"{B}+{ID} { // reset method => not supported yet @@ -2314,96 +2293,96 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) "DESIGNABLE"{B}+{ID} { // designable property => not supported yet } {ID} { - current->read = yytext; + g_current->read = yytext; BEGIN(QtPropAttr); } {ID} { - current->write = yytext; + g_current->write = yytext; BEGIN(QtPropAttr); } "friend"{BN}+("class"|"union"|"struct"){BN}+ { - current->name=yytext; + g_current->name=yytext; BEGIN(FindMembers); } {SCOPENAME} { - if (insideCpp || insideObjC) + if (g_insideCpp || g_insideObjC) { - current->id = ClangParser::instance()->lookup(yyLineNr,yytext); + g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); } - yyBegColNr=yyColNr; - yyBegLineNr=yyLineNr; + g_yyBegColNr=g_yyColNr; + g_yyBegLineNr=g_yyLineNr; lineCount(); - if (insideIDL && yyleng==9 && qstrcmp(yytext,"cpp_quote")==0) + if (g_insideIDL && yyleng==9 && qstrcmp(yytext,"cpp_quote")==0) { BEGIN(CppQuote); } - else if ((insideIDL || insideJava || insideD) && yyleng==6 && qstrcmp(yytext,"import")==0) + else if ((g_insideIDL || g_insideJava || g_insideD) && yyleng==6 && qstrcmp(yytext,"import")==0) { - if (insideIDL) + if (g_insideIDL) BEGIN(NextSemi); - else // insideJava or insideD + else // g_insideJava or g_insideD BEGIN(JavaImport); } - else if (insidePHP && qstrcmp(yytext,"use")==0) + else if (g_insidePHP && qstrcmp(yytext,"use")==0) { BEGIN(PHPUse); } - else if (insideJava && qstrcmp(yytext,"package")==0) + else if (g_insideJava && qstrcmp(yytext,"package")==0) { lineCount(); BEGIN(PackageName); } - else if (insideIDL && qstrcmp(yytext,"case")==0) + else if (g_insideIDL && qstrcmp(yytext,"case")==0) { BEGIN(IDLUnionCase); } - else if (insideTryBlock && qstrcmp(yytext,"catch")==0) + else if (g_insideTryBlock && qstrcmp(yytext,"catch")==0) { - insideTryBlock=FALSE; + g_insideTryBlock=FALSE; BEGIN(TryFunctionBlock); } - else if (insideCpp && qstrcmp(yytext,"alignas")==0) + else if (g_insideCpp && qstrcmp(yytext,"alignas")==0) { - lastAlignAsContext = YY_START; + g_lastAlignAsContext = YY_START; BEGIN(AlignAs); } - else if (insideJS && qstrcmp(yytext,"var")==0) + else if (g_insideJS && qstrcmp(yytext,"var")==0) { // javascript variable - current->type="var"; + g_current->type="var"; } - else if (insideJS && qstrcmp(yytext,"function")==0) + else if (g_insideJS && qstrcmp(yytext,"function")==0) { // javascript function - current->type="function"; + g_current->type="function"; } - else if (insideCS && qstrcmp(yytext,"this")==0) + else if (g_insideCS && qstrcmp(yytext,"this")==0) { // C# indexer addType(); - current->name="this"; + g_current->name="this"; BEGIN(CSIndexer); } - else if (insideCpp && qstrcmp(yytext,"static_assert")==0) + else if (g_insideCpp && qstrcmp(yytext,"static_assert")==0) { // C++11 static_assert BEGIN(StaticAssert); } - else if (insideCpp && qstrcmp(yytext,"decltype")==0) + else if (g_insideCpp && qstrcmp(yytext,"decltype")==0) { // C++11 decltype(x) - current->type+=yytext; + g_current->type+=yytext; BEGIN(DeclType); } - else if (insideSlice && qstrcmp(yytext,"optional")==0) + else if (g_insideSlice && qstrcmp(yytext,"optional")==0) { - if (current->type.isEmpty()) + if (g_current->type.isEmpty()) { - current->type = "optional"; + g_current->type = "optional"; } else { - current->type += " optional"; + g_current->type += " optional"; } - lastModifierContext = YY_START; + g_lastModifierContext = YY_START; BEGIN(SliceOptional); } else @@ -2412,65 +2391,65 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { addType(); } - bool javaLike = insideJava || insideCS || insideD || insidePHP || insideJS; + bool javaLike = g_insideJava || g_insideCS || g_insideD || g_insidePHP || g_insideJS; if (javaLike && qstrcmp(yytext,"public")==0) { - current->protection = Public; + g_current->protection = Public; } else if (javaLike && qstrcmp(yytext,"protected")==0) { - current->protection = Protected; + g_current->protection = Protected; } - else if ((insideCS || insideD || insidePHP || insideJS) && qstrcmp(yytext,"internal")==0) + else if ((g_insideCS || g_insideD || g_insidePHP || g_insideJS) && qstrcmp(yytext,"internal")==0) { - current->protection = Package; + g_current->protection = Package; } else if (javaLike && qstrcmp(yytext,"private")==0) { - current->protection = Private; + g_current->protection = Private; } else if (javaLike && qstrcmp(yytext,"static")==0) { if (YY_START==FindMembers) - current->name = yytext; + g_current->name = yytext; else - current->name += yytext; - current->stat = TRUE; + g_current->name += yytext; + g_current->stat = TRUE; } else { if (YY_START==FindMembers) - current->name = yytext; + g_current->name = yytext; else - current->name += yytext; - if (current->name.left(7)=="static ") + g_current->name += yytext; + if (g_current->name.left(7)=="static ") { - current->stat = TRUE; - current->name= current->name.mid(7); + g_current->stat = TRUE; + g_current->name= g_current->name.mid(7); } - else if (current->name.left(7)=="inline ") + else if (g_current->name.left(7)=="inline ") { - if (current->type.isEmpty()) + if (g_current->type.isEmpty()) { - current->type="inline"; + g_current->type="inline"; } else { - current->type+="inline "; + g_current->type+="inline "; } - current->name= current->name.mid(7); + g_current->name= g_current->name.mid(7); } - else if (current->name.left(6)=="const ") + else if (g_current->name.left(6)=="const ") { - if (current->type.isEmpty()) + if (g_current->type.isEmpty()) { - current->type="const"; + g_current->type="const"; } else { - current->type+="const "; + g_current->type+="const "; } - current->name=current->name.mid(6); + g_current->name=g_current->name.mid(6); } } QCString tmp=yytext; @@ -2480,14 +2459,14 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - externC=FALSE; // see bug759247 + g_externC=FALSE; // see bug759247 BEGIN(FindMembers); } } } "(" { - lastSkipRoundContext = FindMembers; - roundCount=0; + g_lastSkipRoundContext = FindMembers; + g_roundCount=0; BEGIN(SkipRound); } {BN}+ { lineCount(); } @@ -2496,10 +2475,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FindMembers); } "(" { - current->type+=yytext; - lastRoundContext=FindMembers; - pCopyRoundString=¤t->type; - roundCount=0; + g_current->type+=yytext; + g_lastRoundContext=FindMembers; + g_pCopyRoundString=&g_current->type; + g_roundCount=0; BEGIN(CopyRound); } {BN}+ { lineCount(); } @@ -2508,22 +2487,22 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FindMembers); } "["[^\n\]]*"]" { - current->name+=removeRedundantWhiteSpace(yytext); + g_current->name+=removeRedundantWhiteSpace(yytext); BEGIN(FindMembers); } [0-9]{ID} { // some number where we did not expect one } "." { - if (insideJava || insideCS || insideD) + if (g_insideJava || g_insideCS || g_insideD) { - current->name+="."; + g_current->name+="."; } } "::" { - current->name+=yytext; + g_current->name+=yytext; } "("{B}*"\"" { - insideCppQuote=TRUE; + g_insideCppQuote=TRUE; BEGIN(FindMembers); } "::" @@ -2532,8 +2511,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) . \n { lineCount(); } "{" { - curlyCount=0; - lastCurlyContext = TryFunctionBlockEnd ; + g_curlyCount=0; + g_lastCurlyContext = TryFunctionBlockEnd ; BEGIN( SkipCurly ); } . @@ -2546,123 +2525,123 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( FindMembers ); } ")" { - insideCppQuote=FALSE; + g_insideCppQuote=FALSE; BEGIN(FindMembers); } -{B}*"#" { if (insidePHP) +{B}*"#" { if (g_insidePHP) REJECT; - lastCPPContext = YY_START; + g_lastCPPContext = YY_START; BEGIN( SkipCPP ) ; } {B}*"#"{B}*("cmake")?"define" { - if (insidePHP) + if (g_insidePHP) REJECT; - current->bodyLine = yyLineNr; - lastDefineContext = YY_START; + g_current->bodyLine = g_yyLineNr; + g_lastDefineContext = YY_START; BEGIN( Define ); } {B}*"#"{B}+[0-9]+{B}+/"\"" { /* line control directive */ - yyLineNr = atoi(&yytext[1]); - //printf("setting line number to %d\n",yyLineNr); - lastPreLineCtrlContext = YY_START; + g_yyLineNr = atoi(&yytext[1]); + //printf("setting line number to %d\n",g_yyLineNr); + g_lastPreLineCtrlContext = YY_START; if (YY_START==ReadBody || YY_START==ReadNSBody || YY_START==ReadBodyIntf) { - current->program+=yytext; + g_current->program+=yytext; } BEGIN( PreLineCtrl ); } "\""[^\n\"]*"\"" { - yyFileName = stripQuotes(yytext); - if (lastPreLineCtrlContext==ReadBody || - lastPreLineCtrlContext==ReadNSBody || - lastPreLineCtrlContext==ReadBodyIntf) + g_yyFileName = stripQuotes(yytext); + if (g_lastPreLineCtrlContext==ReadBody || + g_lastPreLineCtrlContext==ReadNSBody || + g_lastPreLineCtrlContext==ReadBodyIntf) { - current->program+=yytext; + g_current->program+=yytext; } } . { - if (lastPreLineCtrlContext==ReadBody || - lastPreLineCtrlContext==ReadNSBody || - lastPreLineCtrlContext==ReadBodyIntf) + if (g_lastPreLineCtrlContext==ReadBody || + g_lastPreLineCtrlContext==ReadNSBody || + g_lastPreLineCtrlContext==ReadBodyIntf) { - current->program+=yytext; + g_current->program+=yytext; } } \n { - if (lastPreLineCtrlContext==ReadBody || - lastPreLineCtrlContext==ReadNSBody || - lastPreLineCtrlContext==ReadBodyIntf) + if (g_lastPreLineCtrlContext==ReadBody || + g_lastPreLineCtrlContext==ReadNSBody || + g_lastPreLineCtrlContext==ReadBodyIntf) { - current->program+=yytext; + g_current->program+=yytext; } lineCount(); - BEGIN( lastPreLineCtrlContext ); + BEGIN( g_lastPreLineCtrlContext ); } . \\[\r]*"\n"[\r]* { lineCount(); } [\r]*\n[\r]* { lineCount(); - BEGIN( lastCPPContext) ; + BEGIN( g_lastCPPContext) ; } {ID}{B}*"(" { - current->name = yytext; - current->name = current->name.left(current->name.length()-1).stripWhiteSpace(); - current->args = "("; - current->bodyLine = yyLineNr; - currentArgumentContext = DefineEnd; - fullArgString=current->args.copy(); - copyArgString=¤t->args; + g_current->name = yytext; + g_current->name = g_current->name.left(g_current->name.length()-1).stripWhiteSpace(); + g_current->args = "("; + g_current->bodyLine = g_yyLineNr; + g_currentArgumentContext = DefineEnd; + g_fullArgString=g_current->args.copy(); + g_copyArgString=&g_current->args; BEGIN( ReadFuncArgType ) ; } /* ")" { //printf("Define with args\n"); - current->args += ')'; + g_current->args += ')'; BEGIN( DefineEnd ); } . { - current->args += *yytext; + g_current->args += *yytext; } */ {ID} { //printf("Define '%s' without args\n",yytext); - if (insideCpp || insideObjC) + if (g_insideCpp || g_insideObjC) { - current->id = ClangParser::instance()->lookup(yyLineNr,yytext); + g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); } - current->bodyLine = yyLineNr; - current->name = yytext; + g_current->bodyLine = g_yyLineNr; + g_current->name = yytext; BEGIN(DefineEnd); } \n { - //printf("End define: doc=%s docFile=%s docLine=%d\n",current->doc.data(),current->docFile.data(),current->docLine); + //printf("End define: doc=%s docFile=%s docLine=%d\n",g_current->doc.data(),g_current->docFile.data(),g_current->docLine); lineCount(); - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->type.resize(0); - current->args = current->args.simplifyWhiteSpace(); - current->name = current->name.stripWhiteSpace(); - current->section = Entry::DEFINE_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->type.resize(0); + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::DEFINE_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); - BEGIN(lastDefineContext); + BEGIN(g_lastDefineContext); } ";" { //printf("End define\n"); - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->type.resize(0); - current->type = "const"; - QCString init = current->initializer.data(); + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->type.resize(0); + g_current->type = "const"; + QCString init = g_current->initializer.data(); init = init.simplifyWhiteSpace(); init = init.left(init.length()-1); - current->initializer = init; - current->name = current->name.stripWhiteSpace(); - current->section = Entry::VARIABLE_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->initializer = init; + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::VARIABLE_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN(FindMembers); } @@ -2671,34 +2650,34 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lineCount(); } \" { - if (insideIDL && insideCppQuote) + if (g_insideIDL && g_insideCppQuote) { BEGIN(EndCppQuote); } else { - lastStringContext=DefineEnd; + g_lastStringContext=DefineEnd; BEGIN(SkipString); } } . {ID}["']{BN}*","{BN}* { - current->name = yytext; - current->name = current->name.stripWhiteSpace(); - current->name = current->name.left(current->name.length()-1).stripWhiteSpace(); - current->name = current->name.left(current->name.length()-1); - current->bodyLine = yyLineNr; - lastRoundContext = DefinePHPEnd; - pCopyRoundGString = ¤t->initializer; - roundCount = 0; + g_current->name = yytext; + g_current->name = g_current->name.stripWhiteSpace(); + g_current->name = g_current->name.left(g_current->name.length()-1).stripWhiteSpace(); + g_current->name = g_current->name.left(g_current->name.length()-1); + g_current->bodyLine = g_yyLineNr; + g_lastRoundContext = DefinePHPEnd; + g_pCopyRoundGString = &g_current->initializer; + g_roundCount = 0; BEGIN( GCopyRound ); } [\^%] { // ^ and % are C++/CLI extensions - if (insideCli) + if (g_insideCli) { addType(); - current->name = yytext ; + g_current->name = yytext ; } else { @@ -2706,31 +2685,31 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } [*&]+ { - current->name += yytext ; + g_current->name += yytext ; addType(); } ";"{BN}*("/**"|"//!"|"/*!"|"///")"<" { - if (current->bodyLine==-1) + if (g_current->bodyLine==-1) { - current->bodyLine=yyLineNr; + g_current->bodyLine=g_yyLineNr; } - docBlockContext = YY_START; - docBlockInBody = FALSE; - docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + g_docBlockContext = YY_START; + g_docBlockInBody = FALSE; + g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; indent.fill(' ',computeIndent(yytext,g_column)); - docBlock=indent; + g_docBlock=indent; //printf("indent=%d\n",computeIndent(yytext+1,g_column)); lineCount(); - docBlockTerm = ';'; - if (YY_START==EnumBaseType && current->section==Entry::ENUM_SEC) + g_docBlockTerm = ';'; + if (YY_START==EnumBaseType && g_current->section==Entry::ENUM_SEC) { - current->bitfields = ":"+current->args; - current->args.resize(0); - current->section=Entry::VARIABLE_SEC; + g_current->bitfields = ":"+g_current->args; + g_current->args.resize(0); + g_current->section=Entry::VARIABLE_SEC; } if (yytext[yyleng-3]=='/') { @@ -2744,22 +2723,22 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } ","{BN}*("/**"|"//!"|"/*!"|"///")"<" { - docBlockContext = YY_START; - docBlockInBody = FALSE; - docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + g_docBlockContext = YY_START; + g_docBlockInBody = FALSE; + g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; indent.fill(' ',computeIndent(yytext,g_column)); - docBlock=indent; + g_docBlock=indent; lineCount(); - docBlockTerm = ','; - if (YY_START==EnumBaseType && current->section==Entry::ENUM_SEC) + g_docBlockTerm = ','; + if (YY_START==EnumBaseType && g_current->section==Entry::ENUM_SEC) { - current->bitfields = ":"+current->args; - current->args.resize(0); - current->section=Entry::VARIABLE_SEC; + g_current->bitfields = ":"+g_current->args; + g_current->args.resize(0); + g_current->section=Entry::VARIABLE_SEC; } if (yytext[yyleng-3]=='/') { @@ -2773,20 +2752,20 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {BN}*("/**"|"//!"|"/*!"|"///")"<" { - if (current->bodyLine==-1) + if (g_current->bodyLine==-1) { - current->bodyLine=yyLineNr; + g_current->bodyLine=g_yyLineNr; } - docBlockContext = YY_START; - docBlockInBody = FALSE; - docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + g_docBlockContext = YY_START; + g_docBlockInBody = FALSE; + g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; indent.fill(' ',computeIndent(yytext,g_column)); - docBlock=indent; + g_docBlock=indent; lineCount(); - docBlockTerm = 0; + g_docBlockTerm = 0; if (yytext[yyleng-3]=='/') { startCommentBlock(TRUE); @@ -2800,34 +2779,34 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } ("//"([!/]){B}*{CMD}"{")|("/*"([!*]){B}*{CMD}"{") { - //handleGroupStartCommand(current->name); - if (previous && previous->section==Entry::GROUPDOC_SEC) + //handleGroupStartCommand(g_current->name); + if (g_previous && g_previous->section==Entry::GROUPDOC_SEC) { - // link open command to the group defined in the previous entry - Doxygen::docGroup.open(previous,yyFileName,yyLineNr); + // link open command to the group defined in the g_previous entry + Doxygen::docGroup.open(g_previous,g_yyFileName,g_yyLineNr); } else { - // link open command to the current entry - Doxygen::docGroup.open(current.get(),yyFileName,yyLineNr); + // link open command to the g_current entry + Doxygen::docGroup.open(g_current.get(),g_yyFileName,g_yyLineNr); } - //current = tmp; + //g_current = tmp; initEntry(); if (yytext[1]=='/') { if (yytext[2]=='!' || yytext[2]=='/') { - docBlockContext = YY_START; - docBlockInBody = FALSE; - docBlockAutoBrief = FALSE; - docBlock.resize(0); - docBlockTerm = 0; + g_docBlockContext = YY_START; + g_docBlockInBody = FALSE; + g_docBlockAutoBrief = FALSE; + g_docBlock.resize(0); + g_docBlockTerm = 0; startCommentBlock(TRUE); BEGIN(DocLine); } else { - lastCContext=YY_START; + g_lastCContext=YY_START; BEGIN(SkipCxxComment); } } @@ -2835,498 +2814,498 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { if (yytext[2]=='!' || yytext[2]=='*') { - docBlockContext = YY_START; - docBlockInBody = FALSE; - docBlock.resize(0); - docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + g_docBlockContext = YY_START; + g_docBlockInBody = FALSE; + g_docBlock.resize(0); + g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); - docBlockTerm = 0; + g_docBlockTerm = 0; startCommentBlock(FALSE); BEGIN(DocBlock); } else { - lastCContext=YY_START; + g_lastCContext=YY_START; BEGIN(SkipComment); } } } "//"([!/]){B}*{CMD}"}".*|"/*"([!*]){B}*{CMD}"}"[^*]*"*/" { - bool insideEnum = YY_START==FindFields || (YY_START==ReadInitializer && lastInitializerContext==FindFields); // see bug746226 - Doxygen::docGroup.close(current.get(),yyFileName,yyLineNr,insideEnum); + bool g_insideEnum = YY_START==FindFields || (YY_START==ReadInitializer && g_lastInitializerContext==FindFields); // see bug746226 + Doxygen::docGroup.close(g_current.get(),g_yyFileName,g_yyLineNr,g_insideEnum); lineCount(); } "=" { // in PHP code this could also be due to "bodyLine = yyLineNr; - current->initializer = yytext; - lastInitializerContext = YY_START; - initBracketCount=0; + g_current->bodyLine = g_yyLineNr; + g_current->initializer = yytext; + g_lastInitializerContext = YY_START; + g_initBracketCount=0; BEGIN(ReadInitializer); } {BN}*[gs]"et"{BN}+"raises"{BN}*"("{BN}*{SCOPENAME}{BN}*(","{BN}*{SCOPENAME}{BN}*)*")"{BN}*";" { lineCount(); - current->exception += " "; - current->exception += removeRedundantWhiteSpace(yytext); + g_current->exception += " "; + g_current->exception += removeRedundantWhiteSpace(yytext); } "}" { - current->exception += " }"; + g_current->exception += " }"; BEGIN(FindMembers); } /* Read initializer rules */ "(" { - lastRoundContext=YY_START; - pCopyRoundGString=¤t->initializer; - roundCount=0; - current->initializer+=*yytext; + g_lastRoundContext=YY_START; + g_pCopyRoundGString=&g_current->initializer; + g_roundCount=0; + g_current->initializer+=*yytext; BEGIN(GCopyRound); } "[" { - if (!insidePHP) REJECT; - lastSquareContext=YY_START; - pCopySquareGString=¤t->initializer; - squareCount=0; - current->initializer+=*yytext; + if (!g_insidePHP) REJECT; + g_lastSquareContext=YY_START; + g_pCopySquareGString=&g_current->initializer; + g_squareCount=0; + g_current->initializer+=*yytext; BEGIN(GCopySquare); } "{" { - lastCurlyContext=YY_START; - pCopyCurlyGString=¤t->initializer; - curlyCount=0; - current->initializer+=*yytext; + g_lastCurlyContext=YY_START; + g_pCopyCurlyGString=&g_current->initializer; + g_curlyCount=0; + g_current->initializer+=*yytext; BEGIN(GCopyCurly); } [;,] { - //printf(">> initializer '%s' <<\n",current->initializer.data()); - if (*yytext==';' && (current_root->spec&Entry::Enum)) - { - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->args = current->args.simplifyWhiteSpace(); - current->name = current->name.stripWhiteSpace(); - current->section = Entry::VARIABLE_SEC; - current_root->moveToSubEntryAndRefresh(current); + //printf(">> initializer '%s' <<\n",g_current->initializer.data()); + if (*yytext==';' && (g_current_root->spec&Entry::Enum)) + { + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::VARIABLE_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN(FindMembers); } - else if (*yytext==';' || (lastInitializerContext==FindFields && initBracketCount==0)) // initBracketCount==0 was added for bug 665778 + else if (*yytext==';' || (g_lastInitializerContext==FindFields && g_initBracketCount==0)) // g_initBracketCount==0 was added for bug 665778 { unput(*yytext); - BEGIN(lastInitializerContext); + BEGIN(g_lastInitializerContext); } - else if (*yytext==',' && initBracketCount==0) // for "int a=0,b=0" + else if (*yytext==',' && g_initBracketCount==0) // for "int a=0,b=0" { unput(*yytext); - BEGIN(lastInitializerContext); + BEGIN(g_lastInitializerContext); } else { - current->initializer+=*yytext; + g_current->initializer+=*yytext; } } {RAWBEGIN} { // C++11 raw string - if (!insideCpp) + if (!g_insideCpp) { REJECT; } else { QCString text=yytext; - current->initializer+=text; + g_current->initializer+=text; int i=text.find('"'); g_delimiter = yytext+i+1; g_delimiter=g_delimiter.left(g_delimiter.length()-1); - lastRawStringContext = YY_START; - pCopyRawGString = ¤t->initializer; + g_lastRawStringContext = YY_START; + g_pCopyRawGString = &g_current->initializer; BEGIN(RawGString); //printf("RawGString delimiter='%s'\n",delimiter.data()); } } {RAWEND} { - *pCopyRawGString+=yytext; + *g_pCopyRawGString+=yytext; QCString delimiter = yytext+1; delimiter=delimiter.left(delimiter.length()-1); if (delimiter==g_delimiter) { - BEGIN(lastRawStringContext); + BEGIN(g_lastRawStringContext); } } [^)\n]+ { - *pCopyRawGString+=yytext; + *g_pCopyRawGString+=yytext; } . { - *pCopyRawGString+=yytext; + *g_pCopyRawGString+=yytext; } \n { - *pCopyRawGString+=yytext; + *g_pCopyRawGString+=yytext; lineCount(); } {RAWEND} { - *pCopyRawString+=yytext; - fullArgString+=yytext; + *g_pCopyRawString+=yytext; + g_fullArgString+=yytext; QCString delimiter = yytext+1; delimiter=delimiter.left(delimiter.length()-1); if (delimiter==g_delimiter) { - BEGIN(lastRawStringContext); + BEGIN(g_lastRawStringContext); } } [^)]+ { - *pCopyRawString+=yytext; - fullArgString+=yytext; + *g_pCopyRawString+=yytext; + g_fullArgString+=yytext; } . { - *pCopyRawString+=yytext; - fullArgString+=yytext; + *g_pCopyRawString+=yytext; + g_fullArgString+=yytext; } \n { - *pCopyRawString+=yytext; - fullArgString+=yytext; + *g_pCopyRawString+=yytext; + g_fullArgString+=yytext; lineCount(); } \" { - if (insideIDL && insideCppQuote) + if (g_insideIDL && g_insideCppQuote) { BEGIN(EndCppQuote); } else { - lastStringContext=YY_START; - current->initializer+=yytext; - pCopyQuotedGString=¤t->initializer; + g_lastStringContext=YY_START; + g_current->initializer+=yytext; + g_pCopyQuotedGString=&g_current->initializer; BEGIN(CopyGString); } } "->" { - current->initializer+=yytext; + g_current->initializer+=yytext; } "<<" { - current->initializer+=yytext; + g_current->initializer+=yytext; } ">>" { - current->initializer+=yytext; + g_current->initializer+=yytext; } [<\[{(] { - initBracketCount++; - current->initializer+=*yytext; + g_initBracketCount++; + g_current->initializer+=*yytext; } [>\]})] { - initBracketCount--; - current->initializer+=*yytext; + g_initBracketCount--; + g_current->initializer+=*yytext; } \' { - if (insidePHP) + if (g_insidePHP) { - current->initializer+=yytext; - pCopyQuotedGString = ¤t->initializer; - lastStringContext=YY_START; + g_current->initializer+=yytext; + g_pCopyQuotedGString = &g_current->initializer; + g_lastStringContext=YY_START; BEGIN(CopyPHPGString); } else { - current->initializer+=yytext; + g_current->initializer+=yytext; } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - current->initializer+=yytext; + g_current->initializer+=yytext; } } \n { - current->initializer+=*yytext; + g_current->initializer+=*yytext; lineCount(); } "@\"" { - //printf("insideCS=%d\n",insideCS); - current->initializer+=yytext; - if (!insideCS && !insideObjC) + //printf("g_insideCS=%d\n",g_insideCS); + g_current->initializer+=yytext; + if (!g_insideCS && !g_insideObjC) { REJECT; } else { // C#/ObjC verbatim string - lastSkipVerbStringContext=YY_START; - pSkipVerbString=¤t->initializer; + g_lastSkipVerbStringContext=YY_START; + g_pSkipVerbString=&g_current->initializer; BEGIN(SkipVerbString); } } [^\n"]+ { - *pSkipVerbString+=yytext; + *g_pSkipVerbString+=yytext; } "\"\"" { // quote escape - *pSkipVerbString+=yytext; + *g_pSkipVerbString+=yytext; } "\"" { - *pSkipVerbString+=*yytext; - BEGIN(lastSkipVerbStringContext); + *g_pSkipVerbString+=*yytext; + BEGIN(g_lastSkipVerbStringContext); } \n { - *pSkipVerbString+=*yytext; + *g_pSkipVerbString+=*yytext; lineCount(); } . { - *pSkipVerbString+=*yytext; + *g_pSkipVerbString+=*yytext; } "?>" { - if (insidePHP) + if (g_insidePHP) BEGIN( FindMembersPHP ); else - current->initializer+=yytext; + g_current->initializer+=yytext; } . { - current->initializer+=*yytext; + g_current->initializer+=*yytext; } /* generic quoted string copy rules */ \\. { - *pCopyQuotedString+=yytext; + *g_pCopyQuotedString+=yytext; } \" { - *pCopyQuotedString+=*yytext; - BEGIN( lastStringContext ); + *g_pCopyQuotedString+=*yytext; + BEGIN( g_lastStringContext ); } \' { - *pCopyQuotedString+=*yytext; - BEGIN( lastStringContext ); + *g_pCopyQuotedString+=*yytext; + BEGIN( g_lastStringContext ); } "/*"|"*/"|"//" { - *pCopyQuotedString+=yytext; + *g_pCopyQuotedString+=yytext; } \n { - *pCopyQuotedString+=*yytext; + *g_pCopyQuotedString+=*yytext; lineCount(); } . { - *pCopyQuotedString+=*yytext; + *g_pCopyQuotedString+=*yytext; } /* generic quoted growable string copy rules */ \\. { - *pCopyQuotedGString+=yytext; + *g_pCopyQuotedGString+=yytext; } \" { - *pCopyQuotedGString+=*yytext; - BEGIN( lastStringContext ); + *g_pCopyQuotedGString+=*yytext; + BEGIN( g_lastStringContext ); } \' { - *pCopyQuotedGString+=*yytext; - BEGIN( lastStringContext ); + *g_pCopyQuotedGString+=*yytext; + BEGIN( g_lastStringContext ); } ""/*"|"*/"|"//" { - *pCopyQuotedGString+=yytext; + *g_pCopyQuotedGString+=yytext; } \n { - *pCopyQuotedGString+=*yytext; + *g_pCopyQuotedGString+=*yytext; lineCount(); } . { - *pCopyQuotedGString+=*yytext; + *g_pCopyQuotedGString+=*yytext; } /* generic round bracket list copy rules */ \" { - *pCopyRoundString+=*yytext; - pCopyQuotedString=pCopyRoundString; - lastStringContext=YY_START; + *g_pCopyRoundString+=*yytext; + g_pCopyQuotedString=g_pCopyRoundString; + g_lastStringContext=YY_START; BEGIN(CopyString); } "(" { - *pCopyRoundString+=*yytext; - roundCount++; + *g_pCopyRoundString+=*yytext; + g_roundCount++; } ")" { - *pCopyRoundString+=*yytext; - if (--roundCount<0) - BEGIN(lastRoundContext); + *g_pCopyRoundString+=*yytext; + if (--g_roundCount<0) + BEGIN(g_lastRoundContext); } \n { lineCount(); - *pCopyRoundString+=*yytext; + *g_pCopyRoundString+=*yytext; } \' { - if (insidePHP) + if (g_insidePHP) { - current->initializer+=yytext; - pCopyQuotedString = pCopyRoundString; - lastStringContext=YY_START; + g_current->initializer+=yytext; + g_pCopyQuotedString = g_pCopyRoundString; + g_lastStringContext=YY_START; BEGIN(CopyPHPString); } else { - *pCopyRoundString+=yytext; + *g_pCopyRoundString+=yytext; } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - *pCopyRoundString+=yytext; + *g_pCopyRoundString+=yytext; } } [^"'()\n]+ { - *pCopyRoundString+=yytext; + *g_pCopyRoundString+=yytext; } . { - *pCopyRoundString+=*yytext; + *g_pCopyRoundString+=*yytext; } /* generic round bracket list copy rules for growable strings */ \" { - *pCopyRoundGString+=*yytext; - pCopyQuotedGString=pCopyRoundGString; - lastStringContext=YY_START; + *g_pCopyRoundGString+=*yytext; + g_pCopyQuotedGString=g_pCopyRoundGString; + g_lastStringContext=YY_START; BEGIN(CopyGString); } "(" { - *pCopyRoundGString+=*yytext; - roundCount++; + *g_pCopyRoundGString+=*yytext; + g_roundCount++; } ")" { - *pCopyRoundGString+=*yytext; - if (--roundCount<0) - BEGIN(lastRoundContext); + *g_pCopyRoundGString+=*yytext; + if (--g_roundCount<0) + BEGIN(g_lastRoundContext); } \n { lineCount(); - *pCopyRoundGString+=*yytext; + *g_pCopyRoundGString+=*yytext; } \' { - if (insidePHP) + if (g_insidePHP) { - current->initializer+=yytext; - pCopyQuotedGString = pCopyRoundGString; - lastStringContext=YY_START; + g_current->initializer+=yytext; + g_pCopyQuotedGString = g_pCopyRoundGString; + g_lastStringContext=YY_START; BEGIN(CopyPHPGString); } else { - *pCopyRoundGString+=yytext; + *g_pCopyRoundGString+=yytext; } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - *pCopyRoundGString+=yytext; + *g_pCopyRoundGString+=yytext; } } [^"'()\n/]+ { - *pCopyRoundGString+=yytext; + *g_pCopyRoundGString+=yytext; } . { - *pCopyRoundGString+=*yytext; + *g_pCopyRoundGString+=*yytext; } /* generic square bracket list copy rules for growable strings, we should only enter here in case of php, left the test part as in GCopyRound to keep it compatible with the round bracket version */ \" { - *pCopySquareGString+=*yytext; - pCopyQuotedGString=pCopySquareGString; - lastStringContext=YY_START; + *g_pCopySquareGString+=*yytext; + g_pCopyQuotedGString=g_pCopySquareGString; + g_lastStringContext=YY_START; BEGIN(CopyGString); } "[" { - *pCopySquareGString+=*yytext; - squareCount++; + *g_pCopySquareGString+=*yytext; + g_squareCount++; } "]" { - *pCopySquareGString+=*yytext; - if (--squareCount<0) - BEGIN(lastSquareContext); + *g_pCopySquareGString+=*yytext; + if (--g_squareCount<0) + BEGIN(g_lastSquareContext); } \n { lineCount(); - *pCopySquareGString+=*yytext; + *g_pCopySquareGString+=*yytext; } \' { - if (insidePHP) + if (g_insidePHP) { - current->initializer+=yytext; - pCopyQuotedGString = pCopySquareGString; - lastStringContext=YY_START; + g_current->initializer+=yytext; + g_pCopyQuotedGString = g_pCopySquareGString; + g_lastStringContext=YY_START; BEGIN(CopyPHPGString); } else { - *pCopySquareGString+=yytext; + *g_pCopySquareGString+=yytext; } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - *pCopySquareGString+=yytext; + *g_pCopySquareGString+=yytext; } } [^"\[\]\n/]+ { - *pCopySquareGString+=yytext; + *g_pCopySquareGString+=yytext; } . { - *pCopySquareGString+=*yytext; + *g_pCopySquareGString+=*yytext; } /* generic curly bracket list copy rules */ \" { - *pCopyCurlyString+=*yytext; - pCopyQuotedString=pCopyCurlyString; - lastStringContext=YY_START; + *g_pCopyCurlyString+=*yytext; + g_pCopyQuotedString=g_pCopyCurlyString; + g_lastStringContext=YY_START; BEGIN(CopyString); } \' { - *pCopyCurlyString+=*yytext; - if (insidePHP) + *g_pCopyCurlyString+=*yytext; + if (g_insidePHP) { - pCopyQuotedString=pCopyCurlyString; - lastStringContext=YY_START; + g_pCopyQuotedString=g_pCopyCurlyString; + g_lastStringContext=YY_START; BEGIN(CopyPHPString); } } "{" { - *pCopyCurlyString+=*yytext; - curlyCount++; + *g_pCopyCurlyString+=*yytext; + g_curlyCount++; } "}" { - *pCopyCurlyString+=*yytext; - if (--curlyCount<0) - BEGIN(lastCurlyContext); + *g_pCopyCurlyString+=*yytext; + if (--g_curlyCount<0) + BEGIN(g_lastCurlyContext); } -{CHARLIT} { if (insidePHP) +{CHARLIT} { if (g_insidePHP) { REJECT; } else { - *pCopyCurlyString+=yytext; + *g_pCopyCurlyString+=yytext; } } [^"'{}\/\n]+ { - *pCopyCurlyString+=yytext; + *g_pCopyCurlyString+=yytext; } -"/" { *pCopyCurlyString+=yytext; } +"/" { *g_pCopyCurlyString+=yytext; } \n { lineCount(); - *pCopyCurlyString+=*yytext; + *g_pCopyCurlyString+=*yytext; } . { - *pCopyCurlyString+=*yytext; + *g_pCopyCurlyString+=*yytext; } /* generic curly bracket list copy rules for growable strings */ @@ -3336,7 +3315,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) QCString line = QCString(yytext); int s = line.find(' '); int e = line.find('"',s); - yyLineNr = line.mid(s,e-s).toInt(); + g_yyLineNr = line.mid(s,e-s).toInt(); if (yytext[yyleng-1]=='\n') { lineCount(); @@ -3344,435 +3323,435 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } \" { - *pCopyCurlyGString+=*yytext; - pCopyQuotedGString=pCopyCurlyGString; - lastStringContext=YY_START; + *g_pCopyCurlyGString+=*yytext; + g_pCopyQuotedGString=g_pCopyCurlyGString; + g_lastStringContext=YY_START; BEGIN(CopyGString); } \' { - *pCopyCurlyGString+=*yytext; - if (insidePHP) + *g_pCopyCurlyGString+=*yytext; + if (g_insidePHP) { - pCopyQuotedGString=pCopyCurlyGString; - lastStringContext=YY_START; + g_pCopyQuotedGString=g_pCopyCurlyGString; + g_lastStringContext=YY_START; BEGIN(CopyPHPGString); } } "{" { - *pCopyCurlyGString+=*yytext; - curlyCount++; + *g_pCopyCurlyGString+=*yytext; + g_curlyCount++; } "}" { - *pCopyCurlyGString+=*yytext; - if (--curlyCount<0) - BEGIN(lastCurlyContext); + *g_pCopyCurlyGString+=*yytext; + if (--g_curlyCount<0) + BEGIN(g_lastCurlyContext); } -{CHARLIT} { if (insidePHP) +{CHARLIT} { if (g_insidePHP) { REJECT; } else { - *pCopyCurlyGString+=yytext; + *g_pCopyCurlyGString+=yytext; } } [^"'{}\/\n,]+ { - *pCopyCurlyGString+=yytext; + *g_pCopyCurlyGString+=yytext; } [,]+ { - *pCopyCurlyGString+=yytext; + *g_pCopyCurlyGString+=yytext; } -"/" { *pCopyCurlyGString+=yytext; } +"/" { *g_pCopyCurlyGString+=yytext; } \n { lineCount(); - *pCopyCurlyGString+=*yytext; + *g_pCopyCurlyGString+=*yytext; } . { - *pCopyCurlyGString+=*yytext; + *g_pCopyCurlyGString+=*yytext; } /* ---------------------- */ ":" { - if (current->type.isEmpty() && - current->name=="enum") // see bug 69041, C++11 style anon enum: 'enum : unsigned int {...}' + if (g_current->type.isEmpty() && + g_current->name=="enum") // see bug 69041, C++11 style anon enum: 'enum : unsigned int {...}' { - current->section=Entry::ENUM_SEC; - current->name.resize(0); - current->args.resize(0); + g_current->section=Entry::ENUM_SEC; + g_current->name.resize(0); + g_current->args.resize(0); BEGIN(EnumBaseType); } else { - if (current->type.isEmpty()) // anonymous padding field, e.g. "int :7;" + if (g_current->type.isEmpty()) // anonymous padding field, e.g. "int :7;" { addType(); - current->name.sprintf("__pad%d__",padCount++); + g_current->name.sprintf("__pad%d__",g_padCount++); } BEGIN(BitFields); - current->bitfields+=":"; + g_current->bitfields+=":"; } } . { - current->bitfields+=*yytext; + g_current->bitfields+=*yytext; } . { - current->args+=*yytext; + g_current->args+=*yytext; } \n { lineCount(); - current->args+=' '; + g_current->args+=' '; } [;,] { - QCString oldType = current->type; - if (current->bodyLine==-1) + QCString oldType = g_current->type; + if (g_current->bodyLine==-1) { - current->bodyLine = yyLineNr; + g_current->bodyLine = g_yyLineNr; } - if ( insidePHP && current->type.left(3) == "var" ) + if ( g_insidePHP && g_current->type.left(3) == "var" ) { - current->type = current->type.mid(3); + g_current->type = g_current->type.mid(3); } - if (isTypedef && current->type.left(8)!="typedef ") + if (g_isTypedef && g_current->type.left(8)!="typedef ") { - current->type.prepend("typedef "); + g_current->type.prepend("typedef "); } - bool stat = current->stat; - if (!current->name.isEmpty() && current->section!=Entry::ENUM_SEC) + bool stat = g_current->stat; + if (!g_current->name.isEmpty() && g_current->section!=Entry::ENUM_SEC) { - current->type=current->type.simplifyWhiteSpace(); - current->args=removeRedundantWhiteSpace(current->args); - current->name=current->name.stripWhiteSpace(); - if (current->section==Entry::CLASS_SEC) // remove spec for "struct Bla bla;" + g_current->type=g_current->type.simplifyWhiteSpace(); + g_current->args=removeRedundantWhiteSpace(g_current->args); + g_current->name=g_current->name.stripWhiteSpace(); + if (g_current->section==Entry::CLASS_SEC) // remove spec for "struct Bla bla;" { - current->spec = 0; + g_current->spec = 0; } - current->section = Entry::VARIABLE_SEC ; - current->fileName = yyFileName; - current->startLine = yyBegLineNr; - current->startColumn = yyBegColNr; - current_root->moveToSubEntryAndRefresh( current ) ; + g_current->section = Entry::VARIABLE_SEC ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyBegLineNr; + g_current->startColumn = g_yyBegColNr; + g_current_root->moveToSubEntryAndRefresh( g_current ) ; initEntry(); } if ( *yytext == ',') { - current->stat = stat; // the static attribute holds for all variables - current->name.resize(0); - current->args.resize(0); - current->brief.resize(0); - current->doc.resize(0); - current->initializer.resize(0); - current->bitfields.resize(0); + g_current->stat = stat; // the static attribute holds for all variables + g_current->name.resize(0); + g_current->args.resize(0); + g_current->brief.resize(0); + g_current->doc.resize(0); + g_current->initializer.resize(0); + g_current->bitfields.resize(0); int i=oldType.length(); while (i>0 && (oldType[i-1]=='*' || oldType[i-1]=='&' || oldType[i-1]==' ')) i--; - current->type = oldType.left(i); + g_current->type = oldType.left(i); } else { - mtype = Method; - virt = Normal; - current->groups.clear(); + g_mtype = Method; + g_virt = Normal; + g_current->groups.clear(); initEntry(); } } "[" { - if (insideSlice) + if (g_insideSlice) { - squareCount=1; - lastSquareContext = YY_START; - current->metaData += "["; + g_squareCount=1; + g_lastSquareContext = YY_START; + g_current->metaData += "["; BEGIN( SliceMetadata ); } - else if (!insideCS && - (current->name.isEmpty() || - current->name=="typedef" + else if (!g_insideCS && + (g_current->name.isEmpty() || + g_current->name=="typedef" ) ) // IDL function property { - squareCount=1; - lastSquareContext = YY_START; - idlAttr.resize(0); - idlProp.resize(0); - current->mtype = mtype; + g_squareCount=1; + g_lastSquareContext = YY_START; + g_idlAttr.resize(0); + g_idlProp.resize(0); + g_current->mtype = g_mtype; if (Config_getBool(IDL_PROPERTY_SUPPORT) && - current->mtype == Property) - { // we are inside the properties section of a dispinterface - odlProp = true; - current->spec |= Entry::Gettable; - current->spec |= Entry::Settable; + g_current->mtype == Property) + { // we are g_inside the properties section of a dispinterface + g_odlProp = true; + g_current->spec |= Entry::Gettable; + g_current->spec |= Entry::Settable; } BEGIN( IDLAttribute ); } - else if (insideCS && - current->name.isEmpty()) + else if (g_insideCS && + g_current->name.isEmpty()) { - squareCount=1; - lastSquareContext = YY_START; + g_squareCount=1; + g_lastSquareContext = YY_START; // Skip the C# attribute // for this member - current->args.resize(0); + g_current->args.resize(0); BEGIN( SkipSquare ); } else { - current->args += yytext ; - squareCount=1; - externC=FALSE; // see bug759247 + g_current->args += yytext ; + g_squareCount=1; + g_externC=FALSE; // see bug759247 BEGIN( Array ) ; } } "[" { // Global metadata. - squareCount++; - current->metaData += "["; + g_squareCount++; + g_current->metaData += "["; } {BN}* { lineCount(); } \"[^\"]*\" { - current->metaData += yytext; + g_current->metaData += yytext; } "," { - current->metaData += yytext; + g_current->metaData += yytext; } "]" { - current->metaData += yytext; - if (--squareCount<=0) + g_current->metaData += yytext; + if (--g_squareCount<=0) { - BEGIN (lastSquareContext); + BEGIN (g_lastSquareContext); } } "(" { - current->type += "("; - roundCount++; + g_current->type += "("; + g_roundCount++; } [0-9]+ { - current->type += yytext; + g_current->type += yytext; } ")" { - current->type += ")"; - if(--roundCount<=0) + g_current->type += ")"; + if(--g_roundCount<=0) { - BEGIN (lastModifierContext); + BEGIN (g_lastModifierContext); } } "]" { // end of IDL function attribute - if (--squareCount<=0) + if (--g_squareCount<=0) { lineCount(); - if (current->mtype == Property) + if (g_current->mtype == Property) BEGIN( IDLPropName ); else - BEGIN( lastSquareContext ); + BEGIN( g_lastSquareContext ); } } "propput" { if (Config_getBool(IDL_PROPERTY_SUPPORT)) { - current->mtype = Property; + g_current->mtype = Property; } - current->spec |= Entry::Settable; + g_current->spec |= Entry::Settable; } "propget" { if (Config_getBool(IDL_PROPERTY_SUPPORT)) { - current->mtype = Property; + g_current->mtype = Property; } - current->spec |= Entry::Gettable; + g_current->spec |= Entry::Gettable; } "property" { // UNO IDL property - current->spec |= Entry::Property; + g_current->spec |= Entry::Property; } "attribute" { // UNO IDL attribute - current->spec |= Entry::Attribute; + g_current->spec |= Entry::Attribute; } "optional" { // on UNO IDL interface/service/attribute/property - current->spec |= Entry::Optional; + g_current->spec |= Entry::Optional; } "readonly" { // on UNO IDL attribute or property - if (Config_getBool(IDL_PROPERTY_SUPPORT) && odlProp) + if (Config_getBool(IDL_PROPERTY_SUPPORT) && g_odlProp) { - current->spec ^= Entry::Settable; + g_current->spec ^= Entry::Settable; } else { - current->spec |= Entry::Readonly; + g_current->spec |= Entry::Readonly; } } "bound" { // on UNO IDL attribute or property - current->spec |= Entry::Bound; + g_current->spec |= Entry::Bound; } "removable" { // on UNO IDL property - current->spec |= Entry::Removable; + g_current->spec |= Entry::Removable; } "constrained" { // on UNO IDL property - current->spec |= Entry::Constrained; + g_current->spec |= Entry::Constrained; } "transient" { // on UNO IDL property - current->spec |= Entry::Transient; + g_current->spec |= Entry::Transient; } "maybevoid" { // on UNO IDL property - current->spec |= Entry::MaybeVoid; + g_current->spec |= Entry::MaybeVoid; } "maybedefault" { // on UNO IDL property - current->spec |= Entry::MaybeDefault; + g_current->spec |= Entry::MaybeDefault; } "maybeambiguous" { // on UNO IDL property - current->spec |= Entry::MaybeAmbiguous; + g_current->spec |= Entry::MaybeAmbiguous; } . { } {BN}*{ID}{BN}* { // return type (probably HRESULT) - skip it - if (odlProp) + if (g_odlProp) { // property type - idlProp = yytext; + g_idlProp = yytext; } } {ID}{BN}*"(" { - current->name = yytext; - current->name = current->name.left(current->name.length()-1).stripWhiteSpace(); - current->startLine = yyLineNr; - current->startColumn = yyColNr; + g_current->name = yytext; + g_current->name = g_current->name.left(g_current->name.length()-1).stripWhiteSpace(); + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; BEGIN( IDLProp ); } {BN}*"("{BN}*{ID}{BN}*")"{BN}* { - if (odlProp) + if (g_odlProp) { - idlProp += yytext; + g_idlProp += yytext; } } {ID}{BN}*/";" { - if (odlProp) + if (g_odlProp) { - current->name = yytext; - idlProp = idlProp.stripWhiteSpace(); - odlProp = false; + g_current->name = yytext; + g_idlProp = g_idlProp.stripWhiteSpace(); + g_odlProp = false; BEGIN( IDLProp ); } } {BN}*"["[^\]]*"]"{BN}* { // attribute of a parameter - idlAttr = yytext; - idlAttr=idlAttr.stripWhiteSpace(); + g_idlAttr = yytext; + g_idlAttr=g_idlAttr.stripWhiteSpace(); } {ID} { // property type - idlProp = yytext; + g_idlProp = yytext; } {BN}*{ID}{BN}*"," { // Rare: Another parameter ([propput] HRESULT Item(int index, [in] Type theRealProperty);) - if (!current->args) - current->args = "("; + if (!g_current->args) + g_current->args = "("; else - current->args += ", "; - current->args += idlAttr; - current->args += " "; - current->args += idlProp; // prop was actually type of extra parameter - current->args += " "; - current->args += yytext; - current->args = current->args.left(current->args.length() - 1); // strip comma - idlProp.resize(0); - idlAttr.resize(0); + g_current->args += ", "; + g_current->args += g_idlAttr; + g_current->args += " "; + g_current->args += g_idlProp; // prop was actually type of extra parameter + g_current->args += " "; + g_current->args += yytext; + g_current->args = g_current->args.left(g_current->args.length() - 1); // strip comma + g_idlProp.resize(0); + g_idlAttr.resize(0); BEGIN( IDLProp ); } {BN}*{ID}{BN}*")"{BN}* { // the parameter name for the property - just skip. } ";" { - current->fileName = yyFileName; - current->type = idlProp; - current->args = current->args.simplifyWhiteSpace(); - if (current->args) - current->args += ")"; - current->name = current->name.stripWhiteSpace(); - current->section = Entry::VARIABLE_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->fileName = g_yyFileName; + g_current->type = g_idlProp; + g_current->args = g_current->args.simplifyWhiteSpace(); + if (g_current->args) + g_current->args += ")"; + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::VARIABLE_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN( FindMembers ); } . { // spaces, *, or other stuff - //idlProp+=yytext; + //g_idlProp+=yytext; } -"]" { current->args += *yytext ; - if (--squareCount<=0) +"]" { g_current->args += *yytext ; + if (--g_squareCount<=0) BEGIN( FindMembers ) ; } -"]" { current->args += *yytext ; - if (--squareCount<=0) +"]" { g_current->args += *yytext ; + if (--g_squareCount<=0) BEGIN( Function ) ; } -"[" { current->args += *yytext ; - squareCount++; +"[" { g_current->args += *yytext ; + g_squareCount++; } -. { current->args += *yytext ; } -"[" { squareCount++; } +. { g_current->args += *yytext ; } +"[" { g_squareCount++; } "]" { - if (--squareCount<=0) - BEGIN( lastSquareContext ); + if (--g_squareCount<=0) + BEGIN( g_lastSquareContext ); } \" { - lastStringContext=YY_START; + g_lastStringContext=YY_START; BEGIN( SkipString ); } [^\n\[\]\"]+ "<" { addType(); - current->type += yytext ; + g_current->type += yytext ; BEGIN( Sharp ) ; } -">" { current->type += *yytext ; - if (--sharpCount<=0) +">" { g_current->type += *yytext ; + if (--g_sharpCount<=0) BEGIN( FindMembers ) ; } -"<" { current->type += *yytext ; - sharpCount++; +"<" { g_current->type += *yytext ; + g_sharpCount++; } {BN}+ { - current->type += ' '; + g_current->type += ' '; lineCount(); } -. { current->type += *yytext ; } +. { g_current->type += *yytext ; } {ID} { - if (insideCpp || insideObjC) + if (g_insideCpp || g_insideObjC) { - current->id = ClangParser::instance()->lookup(yyLineNr,yytext); + g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); } - current->bodyLine = yyLineNr; - current->name = yytext; + g_current->bodyLine = g_yyLineNr; + g_current->name = yytext; } "(" { // Java enum initializer unput('('); - lastInitializerContext = YY_START; - initBracketCount=0; - current->initializer = "="; + g_lastInitializerContext = YY_START; + g_initBracketCount=0; + g_current->initializer = "="; BEGIN(ReadInitializer); } "=" { - lastInitializerContext = YY_START; - initBracketCount=0; - current->initializer = yytext; + g_lastInitializerContext = YY_START; + g_initBracketCount=0; + g_current->initializer = yytext; BEGIN(ReadInitializer); } ";" { - if (insideJava) // last enum field in Java class + if (g_insideJava) // g_last enum field in Java class { - if (!current->name.isEmpty()) + if (!g_current->name.isEmpty()) { - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - if (!(current_root->spec&Entry::Enum)) + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + if (!(g_current_root->spec&Entry::Enum)) { - current->type = "@"; // enum marker + g_current->type = "@"; // enum marker } - current->args = current->args.simplifyWhiteSpace(); - current->name = current->name.stripWhiteSpace(); - current->section = Entry::VARIABLE_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::VARIABLE_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); } @@ -3789,65 +3768,65 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) [^\n]* "," { //printf("adding '%s' '%s' '%s' to enum '%s' (mGrpId=%d)\n", - // current->type.data(), current->name.data(), - // current->args.data(), current_root->name.data(),current->mGrpId); - if (!current->name.isEmpty()) - { - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - if (!(current_root->spec&Entry::Enum)) + // g_current->type.data(), g_current->name.data(), + // g_current->args.data(), g_current_root->name.data(),g_current->mGrpId); + if (!g_current->name.isEmpty()) + { + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + if (!(g_current_root->spec&Entry::Enum)) { - current->type = "@"; // enum marker + g_current->type = "@"; // enum marker } - current->args = current->args.simplifyWhiteSpace(); - current->name = current->name.stripWhiteSpace(); - current->section = Entry::VARIABLE_SEC; + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::VARIABLE_SEC; // add to the scope of the enum - if (!insideCS && !insideJava && - !(current_root->spec&Entry::Strong)) + if (!g_insideCS && !g_insideJava && + !(g_current_root->spec&Entry::Strong)) // for C# and Java 1.5+ enum values always have to be explicitly qualified, // same for C++11 style enums (enum class Name {}) { // add to the scope surrounding the enum (copy!) // we cannot during it directly as that would invalidate the iterator in parseCompounds. - //printf("*** adding outer scope entry for %s\n",current->name.data()); - g_outerScopeEntries.emplace_back(current_root->parent(), std::make_unique(*current)); + //printf("*** adding outer scope entry for %s\n",g_current->name.data()); + g_outerScopeEntries.emplace_back(g_current_root->parent(), std::make_unique(*g_current)); } - current_root->moveToSubEntryAndRefresh(current); + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); } else // probably a redundant , { - current->reset(); + g_current->reset(); initEntry(); } } "[" { // attribute list in IDL - squareCount=1; - lastSquareContext = YY_START; + g_squareCount=1; + g_lastSquareContext = YY_START; BEGIN(SkipSquare); } /* "," { unput(*yytext); BEGIN(FindFields); } */ -[^\r\n\#{}"@'/<]* { current->program += yytext ; } -"//".* { current->program += yytext ; } -"#".* { if (!insidePHP) +[^\r\n\#{}"@'/<]* { g_current->program += yytext ; } +"//".* { g_current->program += yytext ; } +"#".* { if (!g_insidePHP) REJECT; // append PHP comment. - current->program += yytext ; + g_current->program += yytext ; } -@\" { current->program += yytext ; - pSkipVerbString = ¤t->program; - lastSkipVerbStringContext=YY_START; +@\" { g_current->program += yytext ; + g_pSkipVerbString = &g_current->program; + g_lastSkipVerbStringContext=YY_START; BEGIN( SkipVerbString ); } -"<<<" { if (insidePHP) +"<<<" { if (g_insidePHP) { - current->program += yytext ; - pCopyHereDocGString = ¤t->program; - lastHereDocContext=YY_START; + g_current->program += yytext ; + g_pCopyHereDocGString = &g_current->program; + g_lastHereDocContext=YY_START; BEGIN( CopyHereDoc ); } else @@ -3855,154 +3834,154 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) REJECT; } } -\" { current->program += yytext ; - pCopyQuotedGString = ¤t->program; - lastStringContext=YY_START; +\" { g_current->program += yytext ; + g_pCopyQuotedGString = &g_current->program; + g_lastStringContext=YY_START; BEGIN( CopyGString ); } -"/*"{B}* { current->program += yytext ; - lastContext = YY_START ; +"/*"{B}* { g_current->program += yytext ; + g_lastContext = YY_START ; BEGIN( Comment ) ; } -"/*"{BL} { current->program += yytext ; - ++yyLineNr ; - lastContext = YY_START ; +"/*"{BL} { g_current->program += yytext ; + ++g_yyLineNr ; + g_lastContext = YY_START ; BEGIN( Comment ) ; } "'" { - if (!insidePHP) + if (!g_insidePHP) { - current->program += yytext; + g_current->program += yytext; } else { // begin of single quoted string - current->program += yytext; - pCopyQuotedGString = ¤t->program; - lastStringContext=YY_START; + g_current->program += yytext; + g_pCopyQuotedGString = &g_current->program; + g_lastStringContext=YY_START; BEGIN(CopyPHPGString); } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; // for PHP code single quotes // are used for strings of arbitrary length } else { - current->program += yytext; + g_current->program += yytext; } } -"{" { current->program += yytext ; - ++curlyCount ; +"{" { g_current->program += yytext ; + ++g_curlyCount ; } "}" { - current->program += yytext ; - --curlyCount ; + g_current->program += yytext ; + --g_curlyCount ; } -"}" { //err("ReadBody count=%d\n",curlyCount); - if ( curlyCount>0 ) +"}" { //err("ReadBody count=%d\n",g_curlyCount); + if ( g_curlyCount>0 ) { - current->program += yytext ; - --curlyCount ; + g_current->program += yytext ; + --g_curlyCount ; } else { - current->endBodyLine = yyLineNr; - Entry * original_root = current_root; // save root this namespace is in - if (current->section == Entry::NAMESPACE_SEC && current->type == "namespace") + g_current->endBodyLine = g_yyLineNr; + Entry * original_root = g_current_root; // save root this namespace is in + if (g_current->section == Entry::NAMESPACE_SEC && g_current->type == "namespace") { int split_point; // save documentation values - QCString doc = current->doc; - int docLine = current->docLine; - QCString docFile = current->docFile; - QCString brief = current->brief; - int briefLine = current->briefLine; - QCString briefFile = current->briefFile; + QCString doc = g_current->doc; + int docLine = g_current->docLine; + QCString docFile = g_current->docFile; + QCString brief = g_current->brief; + int briefLine = g_current->briefLine; + QCString briefFile = g_current->briefFile; // reset documentation values - current->doc = ""; - current->docLine = 0; - current->docFile = ""; - current->brief = ""; - current->briefLine = 0; - current->briefFile = ""; - while ((split_point = current->name.find("::")) != -1) + g_current->doc = ""; + g_current->docLine = 0; + g_current->docFile = ""; + g_current->brief = ""; + g_current->briefLine = 0; + g_current->briefFile = ""; + while ((split_point = g_current->name.find("::")) != -1) { - std::unique_ptr new_current = std::make_unique(*current); - current->program = ""; - new_current->name = current->name.mid(split_point + 2); - current->name = current->name.left(split_point); - if (!current_root->name.isEmpty()) current->name.prepend(current_root->name+"::"); - - Entry *tmp = current.get(); - current_root->moveToSubEntryAndKeep(current); - current_root = tmp; - current.swap(new_current); + std::unique_ptr new_g_current = std::make_unique(*g_current); + g_current->program = ""; + new_g_current->name = g_current->name.mid(split_point + 2); + g_current->name = g_current->name.left(split_point); + if (!g_current_root->name.isEmpty()) g_current->name.prepend(g_current_root->name+"::"); + + Entry *tmp = g_current.get(); + g_current_root->moveToSubEntryAndKeep(g_current); + g_current_root = tmp; + g_current.swap(new_g_current); } // restore documentation values - current->doc = doc; - current->docLine = docLine; - current->docFile = docFile; - current->brief = brief; - current->briefLine = briefLine; - current->briefFile = briefFile; + g_current->doc = doc; + g_current->docLine = docLine; + g_current->docFile = docFile; + g_current->brief = brief; + g_current->briefLine = briefLine; + g_current->briefFile = briefFile; } - QCString &cn = current->name; - QCString rn = current_root->name.copy(); - //printf("cn='%s' rn='%s' isTypedef=%d\n",cn.data(),rn.data(),isTypedef); + QCString &cn = g_current->name; + QCString rn = g_current_root->name.copy(); + //printf("cn='%s' rn='%s' g_isTypedef=%d\n",cn.data(),rn.data(),g_isTypedef); if (!cn.isEmpty() && !rn.isEmpty()) { prependScope(); } - if (isTypedef && cn.isEmpty()) + if (g_isTypedef && cn.isEmpty()) { //printf("Typedef Name\n"); BEGIN( TypedefName ); } else { - if ((current->section == Entry::ENUM_SEC) || (current->spec&Entry::Enum)) + if ((g_current->section == Entry::ENUM_SEC) || (g_current->spec&Entry::Enum)) { - current->program+=','; // add field terminator + g_current->program+=','; // add field terminator } // add compound definition to the tree - current->args=removeRedundantWhiteSpace(current->args); - // was: current->args.simplifyWhiteSpace(); - current->type = current->type.simplifyWhiteSpace(); - current->name = current->name.stripWhiteSpace(); - //printf("adding '%s' '%s' '%s' brief=%s insideObjC=%d %x\n",current->type.data(),current->name.data(),current->args.data(),current->brief.data(),insideObjC,current->section); - if (insideObjC && - ((current->spec&Entry::Interface) || (current->spec==Entry::Category)) + g_current->args=removeRedundantWhiteSpace(g_current->args); + // was: g_current->args.simplifyWhiteSpace(); + g_current->type = g_current->type.simplifyWhiteSpace(); + g_current->name = g_current->name.stripWhiteSpace(); + //printf("adding '%s' '%s' '%s' brief=%s g_insideObjC=%d %x\n",g_current->type.data(),g_current->name.data(),g_current->args.data(),g_current->brief.data(),g_insideObjC,g_current->section); + if (g_insideObjC && + ((g_current->spec&Entry::Interface) || (g_current->spec==Entry::Category)) ) // method definition follows { BEGIN( ReadBodyIntf ) ; } else { - memspecEntry = current.get(); - current_root->copyToSubEntry( current ) ; - if (current->section==Entry::NAMESPACE_SEC || - (current->spec==Entry::Interface) || - insideJava || insidePHP || insideCS || insideD || insideJS || - insideSlice + g_memspecEntry = g_current.get(); + g_current_root->copyToSubEntry( g_current ) ; + if (g_current->section==Entry::NAMESPACE_SEC || + (g_current->spec==Entry::Interface) || + g_insideJava || g_insidePHP || g_insideCS || g_insideD || g_insideJS || + g_insideSlice ) { // namespaces and interfaces and java classes ends with a closing bracket without semicolon - current->reset(); - current_root = original_root; // restore scope from before namespace descent + g_current->reset(); + g_current_root = original_root; // restore scope from before namespace descent initEntry(); - memspecEntry = 0; + g_memspecEntry = 0; BEGIN( FindMembers ) ; } else { static QRegExp re("@[0-9]+$"); - if (!isTypedef && memspecEntry && - memspecEntry->name.find(re)==-1) // not typedef or anonymous type (see bug691071) + if (!g_isTypedef && g_memspecEntry && + g_memspecEntry->name.find(re)==-1) // not typedef or anonymous type (see bug691071) { // enabled the next two lines for bug 623424 - current->doc.resize(0); - current->brief.resize(0); + g_current->doc.resize(0); + g_current->brief.resize(0); } BEGIN( MemberSpec ) ; } @@ -4010,19 +3989,19 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } } -"}"{BN}+"typedef"{BN}+ { //err("ReadBody count=%d\n",curlyCount); +"}"{BN}+"typedef"{BN}+ { //err("ReadBody count=%d\n",g_curlyCount); lineCount(); - if ( curlyCount>0 ) + if ( g_curlyCount>0 ) { - current->program += yytext ; - --curlyCount ; + g_current->program += yytext ; + --g_curlyCount ; } else { - isTypedef = TRUE; - current->endBodyLine = yyLineNr; - QCString &cn = current->name; - QCString rn = current_root->name.copy(); + g_isTypedef = TRUE; + g_current->endBodyLine = g_yyLineNr; + QCString &cn = g_current->name; + QCString rn = g_current_root->name.copy(); if (!cn.isEmpty() && !rn.isEmpty()) { prependScope(); @@ -4032,38 +4011,38 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } ("const"|"volatile"){BN} { // late "const" or "volatile" keyword lineCount(); - current->type.prepend(yytext); + g_current->type.prepend(yytext); } {ID} { - if ((current->section == Entry::ENUM_SEC) || (current->spec&Entry::Enum)) + if ((g_current->section == Entry::ENUM_SEC) || (g_current->spec&Entry::Enum)) { - current->program+=","; // add field terminator + g_current->program+=","; // add field terminator } - current->name=yytext; + g_current->name=yytext; prependScope(); - current->args = current->args.simplifyWhiteSpace(); - current->type = current->type.simplifyWhiteSpace(); - //printf("Adding compound %s %s %s\n",current->type.data(),current->name.data(),current->args.data()); - if (!firstTypedefEntry) + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->type = g_current->type.simplifyWhiteSpace(); + //printf("Adding compound %s %s %s\n",g_current->type.data(),g_current->name.data(),g_current->args.data()); + if (!g_firstTypedefEntry) { - firstTypedefEntry = current.get(); + g_firstTypedefEntry = g_current.get(); } - current_root->moveToSubEntryAndRefresh( current ) ; + g_current_root->moveToSubEntryAndRefresh( g_current ) ; initEntry(); - isTypedef=TRUE; // to undo reset by initEntry() + g_isTypedef=TRUE; // to undo reset by initEntry() BEGIN(MemberSpecSkip); } ";" { /* typedef of anonymous type */ - current->name.sprintf("@%d",anonCount++); - if ((current->section == Entry::ENUM_SEC) || (current->spec&Entry::Enum)) + g_current->name.sprintf("@%d",g_anonCount++); + if ((g_current->section == Entry::ENUM_SEC) || (g_current->spec&Entry::Enum)) { - current->program+=','; // add field terminator + g_current->program+=','; // add field terminator } // add compound definition to the tree - current->args = current->args.simplifyWhiteSpace(); - current->type = current->type.simplifyWhiteSpace(); - memspecEntry = current.get(); - current_root->moveToSubEntryAndRefresh( current ) ; + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->type = g_current->type.simplifyWhiteSpace(); + g_memspecEntry = g_current.get(); + g_current_root->moveToSubEntryAndRefresh( g_current ) ; initEntry(); unput(';'); BEGIN( MemberSpec ) ; @@ -4072,51 +4051,51 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lineCount(); int i=0,l=(int)yyleng,j; while (ispec&Entry::Struct) + if (g_firstTypedefEntry->spec&Entry::Struct) { - msType.prepend("struct "+firstTypedefEntry->name); + g_msType.prepend("struct "+g_firstTypedefEntry->name); } - else if (firstTypedefEntry->spec&Entry::Union) + else if (g_firstTypedefEntry->spec&Entry::Union) { - msType.prepend("union "+firstTypedefEntry->name); + g_msType.prepend("union "+g_firstTypedefEntry->name); } - else if (firstTypedefEntry->section==Entry::ENUM_SEC) + else if (g_firstTypedefEntry->section==Entry::ENUM_SEC) { - msType.prepend("enum "+firstTypedefEntry->name); + g_msType.prepend("enum "+g_firstTypedefEntry->name); } else { - msType.prepend(firstTypedefEntry->name); + g_msType.prepend(g_firstTypedefEntry->name); } } } "(" { // function with struct return type addType(); - current->name = msName; - current->spec = 0; + g_current->name = g_msName; + g_current->spec = 0; unput('('); BEGIN(FindMembers); } [,;] { - if (msName.isEmpty() && !current->name.isEmpty()) + if (g_msName.isEmpty() && !g_current->name.isEmpty()) { - // see if the compound does not have a name or is inside another + // see if the compound does not have a name or is g_inside another // anonymous compound. If so we insert a // special 'anonymous' variable. - //Entry *p=current_root; - const Entry *p=current.get(); + //Entry *p=g_current_root; + const Entry *p=g_current.get(); while (p) { // only look for class scopes, not namespace scopes @@ -4127,164 +4106,164 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) int pi = (i==-1) ? 0 : i+2; if (p->name.at(pi)=='@') { - // anonymous compound inside -> insert dummy variable name + // anonymous compound g_inside -> insert dummy variable name //printf("Adding anonymous variable for scope %s\n",p->name.data()); - msName.sprintf("@%d",anonCount++); + g_msName.sprintf("@%d",g_anonCount++); break; } } //p=p->parent; - if (p==current.get()) p=current_root; else p=p->parent(); + if (p==g_current.get()) p=g_current_root; else p=p->parent(); } } - //printf("msName=%s current->name=%s\n",msName.data(),current->name.data()); - if (!msName.isEmpty() - /*&& msName!=current->name*/) // skip typedef T {} T;, removed due to bug608493 + //printf("g_msName=%s g_current->name=%s\n",g_msName.data(),g_current->name.data()); + if (!g_msName.isEmpty() + /*&& g_msName!=g_current->name*/) // skip typedef T {} T;, removed due to bug608493 { static bool typedefHidesStruct = Config_getBool(TYPEDEF_HIDES_STRUCT); // case 1: typedef struct _S { ... } S_t; // -> omit typedef and use S_t as the struct name if (typedefHidesStruct && - isTypedef && - ((current->spec&(Entry::Struct|Entry::Union)) || - current->section==Entry::ENUM_SEC )&& - msType.stripWhiteSpace().isEmpty() && - memspecEntry) + g_isTypedef && + ((g_current->spec&(Entry::Struct|Entry::Union)) || + g_current->section==Entry::ENUM_SEC )&& + g_msType.stripWhiteSpace().isEmpty() && + g_memspecEntry) { - memspecEntry->name=msName; + g_memspecEntry->name=g_msName; } else // case 2: create a typedef field { std::unique_ptr varEntry=std::make_unique(); - varEntry->lang = language; - varEntry->protection = current->protection ; - varEntry->mtype = current->mtype; - varEntry->virt = current->virt; - varEntry->stat = current->stat; + varEntry->lang = g_language; + varEntry->protection = g_current->protection ; + varEntry->mtype = g_current->mtype; + varEntry->virt = g_current->virt; + varEntry->stat = g_current->stat; varEntry->section = Entry::VARIABLE_SEC; - varEntry->name = msName.stripWhiteSpace(); - varEntry->type = current->type.simplifyWhiteSpace()+" "; - varEntry->args = msArgs; - if (isTypedef) + varEntry->name = g_msName.stripWhiteSpace(); + varEntry->type = g_current->type.simplifyWhiteSpace()+" "; + varEntry->args = g_msArgs; + if (g_isTypedef) { varEntry->type.prepend("typedef "); - // //printf("current->name = %s %s\n",current->name.data(),msName.data()); + // //printf("g_current->name = %s %s\n",g_current->name.data(),g_msName.data()); } if (typedefHidesStruct && - isTypedef && - (current->spec&(Entry::Struct|Entry::Union)) && - memspecEntry + g_isTypedef && + (g_current->spec&(Entry::Struct|Entry::Union)) && + g_memspecEntry ) // case 1: use S_t as type for pS_t in "typedef struct _S {} S_t, *pS_t;" { - varEntry->type+=memspecEntry->name+msType; + varEntry->type+=g_memspecEntry->name+g_msType; } else // case 2: use _S as type for for pS_t { - varEntry->type+=current->name+msType; + varEntry->type+=g_current->name+g_msType; } - varEntry->fileName = yyFileName; - varEntry->startLine = yyLineNr; - varEntry->startColumn = yyColNr; - varEntry->doc = current->doc.copy(); - varEntry->brief = current->brief.copy(); - varEntry->mGrpId = current->mGrpId; - varEntry->initializer = current->initializer; - varEntry->groups = current->groups; - varEntry->sli = current->sli; + varEntry->fileName = g_yyFileName; + varEntry->startLine = g_yyLineNr; + varEntry->startColumn = g_yyColNr; + varEntry->doc = g_current->doc.copy(); + varEntry->brief = g_current->brief.copy(); + varEntry->mGrpId = g_current->mGrpId; + varEntry->initializer = g_current->initializer; + varEntry->groups = g_current->groups; + varEntry->sli = g_current->sli; //printf("Add: type='%s',name='%s',args='%s' brief=%s doc=%s\n", // varEntry->type.data(),varEntry->name.data(), // varEntry->args.data(),varEntry->brief.data(),varEntry->doc.data()); - current_root->moveToSubEntryAndKeep(varEntry); + g_current_root->moveToSubEntryAndKeep(varEntry); } } if (*yytext==';') // end of a struct/class ... { - if (!isTypedef && msName.isEmpty() && memspecEntry && (current->section&Entry::COMPOUND_MASK)) + if (!g_isTypedef && g_msName.isEmpty() && g_memspecEntry && (g_current->section&Entry::COMPOUND_MASK)) { // case where a class/struct has a doc block after it - if (!current->doc.isEmpty()) + if (!g_current->doc.isEmpty()) { - memspecEntry->doc += current->doc; + g_memspecEntry->doc += g_current->doc; } - if (!current->brief.isEmpty()) + if (!g_current->brief.isEmpty()) { - memspecEntry->brief += current->brief; + g_memspecEntry->brief += g_current->brief; } } - msType.resize(0); - msName.resize(0); - msArgs.resize(0); - isTypedef=FALSE; - firstTypedefEntry=0; - memspecEntry=0; - current->reset(); + g_msType.resize(0); + g_msName.resize(0); + g_msArgs.resize(0); + g_isTypedef=FALSE; + g_firstTypedefEntry=0; + g_memspecEntry=0; + g_current->reset(); initEntry(); BEGIN( FindMembers ); } else { - current->doc.resize(0); - current->brief.resize(0); + g_current->doc.resize(0); + g_current->brief.resize(0); } } "=" { - lastInitializerContext=YY_START; - initBracketCount=0; - current->initializer = yytext; + g_lastInitializerContext=YY_START; + g_initBracketCount=0; + g_current->initializer = yytext; BEGIN(ReadInitializer); /* BEGIN(MemberSpecSkip); */ } /* "{" { - curlyCount=0; - lastCurlyContext = MemberSpecSkip; - previous = current; + g_curlyCount=0; + g_lastCurlyContext = MemberSpecSkip; + g_previous = g_current; BEGIN(SkipCurly); } */ "," { BEGIN(MemberSpec); } ";" { unput(';'); BEGIN(MemberSpec); } -{BN}{1,80} { current->program += yytext ; +{BN}{1,80} { g_current->program += yytext ; lineCount() ; } "@end"/[^a-z_A-Z0-9] { // end of Objective C block - current_root->moveToSubEntryAndRefresh( current ) ; + g_current_root->moveToSubEntryAndRefresh( g_current ) ; initEntry(); - language = current->lang = SrcLangExt_Cpp; // see bug746361 - insideObjC=FALSE; + g_language = g_current->lang = SrcLangExt_Cpp; // see bug746361 + g_insideObjC=FALSE; BEGIN( FindMembers ); } -. { current->program += yytext ; } +. { g_current->program += yytext ; } "("/{BN}*"::"*{BN}*({TSCOPE}{BN}*"::")*{TSCOPE}{BN}*")"{BN}*"(" | /* typedef void (A::func_t)(args...) */ ("("({BN}*"::"*{BN}*{TSCOPE}{BN}*"::")*({BN}*[*&\^]{BN}*)+)+ { /* typedef void (A::*ptr_t)(args...) or int (*func(int))[], the ^ is for Obj-C blocks */ - if (insidePHP) // reference parameter + if (g_insidePHP) // reference parameter { REJECT } else { - current->bodyLine = yyLineNr; + g_current->bodyLine = g_yyLineNr; lineCount(); addType(); - funcPtrType=yytext; - roundCount=0; - //current->type += yytext; + g_funcPtrType=yytext; + g_roundCount=0; + //g_current->type += yytext; BEGIN( FuncPtr ); } } {SCOPENAME} { - current->name = yytext; - if (nameIsOperator(current->name)) + g_current->name = yytext; + if (nameIsOperator(g_current->name)) { BEGIN( FuncPtrOperator ); } else { - if (current->name=="const" || current->name=="volatile") + if (g_current->name=="const" || g_current->name=="volatile") { - funcPtrType += current->name; + g_funcPtrType += g_current->name; } else { @@ -4293,65 +4272,65 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } . { - //printf("error: FuncPtr '%c' unexpected at line %d of %s\n",*yytext,yyLineNr,yyFileName); + //printf("error: FuncPtr '%c' unexpected at line %d of %s\n",*yytext,g_yyLineNr,g_yyFileName); } "("{BN}*")"{BN}*/"(" { - current->name += yytext; - current->name = current->name.simplifyWhiteSpace(); + g_current->name += yytext; + g_current->name = g_current->name.simplifyWhiteSpace(); lineCount(); } \n { lineCount(); - current->name += *yytext; + g_current->name += *yytext; } "(" { unput(*yytext); BEGIN( EndFuncPtr ); } . { - current->name += *yytext; + g_current->name += *yytext; } ")"{BN}*/";" { // a variable with extra braces lineCount(); - current->type+=funcPtrType.data()+1; + g_current->type+=g_funcPtrType.data()+1; BEGIN(FindMembers); } ")"{BN}*/"(" { // a function pointer lineCount(); - current->type+=funcPtrType+")"; + g_current->type+=g_funcPtrType+")"; BEGIN(FindMembers); } ")"{BN}*/"[" { // an array of variables lineCount(); - current->type+=funcPtrType.data(); - current->args += ")"; + g_current->type+=g_funcPtrType.data(); + g_current->args += ")"; BEGIN(FindMembers); } "(" { // a function returning a function or // a function returning a pointer to an array - current->args += *yytext ; - //roundCount=0; + g_current->args += *yytext ; + //g_roundCount=0; //BEGIN( FuncFunc ); - current->bodyLine = yyLineNr; - currentArgumentContext = FuncFuncEnd; - fullArgString=current->args.copy(); - copyArgString=¤t->args; + g_current->bodyLine = g_yyLineNr; + g_currentArgumentContext = FuncFuncEnd; + g_fullArgString=g_current->args.copy(); + g_copyArgString=&g_current->args; BEGIN( ReadFuncArgType ) ; } "["[^\n\]]*"]" { - funcPtrType+=yytext; + g_funcPtrType+=yytext; } ")" { BEGIN(FindMembers); } "(" { - current->args += *yytext ; - ++roundCount; + g_current->args += *yytext ; + ++g_roundCount; } ")" { - current->args += *yytext ; - if ( roundCount ) - --roundCount; + g_current->args += *yytext ; + if ( g_roundCount ) + --g_roundCount; else { BEGIN(FuncFuncEnd); @@ -4359,53 +4338,53 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } ")"{BN}*"(" { lineCount(); - current->type+=funcPtrType+")("; + g_current->type+=g_funcPtrType+")("; BEGIN(FuncFuncType); } ")"{BN}*/[;{] { lineCount(); - current->type+=funcPtrType.data()+1; + g_current->type+=g_funcPtrType.data()+1; BEGIN(Function); } ")"{BN}*/"[" { // function returning a pointer to an array lineCount(); - current->type+=funcPtrType; - current->args+=")"; + g_current->type+=g_funcPtrType; + g_current->args+=")"; BEGIN(FuncFuncArray); } . { - current->args += *yytext; + g_current->args += *yytext; } "(" { - current->type += *yytext; - roundCount++; + g_current->type += *yytext; + g_roundCount++; } ")" { - current->type += *yytext; - if (roundCount) - --roundCount; + g_current->type += *yytext; + if (g_roundCount) + --g_roundCount; else BEGIN(Function); } -{BN}*","{BN}* { lineCount() ; current->type += ", " ; } -{BN}+ { lineCount() ; current->type += ' ' ; } +{BN}*","{BN}* { lineCount() ; g_current->type += ", " ; } +{BN}+ { lineCount() ; g_current->type += ' ' ; } . { - current->type += *yytext; + g_current->type += *yytext; } "("/{BN}*{ID}{BN}*"*"{BN}*{ID}*")"{BN}*"(" { // for catching typedef void (__stdcall *f)() like definitions - if (current->type.left(7)=="typedef" && current->bodyLine==-1) + if (g_current->type.left(7)=="typedef" && g_current->bodyLine==-1) // the bodyLine check is to prevent this guard to be true more than once { - current->bodyLine = yyLineNr; + g_current->bodyLine = g_yyLineNr; BEGIN( GetCallType ); } - else if (!current->name.isEmpty()) // normal function + else if (!g_current->name.isEmpty()) // normal function { - current->args = yytext; - current->bodyLine = yyLineNr; - currentArgumentContext = FuncQual; - fullArgString=current->args.copy(); - copyArgString=¤t->args; + g_current->args = yytext; + g_current->bodyLine = g_yyLineNr; + g_currentArgumentContext = FuncQual; + g_fullArgString=g_current->args.copy(); + g_copyArgString=&g_current->args; BEGIN( ReadFuncArgType ) ; //printf(">>> Read function arguments!\n"); } @@ -4413,93 +4392,93 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {BN}*{ID}{BN}*"*" { lineCount(); addType(); - funcPtrType="("; - funcPtrType+=yytext; - roundCount=0; + g_funcPtrType="("; + g_funcPtrType+=yytext; + g_roundCount=0; BEGIN( FuncPtr ); } "(" { - if (!current->name.isEmpty()) + if (!g_current->name.isEmpty()) { - current->args = yytext; - current->bodyLine = yyLineNr; - currentArgumentContext = FuncQual; - fullArgString=current->args.copy(); - copyArgString=¤t->args; + g_current->args = yytext; + g_current->bodyLine = g_yyLineNr; + g_currentArgumentContext = FuncQual; + g_fullArgString=g_current->args.copy(); + g_copyArgString=&g_current->args; BEGIN( ReadFuncArgType ) ; - //printf(">>> Read function arguments current->argList.size()=%d\n",current->argList.size()); + //printf(">>> Read function arguments g_current->argList.size()=%d\n",g_current->argList.size()); } } /* "("{BN}*("void"{BN}*)?")" { lineCount(); - current->args = "()"; + g_current->args = "()"; BEGIN( FuncQual ); } */ /*- Function argument reading rules ---------------------------------------*/ -[^ \/\r\t\n\)\(\"\'#]+ { *copyArgString+=yytext; - fullArgString+=yytext; +[^ \/\r\t\n\)\(\"\'#]+ { *g_copyArgString+=yytext; + g_fullArgString+=yytext; } -[^\n\\\"\']+ { *copyArgString+=yytext; - fullArgString+=yytext; +[^\n\\\"\']+ { *g_copyArgString+=yytext; + g_fullArgString+=yytext; } [^\/\n\)\(\"\']+ { - *copyArgString+=yytext; - fullArgString+=yytext; + *g_copyArgString+=yytext; + g_fullArgString+=yytext; } {BN}* { - *copyArgString+=" "; - fullArgString+=" "; + *g_copyArgString+=" "; + g_fullArgString+=" "; lineCount(); } {RAWBEGIN} { g_delimiter = yytext+2; g_delimiter=g_delimiter.left(g_delimiter.length()-1); - lastRawStringContext = YY_START; - pCopyRawString = copyArgString; - *pCopyRawString+=yytext; - fullArgString+=yytext; + g_lastRawStringContext = YY_START; + g_pCopyRawString = g_copyArgString; + *g_pCopyRawString+=yytext; + g_fullArgString+=yytext; BEGIN(RawString); } \" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - lastCopyArgStringContext = YY_START; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + g_lastCopyArgStringContext = YY_START; BEGIN( CopyArgString ); } "(" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - argRoundCount=0; - lastCopyArgContext = YY_START; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + g_argRoundCount=0; + g_lastCopyArgContext = YY_START; BEGIN( CopyArgRound ); } ")" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - stringToArgumentList(fullArgString,current->argList); - if (insideJS) + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + stringToArgumentList(g_fullArgString,g_current->argList); + if (g_insideJS) { - fixArgumentListForJavaScript(current->argList); + fixArgumentListForJavaScript(g_current->argList); } - handleParametersCommentBlocks(current->argList); + handleParametersCommentBlocks(g_current->argList); - /* remember the current documentation block, since + /* remember the g_current documentation block, since we could overwrite it with the documentation of a function argument, which we then have to correct later on */ - docBackup = current->doc; - briefBackup = current->brief; + g_docBackup = g_current->doc; + g_briefBackup = g_current->brief; - BEGIN( currentArgumentContext ); + BEGIN( g_currentArgumentContext ); } /* a special comment */ ("/*"[*!]|"//"[/!])("<"?) { - if (currentArgumentContext==DefineEnd) + if (g_currentArgumentContext==DefineEnd) { // for defines we interpret a comment // as documentation for the define @@ -4507,17 +4486,17 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { unput(yytext[i]); } - stringToArgumentList(fullArgString,current->argList); - handleParametersCommentBlocks(current->argList); - BEGIN( currentArgumentContext ); + stringToArgumentList(g_fullArgString,g_current->argList); + handleParametersCommentBlocks(g_current->argList); + BEGIN( g_currentArgumentContext ); } else // not a define { // for functions we interpret a comment // as documentation for the argument - fullArgString+=yytext; - lastCopyArgChar=0; - lastCommentInArgContext=YY_START; + g_fullArgString+=yytext; + g_lastCopyArgChar=0; + g_lastCommentInArgContext=YY_START; if (yytext[1]=='/') BEGIN( CopyArgCommentLine ); else @@ -4527,30 +4506,30 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) /* a non-special comment */ "/**/" { /* empty comment */ } "/*" { - lastCContext = YY_START; + g_lastCContext = YY_START; BEGIN( SkipComment ); } "//" { - lastCContext = YY_START; + g_lastCContext = YY_START; BEGIN( SkipCxxComment ); } /* -"'#" { if (insidePHP) +"'#" { if (g_insidePHP) REJECT; - *copyArgString+=yytext; - fullArgString+=yytext; + *g_copyArgString+=yytext; + g_fullArgString+=yytext; } "#" { - if (!insidePHP) + if (!g_insidePHP) REJECT; - lastCContext = YY_START; + g_lastCContext = YY_START; BEGIN( SkipCxxComment ); } */ /* ')' followed by a special comment */ ")"{BN}*("/*"[*!]|"//"[/!])"<" { lineCount(); - if (currentArgumentContext==DefineEnd) + if (g_currentArgumentContext==DefineEnd) { // for defines we interpret a comment // as documentation for the define @@ -4558,21 +4537,21 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { unput(yytext[i]); } - *copyArgString+=*yytext; - fullArgString+=*yytext; - stringToArgumentList(fullArgString,current->argList); - handleParametersCommentBlocks(current->argList); - BEGIN( currentArgumentContext ); + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + stringToArgumentList(g_fullArgString,g_current->argList); + handleParametersCommentBlocks(g_current->argList); + BEGIN( g_currentArgumentContext ); } else { // for functions we interpret a comment - // as documentation for the last argument - lastCopyArgChar=*yytext; + // as documentation for the g_last argument + g_lastCopyArgChar=*yytext; QCString text=&yytext[1]; text=text.stripWhiteSpace(); - lastCommentInArgContext=YY_START; - fullArgString+=text; + g_lastCommentInArgContext=YY_START; + g_fullArgString+=text; if (text.find("//")!=-1) BEGIN( CopyArgCommentLine ); else @@ -4580,152 +4559,152 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } ^{B}*"*"+/{BN}+ -[^\n\\\@\*]+ { fullArgString+=yytext; } -"*/" { fullArgString+=yytext; - if (lastCopyArgChar!=0) - unput(lastCopyArgChar); - BEGIN( lastCommentInArgContext ); +[^\n\\\@\*]+ { g_fullArgString+=yytext; } +"*/" { g_fullArgString+=yytext; + if (g_lastCopyArgChar!=0) + unput(g_lastCopyArgChar); + BEGIN( g_lastCommentInArgContext ); } -\n { fullArgString+=yytext; +\n { g_fullArgString+=yytext; lineCount(); - if (lastCopyArgChar!=0) - unput(lastCopyArgChar); - BEGIN( lastCommentInArgContext ); + if (g_lastCopyArgChar!=0) + unput(g_lastCopyArgChar); + BEGIN( g_lastCommentInArgContext ); } {CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) - docBlockName=&yytext[1]; - fullArgString+=yytext; + g_docBlockName=&yytext[1]; + g_fullArgString+=yytext; BEGIN(CopyArgVerbatim); } {CMD}("f$"|"f["|"f{") { - docBlockName=&yytext[1]; - if (docBlockName.at(1)=='[') + g_docBlockName=&yytext[1]; + if (g_docBlockName.at(1)=='[') { - docBlockName.at(1)='}'; + g_docBlockName.at(1)='}'; } - if (docBlockName.at(1)=='{') + if (g_docBlockName.at(1)=='{') { - docBlockName.at(1)='}'; + g_docBlockName.at(1)='}'; } - fullArgString+=yytext; + g_fullArgString+=yytext; BEGIN(CopyArgVerbatim); } [\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"enddot"|"endcode"|"f$"|"f]"|"f}")/[^a-z_A-Z0-9\-] { // end of verbatim block - fullArgString+=yytext; + g_fullArgString+=yytext; if (yytext[1]=='f') // end of formula { BEGIN(CopyArgCommentLine); } - if (&yytext[4]==docBlockName) + if (&yytext[4]==g_docBlockName) { BEGIN(CopyArgCommentLine); } } -[^\\\@\n]+ { fullArgString+=yytext; } -. { fullArgString+=*yytext; } -\n { fullArgString+=*yytext; lineCount(); } -. { fullArgString+=*yytext; } +[^\\\@\n]+ { g_fullArgString+=yytext; } +. { g_fullArgString+=*yytext; } +\n { g_fullArgString+=*yytext; lineCount(); } +. { g_fullArgString+=*yytext; } {CMD}("brief"|"short"){B}+ { - warn(yyFileName,yyLineNr, - "Ignoring %cbrief command inside argument documentation",*yytext + warn(g_yyFileName,g_yyLineNr, + "Ignoring %cbrief command g_inside argument documentation",*yytext ); - fullArgString+=' '; + g_fullArgString+=' '; } "<" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - argSharpCount=1; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + g_argSharpCount=1; BEGIN( CopyArgSharp ); } ">" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - //printf("end template list '%s'\n",copyArgString->data()); - stringToArgumentList(fullArgString,*currentArgumentList); - BEGIN( currentArgumentContext ); + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + //printf("end template list '%s'\n",g_copyArgString->data()); + stringToArgumentList(g_fullArgString,*g_currentArgumentList); + BEGIN( g_currentArgumentContext ); } "(" { - argRoundCount++; - *copyArgString+=*yytext; - fullArgString+=*yytext; + g_argRoundCount++; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; } ")" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - if (argRoundCount>0) - argRoundCount--; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + if (g_argRoundCount>0) + g_argRoundCount--; else - BEGIN( lastCopyArgContext ); + BEGIN( g_lastCopyArgContext ); } "(" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - argRoundCount=0; - lastCopyArgContext = YY_START; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + g_argRoundCount=0; + g_lastCopyArgContext = YY_START; BEGIN( CopyArgRound ); } "<" { - argSharpCount++; - //printf("argSharpCount++=%d copy\n",argSharpCount); - *copyArgString+=*yytext; - fullArgString+=*yytext; + g_argSharpCount++; + //printf("g_argSharpCount++=%d copy\n",g_argSharpCount); + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; } ">" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - argSharpCount--; - if (argSharpCount>0) + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + g_argSharpCount--; + if (g_argSharpCount>0) { - //printf("argSharpCount--=%d copy\n",argSharpCount); + //printf("g_argSharpCount--=%d copy\n",g_argSharpCount); } else { BEGIN( ReadTempArgs ); - //printf("end of argSharpCount\n"); + //printf("end of g_argSharpCount\n"); } } \\. { - *copyArgString+=yytext; - fullArgString+=yytext; + *g_copyArgString+=yytext; + g_fullArgString+=yytext; } \" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - BEGIN( lastCopyArgStringContext ); + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + BEGIN( g_lastCopyArgStringContext ); } \' { - *copyArgString+=*yytext; - fullArgString+=*yytext; - BEGIN( lastCopyArgStringContext ); + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + BEGIN( g_lastCopyArgStringContext ); } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - *copyArgString+=yytext; - fullArgString+=yytext; + *g_copyArgString+=yytext; + g_fullArgString+=yytext; } } \' { - *copyArgString+=yytext; - fullArgString+=yytext; - if (insidePHP) + *g_copyArgString+=yytext; + g_fullArgString+=yytext; + if (g_insidePHP) { - lastCopyArgStringContext=YY_START; + g_lastCopyArgStringContext=YY_START; BEGIN(CopyArgPHPString); } } \n { lineCount(); - *copyArgString+=*yytext; - fullArgString+=*yytext; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; } . { - *copyArgString+=*yytext; - fullArgString+=*yytext; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; } @@ -4733,28 +4712,28 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) /*------------------------------------------------------------------------*/ -"(" { current->args += *yytext ; - ++roundCount ; +"(" { g_current->args += *yytext ; + ++g_roundCount ; } -")" { current->args += *yytext ; - if ( roundCount ) - --roundCount ; +")" { g_current->args += *yytext ; + if ( g_roundCount ) + --g_roundCount ; else BEGIN( FuncQual ) ; } /* -"#" { if (insidePHP) +"#" { if (g_insidePHP) REJECT; - lastCPPContext = YY_START; + g_lastCPPContext = YY_START; BEGIN(SkipCPP); } */ [{:;,] { if ( qstrcmp(yytext,";")==0 && - insidePHP && - !containsWord(current->type,"function") ) + g_insidePHP && + !containsWord(g_current->type,"function") ) { - current->reset(); + g_current->reset(); initEntry(); BEGIN( FindMembers ); } @@ -4765,88 +4744,88 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } {BN}*"abstract"{BN}* { // pure virtual member function lineCount() ; - current->virt = Pure; - current->args += " override "; + g_current->virt = Pure; + g_current->args += " override "; } {BN}*"override"{BN}* { // C++11 overridden virtual member function lineCount() ; - current->spec |= Entry::Override; - current->args += " override "; + g_current->spec |= Entry::Override; + g_current->args += " override "; BEGIN(FuncQual); } {BN}*"final"{BN}* { // C++11 final method lineCount() ; - current->spec |= Entry::Final; - current->args += " final "; + g_current->spec |= Entry::Final; + g_current->args += " final "; BEGIN(FuncQual); } {BN}*"sealed"{BN}* { // sealed member function lineCount() ; - current->spec |= Entry::Sealed; - current->args += " sealed "; + g_current->spec |= Entry::Sealed; + g_current->args += " sealed "; } {BN}*"new"{BN}* { // new member function lineCount() ; - current->spec |= Entry::New; - current->args += " new "; + g_current->spec |= Entry::New; + g_current->args += " new "; } {BN}*"const"{BN}* { // const member function lineCount() ; - current->args += " const "; - current->argList.constSpecifier=TRUE; + g_current->args += " const "; + g_current->argList.constSpecifier=TRUE; } {BN}*"volatile"{BN}* { // volatile member function lineCount() ; - current->args += " volatile "; - current->argList.volatileSpecifier=TRUE; + g_current->args += " volatile "; + g_current->argList.volatileSpecifier=TRUE; } {BN}*"noexcept"{BN}* { // noexcept qualifier lineCount() ; - current->args += " noexcept "; - current->spec |= Entry::NoExcept; + g_current->args += " noexcept "; + g_current->spec |= Entry::NoExcept; } {BN}*"noexcept"{BN}*"(" { // noexcept expression lineCount() ; - current->args += " noexcept("; - current->spec |= Entry::NoExcept; - lastRoundContext=FuncQual; - pCopyRoundString=¤t->args; - roundCount=0; + g_current->args += " noexcept("; + g_current->spec |= Entry::NoExcept; + g_lastRoundContext=FuncQual; + g_pCopyRoundString=&g_current->args; + g_roundCount=0; BEGIN(CopyRound); } {BN}*"&" { - current->args += " &"; - current->argList.refQualifier=RefQualifierLValue; + g_current->args += " &"; + g_current->argList.refQualifier=RefQualifierLValue; } {BN}*"&&" { - current->args += " &&"; - current->argList.refQualifier=RefQualifierRValue; + g_current->args += " &&"; + g_current->argList.refQualifier=RefQualifierRValue; } {BN}*"="{BN}*"0"{BN}* { // pure virtual member function lineCount() ; - current->args += " = 0"; - current->virt = Pure; - current->argList.pureSpecifier=TRUE; + g_current->args += " = 0"; + g_current->virt = Pure; + g_current->argList.pureSpecifier=TRUE; BEGIN(FuncQual); } {BN}*"="{BN}*"delete"{BN}* { // C++11 explicitly delete member lineCount(); - current->args += " = delete"; - current->spec |= Entry::Delete; - current->argList.isDeleted=TRUE; + g_current->args += " = delete"; + g_current->spec |= Entry::Delete; + g_current->argList.isDeleted=TRUE; BEGIN(FuncQual); } {BN}*"="{BN}*"default"{BN}* { // C++11 explicitly defaulted constructor/assignment operator lineCount(); - current->args += " = default"; - current->spec |= Entry::Default; + g_current->args += " = default"; + g_current->spec |= Entry::Default; BEGIN(FuncQual); } {BN}*"->"{BN}* { lineCount(); - current->argList.trailingReturnType = " -> "; - current->args += " -> "; + g_current->argList.trailingReturnType = " -> "; + g_current->args += " -> "; BEGIN(TrailingReturn); } [{;] { @@ -4854,30 +4833,30 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FuncQual); } . { - current->argList.trailingReturnType+=yytext; - current->args+=yytext; + g_current->argList.trailingReturnType+=yytext; + g_current->args+=yytext; } \n { lineCount(); - current->argList.trailingReturnType+=yytext; - current->args+=' '; + g_current->argList.trailingReturnType+=yytext; + g_current->args+=' '; } {BN}*","{BN}* { lineCount() ; - current->args += ", " ; + g_current->args += ", " ; } {BN}+ { lineCount() ; - current->args += ' ' ; + g_current->args += ' ' ; } -"#" { if (insidePHP) +"#" { if (g_insidePHP) REJECT; - lastCPPContext = YY_START; + g_lastCPPContext = YY_START; BEGIN(SkipCPP); } "=" { - if (insideCli && - (current_root->section&Entry::COMPOUND_MASK) + if (g_insideCli && + (g_current_root->section&Entry::COMPOUND_MASK) ) { BEGIN(CliOverride); @@ -4885,9 +4864,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else { // typically an initialized function pointer - lastInitializerContext=YY_START; - initBracketCount=0; - current->initializer = yytext; + g_lastInitializerContext=YY_START; + g_initBracketCount=0; + g_current->initializer = yytext; BEGIN(ReadInitializer); } } @@ -4907,58 +4886,58 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FuncQual); } \" { - current->args += *yytext; - pCopyQuotedString=¤t->args; - lastStringContext=FuncPtrInit; + g_current->args += *yytext; + g_pCopyQuotedString=&g_current->args; + g_lastStringContext=FuncPtrInit; BEGIN(CopyString); } \' { - current->args += *yytext; - if (insidePHP) + g_current->args += *yytext; + if (g_insidePHP) { - pCopyQuotedString=¤t->args; - lastStringContext=FuncPtrInit; + g_pCopyQuotedString=&g_current->args; + g_lastStringContext=FuncPtrInit; BEGIN(CopyPHPString); } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - current->args += yytext; + g_current->args += yytext; } } {ID} { - current->args += yytext; + g_current->args += yytext; } . { - current->args += *yytext; + g_current->args += *yytext; } \n { - current->args += *yytext; + g_current->args += *yytext; lineCount(); } {ID} { // typically a K&R style C function - if (insideCS && qstrcmp(yytext,"where")==0) + if (g_insideCS && qstrcmp(yytext,"where")==0) { // type constraint for a method - current->typeConstr.clear(); - current->typeConstr.push_back(Argument()); - lastCSConstraint = YY_START; + g_current->typeConstr.clear(); + g_current->typeConstr.push_back(Argument()); + g_lastCSConstraint = YY_START; BEGIN( CSConstraintName ); } else if (checkForKnRstyleC()) { - current->args = yytext; - oldStyleArgType.resize(0); + g_current->args = yytext; + g_oldStyleArgType.resize(0); BEGIN(OldStyleArgs); } else { - current->args += yytext; + g_current->args += yytext; } } [,;] { @@ -4966,36 +4945,36 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) QCString oldStyleArgName; splitKnRArg(oldStyleArgPtr,oldStyleArgName); QCString doc,brief; - if (current->doc!=docBackup) + if (g_current->doc!=g_docBackup) { - doc=current->doc.copy(); - current->doc=docBackup; + doc=g_current->doc.copy(); + g_current->doc=g_docBackup; } - if (current->brief!=briefBackup) + if (g_current->brief!=g_briefBackup) { - brief=current->brief.copy(); - current->brief=briefBackup; + brief=g_current->brief.copy(); + g_current->brief=g_briefBackup; } - addKnRArgInfo(oldStyleArgType+oldStyleArgPtr, + addKnRArgInfo(g_oldStyleArgType+oldStyleArgPtr, oldStyleArgName,brief,doc); - current->args.resize(0); - if (*yytext==';') oldStyleArgType.resize(0); + g_current->args.resize(0); + if (*yytext==';') g_oldStyleArgType.resize(0); } -{ID} { current->args += yytext; } +{ID} { g_current->args += yytext; } "{" { - if (current->argList.empty()) + if (g_current->argList.empty()) { - current->argList.noParameters=TRUE; + g_current->argList.noParameters=TRUE; } - current->args = argListToString(current->argList); + g_current->args = argListToString(g_current->argList); unput('{'); BEGIN(FuncQual); } -. { current->args += *yytext; } -. { current->args += *yytext; } +. { g_current->args += *yytext; } +. { g_current->args += *yytext; } {BN}*"try:" | {BN}*"try"{BN}+ { /* try-function-block */ - insideTryBlock=TRUE; + g_insideTryBlock=TRUE; lineCount(); if (yytext[yyleng-1]==':') { @@ -5004,33 +4983,33 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {BN}*"throw"{BN}*"(" { // C++ style throw clause - current->exception = " throw (" ; - roundCount=0; + g_current->exception = " throw (" ; + g_roundCount=0; lineCount() ; BEGIN( ExcpRound ) ; } {BN}*"raises"{BN}*"(" { - current->exception = " raises (" ; + g_current->exception = " raises (" ; lineCount() ; - roundCount=0; + g_roundCount=0; BEGIN( ExcpRound ) ; } {BN}*"throws"{BN}+ { // Java style throw clause - current->exception = " throws " ; + g_current->exception = " throws " ; lineCount() ; BEGIN( ExcpList ); } -"(" { current->exception += *yytext ; - ++roundCount ; +"(" { g_current->exception += *yytext ; + ++g_roundCount ; } -")" { current->exception += *yytext ; - if ( roundCount ) - --roundCount ; +")" { g_current->exception += *yytext ; + if ( g_roundCount ) + --g_roundCount ; else BEGIN( FuncQual ) ; } . { - current->exception += *yytext; + g_current->exception += *yytext; } "{" { unput('{'); BEGIN( FuncQual ); @@ -5039,101 +5018,101 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) unput(';'); BEGIN( FuncQual ); } "\n" { - current->exception += ' '; + g_current->exception += ' '; lineCount(); } . { - current->exception += *yytext; + g_current->exception += *yytext; } -"(" { current->type += current->name ; - current->name = current->args ; - current->args = yytext ; - roundCount=0; +"(" { g_current->type += g_current->name ; + g_current->name = g_current->args ; + g_current->args = yytext ; + g_roundCount=0; BEGIN( FuncRound ) ; } ":" { - if (!insidePHP) BEGIN(SkipInits); + if (!g_insidePHP) BEGIN(SkipInits); } [;{,] { - current->name=current->name.simplifyWhiteSpace(); - current->type=current->type.simplifyWhiteSpace(); - current->args=removeRedundantWhiteSpace(current->args); - // was: current->args.simplifyWhiteSpace(); - current->fileName = yyFileName; - current->startLine = yyBegLineNr; - current->startColumn = yyBegColNr; + g_current->name=g_current->name.simplifyWhiteSpace(); + g_current->type=g_current->type.simplifyWhiteSpace(); + g_current->args=removeRedundantWhiteSpace(g_current->args); + // was: g_current->args.simplifyWhiteSpace(); + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyBegLineNr; + g_current->startColumn = g_yyBegColNr; static QRegExp re("([^)]*[*&][^)]*)"); // (...*...) - if (*yytext!=';' || (current_root->section&Entry::COMPOUND_MASK) ) + if (*yytext!=';' || (g_current_root->section&Entry::COMPOUND_MASK) ) { - int tempArg=current->name.find('<'); - int ts=current->type.find('<'); - int te=current->type.findRev('>'); - int ti=current->type.find(re,0); + int tempArg=g_current->name.find('<'); + int ts=g_current->type.find('<'); + int te=g_current->type.findRev('>'); + int ti=g_current->type.find(re,0); // bug677315: A get(); is not a function pointer bool isFunction = ti==-1 || // not a (...*...) pattern (ts!=-1 && tstype.data(),ts,te,ti,isFunction); + // g_current->type.data(),ts,te,ti,isFunction); QCString tempName; - if (tempArg==-1) tempName=current->name; else tempName=current->name.left(tempArg); - if (!current->type.isEmpty() && - (!isFunction || current->type.left(8)=="typedef ")) + if (tempArg==-1) tempName=g_current->name; else tempName=g_current->name.left(tempArg); + if (!g_current->type.isEmpty() && + (!isFunction || g_current->type.left(8)=="typedef ")) { - //printf("Scanner.l: found in class variable: '%s' '%s' '%s'\n", current->type.data(),current->name.data(),current->args.data()); - if (isTypedef && current->type.left(8)!="typedef ") + //printf("Scanner.l: found in class variable: '%s' '%s' '%s'\n", g_current->type.data(),g_current->name.data(),g_current->args.data()); + if (g_isTypedef && g_current->type.left(8)!="typedef ") { - current->type.prepend("typedef "); + g_current->type.prepend("typedef "); } - current->section = Entry::VARIABLE_SEC ; + g_current->section = Entry::VARIABLE_SEC ; } else { - //printf("Scanner.l: found in class function: '%s' '%s' '%s'\n", current->type.data(),current->name.data(),current->args.data()); - current->section = Entry::FUNCTION_SEC ; - current->proto = *yytext==';'; + //printf("Scanner.l: found in class function: '%s' '%s' '%s'\n", g_current->type.data(),g_current->name.data(),g_current->args.data()); + g_current->section = Entry::FUNCTION_SEC ; + g_current->proto = *yytext==';'; } } else // a global function prototype or function variable { - //printf("Scanner.l: prototype? type='%s' name='%s' args='%s'\n",current->type.data(),current->name.data(),current->args.data()); - if (!current->type.isEmpty() && - (current->type.find(re,0)!=-1 || current->type.left(8)=="typedef ")) + //printf("Scanner.l: prototype? type='%s' name='%s' args='%s'\n",g_current->type.data(),g_current->name.data(),g_current->args.data()); + if (!g_current->type.isEmpty() && + (g_current->type.find(re,0)!=-1 || g_current->type.left(8)=="typedef ")) { - if (isTypedef && current->type.left(8)!="typedef ") + if (g_isTypedef && g_current->type.left(8)!="typedef ") { - current->type.prepend("typedef "); + g_current->type.prepend("typedef "); } //printf("Scanner.l: found function variable!\n"); - current->section = Entry::VARIABLE_SEC; + g_current->section = Entry::VARIABLE_SEC; } else { //printf("Scanner.l: found prototype\n"); - current->section = Entry::FUNCTION_SEC; - current->proto = TRUE; + g_current->section = Entry::FUNCTION_SEC; + g_current->proto = TRUE; } } - //printf("Adding entry '%s'\n",current->name.data()); - if ( insidePHP) + //printf("Adding entry '%s'\n",g_current->name.data()); + if ( g_insidePHP) { - if (findAndRemoveWord(current->type,"final")) + if (findAndRemoveWord(g_current->type,"final")) { - current->spec |= Entry::Final; + g_current->spec |= Entry::Final; } - if (findAndRemoveWord(current->type,"abstract")) + if (findAndRemoveWord(g_current->type,"abstract")) { - current->spec |= Entry::Abstract; + g_current->spec |= Entry::Abstract; } } - if ( insidePHP && !containsWord(current->type,"function")) + if ( g_insidePHP && !containsWord(g_current->type,"function")) { initEntry(); if ( *yytext == '{' ) { - lastCurlyContext = FindMembers; - curlyCount=0; + g_lastCurlyContext = FindMembers; + g_curlyCount=0; BEGIN( SkipCurly ); } else @@ -5143,66 +5122,66 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - if ( insidePHP) + if ( g_insidePHP) { - findAndRemoveWord(current->type,"function"); + findAndRemoveWord(g_current->type,"function"); } - previous = current.get(); - current_root->moveToSubEntryAndRefresh(current); + g_previous = g_current.get(); + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); // Objective C 2.0: Required/Optional section - if (previous->spec & (Entry::Optional | Entry::Required)) + if (g_previous->spec & (Entry::Optional | Entry::Required)) { - current->spec |= previous->spec & (Entry::Optional|Entry::Required); + g_current->spec |= g_previous->spec & (Entry::Optional|Entry::Required); } - lastCurlyContext = FindMembers; + g_lastCurlyContext = FindMembers; if ( *yytext == ',' ) { - current->type = previous->type; + g_current->type = g_previous->type; // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases) - int i=current->type.length(); - while (i>0 && (current->type[i-1]=='*' || current->type[i-1]=='&' || current->type[i-1]==' ')) i--; - current->type = current->type.left(i); + int i=g_current->type.length(); + while (i>0 && (g_current->type[i-1]=='*' || g_current->type[i-1]=='&' || g_current->type[i-1]==' ')) i--; + g_current->type = g_current->type.left(i); } if ( *yytext == '{' ) { - if ( !insidePHP && (current_root->section & Entry::COMPOUND_MASK) ) + if ( !g_insidePHP && (g_current_root->section & Entry::COMPOUND_MASK) ) { - previous->spec |= Entry::Inline; + g_previous->spec |= Entry::Inline; } //addToBody(yytext); - curlyCount=0; + g_curlyCount=0; BEGIN( SkipCurly ) ; } else { - if (previous->section!=Entry::VARIABLE_SEC) - previous->bodyLine=-1; // a function/member declaration + if (g_previous->section!=Entry::VARIABLE_SEC) + g_previous->bodyLine=-1; // a function/member declaration BEGIN( FindMembers ) ; } } } ">"{BN}*"{" { // C++11 style initializer (see bug 790788) lineCount(); - curlyCount=1; + g_curlyCount=1; BEGIN(SkipC11Inits); } {ID}{BN}*"{" { // C++11 style initializer (see bug 688647) lineCount(); - curlyCount=1; + g_curlyCount=1; BEGIN(SkipC11Inits); } "{" { - ++curlyCount; + ++g_curlyCount; } "}" { - if ( --curlyCount<=0 ) + if ( --g_curlyCount<=0 ) { BEGIN(SkipInits); } } "]]" { - BEGIN(lastC11AttributeContext); + BEGIN(g_lastC11AttributeContext); } "{" { // C++11 style initializer unput('{'); @@ -5210,47 +5189,47 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } "{" { //addToBody(yytext); - ++curlyCount ; + ++g_curlyCount ; } "}"/{BN}*("/*!"|"/**"|"//!"|"///")" Inner block starts at line %d objC=%d\n",yyLineNr,insideObjC); - current = std::make_unique(); - gstat = FALSE; + g_yyLineNr = ce->startLine ; + g_yyColNr = ce->startColumn ; + g_insideObjC = ce->lang==SrcLangExt_ObjC; + //printf("---> Inner block starts at line %d objC=%d\n",g_yyLineNr,g_insideObjC); + g_current = std::make_unique(); + g_stat = FALSE; initEntry(); // deep copy group list from parent (see bug 727732) @@ -7094,68 +7068,68 @@ static void parseCompounds(const std::unique_ptr &rt) // set default protection based on the compound type if( ce->section==Entry::CLASS_SEC ) // class { - if (insidePHP || insideD || insideJS || insideIDL || insideSlice) + if (g_insidePHP || g_insideD || g_insideJS || g_insideIDL || g_insideSlice) { - current->protection = protection = Public ; + g_current->protection = g_protection = Public ; } - else if (insideJava) + else if (g_insideJava) { - current->protection = protection = (ce->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; + g_current->protection = g_protection = (ce->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; } else if (ce->spec&(Entry::Interface | Entry::Ref | Entry::Value | Entry::Struct | Entry::Union)) { if (ce->lang==SrcLangExt_ObjC) { - current->protection = protection = Protected ; + g_current->protection = g_protection = Protected ; } else { - current->protection = protection = Public ; + g_current->protection = g_protection = Public ; } } else { - current->protection = protection = Private ; + g_current->protection = g_protection = Private ; } } else if (ce->section == Entry::ENUM_SEC ) // enum { - current->protection = protection = ce->protection; + g_current->protection = g_protection = ce->protection; } else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace { if (ce->section == Entry::NAMESPACE_SEC ) // unnamed namespace { - current->stat = gstat = TRUE; + g_current->stat = g_stat = TRUE; } - current->protection = protection = ce->protection; + g_current->protection = g_protection = ce->protection; } else // named struct, union, protocol, category { - current->protection = protection = Public ; + g_current->protection = g_protection = Public ; } - mtype = Method; - virt = Normal; - //printf("name=%s current->stat=%d gstat=%d\n",ce->name.data(),current->stat,gstat); + g_mtype = Method; + g_virt = Normal; + //printf("name=%s g_current->stat=%d g_stat=%d\n",ce->name.data(),g_current->stat,g_stat); //memberGroupId = DOX_NOGROUP; //memberGroupRelates.resize(0); //memberGroupInside.resize(0); QCString name = ce->name; - Doxygen::docGroup.enterCompound(yyFileName,yyLineNr,name); + Doxygen::docGroup.enterCompound(g_yyFileName,g_yyLineNr,name); scannerYYlex() ; g_lexInit=TRUE; //forceEndGroup(); - Doxygen::docGroup.leaveCompound(yyFileName,yyLineNr,name); + Doxygen::docGroup.leaveCompound(g_yyFileName,g_yyLineNr,name); ce->program.resize(0); //if (depthIf>0) //{ - // warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!"); + // warn(g_yyFileName,g_yyLineNr,"Documentation block ended in the middle of a conditional section!"); //} } parseCompounds(ce); @@ -7172,91 +7146,84 @@ static void parseMain(const char *fileName, { initParser(); - inputString = fileBuf; - inputPosition = 0; + g_inputString = fileBuf; + g_inputPosition = 0; g_column = 0; - //anonCount = 0; // don't reset per file + //g_anonCount = 0; // don't reset per file //depthIf = 0; - protection = Public; - mtype = Method; - gstat = FALSE; - virt = Normal; - current_root = rt.get(); - global_root = rt.get(); - inputFile.setName(fileName); - if (inputFile.open(IO_ReadOnly)) + g_protection = Public; + g_mtype = Method; + g_stat = FALSE; + g_virt = Normal; + g_current_root = rt.get(); + g_yyLineNr= 1 ; + g_yyFileName = fileName; + setContext(); + bool processWithClang = g_insideCpp || g_insideObjC; + if (processWithClang) { - yyLineNr= 1 ; - yyFileName = fileName; - setContext(); - bool processWithClang = insideCpp || insideObjC; - if (processWithClang) + if (!sameTranslationUnit) // new file { - if (!sameTranslationUnit) // new file - { - ClangParser::instance()->start(fileName,filesInSameTranslationUnit); - } - else - { - ClangParser::instance()->switchToFile(fileName); - } - } - rt->lang = language; - msg("Parsing file %s...\n",yyFileName.data()); - - current_root = rt.get() ; - initParser(); - Doxygen::docGroup.enterFile(yyFileName,yyLineNr); - current = std::make_unique(); - //printf("current=%p current_root=%p\n",current,current_root); - int sec=guessSection(yyFileName); - if (sec) - { - current->name = yyFileName; - current->section = sec; - current_root->moveToSubEntryAndRefresh(current); - } - current->reset(); - initEntry(); - scannerYYrestart( scannerYYin ); - if ( insidePHP ) - { - BEGIN( FindMembersPHP ); + ClangParser::instance()->start(fileName,filesInSameTranslationUnit); } else { - BEGIN( FindMembers ); + ClangParser::instance()->switchToFile(fileName); } + } + rt->lang = g_language; + msg("Parsing file %s...\n",g_yyFileName.data()); - scannerYYlex(); - g_lexInit=TRUE; - - if (YY_START==Comment) - { - warn(yyFileName,yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?"); - } + g_current_root = rt.get() ; + initParser(); + Doxygen::docGroup.enterFile(g_yyFileName,g_yyLineNr); + g_current = std::make_unique(); + //printf("g_current=%p g_current_root=%p\n",g_current,g_current_root); + int sec=guessSection(g_yyFileName); + if (sec) + { + g_current->name = g_yyFileName; + g_current->section = sec; + g_current_root->moveToSubEntryAndRefresh(g_current); + } + g_current->reset(); + initEntry(); + scannerYYrestart( scannerYYin ); + if ( g_insidePHP ) + { + BEGIN( FindMembersPHP ); + } + else + { + BEGIN( FindMembers ); + } - //forceEndGroup(); - Doxygen::docGroup.leaveFile(yyFileName,yyLineNr); + scannerYYlex(); + g_lexInit=TRUE; - rt->program.resize(0); + if (YY_START==Comment) + { + warn(g_yyFileName,g_yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?"); + } - parseCompounds(rt); + //forceEndGroup(); + Doxygen::docGroup.leaveFile(g_yyFileName,g_yyLineNr); - inputFile.close(); + rt->program.resize(0); - anonNSCount++; + parseCompounds(rt); - // add additional entries that were created during processing - for (auto &kv: g_outerScopeEntries) - { - //printf(">>> adding '%s' to scope '%s'\n",kv.second->name.data(),kv.first->name.data()); - kv.first->moveToSubEntryAndKeep(kv.second); - } - g_outerScopeEntries.clear(); + g_anonNSCount++; + // add additional entries that were created during processing + for (auto &kv: g_outerScopeEntries) + { + //printf(">>> adding '%s' to scope '%s'\n",kv.second->name.data(),kv.first->name.data()); + kv.first->moveToSubEntryAndKeep(kv.second); } + g_outerScopeEntries.clear(); + } //---------------------------------------------------------------------------- @@ -7266,10 +7233,10 @@ static void parsePrototype(const QCString &text) //printf("**** parsePrototype(%s) begin\n",text.data()); if (text.isEmpty()) { - warn(yyFileName,yyLineNr,"Empty prototype found!"); + warn(g_yyFileName,g_yyLineNr,"Empty prototype found!"); return; } - if (!current) // nothing to store (see bug683516) + if (!g_current) // nothing to store (see bug683516) { return; } @@ -7281,28 +7248,28 @@ static void parsePrototype(const QCString &text) // save scanner state orgState = YY_CURRENT_BUFFER; yy_switch_to_buffer(yy_create_buffer(scannerYYin, YY_BUF_SIZE)); - orgInputString = inputString; - orgInputPosition = inputPosition; + orgInputString = g_inputString; + orgInputPosition = g_inputPosition; // set new string - inputString = text; - inputPosition = 0; + g_inputString = text; + g_inputPosition = 0; g_column = 0; scannerYYrestart( scannerYYin ); BEGIN(Prototype); scannerYYlex(); g_lexInit=TRUE; - current->name = current->name.stripWhiteSpace(); - if (current->section == Entry::MEMBERDOC_SEC && current->args.isEmpty()) - current->section = Entry::VARIABLEDOC_SEC; + g_current->name = g_current->name.stripWhiteSpace(); + if (g_current->section == Entry::MEMBERDOC_SEC && g_current->args.isEmpty()) + g_current->section = Entry::VARIABLEDOC_SEC; // restore original scanner state YY_BUFFER_STATE tmpState = YY_CURRENT_BUFFER; yy_switch_to_buffer(orgState); yy_delete_buffer(tmpState); - inputString = orgInputString; - inputPosition = orgInputPosition; + g_inputString = orgInputString; + g_inputPosition = orgInputPosition; //printf("**** parsePrototype end\n"); @@ -7327,7 +7294,7 @@ void scanFreeScanner() //static void handleGroupEndCommand() //{ // endGroup(); -// previous=0; +// g_previous=0; //} //---------------------------------------------------------------------------- @@ -7338,7 +7305,7 @@ void CLanguageScanner::startTranslationUnit(const char *) void CLanguageScanner::finishTranslationUnit() { - bool processWithClang = insideCpp || insideObjC; + bool processWithClang = g_insideCpp || g_insideObjC; if (processWithClang) { ClangParser::instance()->finish(); -- cgit v0.12 From 26a634f60f53987d4d8b1f94259cc0a94e2414c3 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 24 Nov 2019 13:41:37 +0100 Subject: Fixed line count misaligned introduced with JAVADOC_BANNER --- src/scanner.l | 74 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/src/scanner.l b/src/scanner.l index e0095ba..3e48916 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -246,7 +246,7 @@ static void initEntry() static void lineCount() { - static int tabSize = Config_getInt(TAB_SIZE); + int tabSize = Config_getInt(TAB_SIZE); const char *p; for (p = yytext ; *p ; ++p ) { @@ -269,7 +269,7 @@ static void lineCount() static inline int computeIndent(const char *s,int startIndent) { int col=startIndent; - static int tabSize=Config_getInt(TAB_SIZE); + int tabSize=Config_getInt(TAB_SIZE); const char *p=s; char c; while ((c=*p++)) @@ -4120,7 +4120,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) if (!g_msName.isEmpty() /*&& g_msName!=g_current->name*/) // skip typedef T {} T;, removed due to bug608493 { - static bool typedefHidesStruct = Config_getBool(TYPEDEF_HIDES_STRUCT); + bool typedefHidesStruct = Config_getBool(TYPEDEF_HIDES_STRUCT); // case 1: typedef struct _S { ... } S_t; // -> omit typedef and use S_t as the struct name if (typedefHidesStruct && @@ -6207,41 +6207,43 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( DocBlock ); } "/**"[*]+{BL} { + bool javadocBanner = Config_getBool(JAVADOC_BANNER); + lineCount(); - static bool javadocBanner = Config_getBool(JAVADOC_BANNER); - - if( javadocBanner ) { - g_lastDocContext = YY_START; + if( javadocBanner ) + { + g_lastDocContext = YY_START; - //printf("Found comment banner at %s:%d\n",g_yyFileName,g_yyLineNr); - if (g_current_root->section & Entry::SCOPE_MASK) - { - g_current->inside = g_current_root->name+"::"; - } - g_current->docLine = g_yyLineNr; - g_current->docFile = g_yyFileName; - g_docBlockContext = YY_START; - g_docBlockInBody = YY_START==SkipCurly; - static bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF); - g_docBlockAutoBrief = javadocAutoBrief; + //printf("Found comment banner at %s:%d\n",g_yyFileName,g_yyLineNr); + if (g_current_root->section & Entry::SCOPE_MASK) + { + g_current->inside = g_current_root->name+"::"; + } + g_current->docLine = g_yyLineNr; + g_current->docFile = g_yyFileName; + g_docBlockContext = YY_START; + g_docBlockInBody = YY_START==SkipCurly; + bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF); + g_docBlockAutoBrief = javadocAutoBrief; - QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock=indent; + QCString indent; + indent.fill(' ',computeIndent(yytext,g_column)); + g_docBlock=indent; - if (g_docBlockAutoBrief) - { - g_current->briefLine = g_yyLineNr; - g_current->briefFile = g_yyFileName; - } - startCommentBlock(FALSE); - BEGIN( DocBlock ); - } else { - g_current->program += yytext ; - g_lastContext = YY_START ; - BEGIN( Comment ) ; + if (g_docBlockAutoBrief) + { + g_current->briefLine = g_yyLineNr; + g_current->briefFile = g_yyFileName; + } + startCommentBlock(FALSE); + BEGIN( DocBlock ); + } + else + { + g_current->program += yytext ; + g_lastContext = YY_START ; + BEGIN( Comment ) ; } - } ("//"{B}*)?"/**"/[^/*] { g_lastDocContext = YY_START; @@ -6255,7 +6257,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) g_current->docFile = g_yyFileName; g_docBlockContext = YY_START; g_docBlockInBody = YY_START==SkipCurly; - static bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF); + bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF); g_docBlockAutoBrief = javadocAutoBrief; QCString indent; @@ -6916,7 +6918,7 @@ static void newEntry() static void handleCommentBlock(const QCString &doc,bool brief) { - static bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS); + bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS); if (g_docBlockInBody && hideInBodyDocs) return; //printf("parseCommentBlock [%s] brief=%d\n",doc.data(),brief); int lineNr = brief ? g_current->briefLine : g_current->docLine; // line of block start @@ -7058,7 +7060,7 @@ static void parseCompounds(const std::unique_ptr &rt) initEntry(); // deep copy group list from parent (see bug 727732) - static bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS); + bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS); if (autoGroupNested && ce->section!=Entry::ENUM_SEC && !(ce->spec&Entry::Enum)) { ce->groups = rt->groups; -- cgit v0.12 From 73a410a00efb17ab7bc673bf2e3ecdc45eb876f4 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 24 Nov 2019 19:10:02 +0100 Subject: Fixed endless loop during preprocessing --- src/pre.l | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pre.l b/src/pre.l index cf13764..abc9df9 100644 --- a/src/pre.l +++ b/src/pre.l @@ -2391,10 +2391,13 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); if (expr.isEmpty()) { + //printf("expansionDict.find(expr)!=0) // check for recursive expansions { + expr=expr.left(pos)+"@-"+expr.right(expr.length()-pos); + //printf(" Date: Mon, 25 Nov 2019 10:59:05 +0100 Subject: Adding some links in search documentation The search chapter was missing some links --- doc/extsearch.doc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/extsearch.doc b/doc/extsearch.doc index ead7ea8..e139408 100644 --- a/doc/extsearch.doc +++ b/doc/extsearch.doc @@ -77,7 +77,7 @@ Since we didn't create or install a doxysearch.db it is OK for the test to fail for this reason. How to correct this is discussed in the next section. Before continuing with the next section add the above -URL (without the `?test` part) to the `SEARCHENGINE_URL` tag in +URL (without the `?test` part) to the \ref cfg_searchengine_url "SEARCHENGINE_URL" tag in doxygen's configuration file: SEARCHENGINE_URL = http://yoursite.com/path/to/cgi/doxysearch.cgi @@ -135,7 +135,8 @@ and then copy the resulting `doxysearch.db` to the directory where also The `searchdata.xml` file doesn't contain any absolute paths or links, so how can the search results from multiple projects be linked back to the right documentation set? -This is where the `EXTERNAL_SEARCH_ID` and `EXTRA_SEARCH_MAPPINGS` options come into play. +This is where the \ref cfg_external_search_id "EXTERNAL_SEARCH_ID" and +\ref cfg_extra_search_mappings "EXTRA_SEARCH_MAPPINGS" options come into play. To be able to identify the different projects, one needs to set a unique ID using \ref cfg_external_search_id "EXTERNAL_SEARCH_ID" @@ -168,8 +169,8 @@ and the search results will link to the right documentation set. When you modify the source code, you should re-run doxygen to get up to date documentation again. When using external searching you also need to update the -search index by re-running `doxyindexer`. You could wrap the call to doxygen -and doxyindexer together in a script to make this process easier. +search index by re-running `doxyindexer`. You could wrap the call to `doxygen` +and `doxyindexer` together in a script to make this process easier. \section extsearch_api Programming interface -- cgit v0.12 From b007be7c1671661f31f056b7b7b5f480279ddbd6 Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 25 Nov 2019 11:28:45 +0100 Subject: Checking of right usage of configuration list items In case of a configuration list item has an equal sign in it ('=') some extra restriction are imposed / made more understandable. --- src/configimpl.l | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/doxygen.cpp | 21 +++++-- src/pre.l | 5 +- 3 files changed, 203 insertions(+), 9 deletions(-) diff --git a/src/configimpl.l b/src/configimpl.l index 0cc5c88..351337e 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -1484,23 +1484,203 @@ void Config::checkAndCorrect() s=includePath.next(); } - // check aliases + // check EXTENSION_MAPPING + QStrList &extmapList = Config_getList(EXTENSION_MAPPING); + s=extmapList.first(); + while (s) + { + QCString extmap=s; + extmap=extmap.stripWhiteSpace(); + int i_equals=extmap.find('='); + if (i_equals==-1) + { + err("Illegal EXTENSION_MAPPING format '%s', no equal sign specified use 'ext=language'\n",extmap.data()); + } + else + { + QCString ext = extmap.left(i_equals); + QCString lang = extmap.mid(i_equals+1); + if (ext.isEmpty()) + { + err("Illegal EXTENSION_MAPPING format '%s', no extension to replace specified use 'ext=language'\n",extmap.data()); + } + else if (lang.isEmpty()) + { + err("Illegal EXTENSION_MAPPING format '%s', no replacement language specified use 'ext=language'\n",extmap.data()); + } + } + s=extmapList.next(); + } + + // check PREDEFINED + if (Config_getBool(ENABLE_PREPROCESSING)) + { + QStrList &predefList = Config_getList(PREDEFINED); + s=predefList.first(); + while (s) + { + QCString predef=s; + predef=predef.stripWhiteSpace(); + int i_equals=predef.find('='); + int i_obrace=predef.find('('); + if ((i_obrace==0) || (i_equals==0) || (i_equals==1 && predef.at(i_equals-1)==':')) + { + err("Illegal PREDEFINED format '%s', no define name specified\n",predef.data()); + } + s=predefList.next(); + } + } + + // check ALIASES QStrList &aliasList = Config_getList(ALIASES); s=aliasList.first(); while (s) { QRegExp re1("[a-z_A-Z][a-z_A-Z0-9]*[ \t]*="); // alias without argument - QRegExp re2("[a-z_A-Z][a-z_A-Z0-9]*{[0-9]*}[ \t]*="); // alias with argument + QRegExp re2("[a-z_A-Z][a-z_A-Z0-9]*{[0-9]+}[ \t]*="); // alias with argument QCString alias=s; alias=alias.stripWhiteSpace(); if (alias.find(re1)!=0 && alias.find(re2)!=0) { - err("Illegal alias format '%s'. Use \"name=value\" or \"name{n}=value\", where n is the number of arguments\n", + err("Illegal ALIASES format '%s'. Use \"name=value\" or \"name{n}=value\", where n is the number of arguments\n", alias.data()); } s=aliasList.next(); } + // check FILTER_PATTERNS + QStrList& filterList = Config_getList(FILTER_PATTERNS); + s=filterList.first(); + while (s) + { + QCString filter=s; + filter=filter.stripWhiteSpace(); + int i=filter.find('='); + if (i==-1) + { + err("Illegal FILTER_PATTERNS format, no equal sign specified in '%s'\n",filter.data()); + } + else + { + QCString myName=filter.left(i).stripWhiteSpace(); + QCString myValue=filter.right(filter.length()-i-1).stripWhiteSpace(); + if (myName.isEmpty()) + { + err("Illegal FILTER_PATTERNS format '%s', no name specified\n",filter.data()); + } + else if (myValue.isEmpty()) + { + err("Illegal FILTER_PATTERNS format '%s', no filter specified\n",filter.data()); + } + } + s=filterList.next(); + } + + // check FILTER_SOURCE_PATTERNS + QStrList& filterSrcList = Config_getList(FILTER_SOURCE_PATTERNS); + s=filterSrcList.first(); + while (s) + { + QCString filterSrc=s; + filterSrc=filterSrc.stripWhiteSpace(); + int i=filterSrc.find('='); + if (i==-1) + { + err("Illegal FILTER_SOURCE_PATTERNS format, no name specified in '%s'\n",filterSrc.data()); + } + else + { + QCString myName=filterSrc.left(i).stripWhiteSpace(); + if (myName.isEmpty()) + { + err("Illegal FILTER_SOURCE_PATTERNS format '%s', no name specified\n",filterSrc.data()); + } + } + s=filterSrcList.next(); + } + + // check TAGFILES + QStrList& tagfilesList = Config_getList(TAGFILES); + s=tagfilesList.first(); + while (s) + { + QCString tagfiles=s; + tagfiles=tagfiles.stripWhiteSpace(); + int i=tagfiles.find('='); + if (i!=-1) + { + QCString myName=tagfiles.left(i).stripWhiteSpace(); + QCString myValue=tagfiles.right(tagfiles.length()-i-1).stripWhiteSpace(); + if (myName.isEmpty()) + { + err("Illegal TAGFILES format '%s', no name specified\n",tagfiles.data()); + } + else if (myValue.isEmpty()) + { + err("Illegal TAGFILES format '%s', no tagfiles specified\n",tagfiles.data()); + } + } + s=tagfilesList.next(); + } + + // check EXTRA_SEARCH_MAPPINGS + if (Config_getBool(SEARCHENGINE) && Config_getBool(GENERATE_HTML)) + { + QStrList& searchList = Config_getList(EXTRA_SEARCH_MAPPINGS); + s=searchList.first(); + while (s) + { + QCString search=s; + search=search.stripWhiteSpace(); + int i=search.find('='); + if (i==-1) + { + err("Illegal EXTRA_SEARCH_MAPPINGS format, no equal sign specified in '%s'\n",search.data()); + } + else + { + QCString myName=search.left(i).stripWhiteSpace(); + QCString myValue=search.right(search.length()-i-1).stripWhiteSpace(); + if (myName.isEmpty()) + { + err("Illegal EXTRA_SEARCH_MAPPINGS format '%s', no tagname specified\n",search.data()); + } + else if (myValue.isEmpty()) + { + err("Illegal EXTRA_SEARCH_MAPPINGS format '%s', no location specified\n",search.data()); + } + } + s=searchList.next(); + } + } + + // check TCL_SUBST + QStrList tclsubstList = Config_getList(TCL_SUBST); + s=tclsubstList.first(); + while (s) + { + QCString tclsubst=s; + int i=tclsubst.find('='); + if (i==-1) + { + err("Illegal TCL_SUBST format, no equal sign specified in '%s'\n",tclsubst.data()); + } + else + { + QCString myName=tclsubst.left(i).stripWhiteSpace(); + QCString myValue=tclsubst.right(tclsubst.length()-i-1).stripWhiteSpace(); + if (myName.isEmpty()) + { + err("Illegal TCL_SUBST format '%s', no name to replace specified\n",tclsubst.data()); + } + else if (myValue.isEmpty()) + { + err("Illegal TCL_SUBST format '%s', no replacement value specified\n",tclsubst.data()); + } + } + s = tclsubstList.next(); + } + // check if GENERATE_TREEVIEW and GENERATE_HTMLHELP are both enabled if (Config_getBool(GENERATE_TREEVIEW) && Config_getBool(GENERATE_HTMLHELP)) { diff --git a/src/doxygen.cpp b/src/doxygen.cpp index d4d55e7..3b37567 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -9209,6 +9209,7 @@ static void readTagFile(const std::unique_ptr &root,const char *tl) { fileName = tagLine.left(eqPos).stripWhiteSpace(); destName = tagLine.right(tagLine.length()-eqPos-1).stripWhiteSpace(); + if (fileName.isEmpty() || destName.isEmpty()) return; QFileInfo fi(fileName); Doxygen::tagDestinationDict.insert(fi.absFilePath().utf8(),new QCString(destName)); //printf("insert tagDestination %s->%s\n",fi.fileName().data(),destName.data()); @@ -10689,11 +10690,22 @@ void adjustConfiguration() while (mapping) { QCString mapStr = mapping; - int i; - if ((i=mapStr.find('='))!=-1) + int i=mapStr.find('='); + if (i==-1) + { + mapping = extMaps.next(); + continue; + } + else { - QCString ext=mapStr.left(i).stripWhiteSpace().lower(); - QCString language=mapStr.mid(i+1).stripWhiteSpace().lower(); + QCString ext = mapStr.left(i).stripWhiteSpace().lower(); + QCString language = mapStr.mid(i+1).stripWhiteSpace().lower(); + if (ext.isEmpty() || language.isEmpty()) + { + mapping = extMaps.next(); + continue; + } + if (!updateLanguageMapping(ext,language)) { err("Failed to map file extension '%s' to unsupported language '%s'.\n" @@ -10709,7 +10721,6 @@ void adjustConfiguration() mapping = extMaps.next(); } - // add predefined macro name to a dictionary QStrList &expandAsDefinedList =Config_getList(EXPAND_AS_DEFINED); s=expandAsDefinedList.first(); diff --git a/src/pre.l b/src/pre.l index abc9df9..9d27e6f 100644 --- a/src/pre.l +++ b/src/pre.l @@ -3250,7 +3250,10 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output int i_cbrace=ds.find(')'); bool nonRecursive = i_equals>0 && ds.at(i_equals-1)==':'; - if (i_obrace==0) continue; // no define name + if ((i_obrace==0) || (i_equals==0) || (i_equals==1 && ds.at(i_equals-1)==':')) + { + continue; // no define name + } if (i_obrace Date: Mon, 25 Nov 2019 21:02:53 +0100 Subject: Fixed preprocessor issue that resulted in "More #endif's than #if's found." warning. --- src/pre.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pre.l b/src/pre.l index abc9df9..85a5728 100644 --- a/src/pre.l +++ b/src/pre.l @@ -2084,7 +2084,7 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin } if (cc!='(') { - unputChar(yyscanner,expr,rest,j,' '); + unputChar(yyscanner,expr,rest,j,cc); return FALSE; } getNextChar(yyscanner,expr,rest,j); // eat the '(' character -- cgit v0.12 From dbd8ceb8efa2e7b413780a43e74b30f039670a72 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Mon, 25 Nov 2019 21:29:51 +0100 Subject: Fixed preprocessor hangup regression --- src/pre.l | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/pre.l b/src/pre.l index 85a5728..fe06b6c 100644 --- a/src/pre.l +++ b/src/pre.l @@ -1934,7 +1934,7 @@ static QCString extractTrailingComment(const char *s) static int getNextChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos); static int getCurrentChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint pos); static void unputChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos,char c); -static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level); +static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level); static QCString stringize(const QCString &s) { @@ -2385,20 +2385,19 @@ static int getNextId(const QCString &expr,int p,int *l) * starting at position \a pos. * May read additional characters from the input while re-scanning! */ -static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level) +static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); + //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : "", pos, level); if (expr.isEmpty()) { //printf("expansionDict.find(expr)!=0) // check for recursive expansions { - expr=expr.left(pos)+"@-"+expr.right(expr.length()-pos); //printf("nonRecursive=%d\n",macroName.data(),def->nonRecursive); + //printf(" macroName=%s restExpr='%s' def->nonRecursive=%d\n",macroName.data(),restExpr.data(),def->nonRecursive); + bool expanded=false; if (def && !def->nonRecursive) { state->expandedDict->insert(macroName,def); - expandExpression(yyscanner,resultExpr,&restExpr,0,level+1); + expanded = expandExpression(yyscanner,resultExpr,&restExpr,0,level+1); state->expandedDict->remove(macroName); } - expr=expr.left(p)+resultExpr+restExpr; - //printf(" new expression: '%s' old i=%d new i=%d\n",expr.data(),i,p); - i=p; + if (expanded) + { + expr=expr.left(p)+resultExpr+restExpr; + //printf(" new expression: '%s' old i=%d new i=%d\n",expr.data(),i,p); + i=p; + } + else + { + expr=expr.left(p)+"@-"+expr.right(expr.length()-p); + i=p+l+2; + } } else // move to the next macro name { @@ -2494,6 +2502,7 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in } } //printf("data() : 0, pos,level); + return TRUE; } /*! @brief Process string or character literal. -- cgit v0.12 From 6382986b77d302be187d95aaa850eff132ec1d7d Mon Sep 17 00:00:00 2001 From: Tobias Off Date: Tue, 19 Nov 2019 13:01:27 +0100 Subject: Refactoring of portable.h and portable.cpp functions to be contained in a namespace Fixing some memory issues caused by not correctly freed pointers --- src/cite.cpp | 6 +- src/config.xml | 2 +- src/configimpl.l | 16 +-- src/context.cpp | 34 +++--- src/definition.cpp | 16 +-- src/dia.cpp | 18 ++-- src/diagram.cpp | 8 +- src/docparser.cpp | 10 +- src/doctokenizer.l | 2 +- src/dot.cpp | 18 ++-- src/dotgroupcollaboration.cpp | 10 ++ src/dotrunner.cpp | 14 +-- src/doxygen.cpp | 34 +++--- src/filedef.cpp | 4 +- src/formula.cpp | 32 +++--- src/htags.cpp | 6 +- src/message.cpp | 2 +- src/msc.cpp | 8 +- src/plantuml.cpp | 16 +-- src/portable.cpp | 234 +++++++++++++++++++----------------------- src/portable.h | 57 +++++----- src/pre.l | 2 +- src/util.cpp | 20 ++-- src/vhdldocgen.cpp | 4 +- 24 files changed, 288 insertions(+), 285 deletions(-) diff --git a/src/cite.cpp b/src/cite.cpp index f15f595..40084b6 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -235,14 +235,14 @@ void CiteDict::generatePage() const // 5. run bib2xhtml perl script on the generated file which will insert the // bibliography in citelist.doc int exitCode; - portable_sysTimerStop(); - if ((exitCode=portable_system("perl","\""+bib2xhtmlFile+"\" "+bibOutputFiles+" \""+ + Portables::sysTimerStop(); + if ((exitCode=Portables::system("perl","\""+bib2xhtmlFile+"\" "+bibOutputFiles+" \""+ citeListFile+"\"")) != 0) { err("Problems running bibtex. Verify that the command 'perl --version' works from the command line. Exit code: %d\n", exitCode); } - portable_sysTimerStop(); + Portables::sysTimerStop(); QDir::setCurrent(oldDir); diff --git a/src/config.xml b/src/config.xml index d206203..fb0e01a 100644 --- a/src/config.xml +++ b/src/config.xml @@ -953,7 +953,7 @@ Go to the next section or return to the ]]> -