summaryrefslogtreecommitdiffstats
path: root/src/docparser.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2018-10-27 13:19:39 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2018-10-27 13:19:39 (GMT)
commitcf1c218d74ef52c22f9f22c33b1922c10d8291cd (patch)
tree8dcc8ae7b97b94d1c57bbeb580908c895d5d1e0c /src/docparser.cpp
parent681038d8137ef9ba36b575aada4ae8526631001a (diff)
parenta68e6c0724f99dfa6cea25f7d56fb6077100fc85 (diff)
downloadDoxygen-cf1c218d74ef52c22f9f22c33b1922c10d8291cd.zip
Doxygen-cf1c218d74ef52c22f9f22c33b1922c10d8291cd.tar.gz
Doxygen-cf1c218d74ef52c22f9f22c33b1922c10d8291cd.tar.bz2
Merge branch 'feature/bug_warning_msg' of https://github.com/albert-github/doxygen into albert-github-feature/bug_warning_msg
Diffstat (limited to 'src/docparser.cpp')
-rw-r--r--src/docparser.cpp202
1 files changed, 59 insertions, 143 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp
index ad7f00e..f1c969b 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -866,7 +866,30 @@ static bool findDocsForMemberOrCompound(const char *commandName,
return FALSE;
}
//---------------------------------------------------------------------------
+inline void errorHandleDefaultToken(DocNode *parent,int tok,
+ QList<DocNode> &children,const char *txt)
+{
+ switch (tok)
+ {
+ case TK_COMMAND:
+ case TK_COMMAND1:
+ children.append(new DocWord(parent,(tok == TK_COMMAND ? '@' : '\\') + g_token->name));
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a %s",
+ qPrint((tok == TK_COMMAND ? '@' : '\\') + g_token->name), txt);
+ break;
+ case TK_SYMBOL:
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found found as part of a %s",
+ qPrint(g_token->name), txt);
+ break;
+ default:
+ children.append(new DocWord(parent,g_token->name));
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s found as part of a %s",
+ tokToString(tok), txt);
+ break;
+ }
+}
+//---------------------------------------------------------------------------
// forward declaration
static bool defaultHandleToken(DocNode *parent,int tok,
QList<DocNode> &children,bool
@@ -876,6 +899,7 @@ static int handleStyleArgument(DocNode *parent,QList<DocNode> &children,
const QCString &cmdName)
{
DBG(("handleStyleArgument(%s)\n",qPrint(cmdName)));
+ QCString saveCmdName = cmdName;
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
@@ -901,14 +925,6 @@ static int handleStyleArgument(DocNode *parent,QList<DocNode> &children,
{
switch (tok)
{
- case TK_COMMAND:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command \\%s as the argument of a \\%s command",
- qPrint(g_token->name),qPrint(cmdName));
- break;
- case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found while handling command %s",
- qPrint(g_token->name),qPrint(cmdName));
- break;
case TK_HTMLTAG:
if (insideLI(parent) && Mappers::htmlTagMapper->map(g_token->name) && g_token->endTag)
{ // ignore </li> as the end of a style command
@@ -917,8 +933,7 @@ static int handleStyleArgument(DocNode *parent,QList<DocNode> &children,
return tok;
break;
default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s while handling command %s",
- tokToString(tok),qPrint(cmdName));
+ errorHandleDefaultToken(parent,tok,children,"\\" + saveCmdName + " command");
break;
}
break;
@@ -1297,21 +1312,7 @@ static void defaultHandleTitleAndSize(const int cmd, DocNode *parent, QList<DocN
}
if (!defaultHandleToken(parent,tok,children))
{
- switch (tok)
- {
- case TK_COMMAND:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\%s",
- qPrint(g_token->name), Mappers::cmdMapper->find(cmd).data());
- break;
- case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
- qPrint(g_token->name));
- break;
- default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
- tokToString(tok));
- break;
- }
+ errorHandleDefaultToken(parent,tok,children,Mappers::cmdMapper->find(cmd).data());
}
}
// parse size attributes
@@ -1370,7 +1371,7 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children
{
DBG(("token %s at %d",tokToString(tok),doctokenizerYYlineno));
if (tok==TK_WORD || tok==TK_LNKWORD || tok==TK_SYMBOL || tok==TK_URL ||
- tok==TK_COMMAND || tok==TK_HTMLTAG
+ tok==TK_COMMAND || tok==TK_COMMAND1 || tok==TK_HTMLTAG
)
{
DBG((" name=%s",qPrint(g_token->name)));
@@ -1381,6 +1382,7 @@ reparsetoken:
switch (tok)
{
case TK_COMMAND:
+ case TK_COMMAND1:
switch (Mappers::cmdMapper->map(tokenName))
{
case CMD_BSLASH:
@@ -2334,21 +2336,7 @@ void DocSecRefItem::parse()
{
if (!defaultHandleToken(this,tok,m_children))
{
- switch (tok)
- {
- case TK_COMMAND:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\refitem",
- qPrint(g_token->name));
- break;
- case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
- qPrint(g_token->name));
- break;
- default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
- tokToString(tok));
- break;
- }
+ errorHandleDefaultToken(this,tok,m_children,"\\refitem");
}
}
doctokenizerYYsetStatePara();
@@ -2396,7 +2384,7 @@ void DocSecRefList::parse()
// handle items
while (tok)
{
- if (tok==TK_COMMAND)
+ if (tok==TK_COMMAND || tok == TK_COMMAND1)
{
switch (Mappers::cmdMapper->map(g_token->name))
{
@@ -2476,21 +2464,7 @@ void DocInternalRef::parse()
{
if (!defaultHandleToken(this,tok,m_children))
{
- switch (tok)
- {
- case TK_COMMAND:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\ref",
- qPrint(g_token->name));
- break;
- case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
- qPrint(g_token->name));
- break;
- default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
- tokToString(tok));
- break;
- }
+ errorHandleDefaultToken(this,tok,m_children,"\\ref");
}
}
@@ -2634,19 +2608,10 @@ void DocRef::parse()
{
switch (tok)
{
- case TK_COMMAND:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\ref",
- qPrint(g_token->name));
- break;
- case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
- qPrint(g_token->name));
- break;
case TK_HTMLTAG:
break;
default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
- tokToString(tok));
+ errorHandleDefaultToken(this,tok,m_children,"\\ref");
break;
}
}
@@ -2758,6 +2723,7 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink)
switch (tok)
{
case TK_COMMAND:
+ case TK_COMMAND1:
switch (Mappers::cmdMapper->map(g_token->name))
{
case CMD_ENDLINK:
@@ -2773,13 +2739,13 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink)
}
break;
case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found as part of a \\link",
qPrint(g_token->name));
break;
case TK_HTMLTAG:
if (g_token->name!="see" || !isXmlLink)
{
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected xml/html command %s found",
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected xml/html command %s found as part of a \\link",
qPrint(g_token->name));
}
goto endlink;
@@ -2957,21 +2923,7 @@ void DocVhdlFlow::parse()
{
if (!defaultHandleToken(this,tok,m_children))
{
- switch (tok)
- {
- case TK_COMMAND:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\vhdlflow",
- qPrint(g_token->name));
- break;
- case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
- qPrint(g_token->name));
- break;
- default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
- tokToString(tok));
- break;
- }
+ errorHandleDefaultToken(this,tok,m_children,"\\vhdlflow");
}
}
tok=doctokenizerYYlex();
@@ -3018,10 +2970,6 @@ int DocHtmlHeader::parse()
{
switch (tok)
{
- case TK_COMMAND:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a <h%d> tag",
- qPrint(g_token->name),m_level);
- break;
case TK_HTMLTAG:
{
int tagId=Mappers::htmlTagMapper->map(g_token->name);
@@ -3099,14 +3047,10 @@ int DocHtmlHeader::parse()
}
break;
- case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
- qPrint(g_token->name));
- break;
default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
- tokToString(tok));
- break;
+ char tmp[20];
+ sprintf(tmp,"<h%d>tag",m_level);
+ errorHandleDefaultToken(this,tok,m_children,tmp);
}
}
}
@@ -3138,14 +3082,6 @@ int DocHRef::parse()
{
switch (tok)
{
- case TK_COMMAND:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a <a>..</a> block",
- qPrint(g_token->name));
- break;
- case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
- qPrint(g_token->name));
- break;
case TK_HTMLTAG:
{
@@ -3162,8 +3098,7 @@ int DocHRef::parse()
}
break;
default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
- tokToString(tok),doctokenizerYYlineno);
+ errorHandleDefaultToken(this,tok,m_children,"<a>..</a> block");
break;
}
}
@@ -3297,6 +3232,7 @@ int DocIndexEntry::parse()
}
break;
case TK_COMMAND:
+ case TK_COMMAND1:
switch (Mappers::cmdMapper->map(g_token->name))
{
case CMD_BSLASH: m_entry+='\\'; break;
@@ -3384,14 +3320,6 @@ int DocHtmlCaption::parse()
{
switch (tok)
{
- case TK_COMMAND:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a <caption> tag",
- qPrint(g_token->name));
- break;
- case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
- qPrint(g_token->name));
- break;
case TK_HTMLTAG:
{
int tagId=Mappers::htmlTagMapper->map(g_token->name);
@@ -3408,9 +3336,7 @@ int DocHtmlCaption::parse()
}
break;
default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
- tokToString(tok));
- break;
+ errorHandleDefaultToken(this,tok,m_children,"<caption> tag");
}
}
}
@@ -3924,6 +3850,7 @@ int DocHtmlDescTitle::parse()
switch (tok)
{
case TK_COMMAND:
+ case TK_COMMAND1:
{
QCString cmdName=g_token->name;
bool isJavaLink=FALSE;
@@ -3934,7 +3861,7 @@ int DocHtmlDescTitle::parse()
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
- warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after \\%s command",
qPrint(g_token->name));
}
else
@@ -3943,7 +3870,7 @@ int DocHtmlDescTitle::parse()
tok=doctokenizerYYlex(); // get the reference id
if (tok!=TK_WORD)
{
- warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of \\%s command",
tokToString(tok),qPrint(cmdName));
}
else
@@ -3964,7 +3891,7 @@ int DocHtmlDescTitle::parse()
int tok=doctokenizerYYlex();
if (tok!=TK_WHITESPACE)
{
- warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after %s command",
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after \\%s command",
qPrint(cmdName));
}
else
@@ -3973,7 +3900,7 @@ int DocHtmlDescTitle::parse()
tok=doctokenizerYYlex();
if (tok!=TK_WORD)
{
- warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of %s",
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected token %s as the argument of \\%s command",
tokToString(tok),qPrint(cmdName));
}
else
@@ -3992,13 +3919,13 @@ int DocHtmlDescTitle::parse()
break;
default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a <dt> tag",
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command \\%s found as part of a <dt> tag",
qPrint(g_token->name));
}
}
break;
case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol \\%s found as part of a <dt> tag",
qPrint(g_token->name));
break;
case TK_HTMLTAG:
@@ -4039,7 +3966,7 @@ int DocHtmlDescTitle::parse()
}
break;
default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s found as part of a <dt> tag",
tokToString(tok));
break;
}
@@ -4544,21 +4471,7 @@ void DocTitle::parse()
{
if (!defaultHandleToken(this,tok,m_children))
{
- switch (tok)
- {
- case TK_COMMAND:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a title section",
- qPrint(g_token->name));
- break;
- case TK_SYMBOL:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
- qPrint(g_token->name));
- break;
- default:
- warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
- tokToString(tok));
- break;
- }
+ errorHandleDefaultToken(this,tok,m_children,"title section");
}
}
doctokenizerYYsetStatePara();
@@ -5419,7 +5332,7 @@ void DocPara::handleInheritDoc()
}
-int DocPara::handleCommand(const QCString &cmdName)
+int DocPara::handleCommand(const QCString &cmdName, const int tok)
{
DBG(("handleCommand(%s)\n",qPrint(cmdName)));
int retval = RetVal_OK;
@@ -5427,6 +5340,7 @@ int DocPara::handleCommand(const QCString &cmdName)
switch (cmdId)
{
case CMD_UNKNOWN:
+ m_children.append(new DocWord(this,(tok == TK_COMMAND ? '@' : '\\') + cmdName));
warn_doc_error(g_fileName,doctokenizerYYlineno,"Found unknown command `\\%s'",qPrint(cmdName));
break;
case CMD_EMPHASIS:
@@ -6529,7 +6443,7 @@ int DocPara::parse()
reparsetoken:
DBG(("token %s at %d",tokToString(tok),doctokenizerYYlineno));
if (tok==TK_WORD || tok==TK_LNKWORD || tok==TK_SYMBOL || tok==TK_URL ||
- tok==TK_COMMAND || tok==TK_HTMLTAG
+ tok==TK_COMMAND || tok == TK_COMMAND1 || tok==TK_HTMLTAG
)
{
DBG((" name=%s",qPrint(g_token->name)));
@@ -6627,7 +6541,7 @@ reparsetoken:
}
else // other section
{
- tok = TK_COMMAND;
+ tok = TK_COMMAND1;
}
DBG(("reparsing command %s\n",qPrint(g_token->name)));
goto reparsetoken;
@@ -6673,6 +6587,7 @@ reparsetoken:
}
break;
case TK_COMMAND:
+ case TK_COMMAND1:
{
// see if we have to start a simple section
int cmd = Mappers::cmdMapper->map(g_token->name);
@@ -6708,7 +6623,7 @@ reparsetoken:
}
// handle the command
- retval=handleCommand(g_token->name);
+ retval=handleCommand(g_token->name,tok);
DBG(("handleCommand returns %x\n",retval));
// check the return value
@@ -6726,7 +6641,7 @@ reparsetoken:
}
else // other section
{
- tok = TK_COMMAND;
+ tok = TK_COMMAND1;
}
DBG(("reparsing command %s\n",qPrint(g_token->name)));
goto reparsetoken;
@@ -6999,6 +6914,7 @@ void DocText::parse()
}
break;
case TK_COMMAND:
+ case TK_COMMAND1:
switch (Mappers::cmdMapper->map(g_token->name))
{
case CMD_BSLASH: