Skip to content

Commit 03fb816

Browse files
committed
Better warning message in case of illegal command
When having a problem like: ``` /** \file * * \link Something \see nothing2 \endlink * * \link Something @see nothing3 \endlink */ ``` We will get a.o. the warnings: ``` .../aa.h:3: warning: Illegal command see as part of a \link .../aa.h:5: warning: Illegal command see as part of a \link ``` it is not clear what the problem is. With this patch we get a little bit clearer warning: ``` .../aa.h:3: warning: Illegal command \see as part of a \link .../aa.h:5: warning: Illegal command @see as part of a \link ```
1 parent 0a1a216 commit 03fb816

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/docparser.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -803,14 +803,15 @@ static bool findDocsForMemberOrCompound(const char *commandName,
803803
inline void errorHandleDefaultToken(DocNode *parent,int tok,
804804
QList<DocNode> &children,const char *txt)
805805
{
806+
char *cmd_start = "\\";
806807
switch (tok)
807808
{
808809
case TK_COMMAND_AT:
809-
// fall through
810+
cmd_start = "@";
810811
case TK_COMMAND_BS:
811812
children.append(new DocWord(parent,TK_COMMAND_CHAR(tok) + g_token->name));
812813
warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a %s",
813-
qPrint(TK_COMMAND_CHAR(tok) + g_token->name), txt);
814+
qPrint(cmd_start + g_token->name),txt);
814815
break;
815816
case TK_SYMBOL:
816817
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found found as part of a %s",
@@ -2312,6 +2313,7 @@ void DocSecRefList::parse()
23122313
{
23132314
if (tok==TK_COMMAND_AT || tok == TK_COMMAND_BS)
23142315
{
2316+
char *cmd_start = (tok==TK_COMMAND_AT ? "@" : "\\");
23152317
switch (Mappers::cmdMapper->map(g_token->name))
23162318
{
23172319
case CMD_SECREFITEM:
@@ -2339,7 +2341,7 @@ void DocSecRefList::parse()
23392341
goto endsecreflist;
23402342
default:
23412343
warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\secreflist",
2342-
qPrint(g_token->name));
2344+
qPrint(cmd_start + g_token->name));
23432345
goto endsecreflist;
23442346
}
23452347
}
@@ -2646,9 +2648,11 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink)
26462648
{
26472649
if (!defaultHandleToken(this,tok,m_children,FALSE))
26482650
{
2651+
char *cmd_start = "\\";
26492652
switch (tok)
26502653
{
26512654
case TK_COMMAND_AT:
2655+
cmd_start = "@";
26522656
// fall through
26532657
case TK_COMMAND_BS:
26542658
switch (Mappers::cmdMapper->map(g_token->name))
@@ -2661,7 +2665,7 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink)
26612665
goto endlink;
26622666
default:
26632667
warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\link",
2664-
qPrint(g_token->name));
2668+
qPrint(cmd_start + g_token->name));
26652669
break;
26662670
}
26672671
break;
@@ -3793,9 +3797,11 @@ int DocHtmlDescTitle::parse()
37933797
{
37943798
if (!defaultHandleToken(this,tok,m_children))
37953799
{
3800+
char *cmd_start = "\\";
37963801
switch (tok)
37973802
{
37983803
case TK_COMMAND_AT:
3804+
cmd_start = "@";
37993805
// fall through
38003806
case TK_COMMAND_BS:
38013807
{
@@ -3866,8 +3872,8 @@ int DocHtmlDescTitle::parse()
38663872

38673873
break;
38683874
default:
3869-
warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command \\%s found as part of a <dt> tag",
3870-
qPrint(g_token->name));
3875+
warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s found as part of a <dt> tag",
3876+
qPrint(cmd_start + g_token->name));
38713877
}
38723878
}
38733879
break;

0 commit comments

Comments
 (0)