Implemented parsing support for missing commands: \xrefitem, \ref, \subpage, \dotfile, \mscfile, \image, fixed \par

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13319 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dmitry Kabak 2012-07-13 10:46:59 +00:00
commit 6a7fe334be
2 changed files with 84 additions and 22 deletions

View file

@ -12,7 +12,7 @@ const char *commandArray[] = {
"enum", "example", "exception", "f$", "f[", "f]", "f{", "f}", "file", "fn", "headerfile",
"hideinitializer", "htmlinclude", "htmlonly", "if", "ifnot", "image", "include",
"includelineno", "ingroup", "internal", "invariant", "interface", "latexonly", "li",
"line", "link", "mainpage", "manonly", "msc", "n", "name", "namespace", "nosubgrouping",
"line", "link", "mainpage", "manonly", "msc", "mscfile", "n", "name", "namespace", "nosubgrouping",
"note", "overload", "p", "package", "page", "par", "paragraph", "param", "post", "pre",
"private", "privatesection", "property", "protected", "protectedsection", "protocol",
"public", "publicsection", "ref", "relates", "relatesalso", "remarks", "remark", "result", "return", "returns", "retval",
@ -37,7 +37,7 @@ const char *ignoredSimpleCommands[] = {
const int ignoredSimpleCommandsSize = sizeof(ignoredSimpleCommands) / sizeof(*ignoredSimpleCommands);
const char *commandWords[] = {
"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include",
"a", "b", "c", "e", "em", "p", "def", "enum", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include",
"includelineno"};
const int commandWordsSize = sizeof(commandWords) / sizeof(*commandWords);
@ -68,7 +68,7 @@ const char *commandEndCommands[] = {
const int commandEndCommandsSize = sizeof(commandEndCommands) / sizeof(*commandEndCommands);
const char *commandWordParagraphs[] = {
"param", "tparam", "throw", "throws", "retval", "exception"};
"param", "tparam", "throw", "throws", "retval", "exception", "example"};
const int commandWordParagraphsSize = sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs);
const char *commandWordLines[] = {
@ -92,7 +92,7 @@ const int commandErrorThrowingsSize = sizeof(commandErrorThrowings) / sizeof(*co
const char *commandUniques[] = {
"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li",
"if", "ifnot", "elseif", "else"};
"if", "ifnot", "elseif", "else", "mscfile"};
const int commandUniquesSize = sizeof(commandUniques) / sizeof(*commandUniques);
#endif

View file

@ -407,11 +407,28 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
}
// \xrefitem <key> "(heading)" "(std::list title)" {text}
else if (theCommand == "xrefitem") {
//TODO Implement xrefitem
if (noisy)
cout << "Not Adding " << theCommand << endl;
cout << "Parsing " << theCommand << endl;
std::string key = getNextWord(tokList);
if (key.empty()) {
tokList.printListError("No key followed " + theCommand + " command. Not added");
return 0;
}
std::string heading = getNextWord(tokList);
if (key.empty()) {
tokList.printListError("No heading followed " + theCommand + " command. Not added");
return 0;
}
std::string title = getNextWord(tokList);
if (title.empty()) {
tokList.printListError("No title followed " + theCommand + " command. Not added");
return 0;
}
std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList);
tokList.setIterator(endOfParagraph);
aNewList = parse(endOfParagraph, tokList);
aNewList.push_front(DoxygenEntity("plainstd::string", title));
aNewList.push_front(DoxygenEntity("plainstd::string", heading));
aNewList.push_front(DoxygenEntity("plainstd::string", key));
return 1;
}
// \ingroup (<groupname> [<groupname> <groupname>])
@ -432,7 +449,8 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
std::list < Token >::iterator endOfLine = getOneLine(tokList);
aNewList = parse(endOfLine, tokList);
std::list < DoxygenEntity > aNewList2;
aNewList2 = parse(endOfLine, tokList);
std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList);
aNewList2 = parse(endOfParagraph, tokList);
aNewList.splice(aNewList.end(), aNewList2);
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
return 1;
@ -478,31 +496,75 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
}
// \ref <name> ["(text)"]
else if (theCommand == "ref") {
//TODO Implement ref
if (noisy)
cout << "Not Adding " << theCommand << endl;
std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList);
tokList.setIterator(endOfParagraph);
cout << "Parsing " << theCommand << endl;
std::string name = getNextWord(tokList);
if (name.empty()) {
tokList.printListError("No key followed " + theCommand + " command. Not added");
return 0;
}
std::string text = getNextWord(tokList);
aNewList.push_back(DoxygenEntity("plainstd::string", name));
if (!text.empty())
aNewList.push_back(DoxygenEntity("plainstd::string", text));
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
}
// \subpage <name> ["(text)"]
else if (theCommand == "subpage") {
//TODO implement subpage
if (noisy)
cout << "Not Adding " << theCommand << endl;
std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList);
tokList.setIterator(endOfParagraph);
cout << "Parsing " << theCommand << endl;
std::string name = getNextWord(tokList);
if (name.empty()) {
tokList.printListError("No name followed " + theCommand + " command. Not added");
return 0;
}
std::string text = getNextWord(tokList);
aNewList.push_back(DoxygenEntity("plainstd::string", name));
if (!text.empty())
aNewList.push_back(DoxygenEntity("plainstd::string", text));
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
}
// \dotfile <file> ["caption"]
else if (theCommand == "dotfile") {
//TODO implement dotfile
// \mscfile <file> ["caption"]
else if (theCommand == "dotfile" || theCommand == "mscfile") {
if (noisy)
cout << "Not Adding " << theCommand << endl;
std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList);
tokList.setIterator(endOfParagraph);
cout << "Parsing " << theCommand << endl;
std::string file = getNextWord(tokList);
if (file.empty()) {
tokList.printListError("No file followed " + theCommand + " command. Not added");
return 0;
}
std::string caption = getNextWord(tokList);
aNewList.push_back(DoxygenEntity("plainstd::string", file));
if (!caption.empty())
aNewList.push_back(DoxygenEntity("plainstd::string", caption));
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
}
// \image <format> <file> ["caption"] [<sizeindication>=<size>]
else if (theCommand == "image") {
//todo implement image
if (noisy)
cout << "Parsing " << theCommand << endl;
std::string format = getNextWord(tokList);
if (format.empty()) {
tokList.printListError("No format followed " + theCommand + " command. Not added");
return 0;
}
std::string file = getNextWord(tokList);
if (file.empty()) {
tokList.printListError("No name followed " + theCommand + " command. Not added");
return 0;
}
std::string caption = getNextWord(tokList);
std::string size = getNextWord(tokList);
std::list < DoxygenEntity > aNewList;
aNewList.push_back(DoxygenEntity("plainstd::string", format));
aNewList.push_back(DoxygenEntity("plainstd::string", file));
if (!caption.empty())
aNewList.push_back(DoxygenEntity("plainstd::string", caption));
if (!size.empty())
aNewList.push_back(DoxygenEntity("plainstd::string", size));
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
}
// \addtogroup <name> [(title)]
else if (theCommand == "addtogroup") {