Skip to content

Commit 408a727

Browse files
committed
Incorrect line count with \include{doc}
In case we have: **foo.h** ``` /// \file /// /// The level 1 /// /// provoking an error \error_5_1_h /// /// \include{doc} kaboom.md /// \brief the fie 1 /// \details the fie 1 /// \error_11_h void foo_1() {} ``` **kaboom.md** ``` # Uh-oh 1 Seems Doxygen isn't playing nice with slightly longer paths... \error_3 ``` we get the warnings: ``` .../foo.h:5: warning: Found unknown command '\error_5_1_h' .../kaboom.md:3: warning: Found unknown command '\error_3' .../foo.h:14: warning: Found unknown command '\error_11_h' ``` though the last one should read ``` .../foo.h:11: warning: Found unknown command '\error_11_h' ``` Problem is due to the fact that `\include{doc}` adds lines but the correction of the number of lines is done based for the current comment block so subsequent comment blocks don't know about it, this has to be handled in the scanner that extracts the comment blocks. (code analogous to the doctokenizer)
1 parent 351dba6 commit 408a727

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/scanner.l

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,13 @@ LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!"|"<=>"
281281
BITOP "&"|"|"|"^"|"<<"|">>"|"~"
282282
OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
283283
MODULE_ID ({ID}".")*{ID}
284+
LINENR {B}*[1-9][0-9]*
285+
FILEICHAR [a-z_A-Z0-9\\:\\\/\-\+=&#@]
286+
FILEECHAR [a-z_A-Z0-9\-\+=&#@]
287+
FILECHARS {FILEICHAR}*{FILEECHAR}+
288+
HFILEMASK {FILEICHAR}*("."{FILEICHAR}+)+{FILECHARS}*
289+
VFILEMASK {FILECHARS}("."{FILECHARS})*
290+
FILEMASK {VFILEMASK}|{HFILEMASK}
284291
285292
/* no comment start / end signs inside square brackets */
286293
NCOMM [^/\*]
@@ -6901,6 +6908,31 @@ NONLopt [^\n]*
69016908
yyextra->nestedComment=0;
69026909
BEGIN(DocCopyBlock);
69036910
}
6911+
<DocBlock>{CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
6912+
yyextra->fileName = &yytext[6];
6913+
yyextra->fileName = yyextra->fileName.stripWhiteSpace();
6914+
yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
6915+
yyextra->docBlock << yytext;
6916+
}
6917+
<DocBlock>{CMD}"ifile"{B}+{FILEMASK} {
6918+
yyextra->fileName = &yytext[6];
6919+
yyextra->fileName = yyextra->fileName.stripWhiteSpace();
6920+
yyextra->docBlock << yytext;
6921+
}
6922+
<DocBlock>{CMD}"iline"{LINENR}/[\n\.] |
6923+
<DocBlock>{CMD}"iline"{LINENR}{B} {
6924+
bool ok = false;
6925+
int nr = QCString(&yytext[6]).toInt(&ok);
6926+
if (!ok)
6927+
{
6928+
warn(yyextra->fileName,yyextra->yyLineNr,"Invalid line number '%s' for iline command",yytext);
6929+
}
6930+
else
6931+
{
6932+
yyextra->yyLineNr = nr;
6933+
}
6934+
yyextra->docBlock << yytext;
6935+
}
69046936
<DocBlock>{B}*"<"{PRE}">" {
69056937
yyextra->docBlock << yytext;
69066938
yyextra->docBlockName="<pre>";

0 commit comments

Comments
 (0)