Skip to content

Commit 42d0f98

Browse files
committed
issue #10700 Include command in class documentation
1 parent 69886ba commit 42d0f98

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

src/commentcnv.l

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ struct commentcnvYY_state
8888
int inBufPos = 0;
8989
int col = 0;
9090
int blockHeadCol = 0;
91+
int insertCommentCol = 0;
9192
bool mlBrief = FALSE;
9293
int readLineCtx = 0;
9394
int includeCtx = 0;
@@ -136,6 +137,7 @@ static int yyread(yyscan_t yyscanner,char *buf,int max_size);
136137
static void replaceComment(yyscan_t yyscanner,int offset);
137138
static void clearCommentStack(yyscan_t yyscanner);
138139
static bool readIncludeFile(yyscan_t yyscanner,const QCString &inc,const QCString &blockId);
140+
static void insertCommentStart(yyscan_t yyscanner);
139141

140142
#undef YY_INPUT
141143
#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
@@ -682,6 +684,7 @@ SLASHopt [/]*
682684
}
683685
<Verbatim,VerbatimCode>\n { /* new line in verbatim block */
684686
copyToOutput(yyscanner,yytext,yyleng);
687+
insertCommentStart(yyscanner);
685688
}
686689
<Verbatim>^[ \t]*{CPPC}[/!] {
687690
if (yyextra->blockName=="enddot" || yyextra->blockName=="endmsc" || yyextra->blockName=="enduml" || yyextra->blockName.at(0)=='f')
@@ -1026,6 +1029,14 @@ SLASHopt [/]*
10261029
{
10271030
fileName=fileName.mid(1,fileName.length()-2); // strip quotes
10281031
}
1032+
if (yyextra->includeCtx==ReadLine)
1033+
{
1034+
yyextra->insertCommentCol = yyextra->blockHeadCol+3;
1035+
}
1036+
else
1037+
{
1038+
yyextra->insertCommentCol = 0;
1039+
}
10291040
if (readIncludeFile(yyscanner,fileName,""))
10301041
{
10311042
BEGIN(IncludeFile);
@@ -1043,6 +1054,14 @@ SLASHopt [/]*
10431054
fileName=fileName.left(i).stripWhiteSpace();
10441055
//printf("yytext='%s' i=%d fileName='%s' blockId='%s'\n",yytext,i,qPrint(fileName),qPrint(blockId));
10451056
if (fileName == "this") fileName=yyextra->fileName;
1057+
if (yyextra->includeCtx==ReadLine)
1058+
{
1059+
yyextra->insertCommentCol = yyextra->blockHeadCol+3;
1060+
}
1061+
else
1062+
{
1063+
yyextra->insertCommentCol = 0;
1064+
}
10461065
if (readIncludeFile(yyscanner,fileName,blockId))
10471066
{
10481067
BEGIN(IncludeFile);
@@ -1054,6 +1073,7 @@ SLASHopt [/]*
10541073
}
10551074
<IncludeDoc,SnippetDoc>\n {
10561075
copyToOutput(yyscanner,yytext,yyleng);
1076+
insertCommentStart(yyscanner);
10571077
// missing file name
10581078
//warn(yyextra->fileName,yyextra->lineNr,"Found \\include{doc} command without valid file name argument");
10591079
BEGIN(yyextra->includeCtx);
@@ -1188,6 +1208,7 @@ SLASHopt [/]*
11881208
}
11891209
<IncludeFile>\n {
11901210
copyToOutput(yyscanner,yytext,yyleng);
1211+
insertCommentStart(yyscanner);
11911212
}
11921213
<*>. {
11931214
copyToOutput(yyscanner,yytext,yyleng);
@@ -1444,6 +1465,18 @@ static QCString extractBlock(const QCString &text,const QCString &marker,int &bl
14441465
return l2>l1 ? text.mid(l1,l2-l1) : QCString();
14451466
}
14461467

1468+
static void insertCommentStart(yyscan_t yyscanner)
1469+
{
1470+
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1471+
if (yyextra->insertCommentCol>=3)
1472+
{
1473+
for (int i=0;i<yyextra->insertCommentCol-3;i++)
1474+
{
1475+
copyToOutput(yyscanner," ");
1476+
}
1477+
copyToOutput(yyscanner," * ");
1478+
}
1479+
}
14471480

14481481
static bool readIncludeFile(yyscan_t yyscanner,const QCString &inc,const QCString &blockId)
14491482
{
@@ -1527,6 +1560,7 @@ static bool readIncludeFile(yyscan_t yyscanner,const QCString &inc,const QCStrin
15271560
yyextra->inBuf = &fs->fileBuf;
15281561
yyextra->inBufPos = 0;
15291562
yyextra->includeStack.push_back(std::move(fs));
1563+
insertCommentStart(yyscanner);
15301564
//printf("switched to %s\n",qPrint(fileName));
15311565
}
15321566
else

src/scanner.l

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6958,8 +6958,12 @@ NONLopt [^\n]*
69586958
handleCommentBlock(yyscanner,yyextra->docBlock.str(),FALSE);
69596959
BEGIN(yyextra->docBlockContext);
69606960
}
6961+
<DocBlock>"\\ilinebr "{B}*"*"/[^/] {
6962+
QCString indent;
6963+
indent.fill(' ',computeIndent(yytext+8,yyextra->column));
6964+
yyextra->docBlock << "\\ilinebr " << indent;
6965+
}
69616966
<DocBlock>^{B}*"*"+/[^/] {
6962-
69636967
QCString indent;
69646968
indent.fill(' ',computeIndent(yytext,yyextra->column));
69656969
yyextra->docBlock << indent;

0 commit comments

Comments
 (0)