Skip to content

Commit

Permalink
Merge pull request #10862 from albert-github/feature/issue_10859
Browse files Browse the repository at this point in the history
issue #10859 More restrictive block-id character set in Doxygen >= 1.10
  • Loading branch information
doxygen committed May 14, 2024
2 parents 9f2e28b + 92eca6d commit a900735
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/commentcnv.l
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ struct commentcnvYY_state
bool isFixedForm = FALSE; // For Fortran
std::deque<std::unique_ptr<commentcnv_FileState>> includeStack;
std::vector<std::string> expandedAliases;
QCString snippetFileName;
QCString snippetName;
};

[[maybe_unused]] static const char *stateToString(int state);
Expand Down Expand Up @@ -184,6 +186,7 @@ MAILADDR ("mailto:")?[a-z_A-Z0-9\x80-\xff.+-]+"@"[a-z_A-Z0-9\x80-\xff-]+("."[a
%x ReadAliasArgs
%x IncludeDoc
%x SnippetDoc
%x SnippetDocTag
%x IncludeFile

CMD ("\\"|"@")
Expand Down Expand Up @@ -1107,15 +1110,24 @@ SLASHopt [/]*
BEGIN(yyextra->includeCtx);
}
}
<SnippetDoc>({FILEMASK}|"\""[^\n\"]+"\""){B}+{ID} {
QCString fileName=yytext;
int i=fileName.findRev(' ');
if (i==-1) i=fileName.findRev('\t');
QCString blockId = "["+fileName.mid(i+1)+"]";
fileName=fileName.left(i).stripWhiteSpace();
//printf("yytext='%s' i=%d fileName='%s' blockId='%s'\n",yytext,i,qPrint(fileName),qPrint(blockId));
if (fileName == "this") fileName=yyextra->fileName;
if (readIncludeFile(yyscanner,fileName,blockId))
<SnippetDoc>({FILEMASK}|"\""[^\n\"]+"\""){B}+ {
yyextra->snippetFileName=yytext;
yyextra->snippetFileName=yyextra->snippetFileName.stripWhiteSpace();
if (yyextra->snippetFileName == "this") yyextra->snippetFileName=yyextra->fileName;
yyextra->snippetName = "";
BEGIN(SnippetDocTag);
}
<SnippetDocTag>[^\\\n]+ {
yyextra->snippetName += yytext;
}
<SnippetDocTag>"\\" {
yyextra->snippetName += yytext;
}
<SnippetDocTag>(\n|"\\ilinebr") {
for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]);
yyextra->snippetName = yyextra->snippetName.stripWhiteSpace();
QCString blockId = "["+yyextra->snippetName+"]";
if (readIncludeFile(yyscanner,yyextra->snippetFileName,blockId))
{
BEGIN(IncludeFile);
}
Expand All @@ -1124,6 +1136,7 @@ SLASHopt [/]*
BEGIN(yyextra->includeCtx);
}
}

<IncludeDoc,SnippetDoc>\n {
copyToOutput(yyscanner,yytext,yyleng);
insertCommentStart(yyscanner);
Expand Down

0 comments on commit a900735

Please sign in to comment.