diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index dce394798..88b2863cf 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -393,19 +393,20 @@ void DoxygenParser::skipEndOfLine() } } -int DoxygenParser::addSimpleCommand(const std::string &theCommand, - DoxygenEntityList &doxyList) +void +DoxygenParser::addSimpleCommand(const std::string &theCommand, + DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; doxyList.push_back(DoxygenEntity(theCommand)); - return 1; } -int DoxygenParser::addCommandWord(const std::string &theCommand, - const TokenList &, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommandWord(const std::string &theCommand, + const TokenList &, + DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -420,17 +421,16 @@ int DoxygenParser::addCommandWord(const std::string &theCommand, DoxygenEntityList aNewList; aNewList.push_back(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; } else { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); } - return 0; } -int DoxygenParser::addCommandLine(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommandLine(const std::string &theCommand, + const TokenList &tokList, + DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -438,12 +438,12 @@ int DoxygenParser::addCommandLine(const std::string &theCommand, DoxygenEntityList aNewList = parse(endOfLine, tokList); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); skipEndOfLine(); - return 1; } -int DoxygenParser::addCommandParagraph(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommandParagraph(const std::string &theCommand, + const TokenList &tokList, + DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -452,30 +452,30 @@ int DoxygenParser::addCommandParagraph(const std::string &theCommand, DoxygenEntityList aNewList; aNewList = parse(endOfParagraph, tokList); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; } -int DoxygenParser::addCommandEndCommand(const std::string &theCommand, - const TokenList & tokList, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommandEndCommand(const std::string &theCommand, + const TokenList & tokList, + DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; TokenListCIt endCommand = getEndCommand("end" + theCommand, tokList); if (endCommand == tokList.end()) { printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected end" + theCommand); - return 0; + return; } DoxygenEntityList aNewList; aNewList = parse(endCommand, tokList); m_tokenListIt++; doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; } -int DoxygenParser::addCommandWordParagraph(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommandWordParagraph(const std::string &theCommand, + const TokenList &tokList, + DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -485,19 +485,19 @@ int DoxygenParser::addCommandWordParagraph(const std::string &theCommand, if (name.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); - return 0; + return; } TokenListCIt endOfParagraph = getEndOfParagraph(tokList); DoxygenEntityList aNewList; aNewList = parse(endOfParagraph, tokList); aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; } -int DoxygenParser::addCommandWordLine(const std::string &theCommand, - const TokenList & tokList, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommandWordLine(const std::string &theCommand, + const TokenList & tokList, + DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -505,7 +505,7 @@ int DoxygenParser::addCommandWordLine(const std::string &theCommand, if (name.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); - return 0; + return; } TokenListCIt endOfLine = getOneLine(tokList); @@ -513,13 +513,13 @@ int DoxygenParser::addCommandWordLine(const std::string &theCommand, aNewList = parse(endOfLine, tokList); aNewList.push_front(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; //else cout << "No line followed " << theCommand << " command. Not added" << endl; } -int DoxygenParser::addCommandWordOWordOWord(const std::string &theCommand, - const TokenList &, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommandWordOWordOWord(const std::string &theCommand, + const TokenList &, + DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -528,7 +528,7 @@ int DoxygenParser::addCommandWordOWordOWord(const std::string &theCommand, if (name.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); - return 0; + return; } std::string headerfile = getNextWord(); std::string headername = getNextWord(); @@ -539,12 +539,12 @@ int DoxygenParser::addCommandWordOWordOWord(const std::string &theCommand, if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headername)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; } -int DoxygenParser::addCommandOWord(const std::string &theCommand, - const TokenList &, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommandOWord(const std::string &theCommand, + const TokenList &, + DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -553,48 +553,48 @@ int DoxygenParser::addCommandOWord(const std::string &theCommand, DoxygenEntityList aNewList; aNewList.push_back(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; } -int DoxygenParser::addCommandErrorThrow(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &) +void +DoxygenParser::addCommandErrorThrow(const std::string &theCommand, + const TokenList &tokList, + DoxygenEntityList &) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "Encountered: " + theCommand + "\nThis command should not have been encountered. Behaviour past this may be unpredictable"); m_tokenListIt = getOneLine(tokList); - return 0; } -int DoxygenParser::addCommandHtml(const std::string &theCommand, - const TokenList &, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommandHtml(const std::string &theCommand, + const TokenList &, + DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; std::string htmlTagArgs = getNextToken(); doxyList.push_back(DoxygenEntity(theCommand, htmlTagArgs)); - return 1; } -int DoxygenParser::addCommandHtmlEntity(const std::string &theCommand, - const TokenList &, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommandHtmlEntity(const std::string &theCommand, + const TokenList &, + DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; DoxygenEntityList aNewList; doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; } -int DoxygenParser::addCommandUnique(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommandUnique(const std::string &theCommand, + const TokenList &tokList, + DoxygenEntityList &doxyList) { static std::map endCommands; @@ -613,19 +613,19 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, if (key.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added"); - return 0; + return; } std::string heading = getNextWord(); if (key.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No heading followed " + theCommand + " command. Not added"); - return 0; + return; } std::string title = getNextWord(); if (title.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No title followed " + theCommand + " command. Not added"); - return 0; + return; } TokenListCIt endOfParagraph = getEndOfParagraph(tokList); aNewList = parse(endOfParagraph, tokList); @@ -633,7 +633,6 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, aNewList.push_front(DoxygenEntity("plainstd::string", heading)); aNewList.push_front(DoxygenEntity("plainstd::string", key)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; } // \ingroup ( [ ]) else if (theCommand == "ingroup") { @@ -646,7 +645,6 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, if (!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; } // \par [(paragraph title)] { paragraph } else if (theCommand == "par") { @@ -657,7 +655,6 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, aNewList2 = parse(endOfParagraph, tokList); aNewList.splice(aNewList.end(), aNewList2); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; } // \headerfile [] else if (theCommand == "headerfile") { @@ -668,7 +665,6 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, if (!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); - return 1; } // \overload [(function declaration)] else if (theCommand == "overload") { @@ -679,7 +675,6 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } else doxyList.push_back(DoxygenEntity(theCommand)); - return 1; } // \weakgroup [(title)] else if (theCommand == "weakgroup") { @@ -689,7 +684,7 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, if (name.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); - return 0; + return; } DoxygenEntityList aNewList; TokenListCIt endOfLine = getOneLine(tokList); @@ -707,7 +702,7 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, if (name.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added"); - return 0; + return; } DoxygenEntityList aNewList; aNewList.push_front(DoxygenEntity("plainstd::string", name)); @@ -737,7 +732,7 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, if (name.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added"); - return 0; + return; } std::string text = getNextWord(); aNewList.push_back(DoxygenEntity("plainstd::string", name)); @@ -786,7 +781,7 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, if (file.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No file followed " + theCommand + " command. Not added"); - return 0; + return; } std::string caption = getNextWord(); aNewList.push_back(DoxygenEntity("plainstd::string", file)); @@ -802,13 +797,13 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, if (format.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No format followed " + theCommand + " command. Not added"); - return 0; + return; } std::string file = getNextWord(); if (file.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added"); - return 0; + return; } std::string caption = getNextWord(); std::string size = getNextWord(); @@ -831,7 +826,7 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, printListError(WARN_DOXYGEN_COMMAND_ERROR, "There should be at least one word following the '" + theCommand + "' command. Command ignored."); - return 0; + return; } DoxygenEntityList aNewList; TokenListCIt endOfLine = getOneLine(tokList); @@ -857,7 +852,7 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, if (cond.empty()) { printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); - return 0; + return; } } @@ -887,7 +882,7 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, if (endCommand == tokList.end()) { printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "No corresponding endif found"); - return 0; + return; } DoxygenEntityList aNewList; @@ -898,7 +893,6 @@ int DoxygenParser::addCommandUnique(const std::string &theCommand, aNewList.push_front(DoxygenEntity("plainstd::string", cond)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } - return 0; } String* DoxygenParser::getIgnoreFeature(const std::string& theCommand, @@ -935,16 +929,17 @@ string DoxygenParser::getIgnoreFeatureEndCommand(const std::string& theCommand) return endCommand; } -int DoxygenParser::ignoreCommand(const std::string& theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList) +void +DoxygenParser::ignoreCommand(const std::string& theCommand, + const TokenList &tokList, + DoxygenEntityList &doxyList) { const string endCommand = getIgnoreFeatureEndCommand(theCommand); if (!endCommand.empty()) { TokenListCIt itEnd = getEndCommand(endCommand, tokList); if (itEnd == tokList.end()) { printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected " + endCommand); - return 0; + return; } // If we ignore the command, also ignore any whitespace preceding it as we @@ -975,7 +970,7 @@ int DoxygenParser::ignoreCommand(const std::string& theCommand, "Invalid \"doxygen:ignore\" feature \"contents\" attribute \"%s\".\n", Char(contents) ); - return 0; + return; } } @@ -996,16 +991,15 @@ int DoxygenParser::ignoreCommand(const std::string& theCommand, "Invalid \"doxygen:ignore\" feature \"range\" attribute \"%s\".\n", Char(range) ); - return 0; + return; } } - - return 1; } -int DoxygenParser::addCommand(const std::string &commandString, - const TokenList &tokList, - DoxygenEntityList &doxyList) +void +DoxygenParser::addCommand(const std::string &commandString, + const TokenList &tokList, + DoxygenEntityList &doxyList) { string theCommand = stringToLower(commandString); @@ -1015,38 +1009,52 @@ int DoxygenParser::addCommand(const std::string &commandString, if (noisy) cout << "Parsing plain std::string :" << nextPhrase << endl; doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase)); - return 1; + return; } switch (commandBelongs(commandString)) { case SIMPLECOMMAND: - return addSimpleCommand(theCommand, doxyList); + addSimpleCommand(theCommand, doxyList); + break; case COMMANDWORD: - return addCommandWord(theCommand, tokList, doxyList); + addCommandWord(theCommand, tokList, doxyList); + break; case COMMANDLINE: - return addCommandLine(theCommand, tokList, doxyList); + addCommandLine(theCommand, tokList, doxyList); + break; case COMMANDPARAGRAPH: - return addCommandParagraph(theCommand, tokList, doxyList); + addCommandParagraph(theCommand, tokList, doxyList); + break; case COMMANDENDCOMMAND: - return addCommandEndCommand(theCommand, tokList, doxyList); + addCommandEndCommand(theCommand, tokList, doxyList); + break; case COMMANDWORDPARAGRAPH: - return addCommandWordParagraph(theCommand, tokList, doxyList); + addCommandWordParagraph(theCommand, tokList, doxyList); + break; case COMMANDWORDLINE: - return addCommandWordLine(theCommand, tokList, doxyList); + addCommandWordLine(theCommand, tokList, doxyList); + break; case COMMANDWORDOWORDWORD: - return addCommandWordOWordOWord(theCommand, tokList, doxyList); + addCommandWordOWordOWord(theCommand, tokList, doxyList); + break; case COMMANDOWORD: - return addCommandOWord(theCommand, tokList, doxyList); + addCommandOWord(theCommand, tokList, doxyList); + break; case COMMANDERRORTHROW: - return addCommandErrorThrow(theCommand, tokList, doxyList); + addCommandErrorThrow(theCommand, tokList, doxyList); + break; case COMMANDUNIQUE: - return addCommandUnique(theCommand, tokList, doxyList); + addCommandUnique(theCommand, tokList, doxyList); + break; case COMMAND_HTML: - return addCommandHtml(theCommand, tokList, doxyList); + addCommandHtml(theCommand, tokList, doxyList); + break; case COMMAND_HTML_ENTITY: - return addCommandHtmlEntity(theCommand, tokList, doxyList); + addCommandHtmlEntity(theCommand, tokList, doxyList); + break; case COMMAND_IGNORE: - return ignoreCommand(commandString, tokList, doxyList); + ignoreCommand(commandString, tokList, doxyList); + break; case NONE: case END_LINE: case PARAGRAPH_END: @@ -1055,7 +1063,6 @@ int DoxygenParser::addCommand(const std::string &commandString, // TODO: Ensure that these values either are correctly ignored here or can't happen. break; } - return 0; } /** diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index 753b996d8..521d2a02f 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -240,7 +240,7 @@ private: * Plain commands, such as newline etc, they contain no other data * \n \\ \@ \& \$ \# \< \> \% */ - int addSimpleCommand(const std::string &theCommand, + void addSimpleCommand(const std::string &theCommand, DoxygenEntityList &doxyList); /* * CommandWord @@ -250,7 +250,7 @@ private: * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", * "includelineno" */ - int addCommandWord(const std::string &theCommand, + void addCommandWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* @@ -260,7 +260,7 @@ private: * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", * "until", "property" */ - int addCommandLine(const std::string &theCommand, + void addCommandLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* @@ -271,7 +271,7 @@ private: * "details", "invariant", "deprecated", "date", "note", "warning", * "version", "todo", "bug", "attention", "brief", "arg", "author" */ - int addCommandParagraph(const std::string &theCommand, + void addCommandParagraph(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* @@ -283,7 +283,7 @@ private: * "link" * Returns 1 if success, 0 if the endcommand is never encountered. */ - int addCommandEndCommand(const std::string &theCommand, + void addCommandEndCommand(const std::string &theCommand, const TokenList & tokList, DoxygenEntityList &doxyList); /* @@ -292,7 +292,7 @@ private: * Commands such as param * "param", "tparam", "throw", "throws", "retval", "exception" */ - int addCommandWordParagraph(const std::string &theCommand, + void addCommandWordParagraph(const std::string &theCommand, const TokenList & tokList, DoxygenEntityList &doxyList); /* @@ -301,7 +301,7 @@ private: * Commands such as param * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" */ - int addCommandWordLine(const std::string &theCommand, + void addCommandWordLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* @@ -310,7 +310,7 @@ private: * Commands such as class * "category", "class", "protocol", "interface", "struct", "union" */ - int addCommandWordOWordOWord(const std::string &theCommand, + void addCommandWordOWordOWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* @@ -319,7 +319,7 @@ private: * Commands such as dir * "dir", "file", "cond" */ - int addCommandOWord(const std::string &theCommand, + void addCommandOWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); @@ -327,22 +327,22 @@ private: * Commands that should not be encountered (such as PHP only) * goes til the end of line then returns */ - int addCommandErrorThrow(const std::string &theCommand, + void addCommandErrorThrow(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); - int addCommandHtml(const std::string &theCommand, + void addCommandHtml(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); - int addCommandHtmlEntity(const std::string &theCommand, + void addCommandHtmlEntity(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* *Adds the unique commands- different process for each unique command */ - int addCommandUnique(const std::string &theCommand, + void addCommandUnique(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); @@ -350,7 +350,7 @@ private: * Simply ignore the given command, possibly with the word following it or * until the matching end command. */ - int ignoreCommand(const std::string& theCommand, + void ignoreCommand(const std::string& theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); @@ -358,7 +358,7 @@ private: * The actual "meat" of the doxygen parser. Calls the correct addCommand...() * function. */ - int addCommand(const std::string &commandString, + void addCommand(const std::string &commandString, const TokenList &tokList, DoxygenEntityList &doxyList);