From: <ka...@us...> - 2012-07-13 10:47:06
|
Revision: 13319 http://swig.svn.sourceforge.net/swig/?rev=13319&view=rev Author: kabbi Date: 2012-07-13 10:46:59 +0000 (Fri, 13 Jul 2012) Log Message: ----------- Implemented parsing support for missing commands: \xrefitem, \ref, \subpage, \dotfile, \mscfile, \image, fixed \par Modified Paths: -------------- branches/gsoc2012-doxygen/Source/DoxygenTranslator/src/DoxygenCommands.h branches/gsoc2012-doxygen/Source/DoxygenTranslator/src/DoxygenParser.cpp Modified: branches/gsoc2012-doxygen/Source/DoxygenTranslator/src/DoxygenCommands.h =================================================================== --- branches/gsoc2012-doxygen/Source/DoxygenTranslator/src/DoxygenCommands.h 2012-07-12 17:53:02 UTC (rev 13318) +++ branches/gsoc2012-doxygen/Source/DoxygenTranslator/src/DoxygenCommands.h 2012-07-13 10:46:59 UTC (rev 13319) @@ -12,7 +12,7 @@ "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 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 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 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 Modified: branches/gsoc2012-doxygen/Source/DoxygenTranslator/src/DoxygenParser.cpp =================================================================== --- branches/gsoc2012-doxygen/Source/DoxygenTranslator/src/DoxygenParser.cpp 2012-07-12 17:53:02 UTC (rev 13318) +++ branches/gsoc2012-doxygen/Source/DoxygenTranslator/src/DoxygenParser.cpp 2012-07-13 10:46:59 UTC (rev 13319) @@ -407,11 +407,28 @@ } // \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 @@ 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 @@ } // \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") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |