Skip to content

Commit

Permalink
bug 539818 C Preprocessor enum printing trick not handled properly by…
Browse files Browse the repository at this point in the history
… Doxygen

The determination of the end quote was not handled properly, so when inside a string we had, at the end, also skip the end quote.
Special attention had to be paid to  escaped quotes.
  • Loading branch information
albert-github committed Jul 4, 2022
1 parent 60f5639 commit 70df5ab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/util.cpp
Expand Up @@ -889,7 +889,7 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope,
size_t strLen = txtStr.length();
if (strLen==0) return;

static const reg::Ex regExp(R"((::)?\a[\w~!\\.:$]*)");
static const reg::Ex regExp(R"((::)?\a[\w~!\\.:$"]*)");
reg::Iterator it(txtStr,regExp);
reg::Iterator end;

Expand Down Expand Up @@ -919,6 +919,7 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope,
for (size_t i=index;i<newIndex;i++)
{
if (txtStr.at(i)=='"') insideString=!insideString;
if (txtStr.at(i)=='\\') i++; // skip next character it is escaped
}

//printf("floatingIndex=%d strlen=%d autoBreak=%d\n",floatingIndex,strLen,autoBreak);
Expand Down Expand Up @@ -1060,7 +1061,7 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope,
if (md!=self && (self==0 || md->name()!=self->name()))
// name check is needed for overloaded members, where getDefs just returns one
{
/* in case of Fortran scop and the variable is a non Fortran variable: don't link,
/* in case of Fortran scope and the variable is a non Fortran variable: don't link,
* see also getLink in fortrancode.l
*/
if (!(scope && (scope->getLanguage() == SrcLangExt_Fortran) && md->isVariable() && (md->getLanguage() != SrcLangExt_Fortran)))
Expand All @@ -1081,6 +1082,7 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope,
// set next start point in the string
//printf("index=%d/%d\n",index,txtStr.length());
skipIndex=index=newIndex+matchLen;
if (insideString) index++;
}
// add last part of the string to the result.
//ol.docify(txtStr.right(txtStr.length()-skipIndex));
Expand Down

0 comments on commit 70df5ab

Please sign in to comment.