Whitespace corrects.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10840 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Jamie Kirkpatrick 2008-09-12 11:19:07 +00:00
commit eb38ea3a43
3 changed files with 659 additions and 638 deletions

View file

@ -10,27 +10,6 @@
#include "DoxygenEntity.h" #include "DoxygenEntity.h"
#include <iostream> #include <iostream>
/*
* Basic node for commands that have nothing after them (eg: \n)
*/
std::string DoxygenEntity::commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attention",
"author", "b", "brief", "bug", "c", "callgraph", "callergraph", "category",
"class", "code", "cond", "copybrief", "copydetails", "copydoc", "date", "def",
"defgroup", "deprecated", "details", "dir", "dontinclude", "dot", "dotfile", "e",
"else", "elseif", "em", "endcode", "endcond", "enddot", "endhtmlonly", "endif",
"std::endlatexonly", "std::endlink", "endmanonly", "endmsc", "endverbatim", "endxmlonly",
"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",
"note", "overload", "p", "package", "page", "par", "paragraph", "param", "post", "pre",
"private", "privatesection", "property", "protected", "protectedsection", "protocol",
"public", "publicsection", "ref", "relates", "relatesalso", "remarks", "return", "retval",
"sa", "section", "see", "showinitializer", "since", "skip", "skipline", "struct", "subpage",
"subsection", "subsubsection", "test", "throw", "todo", "tparam", "typedef", "union", "until",
"var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem",
"$", "@", std::string(1, 92), "&", "~", "<", ">", "#", "%"};
DoxygenEntity::DoxygenEntity(std::string typeEnt){ DoxygenEntity::DoxygenEntity(std::string typeEnt){
typeOfEntity = typeEnt; typeOfEntity = typeEnt;
data = ""; data = "";

View file

@ -25,7 +25,6 @@ struct DoxygenEntity{
std::list <DoxygenEntity> entityList; std::list <DoxygenEntity> entityList;
std::string data; std::string data;
int isLeaf; int isLeaf;
static std::string commandArray[];
}; };
/* /*

View file

@ -83,7 +83,7 @@ std::string commandErrorThrowings[] = {"annotatedclassstd::list", "classhierarch
"endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond",
"endif"}; "endif"};
std::string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", std::string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref",
"subpage", "dotfile", "image", "addtogroup", "li"}; "subpage", "dotfile", "image", "addtogroup", "li"};
/* Changes a std::string to all lower case */ /* Changes a std::string to all lower case */
@ -100,7 +100,7 @@ std::string StringToLower(std::string stringToConvert){
int findCommand(std::string smallString){ int findCommand(std::string smallString){
smallString = StringToLower(smallString); smallString = StringToLower(smallString);
int a; int a;
for (int i = 0; i < sizeof(commandArray)/sizeof(*commandArray); i++){ for (unsigned i = 0; i < sizeof(commandArray)/sizeof(*commandArray); i++){
if( (a = smallString.compare(commandArray[i])) == 0){ if( (a = smallString.compare(commandArray[i])) == 0){
return 101 + i; return 101 + i;
} }
@ -114,7 +114,7 @@ int findCommand(std::string smallString){
*/ */
int isSectionIndicator(std::string smallString){ int isSectionIndicator(std::string smallString){
smallString = StringToLower(smallString); smallString = StringToLower(smallString);
for (int i = 0; i < sizeof( sectionIndicators)/sizeof(* sectionIndicators); i++){ for (unsigned i = 0; i < sizeof( sectionIndicators)/sizeof(* sectionIndicators); i++){
if( smallString.compare( sectionIndicators[i]) == 0){ if( smallString.compare( sectionIndicators[i]) == 0){
return 1; return 1;
} }
@ -129,7 +129,7 @@ void printTree( std::list <DoxygenEntity> &rootList){
(*p).printEntity(0); (*p).printEntity(0);
p++; p++;
} }
} }
/* Determines how a command should be handled (what group it belongs to /* Determines how a command should be handled (what group it belongs to
* for parsing rules * for parsing rules
@ -137,51 +137,66 @@ void printTree( std::list <DoxygenEntity> &rootList){
int commandBelongs(std::string theCommand){ int commandBelongs(std::string theCommand){
std::string smallString = StringToLower(theCommand); std::string smallString = StringToLower(theCommand);
//cout << " Looking for command " << theCommand << endl; //cout << " Looking for command " << theCommand << endl;
int i = 0; unsigned i = 0;
for ( i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){ for (i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){
if(smallString.compare(simpleCommands[i]) == 0){return SIMPLECOMMAND;} if(smallString.compare(simpleCommands[i]) == 0)
return SIMPLECOMMAND;
} }
for ( i = 0; i < sizeof(ignoredSimpleCommands)/sizeof(*ignoredSimpleCommands); i++){ for (i = 0; i < sizeof(ignoredSimpleCommands)/sizeof(*ignoredSimpleCommands); i++){
if(smallString.compare(ignoredSimpleCommands[i]) == 0){return IGNOREDSIMPLECOMMAND;} if(smallString.compare(ignoredSimpleCommands[i]) == 0)
return IGNOREDSIMPLECOMMAND;
} }
for ( i = 0; i < sizeof(commandWords)/sizeof(*commandWords); i++){ for (i = 0; i < sizeof(commandWords)/sizeof(*commandWords); i++){
if(smallString.compare( commandWords[i]) == 0){return COMMANDWORD;} if(smallString.compare( commandWords[i]) == 0)
return COMMANDWORD;
} }
for ( i = 0; i < sizeof(ignoredCommandWords)/sizeof(*ignoredCommandWords); i++){ for (i = 0; i < sizeof(ignoredCommandWords)/sizeof(*ignoredCommandWords); i++){
if(smallString.compare( ignoredCommandWords[i]) == 0){return IGNOREDCOMMANDWORD;} if(smallString.compare( ignoredCommandWords[i]) == 0)
return IGNOREDCOMMANDWORD;
} }
for ( i = 0; i < sizeof(commandLines)/sizeof(*commandLines); i++){ for (i = 0; i < sizeof(commandLines)/sizeof(*commandLines); i++){
if(smallString.compare( commandLines[i]) == 0){return COMMANDLINE;} if(smallString.compare( commandLines[i]) == 0)
return COMMANDLINE;
} }
for ( i = 0; i < sizeof(ignoreCommandLines)/sizeof(*ignoreCommandLines); i++){ for (i = 0; i < sizeof(ignoreCommandLines)/sizeof(*ignoreCommandLines); i++){
if(smallString.compare( ignoreCommandLines[i]) == 0){return IGNOREDCOMMANDLINE;} if(smallString.compare( ignoreCommandLines[i]) == 0)
return IGNOREDCOMMANDLINE;
} }
for ( i = 0; i < sizeof(commandParagraph)/sizeof(*commandParagraph); i++){ for (i = 0; i < sizeof(commandParagraph)/sizeof(*commandParagraph); i++){
if(smallString.compare( commandParagraph[i]) == 0){return COMMANDPARAGRAPH;} if(smallString.compare( commandParagraph[i]) == 0)
return COMMANDPARAGRAPH;
} }
for ( i = 0; i < sizeof(ignoreCommandParagraphs)/sizeof(*ignoreCommandParagraphs); i++){ for (i = 0; i < sizeof(ignoreCommandParagraphs)/sizeof(*ignoreCommandParagraphs); i++){
if(smallString.compare( ignoreCommandParagraphs[i]) == 0){return IGNORECOMMANDPARAGRAPH;} if(smallString.compare( ignoreCommandParagraphs[i]) == 0)
return IGNORECOMMANDPARAGRAPH;
} }
for ( i = 0; i < sizeof(commandEndCommands)/sizeof(*commandEndCommands); i++){ for (i = 0; i < sizeof(commandEndCommands)/sizeof(*commandEndCommands); i++){
if(smallString.compare( commandEndCommands[i]) == 0){return COMMANDENDCOMMAND ;} if(smallString.compare( commandEndCommands[i]) == 0)
return COMMANDENDCOMMAND;
} }
for ( i = 0; i < sizeof(commandWordParagraphs)/sizeof(*commandWordParagraphs); i++){ for (i = 0; i < sizeof(commandWordParagraphs)/sizeof(*commandWordParagraphs); i++){
if(smallString.compare( commandWordParagraphs[i]) == 0){return COMMANDWORDPARAGRAPH;} if(smallString.compare( commandWordParagraphs[i]) == 0)
return COMMANDWORDPARAGRAPH;
} }
for ( i = 0; i < sizeof(commandWordLines)/sizeof(*commandWordLines); i++){ for (i = 0; i < sizeof(commandWordLines)/sizeof(*commandWordLines); i++){
if(smallString.compare( commandWordLines[i]) == 0){return COMMANDWORDLINE ;} if(smallString.compare( commandWordLines[i]) == 0)
return COMMANDWORDLINE;
} }
for ( i = 0; i < sizeof(commandWordOWordOWords)/sizeof(*commandWordOWordOWords); i++){ for (i = 0; i < sizeof(commandWordOWordOWords)/sizeof(*commandWordOWordOWords); i++){
if(smallString.compare( commandWordOWordOWords[i]) == 0){return COMMANDWORDOWORDWORD;} if(smallString.compare( commandWordOWordOWords[i]) == 0)
return COMMANDWORDOWORDWORD;
} }
for ( i = 0; i < sizeof(commandOWords)/sizeof(*commandOWords); i++){ for (i = 0; i < sizeof(commandOWords)/sizeof(*commandOWords); i++){
if(smallString.compare( commandOWords[i]) == 0){return COMMANDOWORD;} if(smallString.compare( commandOWords[i]) == 0)
return COMMANDOWORD;
} }
for ( i = 0; i < sizeof(commandErrorThrowings)/sizeof(*commandErrorThrowings); i++){ for (i = 0; i < sizeof(commandErrorThrowings)/sizeof(*commandErrorThrowings); i++){
if(smallString.compare( commandErrorThrowings[i]) == 0){return COMMANDERRORTHROW;} if(smallString.compare( commandErrorThrowings[i]) == 0)
return COMMANDERRORTHROW;
} }
for ( i = 0; i < sizeof(commandUniques)/sizeof(*commandUniques); i++){ for (i = 0; i < sizeof(commandUniques)/sizeof(*commandUniques); i++){
if(smallString.compare( commandUniques[i]) == 0){return COMMANDUNIQUE;} if(smallString.compare( commandUniques[i]) == 0)
return COMMANDUNIQUE;
} }
return 0; return 0;
} }
@ -323,9 +338,10 @@ std::list<Token>::iterator getEndCommand(std::string theCommand, TokenList &tokL
*/ */
//TODO getTilAnyCommand //TODO getTilAnyCommand
std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &tokList){ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &tokList){
#pragma unused(theCommand,tokList)
std::list<Token>::iterator anIterator; std::list<Token>::iterator anIterator;
return anIterator; return anIterator;
} }
@ -335,127 +351,138 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
* Plain commands, such as newline etc, they contain no other data * Plain commands, such as newline etc, they contain no other data
* \n \\ \@ \& \$ \# \< \> \% * \n \\ \@ \& \$ \# \< \> \%
*/ */
int addSimpleCommand(std::string theCommand, std::list <DoxygenEntity> &doxyList){ int addSimpleCommand(std::string theCommand, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy) cout << "Parsing " << theCommand << endl;
doxyList.push_back(DoxygenEntity(theCommand)); doxyList.push_back(DoxygenEntity(theCommand));
return 1; return 1;
} }
/* NOT INCLUDED Simple Commands /* NOT INCLUDED Simple Commands
* Format: @command * Format: @command
* Plain commands, such as newline etc, they contain no other data * Plain commands, such as newline etc, they contain no other data
*/ */
int ignoreSimpleCommand(std::string theCommand, std::list <DoxygenEntity> &doxyList){ int ignoreSimpleCommand(std::string theCommand, std::list <DoxygenEntity> &doxyList){
#pragma unused(doxyList)
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy) cout << "Not Adding " << theCommand << endl;
return 1; return 1;
} }
/* CommandWord /* CommandWord
* Format: @command <word> * Format: @command <word>
* Commands with a single WORD after then such as @b * Commands with a single WORD after then such as @b
* "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", * "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package",
* "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"
*/ */
int addCommandWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int addCommandWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy) cout << "Parsing " << theCommand << endl;
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
if (!name.empty()){ if (!name.empty()){
doxyList.push_back(DoxygenEntity(theCommand, name)); doxyList.push_back(DoxygenEntity(theCommand, name));
return 1; return 1;
} }
else cout << "No word followed " << theCommand << " command. Not added" << endl; else
cout << "No word followed " << theCommand << " command. Not added" << endl;
return 0; return 0;
} }
/* NOT INCLUDED CommandWord /* NOT INCLUDED CommandWord
* Format: @command <word> * Format: @command <word>
* Commands with a single WORD after then such as @b * Commands with a single WORD after then such as @b
* "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"
*/ */
int ignoreCommandWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int ignoreCommandWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Not Adding " << theCommand << endl; #pragma unused(doxyList)
if (noisy)
cout << "Not Adding " << theCommand << endl;
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
if (!name.empty()){ if (!name.empty())
return 1; return 1;
} else
else cout << "WARNING: No word followed " << theCommand << " command." << endl; cout << "WARNING: No word followed " << theCommand << " command." << endl;
return 0; return 0;
} }
/* CommandLine /* CommandLine
* Format: @command (line) * Format: @command (line)
* Commands with a single LINE after then such as @var * Commands with a single LINE after then such as @var
* "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"
*/ */
int addCommandLine(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int addCommandLine(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
std::list<Token>::iterator endOfLine = getOneLine(tokList); std::list<Token>::iterator endOfLine = getOneLine(tokList);
std::list <DoxygenEntity> aNewList; std::list <DoxygenEntity> aNewList = parse(endOfLine, tokList);
aNewList = parse(endOfLine, tokList);
doxyList.push_back( DoxygenEntity(theCommand, aNewList)); doxyList.push_back( DoxygenEntity(theCommand, aNewList));
return 1; return 1;
} }
/* NOT INCLUDED CommandLine /* NOT INCLUDED CommandLine
* Format: @command (line) * Format: @command (line)
* Commands with a single LINE after then such as @var * Commands with a single LINE after then such as @var
* *
*/ */
int ignoreCommandLine(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int ignoreCommandLine(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Not Adding " << theCommand << endl; #pragma unused(doxyList)
if (noisy)
cout << "Not Adding " << theCommand << endl;
std::list<Token>::iterator endOfLine = getOneLine(tokList); std::list<Token>::iterator endOfLine = getOneLine(tokList);
tokList.setIterator(endOfLine); tokList.setIterator(endOfLine);
return 1; return 1;
} }
/* CommandParagraph /* CommandParagraph
* Format: @command {paragraph} * Format: @command {paragraph}
* Commands with a single paragraph after then such as @return * Commands with a single paragraph after then such as @return
* "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", * "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant",
* "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author"
*/ */
int addCommandParagraph(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int addCommandParagraph(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList); std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
std::list <DoxygenEntity> aNewList; std::list <DoxygenEntity> aNewList;
aNewList = parse(endOfParagraph, tokList); aNewList = parse(endOfParagraph, tokList);
doxyList.push_back( DoxygenEntity(theCommand, aNewList)); doxyList.push_back( DoxygenEntity(theCommand, aNewList));
return 1; return 1;
} }
/* CommandParagraph /* CommandParagraph
* Format: @command {paragraph} * Format: @command {paragraph}
* Commands with a single LINE after then such as @var * Commands with a single LINE after then such as @var
* *
*/ */
int ignoreCommandParagraph(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int ignoreCommandParagraph(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Not Adding " << theCommand << endl; #pragma unused(doxyList)
if (noisy)
cout << "Not Adding " << theCommand << endl;
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList); std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
tokList.setIterator(endOfParagraph); tokList.setIterator(endOfParagraph);
return 1; return 1;
} }
/* Command EndCommand /* Command EndCommand
* Format: @command and ends at @endcommand * Format: @command and ends at @endcommand
* Commands that take in a block of text such as @code * Commands that take in a block of text such as @code
* "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", * "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly",
* "verbatim", "xmlonly", "cond", "if", "ifnot", "link" * "verbatim", "xmlonly", "cond", "if", "ifnot", "link"
* Returns 1 if success, 0 if the endcommand is never encountered. * Returns 1 if success, 0 if the endcommand is never encountered.
*/ */
int addCommandEndCommand(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int addCommandEndCommand(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy)
cout << "Not Adding " << theCommand << endl;
std::string description = getStringTilEndCommand( "end" + theCommand, tokList); std::string description = getStringTilEndCommand( "end" + theCommand, tokList);
doxyList.push_back(DoxygenEntity(theCommand, description)); doxyList.push_back(DoxygenEntity(theCommand, description));
return 1; return 1;
} }
/* CommandWordParagraph /* CommandWordParagraph
* Format: @command <word> {paragraph} * Format: @command <word> {paragraph}
* Commands such as param * Commands such as param
* "param", "tparam", "throw", "retval", "exception" * "param", "tparam", "throw", "retval", "exception"
*/ */
int addCommandWordParagraph(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int addCommandWordParagraph(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
if (name.empty()){ if (name.empty()){
cout << "No word followed " << theCommand << " command. Not added" << endl; cout << "No word followed " << theCommand << " command. Not added" << endl;
@ -467,14 +494,14 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
aNewList.push_front(DoxygenEntity("plainstd::string", name)); aNewList.push_front(DoxygenEntity("plainstd::string", name));
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
return 1; return 1;
} }
/* CommandWordLine /* CommandWordLine
* Format: @command <word> (line) * Format: @command <word> (line)
* Commands such as param * Commands such as param
* "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup"
*/ */
int addCommandWordLine(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int addCommandWordLine(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy) cout << "Parsing " << theCommand << endl;
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
if (name.empty()){ if (name.empty()){
@ -487,17 +514,17 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
aNewList.push_front(DoxygenEntity("plainstd::string", name)); aNewList.push_front(DoxygenEntity("plainstd::string", name));
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
return 1; return 1;
//else cout << "No line followed " << theCommand << " command. Not added" << endl; //else cout << "No line followed " << theCommand << " command. Not added" << endl;
} }
/* Command Word Optional Word Optional Word /* Command Word Optional Word Optional Word
* Format: @command <word> [<header-file>] [<header-name>] * Format: @command <word> [<header-file>] [<header-name>]
* Commands such as class * Commands such as class
* "category", "class", "protocol", "interface", "struct", "union" * "category", "class", "protocol", "interface", "struct", "union"
*/ */
int addCommandWordOWordOWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int addCommandWordOWordOWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
if (name.empty()){ if (name.empty()){
cout << "No word followed " << theCommand << " command. Not added" << endl; cout << "No word followed " << theCommand << " command. Not added" << endl;
@ -507,28 +534,32 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
std::string headername = getNextWord(tokList); std::string headername = getNextWord(tokList);
std::list <DoxygenEntity> aNewList; std::list <DoxygenEntity> aNewList;
aNewList.push_back(DoxygenEntity("plainstd::string", name)); aNewList.push_back(DoxygenEntity("plainstd::string", name));
if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headerfile)); if (!headerfile.empty())
if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headername)); aNewList.push_back(DoxygenEntity("plainstd::string", headerfile));
if (!headername.empty())
aNewList.push_back(DoxygenEntity("plainstd::string", headername));
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
return 1; return 1;
} }
/* Command Optional Word /* Command Optional Word
* Format: @command [<word>] * Format: @command [<word>]
* Commands such as dir * Commands such as dir
* "dir", "file", "cond" * "dir", "file", "cond"
*/ */
int addCommandOWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int addCommandOWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
doxyList.push_back(DoxygenEntity(theCommand, name)); doxyList.push_back(DoxygenEntity(theCommand, name));
return 1; return 1;
} }
/* Commands that should not be encountered (such as PHP only) /* Commands that should not be encountered (such as PHP only)
* goes til the end of line then returns * goes til the end of line then returns
*/ */
int addCommandErrorThrow(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int addCommandErrorThrow(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
#pragma unused(doxyList)
cout << "Encountered :" << theCommand << endl; cout << "Encountered :" << theCommand << endl;
cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl; cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl;
std::list<Token>::iterator endOfLine = getOneLine(tokList); std::list<Token>::iterator endOfLine = getOneLine(tokList);
@ -537,7 +568,7 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
} }
/* Adds the unique commands- different process for each unique command */ /* Adds the unique commands- different process for each unique command */
int addCommandUnique(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){ int addCommandUnique(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
std::list <DoxygenEntity> aNewList; std::list <DoxygenEntity> aNewList;
if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0){ if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0){
std::list<Token>::iterator endOfSection = getEndOfSection(theCommand, tokList); std::list<Token>::iterator endOfSection = getEndOfSection(theCommand, tokList);
@ -548,7 +579,8 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
// \xrefitem <key> "(heading)" "(std::list title)" {text} // \xrefitem <key> "(heading)" "(std::list title)" {text}
else if (theCommand.compare("xrefitem") == 0){ else if (theCommand.compare("xrefitem") == 0){
//TODO Implement xrefitem //TODO Implement xrefitem
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy)
cout << "Not Adding " << theCommand << endl;
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList); std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
tokList.setIterator(endOfParagraph); tokList.setIterator(endOfParagraph);
return 1; return 1;
@ -558,9 +590,11 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
aNewList.push_back(DoxygenEntity("plainstd::string", name)); aNewList.push_back(DoxygenEntity("plainstd::string", name));
name = getNextWord(tokList); name = getNextWord(tokList);
if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); if(!name.empty())
aNewList.push_back(DoxygenEntity("plainstd::string", name));
name = getNextWord(tokList); name = getNextWord(tokList);
if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); if(!name.empty())
aNewList.push_back(DoxygenEntity("plainstd::string", name));
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
return 1; return 1;
} }
@ -580,7 +614,8 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
aNewList.push_back(DoxygenEntity("plainstd::string", name)); aNewList.push_back(DoxygenEntity("plainstd::string", name));
name = getNextWord(tokList); name = getNextWord(tokList);
if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name)); if(!name.empty())
aNewList.push_back(DoxygenEntity("plainstd::string", name));
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
return 1; return 1;
} }
@ -592,7 +627,8 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
aNewList = parse(endOfLine, tokList); aNewList = parse(endOfLine, tokList);
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
} }
else doxyList.push_back(DoxygenEntity(theCommand)); else
doxyList.push_back(DoxygenEntity(theCommand));
return 1; return 1;
} }
// \weakgroup <name> [(title)] // \weakgroup <name> [(title)]
@ -614,21 +650,24 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
// \ref <name> ["(text)"] // \ref <name> ["(text)"]
else if (theCommand.compare("ref") == 0){ else if (theCommand.compare("ref") == 0){
//TODO Implement ref //TODO Implement ref
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy)
cout << "Not Adding " << theCommand << endl;
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList); std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
tokList.setIterator(endOfParagraph); tokList.setIterator(endOfParagraph);
} }
// \subpage <name> ["(text)"] // \subpage <name> ["(text)"]
else if (theCommand.compare("subpage") == 0){ else if (theCommand.compare("subpage") == 0){
//TODO implement subpage //TODO implement subpage
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy)
cout << "Not Adding " << theCommand << endl;
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList); std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
tokList.setIterator(endOfParagraph); tokList.setIterator(endOfParagraph);
} }
// \dotfile <file> ["caption"] // \dotfile <file> ["caption"]
else if (theCommand.compare("dotfile") == 0){ else if (theCommand.compare("dotfile") == 0){
//TODO implement dotfile //TODO implement dotfile
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy)
cout << "Not Adding " << theCommand << endl;
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList); std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
tokList.setIterator(endOfParagraph); tokList.setIterator(endOfParagraph);
} }
@ -638,7 +677,8 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
} }
// \addtogroup <name> [(title)] // \addtogroup <name> [(title)]
else if (theCommand.compare("addtogroup") == 0){ else if (theCommand.compare("addtogroup") == 0){
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
if (name.empty()){ if (name.empty()){
cout << "No word followed " << theCommand << " command. Not added" << endl; cout << "No word followed " << theCommand << " command. Not added" << endl;
@ -653,7 +693,7 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
} }
return 0; return 0;
} }
/* The actual "meat" of the doxygen parser. This is not yet fully implemented /* The actual "meat" of the doxygen parser. This is not yet fully implemented
* with my current design- however the skeletal outline is contained in * with my current design- however the skeletal outline is contained in
@ -724,17 +764,19 @@ std::list<DoxygenEntity> parse(std::list<Token>::iterator endParsingIndex, Token
int currCommand; int currCommand;
while (tokList.current() != endParsingIndex){ while (tokList.current() != endParsingIndex){
Token currToken = tokList.peek(); Token currToken = tokList.peek();
if(noisy) cout << "Parsing for phrase starting in:" << currToken.toString() << endl; if(noisy)
cout << "Parsing for phrase starting in:" << currToken.toString() << endl;
if(currToken.tokenType == END_LINE ){ if(currToken.tokenType == END_LINE ){
tokList.next(); tokList.next();
} }
else if(currToken.tokenType == COMMAND){ else if(currToken.tokenType == COMMAND){
currCommand = findCommand(currToken.tokenString); currCommand = findCommand(currToken.tokenString);
if (currCommand < 0 ){ if (currCommand < 0 ){
if(noisy) cout << "Unidentified Command " << currToken.tokenString << endl; if(noisy)
cout << "Unidentified Command " << currToken.tokenString << endl;
tokList.next(); tokList.next();
addCommand(std::string("plainstd::string"), tokList, aNewList);} addCommand(std::string("plainstd::string"), tokList, aNewList);
//cout << "Command: " << currWord << " " << currCommand << endl; }
else { tokList.next(); else { tokList.next();
addCommand(currToken.tokenString, tokList, aNewList); addCommand(currToken.tokenString, tokList, aNewList);
} }
@ -742,10 +784,10 @@ std::list<DoxygenEntity> parse(std::list<Token>::iterator endParsingIndex, Token
else if (currToken.tokenType == PLAINSTRING){ else if (currToken.tokenType == PLAINSTRING){
addCommand(std::string("plainstd::string"), tokList, aNewList); addCommand(std::string("plainstd::string"), tokList, aNewList);
} }
else break; break;
} }
return aNewList; return aNewList;
} }
std::list<DoxygenEntity> parseRoot(std::list<Token>::iterator endParsingIndex, TokenList &tokList){ std::list<DoxygenEntity> parseRoot(std::list<Token>::iterator endParsingIndex, TokenList &tokList){
std::list <DoxygenEntity> aNewList; std::list <DoxygenEntity> aNewList;
@ -759,7 +801,8 @@ std::list<DoxygenEntity> parseRoot(std::list<Token>::iterator endParsingIndex, T
else if(currToken.tokenType == COMMAND){ else if(currToken.tokenType == COMMAND){
currCommand = findCommand(currToken.tokenString); currCommand = findCommand(currToken.tokenString);
if (currCommand < 0 ){ if (currCommand < 0 ){
if(noisy) cout << "Unidentified Command " << currToken.tokenString << endl; if(noisy)
cout << "Unidentified Command " << currToken.tokenString << endl;
tokList.next(); tokList.next();
addCommand(std::string("partofdescription"), tokList, aNewList);} addCommand(std::string("partofdescription"), tokList, aNewList);}
//cout << "Command: " << currWord << " " << currCommand << endl; //cout << "Command: " << currWord << " " << currCommand << endl;
@ -772,7 +815,7 @@ std::list<DoxygenEntity> parseRoot(std::list<Token>::iterator endParsingIndex, T
} }
} }
return aNewList; return aNewList;
} }
std::list<DoxygenEntity> DoxygenParser::createTree(std::string doxygenBlob){ std::list<DoxygenEntity> DoxygenParser::createTree(std::string doxygenBlob){
TokenList tokList = TokenList(doxygenBlob); TokenList tokList = TokenList(doxygenBlob);