refactored DoxygenParser: class Token is now nested in Doxygen parser because it is only used there, class TokenList has been removed - it more or less duplicated std::list, other code moved to DoxygenParser
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13722 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
549b2046b1
commit
ed6df45c0a
8 changed files with 521 additions and 214 deletions
21
.project
21
.project
|
|
@ -5,7 +5,28 @@
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.autotools.core.genmakebuilderV2</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||||
|
<triggers>full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.autotools.core.autotoolsNatureV2</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ DoxygenEntity::DoxygenEntity(std::string typeEnt, std::list < DoxygenEntity > &e
|
||||||
entityList = entList;
|
entityList = entList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoxygenEntity::printEntity(int level) {
|
void DoxygenEntity::printEntity(int level) const {
|
||||||
int thisLevel = level;
|
int thisLevel = level;
|
||||||
if (isLeaf) {
|
if (isLeaf) {
|
||||||
for (int i = 0; i < thisLevel; i++) {
|
for (int i = 0; i < thisLevel; i++) {
|
||||||
|
|
@ -63,7 +63,7 @@ void DoxygenEntity::printEntity(int level) {
|
||||||
|
|
||||||
std::cout << "Node Command : " << typeOfEntity << std::endl;
|
std::cout << "Node Command : " << typeOfEntity << std::endl;
|
||||||
|
|
||||||
std::list < DoxygenEntity >::iterator p = entityList.begin();
|
std::list < DoxygenEntity >::const_iterator p = entityList.begin();
|
||||||
thisLevel++;
|
thisLevel++;
|
||||||
|
|
||||||
while (p != entityList.end()) {
|
while (p != entityList.end()) {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ struct DoxygenEntity {
|
||||||
DoxygenEntity(std::string typeEnt, std::string param1);
|
DoxygenEntity(std::string typeEnt, std::string param1);
|
||||||
DoxygenEntity(std::string typeEnt, std::list < DoxygenEntity > &entList);
|
DoxygenEntity(std::string typeEnt, std::list < DoxygenEntity > &entList);
|
||||||
|
|
||||||
void printEntity(int level);
|
void printEntity(int level) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,22 @@
|
||||||
|
|
||||||
#include "DoxygenParser.h"
|
#include "DoxygenParser.h"
|
||||||
#include "DoxygenCommands.h"
|
#include "DoxygenCommands.h"
|
||||||
|
#include "swig.h"
|
||||||
|
#include "swigwarn.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using std::cout;
|
||||||
|
using std::endl;
|
||||||
|
|
||||||
// Define static class members
|
// Define static class members
|
||||||
std::map<std::string, DoxyCommandEnum> DoxygenParser::doxygenCommands;
|
std::map<std::string, DoxyCommandEnum> DoxygenParser::doxygenCommands;
|
||||||
std::set<std::string> DoxygenParser::doxygenSectionIndicators;
|
std::set<std::string> DoxygenParser::doxygenSectionIndicators;
|
||||||
|
|
||||||
|
const int TOKENSPERLINE = 8; //change this to change the printing behaviour of the token list
|
||||||
|
|
||||||
|
|
||||||
DoxygenParser::DoxygenParser(bool noisy) : noisy(noisy) {
|
DoxygenParser::DoxygenParser(bool noisy) : noisy(noisy) {
|
||||||
fillTables();
|
fillTables();
|
||||||
|
|
@ -58,42 +69,48 @@ void DoxygenParser::fillTables() {
|
||||||
doxygenSectionIndicators.insert(sectionIndicators[i]);
|
doxygenSectionIndicators.insert(sectionIndicators[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DoxygenParser::stringToLower(std::string &stringToConvert) {
|
|
||||||
for (unsigned int i = 0; i < stringToConvert.length(); i++) {
|
std::string DoxygenParser::stringToLower(const std::string &stringToConvert) {
|
||||||
stringToConvert[i] = tolower(stringToConvert[i]);
|
|
||||||
|
string result(stringToConvert.size(), ' ');
|
||||||
|
|
||||||
|
for (size_t i = 0; i < result.size(); i++) {
|
||||||
|
result[i] = tolower(stringToConvert[i]);
|
||||||
}
|
}
|
||||||
return stringToConvert; //return the converted std::string
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::findCommand(std::string smallString) {
|
|
||||||
std::map<std::string, DoxyCommandEnum>::iterator it;
|
bool DoxygenParser::findCommand(const std::string &smallString) {
|
||||||
smallString = stringToLower(smallString);
|
// I'm not sure if we can really do so, because there are different commands
|
||||||
// I'm not sure if we can really do so, because there are different commands
|
// in doxygenCommands and original commandArray
|
||||||
// in doxygenCommands and original commandArray
|
|
||||||
it = doxygenCommands.find(smallString);
|
std::map<std::string, DoxyCommandEnum>::iterator it =
|
||||||
if (it != doxygenCommands.end())
|
doxygenCommands.find(stringToLower(smallString));
|
||||||
return 1;
|
|
||||||
return -1;
|
return it != doxygenCommands.end(); // returns true if command was found
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::isSectionIndicator(std::string smallString) {
|
|
||||||
smallString = stringToLower(smallString);
|
bool DoxygenParser::isSectionIndicator(const std::string &smallString) {
|
||||||
std::set<std::string>::iterator it;
|
|
||||||
it = doxygenSectionIndicators.find(smallString);
|
std::set<std::string>::iterator it =
|
||||||
if (it != doxygenSectionIndicators.end())
|
doxygenSectionIndicators.find(stringToLower(smallString));
|
||||||
return 1;
|
|
||||||
return 0;
|
return it != doxygenSectionIndicators.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoxygenParser::printTree(std::list < DoxygenEntity > &rootList) {
|
|
||||||
std::list < DoxygenEntity >::iterator p = rootList.begin();
|
void DoxygenParser::printTree(const std::list <DoxygenEntity> &rootList) {
|
||||||
|
std::list < DoxygenEntity >::const_iterator p = rootList.begin();
|
||||||
while (p != rootList.end()) {
|
while (p != rootList.end()) {
|
||||||
(*p).printEntity(0);
|
(*p).printEntity(0);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::commandBelongs(std::string theCommand) {
|
int DoxygenParser::commandBelongs(const 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;
|
||||||
std::map<std::string, DoxyCommandEnum>::iterator it;
|
std::map<std::string, DoxyCommandEnum>::iterator it;
|
||||||
|
|
@ -103,100 +120,123 @@ int DoxygenParser::commandBelongs(std::string theCommand) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DoxygenParser::getNextWord(TokenList & tokList) {
|
std::string DoxygenParser::getNextWord(const TokenList &tokList) {
|
||||||
Token nextToken = tokList.peek();
|
// MK Token nextToken = tokList.peek();
|
||||||
if (nextToken.tokenType == PLAINSTRING) {
|
if (m_tokenListIt == m_tokenList.end()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
Token nextToken = *m_tokenListIt;
|
||||||
|
if (nextToken.m_tokenType == PLAINSTRING) {
|
||||||
// handle quoted strings as words
|
// handle quoted strings as words
|
||||||
if (nextToken.tokenString[0] == '"'
|
if (nextToken.m_tokenString[0] == '"'
|
||||||
&& nextToken.tokenString[nextToken.tokenString.size() - 1] != '"') {
|
&& nextToken.m_tokenString[nextToken.m_tokenString.size() - 1] != '"') {
|
||||||
string word = nextToken.tokenString + " ";
|
|
||||||
nextToken = tokList.next();
|
string word = nextToken.m_tokenString + " ";
|
||||||
|
nextToken = *m_tokenListIt++;
|
||||||
while (true) {
|
while (true) {
|
||||||
string nextWord = getNextWord(tokList);
|
string nextWord = getNextWord(tokList);
|
||||||
if (!nextWord.size()) // maybe report unterminated string error
|
if (!nextWord.size()) {// maybe report unterminated string error
|
||||||
return word;
|
return word;
|
||||||
|
}
|
||||||
word += nextWord;
|
word += nextWord;
|
||||||
if (word[word.size() - 1] == '"') // strip quotes
|
if (word[word.size() - 1] == '"') { // strip quotes
|
||||||
return word.substr(1, word.size() - 2);
|
return word.substr(1, word.size() - 2);
|
||||||
|
}
|
||||||
word += " ";
|
word += " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tokList.next();
|
m_tokenListIt++;
|
||||||
return nextToken.tokenString;
|
return nextToken.m_tokenString;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list < Token >::iterator DoxygenParser::getOneLine(TokenList & tokList) {
|
|
||||||
std::list < Token >::iterator endOfLine = tokList.iteratorCopy();
|
DoxygenParser::TokenListCIt DoxygenParser::getOneLine(const TokenList &tokList) {
|
||||||
while (endOfLine != tokList.end()) {
|
|
||||||
if ((*endOfLine).tokenType == END_LINE) {
|
TokenListCIt endOfLineIt = m_tokenListIt;
|
||||||
//cout << "REACHED END" << endl;
|
|
||||||
//endOfLine++;
|
while (endOfLineIt != tokList.end()) {
|
||||||
return endOfLine;
|
if (endOfLineIt->m_tokenType == END_LINE) {
|
||||||
|
return endOfLineIt;
|
||||||
}
|
}
|
||||||
endOfLine++;
|
endOfLineIt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tokList.end();
|
return tokList.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DoxygenParser::getStringTilCommand(TokenList & tokList) {
|
|
||||||
std::string description;
|
std::string DoxygenParser::getStringTilCommand(const TokenList & tokList) {
|
||||||
if (tokList.peek().tokenType == 0)
|
|
||||||
|
if (m_tokenListIt == tokList.end()) {
|
||||||
return "";
|
return "";
|
||||||
while (tokList.peek().tokenType == PLAINSTRING) {
|
}
|
||||||
Token currentToken = tokList.next();
|
|
||||||
if (currentToken.tokenType == PLAINSTRING) {
|
string description;
|
||||||
description = description + currentToken.tokenString + " ";
|
|
||||||
|
while (m_tokenListIt->m_tokenType == PLAINSTRING) {
|
||||||
|
const Token ¤tToken = *m_tokenListIt++;
|
||||||
|
if (currentToken.m_tokenType == PLAINSTRING) {
|
||||||
|
description = description + currentToken.m_tokenString + " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DoxygenParser::getStringTilEndCommand(std::string theCommand, TokenList & tokList) {
|
|
||||||
std::string description;
|
std::string DoxygenParser::getStringTilEndCommand(const std::string & theCommand, const TokenList & tokList) {
|
||||||
if (tokList.peek().tokenType == 0)
|
|
||||||
return "";
|
if (m_tokenListIt == tokList.end()) {
|
||||||
while (tokList.current() != tokList.end()) {
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
string description;
|
||||||
|
while (m_tokenListIt != tokList.end()) {
|
||||||
|
|
||||||
//TODO: it won't output doxygen commands, need a way to fix it
|
//TODO: it won't output doxygen commands, need a way to fix it
|
||||||
if (tokList.peek().tokenType == PLAINSTRING)
|
if (m_tokenListIt->m_tokenType == PLAINSTRING) {
|
||||||
description += tokList.peek().tokenString + " ";
|
description += m_tokenListIt->m_tokenString + " ";
|
||||||
if (tokList.peek().tokenType == END_LINE)
|
} else if (m_tokenListIt->m_tokenType == END_LINE) {
|
||||||
description += "\n";
|
description += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (tokList.peek().tokenString == theCommand) {
|
if (m_tokenListIt->m_tokenString == theCommand) {
|
||||||
tokList.next();
|
m_tokenListIt++;
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
tokList.next();
|
m_tokenListIt++;
|
||||||
}
|
}
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_EXPECTED, theCommand + " command expected");
|
|
||||||
|
printListError(WARN_DOXYGEN_COMMAND_EXPECTED, theCommand + " command expected");
|
||||||
|
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list < Token >::iterator DoxygenParser::getEndOfParagraph(TokenList & tokList) {
|
|
||||||
std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy();
|
DoxygenParser::TokenListCIt DoxygenParser::getEndOfParagraph(const TokenList & tokList) {
|
||||||
|
|
||||||
|
TokenListCIt endOfParagraph = m_tokenListIt;
|
||||||
|
|
||||||
while (endOfParagraph != tokList.end()) {
|
while (endOfParagraph != tokList.end()) {
|
||||||
if ((*endOfParagraph).tokenType == END_LINE) {
|
if ((*endOfParagraph).m_tokenType == END_LINE) {
|
||||||
endOfParagraph++;
|
endOfParagraph++;
|
||||||
if (endOfParagraph != tokList.end() && (*endOfParagraph).tokenType == END_LINE) {
|
if (endOfParagraph != tokList.end() && (*endOfParagraph).m_tokenType == END_LINE) {
|
||||||
endOfParagraph++;
|
endOfParagraph++;
|
||||||
//cout << "ENCOUNTERED END OF PARA" << endl;
|
//cout << "ENCOUNTERED END OF PARA" << endl;
|
||||||
return endOfParagraph;
|
return endOfParagraph;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((*endOfParagraph).tokenType == COMMAND) {
|
} else if ((*endOfParagraph).m_tokenType == COMMAND) {
|
||||||
|
|
||||||
if (isSectionIndicator((*endOfParagraph).tokenString)) {
|
if (isSectionIndicator((*endOfParagraph).m_tokenString)) {
|
||||||
return endOfParagraph;
|
return endOfParagraph;
|
||||||
} else
|
} else
|
||||||
endOfParagraph++;
|
endOfParagraph++;
|
||||||
|
|
||||||
} else if ((*endOfParagraph).tokenType == PLAINSTRING) {
|
} else if ((*endOfParagraph).m_tokenType == PLAINSTRING) {
|
||||||
endOfParagraph++;
|
endOfParagraph++;
|
||||||
} else {
|
} else {
|
||||||
return tokList.end();
|
return tokList.end();
|
||||||
|
|
@ -206,19 +246,23 @@ std::list < Token >::iterator DoxygenParser::getEndOfParagraph(TokenList & tokLi
|
||||||
return tokList.end();
|
return tokList.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list < Token >::iterator DoxygenParser::getEndOfSection(std::string theCommand, TokenList & tokList) {
|
|
||||||
std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy();
|
DoxygenParser::TokenListCIt DoxygenParser::getEndOfSection(const std::string & theCommand,
|
||||||
|
const TokenList & tokList) {
|
||||||
|
|
||||||
|
TokenListCIt endOfParagraph = m_tokenListIt;
|
||||||
|
|
||||||
while (endOfParagraph != tokList.end()) {
|
while (endOfParagraph != tokList.end()) {
|
||||||
if ((*endOfParagraph).tokenType == COMMAND) {
|
if ((*endOfParagraph).m_tokenType == COMMAND) {
|
||||||
if (theCommand == (*endOfParagraph).tokenString)
|
if (theCommand == (*endOfParagraph).m_tokenString)
|
||||||
return endOfParagraph;
|
return endOfParagraph;
|
||||||
else
|
else
|
||||||
endOfParagraph++;
|
endOfParagraph++;
|
||||||
} else if ((*endOfParagraph).tokenType == PLAINSTRING) {
|
} else if ((*endOfParagraph).m_tokenType == PLAINSTRING) {
|
||||||
endOfParagraph++;
|
endOfParagraph++;
|
||||||
} else if ((*endOfParagraph).tokenType == END_LINE) {
|
} else if ((*endOfParagraph).m_tokenType == END_LINE) {
|
||||||
endOfParagraph++;
|
endOfParagraph++;
|
||||||
if ((*endOfParagraph).tokenType == END_LINE) {
|
if ((*endOfParagraph).m_tokenType == END_LINE) {
|
||||||
endOfParagraph++;
|
endOfParagraph++;
|
||||||
return endOfParagraph;
|
return endOfParagraph;
|
||||||
}
|
}
|
||||||
|
|
@ -227,12 +271,16 @@ std::list < Token >::iterator DoxygenParser::getEndOfSection(std::string theComm
|
||||||
return tokList.end();
|
return tokList.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list < Token >::iterator DoxygenParser::getEndCommand(std::string theCommand, TokenList & tokList) {
|
|
||||||
std::list < Token >::iterator endOfCommand = tokList.iteratorCopy();
|
DoxygenParser::TokenListCIt DoxygenParser::getEndCommand(const std::string & theCommand,
|
||||||
|
const TokenList & tokList) {
|
||||||
|
|
||||||
|
TokenListCIt endOfCommand = m_tokenListIt;
|
||||||
|
|
||||||
while (endOfCommand != tokList.end()) {
|
while (endOfCommand != tokList.end()) {
|
||||||
endOfCommand++;
|
endOfCommand++;
|
||||||
if ((*endOfCommand).tokenType == COMMAND) {
|
if ((*endOfCommand).m_tokenType == COMMAND) {
|
||||||
if (theCommand == (*endOfCommand).tokenString) {
|
if (theCommand == (*endOfCommand).m_tokenString) {
|
||||||
return endOfCommand;
|
return endOfCommand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -241,75 +289,99 @@ std::list < Token >::iterator DoxygenParser::getEndCommand(std::string theComman
|
||||||
return tokList.end();
|
return tokList.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list < Token >::iterator DoxygenParser::getTilAnyCommand(std::string, TokenList &) {
|
/* DoxygenParser::TokenListIt DoxygenParser::getTilAnyCommand(const std::string &,
|
||||||
std::list < Token >::iterator anIterator;
|
TokenList &) {
|
||||||
|
TokenListIt anIterator;
|
||||||
return anIterator;
|
return anIterator;
|
||||||
}
|
} */
|
||||||
|
|
||||||
int DoxygenParser::addSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) {
|
|
||||||
|
int DoxygenParser::addSimpleCommand(const std::string &theCommand,
|
||||||
|
std::list < DoxygenEntity > &doxyList) {
|
||||||
if (noisy)
|
if (noisy)
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
|
|
||||||
doxyList.push_back(DoxygenEntity(theCommand));
|
doxyList.push_back(DoxygenEntity(theCommand));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::addCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
|
|
||||||
|
int DoxygenParser::addCommandWord(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList) {
|
||||||
if (noisy)
|
if (noisy)
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
|
|
||||||
std::string name = getNextWord(tokList);
|
std::string name = getNextWord(tokList);
|
||||||
if (!name.empty()) {
|
if (!name.empty()) {
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
aNewList.push_back(DoxygenEntity("plainstd::string", name));
|
aNewList.push_back(DoxygenEntity("plainstd::string", name));
|
||||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::addCommandLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
|
|
||||||
|
int DoxygenParser::addCommandLine(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList) {
|
||||||
if (noisy)
|
if (noisy)
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
std::list < Token >::iterator endOfLine = getOneLine(tokList);
|
TokenListCIt endOfLine = getOneLine(tokList);
|
||||||
std::list < DoxygenEntity > aNewList = parse(endOfLine, tokList);
|
std::list < DoxygenEntity > aNewList = parse(endOfLine, tokList);
|
||||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::addCommandParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
|
|
||||||
|
int DoxygenParser::addCommandParagraph(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList) {
|
||||||
if (noisy)
|
if (noisy)
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList);
|
|
||||||
|
TokenListCIt 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::addCommandEndCommand(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
|
|
||||||
|
int DoxygenParser::addCommandEndCommand(const std::string &theCommand,
|
||||||
|
const TokenList & tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList) {
|
||||||
if (noisy)
|
if (noisy)
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
std::list < Token >::iterator endCommand = getEndCommand("end" + theCommand, tokList);
|
TokenListCIt endCommand = getEndCommand("end" + theCommand, tokList);
|
||||||
if (endCommand == tokList.end()) {
|
if (endCommand == tokList.end()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected end" + theCommand);
|
printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected end" + theCommand);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
aNewList = parse(endCommand, tokList);
|
aNewList = parse(endCommand, tokList);
|
||||||
tokList.next();
|
m_tokenListIt++;
|
||||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::addCommandWordParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
|
|
||||||
|
int DoxygenParser::addCommandWordParagraph(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList) {
|
||||||
if (noisy)
|
if (noisy)
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
|
|
||||||
std::string name = getNextWord(tokList);
|
std::string name = getNextWord(tokList);
|
||||||
|
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList);
|
TokenListCIt endOfParagraph = getEndOfParagraph(tokList);
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
aNewList = parse(endOfParagraph, tokList);
|
aNewList = parse(endOfParagraph, tokList);
|
||||||
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
||||||
|
|
@ -317,15 +389,18 @@ int DoxygenParser::addCommandWordParagraph(std::string theCommand, TokenList & t
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::addCommandWordLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
|
int DoxygenParser::addCommandWordLine(const std::string &theCommand,
|
||||||
|
const TokenList & tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList) {
|
||||||
if (noisy)
|
if (noisy)
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
std::string name = getNextWord(tokList);
|
std::string name = getNextWord(tokList);
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::list < Token >::iterator endOfLine = getOneLine(tokList);
|
|
||||||
|
TokenListCIt endOfLine = getOneLine(tokList);
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
aNewList = parse(endOfLine, tokList);
|
aNewList = parse(endOfLine, tokList);
|
||||||
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
||||||
|
|
@ -334,12 +409,15 @@ int DoxygenParser::addCommandWordLine(std::string theCommand, TokenList & tokLis
|
||||||
//else cout << "No line followed " << theCommand << " command. Not added" << endl;
|
//else cout << "No line followed " << theCommand << " command. Not added" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::addCommandWordOWordOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
|
int DoxygenParser::addCommandWordOWordOWord(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList) {
|
||||||
if (noisy)
|
if (noisy)
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
|
|
||||||
std::string name = getNextWord(tokList);
|
std::string name = getNextWord(tokList);
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::string headerfile = getNextWord(tokList);
|
std::string headerfile = getNextWord(tokList);
|
||||||
|
|
@ -354,29 +432,40 @@ int DoxygenParser::addCommandWordOWordOWord(std::string theCommand, TokenList &
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::addCommandOWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
|
|
||||||
|
int DoxygenParser::addCommandOWord(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList) {
|
||||||
if (noisy)
|
if (noisy)
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
|
|
||||||
std::string name = getNextWord(tokList);
|
std::string name = getNextWord(tokList);
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
aNewList.push_back(DoxygenEntity("plainstd::string", name));
|
aNewList.push_back(DoxygenEntity("plainstd::string", name));
|
||||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::addCommandErrorThrow(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &) {
|
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "Encountered: " + theCommand +
|
int DoxygenParser::addCommandErrorThrow(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &) {
|
||||||
|
|
||||||
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "Encountered: " + theCommand +
|
||||||
"\nThis command should not have been encountered. Behaviour past this may be unpredictable");
|
"\nThis command should not have been encountered. Behaviour past this may be unpredictable");
|
||||||
std::list < Token >::iterator endOfLine = getOneLine(tokList);
|
m_tokenListIt = getOneLine(tokList);
|
||||||
tokList.setIterator(endOfLine);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
|
|
||||||
|
int DoxygenParser::addCommandUnique(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList) {
|
||||||
|
|
||||||
static std::map<std::string, std::string> endCommands;
|
static std::map<std::string, std::string> endCommands;
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
if (theCommand == "arg" || theCommand == "li") {
|
if (theCommand == "arg" || theCommand == "li") {
|
||||||
std::list < Token >::iterator endOfSection = getEndOfSection(theCommand, tokList);
|
TokenListCIt endOfSection = getEndOfSection(theCommand, tokList);
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
aNewList = parse(endOfSection, tokList);
|
aNewList = parse(endOfSection, tokList);
|
||||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||||
|
|
@ -387,20 +476,20 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
std::string key = getNextWord(tokList);
|
std::string key = getNextWord(tokList);
|
||||||
if (key.empty()) {
|
if (key.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::string heading = getNextWord(tokList);
|
std::string heading = getNextWord(tokList);
|
||||||
if (key.empty()) {
|
if (key.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No heading followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No heading followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::string title = getNextWord(tokList);
|
std::string title = getNextWord(tokList);
|
||||||
if (title.empty()) {
|
if (title.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No title followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No title followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList);
|
TokenListCIt endOfParagraph = getEndOfParagraph(tokList);
|
||||||
aNewList = parse(endOfParagraph, tokList);
|
aNewList = parse(endOfParagraph, tokList);
|
||||||
aNewList.push_front(DoxygenEntity("plainstd::string", title));
|
aNewList.push_front(DoxygenEntity("plainstd::string", title));
|
||||||
aNewList.push_front(DoxygenEntity("plainstd::string", heading));
|
aNewList.push_front(DoxygenEntity("plainstd::string", heading));
|
||||||
|
|
@ -423,10 +512,10 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
}
|
}
|
||||||
// \par [(paragraph title)] { paragraph }
|
// \par [(paragraph title)] { paragraph }
|
||||||
else if (theCommand == "par") {
|
else if (theCommand == "par") {
|
||||||
std::list < Token >::iterator endOfLine = getOneLine(tokList);
|
TokenListCIt endOfLine = getOneLine(tokList);
|
||||||
aNewList = parse(endOfLine, tokList);
|
aNewList = parse(endOfLine, tokList);
|
||||||
std::list < DoxygenEntity > aNewList2;
|
std::list < DoxygenEntity > aNewList2;
|
||||||
std::list < Token >::iterator endOfParagraph = getEndOfParagraph(tokList);
|
TokenListCIt endOfParagraph = getEndOfParagraph(tokList);
|
||||||
aNewList2 = parse(endOfParagraph, tokList);
|
aNewList2 = parse(endOfParagraph, tokList);
|
||||||
aNewList.splice(aNewList.end(), aNewList2);
|
aNewList.splice(aNewList.end(), aNewList2);
|
||||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||||
|
|
@ -445,8 +534,8 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
}
|
}
|
||||||
// \overload [(function declaration)]
|
// \overload [(function declaration)]
|
||||||
else if (theCommand == "overload") {
|
else if (theCommand == "overload") {
|
||||||
std::list < Token >::iterator endOfLine = getOneLine(tokList);
|
TokenListCIt endOfLine = getOneLine(tokList);
|
||||||
if (endOfLine != tokList.current()) {
|
if (endOfLine != m_tokenListIt) {
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
aNewList = parse(endOfLine, tokList);
|
aNewList = parse(endOfLine, tokList);
|
||||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||||
|
|
@ -460,12 +549,12 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
std::string name = getNextWord(tokList);
|
std::string name = getNextWord(tokList);
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
std::list < Token >::iterator endOfLine = getOneLine(tokList);
|
TokenListCIt endOfLine = getOneLine(tokList);
|
||||||
if (endOfLine != tokList.current()) {
|
if (endOfLine != m_tokenListIt) {
|
||||||
aNewList = parse(endOfLine, tokList);
|
aNewList = parse(endOfLine, tokList);
|
||||||
}
|
}
|
||||||
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
||||||
|
|
@ -477,7 +566,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
std::string name = getNextWord(tokList);
|
std::string name = getNextWord(tokList);
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::string text = getNextWord(tokList);
|
std::string text = getNextWord(tokList);
|
||||||
|
|
@ -492,7 +581,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
std::string name = getNextWord(tokList);
|
std::string name = getNextWord(tokList);
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::string text = getNextWord(tokList);
|
std::string text = getNextWord(tokList);
|
||||||
|
|
@ -541,7 +630,7 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
std::string file = getNextWord(tokList);
|
std::string file = getNextWord(tokList);
|
||||||
if (file.empty()) {
|
if (file.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No file followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No file followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::string caption = getNextWord(tokList);
|
std::string caption = getNextWord(tokList);
|
||||||
|
|
@ -556,12 +645,12 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
std::string format = getNextWord(tokList);
|
std::string format = getNextWord(tokList);
|
||||||
if (format.empty()) {
|
if (format.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No format followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No format followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::string file = getNextWord(tokList);
|
std::string file = getNextWord(tokList);
|
||||||
if (file.empty()) {
|
if (file.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::string caption = getNextWord(tokList);
|
std::string caption = getNextWord(tokList);
|
||||||
|
|
@ -582,12 +671,12 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
cout << "Parsing " << theCommand << endl;
|
cout << "Parsing " << theCommand << endl;
|
||||||
std::string name = getNextWord(tokList);
|
std::string name = getNextWord(tokList);
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
std::list < Token >::iterator endOfLine = getOneLine(tokList);
|
TokenListCIt endOfLine = getOneLine(tokList);
|
||||||
if (endOfLine != tokList.current()) {
|
if (endOfLine != m_tokenListIt) {
|
||||||
aNewList = parse(endOfLine, tokList);
|
aNewList = parse(endOfLine, tokList);
|
||||||
}
|
}
|
||||||
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
||||||
|
|
@ -605,22 +694,22 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
if (needsCond) {
|
if (needsCond) {
|
||||||
cond = getNextWord(tokList);
|
cond = getNextWord(tokList);
|
||||||
if (cond.empty()) {
|
if (cond.empty()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int nestedCounter = 1;
|
int nestedCounter = 1;
|
||||||
std::list < Token >::iterator endCommand = tokList.end();
|
TokenListCIt endCommand = tokList.end();
|
||||||
|
|
||||||
// go through the commands and find closing endif or else or elseif
|
// go through the commands and find closing endif or else or elseif
|
||||||
std::list < Token >::iterator it=tokList.iteratorCopy();
|
for (TokenListCIt it = m_tokenListIt; it!=tokList.end(); it++) {
|
||||||
for (; it!=tokList.end(); it++) {
|
if (it->m_tokenType == COMMAND) {
|
||||||
if (it->tokenType == COMMAND) {
|
if (it->m_tokenString == "if" || it->m_tokenString == "ifnot")
|
||||||
if (it->tokenString == "if" || it->tokenString == "ifnot")
|
|
||||||
nestedCounter++;
|
nestedCounter++;
|
||||||
else if (it->tokenString == "endif")
|
else if (it->m_tokenString == "endif")
|
||||||
nestedCounter--;
|
nestedCounter--;
|
||||||
if (nestedCounter == 1 && (it->tokenString == "else" || it->tokenString == "elseif")) { // else found
|
if (nestedCounter == 1 && (it->m_tokenString == "else" || it->m_tokenString == "elseif")) { // else found
|
||||||
endCommand = it;
|
endCommand = it;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -633,14 +722,14 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endCommand == tokList.end()) {
|
if (endCommand == tokList.end()) {
|
||||||
tokList.printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "No corresponding endif found");
|
printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "No corresponding endif found");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
aNewList = parse(endCommand, tokList);
|
aNewList = parse(endCommand, tokList);
|
||||||
if (skipEndif)
|
if (skipEndif)
|
||||||
tokList.next();
|
m_tokenListIt++;
|
||||||
if (needsCond)
|
if (needsCond)
|
||||||
aNewList.push_front(DoxygenEntity("plainstd::string", cond));
|
aNewList.push_front(DoxygenEntity("plainstd::string", cond));
|
||||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||||
|
|
@ -648,7 +737,11 @@ int DoxygenParser::addCommandUnique(std::string theCommand, TokenList & tokList,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoxygenParser::addCommand(std::string commandString, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
|
|
||||||
|
int DoxygenParser::addCommand(const std::string &commandString,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList) {
|
||||||
|
|
||||||
std::string theCommand = stringToLower(commandString);
|
std::string theCommand = stringToLower(commandString);
|
||||||
if (theCommand == "plainstd::string") {
|
if (theCommand == "plainstd::string") {
|
||||||
std::string nextPhrase = getStringTilCommand(tokList);
|
std::string nextPhrase = getStringTilCommand(tokList);
|
||||||
|
|
@ -684,48 +777,46 @@ int DoxygenParser::addCommand(std::string commandString, TokenList & tokList, st
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list < DoxygenEntity > DoxygenParser::parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList, bool root) {
|
|
||||||
|
std::list < DoxygenEntity > DoxygenParser::parse(TokenListCIt endParsingIndex,
|
||||||
|
const TokenList &tokList,
|
||||||
|
bool root) {
|
||||||
// if we are root, than any strings should be added as 'partofdescription', else as 'plainstd::string'
|
// if we are root, than any strings should be added as 'partofdescription', else as 'plainstd::string'
|
||||||
std::string currPlainstringCommandType = root ? "partofdescription" : "plainstd::string";
|
std::string currPlainstringCommandType = root ? "partofdescription" : "plainstd::string";
|
||||||
std::list < DoxygenEntity > aNewList;
|
std::list < DoxygenEntity > aNewList;
|
||||||
int currCommand;
|
|
||||||
while (tokList.current() != endParsingIndex) {
|
while (m_tokenListIt != endParsingIndex) {
|
||||||
Token currToken = tokList.peek();
|
|
||||||
|
Token currToken = *m_tokenListIt;
|
||||||
|
|
||||||
if (noisy)
|
if (noisy)
|
||||||
cout << "Parsing for phrase starting in:" << currToken.toString() << endl;
|
cout << "Parsing for phrase starting in:" << currToken.toString() << endl;
|
||||||
if (currToken.tokenType == END_LINE) {
|
|
||||||
aNewList.push_back(DoxygenEntity("plainstd::endl"));
|
if (currToken.m_tokenType == END_LINE) {
|
||||||
tokList.next();
|
aNewList.push_back(DoxygenEntity("plainstd::endl"));
|
||||||
} else if (currToken.tokenType == COMMAND) {
|
m_tokenListIt++;
|
||||||
currCommand = findCommand(currToken.tokenString);
|
} else if (currToken.m_tokenType == COMMAND) {
|
||||||
if (currCommand < 0) {
|
m_tokenListIt++;
|
||||||
if (noisy)
|
addCommand(currToken.m_tokenString, tokList, aNewList);
|
||||||
cout << "Unidentified Command " << currToken.tokenString << endl;
|
} else if (currToken.m_tokenType == PLAINSTRING) {
|
||||||
tokList.printListError(WARN_DOXYGEN_UNKNOWN_COMMAND, "Unsupported command: '" + currToken.tokenString + "'. Ignored");
|
|
||||||
tokList.current()->tokenType = PLAINSTRING; // little hack to add the command as plaintext
|
|
||||||
addCommand(currPlainstringCommandType, tokList, aNewList);
|
|
||||||
} else {
|
|
||||||
tokList.next();
|
|
||||||
addCommand(currToken.tokenString, tokList, aNewList);
|
|
||||||
}
|
|
||||||
} else if (currToken.tokenType == PLAINSTRING) {
|
|
||||||
addCommand(currPlainstringCommandType, tokList, aNewList);
|
addCommand(currPlainstringCommandType, tokList, aNewList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endParsingIndex != tokList.end() && tokList.current() == tokList.end()) {
|
if (endParsingIndex != tokList.end() && m_tokenListIt == tokList.end()) {
|
||||||
// this could happen if we cant reach the original endParsingIndex
|
// this could happen if we can't reach the original endParsingIndex
|
||||||
tokList.printListError(WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT, "Unexpected end of comment encountered");
|
printListError(WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT, "Unexpected end of comment encountered");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return aNewList;
|
return aNewList;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list < DoxygenEntity > DoxygenParser::createTree(std::string doxygenBlob, std::string fileName, int lineNumber) {
|
|
||||||
TokenList tokList = TokenList::tokenizeDoxygenComment(doxygenBlob, fileName, lineNumber);
|
std::list < DoxygenEntity > DoxygenParser::createTree(const std::string &doxygenBlob, const std::string &fileName, int lineNumber) {
|
||||||
|
TokenList tokList = tokenizeDoxygenComment(doxygenBlob, fileName, lineNumber);
|
||||||
if (noisy) {
|
if (noisy) {
|
||||||
cout << "---TOKEN LIST---" << endl;
|
cout << "---TOKEN LIST---" << endl;
|
||||||
tokList.printList();
|
printList();
|
||||||
}
|
}
|
||||||
std::list < DoxygenEntity > rootList;
|
std::list < DoxygenEntity > rootList;
|
||||||
rootList = parse(tokList.end(), tokList, true);
|
rootList = parse(tokList.end(), tokList, true);
|
||||||
|
|
@ -735,3 +826,116 @@ std::list < DoxygenEntity > DoxygenParser::createTree(std::string doxygenBlob, s
|
||||||
}
|
}
|
||||||
return rootList;
|
return rootList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DoxygenParser::TokenList DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment,
|
||||||
|
const std::string &fileName,
|
||||||
|
int fileLine) {
|
||||||
|
TokenList tokList;
|
||||||
|
m_fileLineNo = fileLine;
|
||||||
|
m_fileName = fileName;
|
||||||
|
|
||||||
|
bool isPlainString = false;
|
||||||
|
string::size_type pos, lastPos = 0;
|
||||||
|
char prevChar = doxygenComment[lastPos];
|
||||||
|
string currentWord;
|
||||||
|
while (true) {
|
||||||
|
isPlainString = false;
|
||||||
|
pos = doxygenComment.find_first_of("\\@\t\n ", lastPos);
|
||||||
|
if (pos == string::npos)
|
||||||
|
pos = doxygenComment.size();
|
||||||
|
|
||||||
|
currentWord = doxygenComment.substr(lastPos, pos-lastPos);
|
||||||
|
if (prevChar == '\n')
|
||||||
|
tokList.push_back(Token(END_LINE, "\n"));
|
||||||
|
else if (prevChar == '\\' || prevChar == '@') {
|
||||||
|
// it's a doxygen command
|
||||||
|
// hack to get commands like \\ or \@ or @\ or @@
|
||||||
|
if (doxygenComment[pos] == '@' || doxygenComment[pos] == '\\') {
|
||||||
|
currentWord += doxygenComment[pos];
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
// also strip the command till the first nonalpha char
|
||||||
|
for (int i = 2; i < currentWord.size(); i++) {
|
||||||
|
if (!isalpha(currentWord[i])) {
|
||||||
|
currentWord = currentWord.substr(0, i);
|
||||||
|
// set current parsing pos back, to parse the rest of the command
|
||||||
|
pos = lastPos + i - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (findCommand(currentWord)) {
|
||||||
|
tokList.push_back(Token(COMMAND, currentWord));
|
||||||
|
} else {
|
||||||
|
// unknown commands are not translated - treated as literal string
|
||||||
|
tokList.push_back(Token(PLAINSTRING, currentWord));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentWord.size() && (currentWord[0] == '!' || currentWord[0] == '*' || currentWord[0] == '/')) {
|
||||||
|
// check if it's one of the '!!!', '***', '///' of any length
|
||||||
|
char c = currentWord[0];
|
||||||
|
isPlainString = false;
|
||||||
|
for (size_t i=0; i<currentWord.size(); i++)
|
||||||
|
if (currentWord[i] != c) {
|
||||||
|
isPlainString = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
isPlainString = true;
|
||||||
|
|
||||||
|
if (isPlainString && currentWord.size())
|
||||||
|
tokList.push_back(Token(PLAINSTRING, currentWord));
|
||||||
|
|
||||||
|
prevChar = doxygenComment[pos];
|
||||||
|
lastPos = pos + 1;
|
||||||
|
if (lastPos >= doxygenComment.size())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tokenListIt = tokList.begin();
|
||||||
|
|
||||||
|
return tokList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DoxygenParser::printList() {
|
||||||
|
TokenListIt p = m_tokenList.begin();
|
||||||
|
int i = 1;
|
||||||
|
int b = 0;
|
||||||
|
while (p != m_tokenList.end()) {
|
||||||
|
cout << (*p).toString() << " ";
|
||||||
|
b = i % TOKENSPERLINE;
|
||||||
|
if (b == 0)
|
||||||
|
cout << endl;
|
||||||
|
p++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
TokenListCIt startIt = m_tokenList.begin();
|
||||||
|
|
||||||
|
int tokNo = 0;
|
||||||
|
for (TokenListCIt it = startIt; it != m_tokenList.end(); it++, tokNo++) {
|
||||||
|
cout << it->toString() << " ";
|
||||||
|
|
||||||
|
if ((tokNo % TOKENSPERLINE) == 0) {
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoxygenParser::printListError(int warningType,
|
||||||
|
const std::string &message) {
|
||||||
|
int curLine = m_fileLineNo;
|
||||||
|
for (TokenListCIt it = m_tokenList.begin(); it != m_tokenListIt; it++) {
|
||||||
|
if (it->m_tokenType == END_LINE) {
|
||||||
|
curLine++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Swig_warning(warningType, m_fileName.c_str(),
|
||||||
|
curLine,
|
||||||
|
"Doxygen parser warning: %s. \n",
|
||||||
|
message.c_str());
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,80 +16,128 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include "DoxygenEntity.h"
|
#include "DoxygenEntity.h"
|
||||||
#include "TokenList.h"
|
|
||||||
class DoxygenParser {
|
class DoxygenParser {
|
||||||
public:
|
|
||||||
DoxygenParser(bool noisy = false);
|
|
||||||
virtual ~DoxygenParser();
|
|
||||||
std::list < DoxygenEntity > createTree(std::string doxygen, std::string fileName, int lineNumber);
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/** This class contains parts of Doxygen comment as a token. */
|
||||||
|
class Token {
|
||||||
|
public:
|
||||||
|
// typedef enum {COMMAND, PLAINSTRING, END_LINE, PARAGRAPH_END} ETokenType;
|
||||||
|
DoxyCommandEnum m_tokenType;
|
||||||
|
std::string m_tokenString; /* the data , such as param for @param */
|
||||||
|
|
||||||
|
Token(DoxyCommandEnum tType, std::string tString) :
|
||||||
|
m_tokenType(tType),
|
||||||
|
m_tokenString(tString) {}
|
||||||
|
|
||||||
|
std::string toString() const {
|
||||||
|
|
||||||
|
switch (m_tokenType) {
|
||||||
|
case END_LINE:
|
||||||
|
return "{END OF LINE}";
|
||||||
|
case PARAGRAPH_END:
|
||||||
|
return "{END OF PARAGRAPH}";
|
||||||
|
case PLAINSTRING:
|
||||||
|
return "{PLAINSTRING :" + m_tokenString + "}";
|
||||||
|
case COMMAND:
|
||||||
|
return "{COMMAND : " + m_tokenString + "}";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef std::list<Token> TokenList;
|
||||||
|
typedef TokenList::const_iterator TokenListCIt;
|
||||||
|
typedef TokenList::iterator TokenListIt;
|
||||||
|
|
||||||
|
TokenList m_tokenList;
|
||||||
|
TokenListCIt m_tokenListIt;
|
||||||
|
std::string m_fileName;
|
||||||
|
int m_fileLineNo;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Whether to print lots of debug info during parsing
|
||||||
|
*/
|
||||||
|
bool noisy;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Map of Doxygen commands to determine if a string is a
|
||||||
|
* command and how it needs to be parsed
|
||||||
|
*/
|
||||||
|
static std::map<std::string, DoxyCommandEnum> doxygenCommands;
|
||||||
|
static std::set<std::string> doxygenSectionIndicators;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*Changes a std::string to all lower case
|
*Changes a std::string to all lower case
|
||||||
*/
|
*/
|
||||||
std::string stringToLower(std::string &stringToConvert);
|
std::string stringToLower(const std::string &stringToConvert);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finds out if a command exists (is a possible command)
|
* Finds out if a command exists (is a possible command)
|
||||||
* returns -1 if no match is found
|
* returns -1 if no match is found
|
||||||
*/
|
*/
|
||||||
int findCommand(std::string smallString);
|
bool findCommand(const std::string &smallString);
|
||||||
/*
|
/*
|
||||||
* isSectionIndicator returns a boolean if the command is a section indicator
|
* isSectionIndicator returns a boolean if the command is a section indicator
|
||||||
* This is a helper method for finding the end of a paragraph
|
* This is a helper method for finding the end of a paragraph
|
||||||
* by Doxygen's terms
|
* by Doxygen's terms
|
||||||
*/
|
*/
|
||||||
int isSectionIndicator(std::string smallString);
|
bool isSectionIndicator(const std::string &smallString);
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
*/
|
*/
|
||||||
int commandBelongs(std::string theCommand);
|
int commandBelongs(const std::string &theCommand);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*prints the parse tree
|
*prints the parse tree
|
||||||
*/
|
*/
|
||||||
void printTree(std::list < DoxygenEntity > &rootList);
|
void printTree(const std::list <DoxygenEntity> &rootList);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the next word ON THE CURRENT LINE ONLY
|
* Returns the next word ON THE CURRENT LINE ONLY
|
||||||
* if a new line is encountered, returns a blank std::string.
|
* if a new line is encountered, returns a blank std::string.
|
||||||
* Updates the index it is given if success.
|
* Updates the index it is given if success.
|
||||||
*/
|
*/
|
||||||
std::string getNextWord(TokenList & tokList);
|
std::string getNextWord(const TokenList &tokList);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the location of the end of the line as
|
* Returns the location of the end of the line as
|
||||||
* an iterator.
|
* an iterator.
|
||||||
*/
|
*/
|
||||||
std::list < Token >::iterator getOneLine(TokenList & tokList);
|
TokenListCIt getOneLine(const TokenList &tokList);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns a properly formatted std::string
|
* Returns a properly formatted std::string
|
||||||
* up til ANY command or end of line is encountered.
|
* up til ANY command or end of line is encountered.
|
||||||
*/
|
*/
|
||||||
std::string getStringTilCommand(TokenList & tokList);
|
std::string getStringTilCommand(const TokenList &tokList);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns a properly formatted std::string
|
* Returns a properly formatted std::string
|
||||||
* up til the command specified is encountered
|
* up til the command specified is encountered
|
||||||
*/
|
*/
|
||||||
//TODO check that this behaves properly for formulas
|
//TODO check that this behaves properly for formulas
|
||||||
std::string getStringTilEndCommand(std::string theCommand, TokenList & tokList);
|
std::string getStringTilEndCommand(const std::string &theCommand,
|
||||||
|
const TokenList &tokList);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the end of a Paragraph as an iterator-
|
* Returns the end of a Paragraph as an iterator-
|
||||||
* Paragraph is defined in Doxygen to be a paragraph of text
|
* Paragraph is defined in Doxygen to be a paragraph of text
|
||||||
* separated by either a structural command or a blank line
|
* separated by either a structural command or a blank line
|
||||||
*/
|
*/
|
||||||
std::list < Token >::iterator getEndOfParagraph(TokenList & tokList);
|
TokenListCIt getEndOfParagraph(const TokenList &tokList);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the end of a section, defined as the first blank line OR first encounter of the same
|
* Returns the end of a section, defined as the first blank line OR first encounter of the same
|
||||||
* command. Example of this behaviour is \arg
|
* command. Example of this behaviour is \arg
|
||||||
* if no end is encountered, returns the last token of the std::list.
|
* if no end is encountered, returns the last token of the std::list.
|
||||||
*/
|
*/
|
||||||
std::list < Token >::iterator getEndOfSection(std::string theCommand, TokenList & tokList);
|
TokenListCIt getEndOfSection(const std::string &theCommand,
|
||||||
|
const TokenList &tokList);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This method is for returning the end of a specific form of doxygen command
|
* This method is for returning the end of a specific form of doxygen command
|
||||||
|
|
@ -98,12 +146,14 @@ private:
|
||||||
* progressTilEndCommand("endcode", tokenList);
|
* progressTilEndCommand("endcode", tokenList);
|
||||||
* If the end is never encountered, it returns the end of the std::list.
|
* If the end is never encountered, it returns the end of the std::list.
|
||||||
*/
|
*/
|
||||||
std::list < Token >::iterator getEndCommand(std::string theCommand, TokenList & tokList);
|
TokenListCIt getEndCommand(const std::string &theCommand,
|
||||||
|
const TokenList &tokList);
|
||||||
/*
|
/*
|
||||||
* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered
|
* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered
|
||||||
*/
|
|
||||||
//TODO getTilAnyCommand
|
//TODO getTilAnyCommand
|
||||||
std::list < Token >::iterator getTilAnyCommand(std::string theCommand, TokenList & tokList);
|
TokenListCIt getTilAnyCommand(const std::string &theCommand,
|
||||||
|
const TokenList &tokList);
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Method for Adding a Simple Command
|
* Method for Adding a Simple Command
|
||||||
|
|
@ -111,7 +161,8 @@ private:
|
||||||
* 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(const std::string &theCommand,
|
||||||
|
std::list < DoxygenEntity > &doxyList);
|
||||||
/*
|
/*
|
||||||
* CommandWord
|
* CommandWord
|
||||||
* Format: @command <word>
|
* Format: @command <word>
|
||||||
|
|
@ -119,14 +170,18 @@ private:
|
||||||
* "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(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList);
|
||||||
/*
|
/*
|
||||||
* 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(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList);
|
||||||
/*
|
/*
|
||||||
* CommandParagraph
|
* CommandParagraph
|
||||||
* Format: @command {paragraph}
|
* Format: @command {paragraph}
|
||||||
|
|
@ -134,7 +189,9 @@ private:
|
||||||
* "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(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList);
|
||||||
/*
|
/*
|
||||||
* Command EndCommand
|
* Command EndCommand
|
||||||
* Format: @command and ends at @endcommand
|
* Format: @command and ends at @endcommand
|
||||||
|
|
@ -143,68 +200,83 @@ private:
|
||||||
* "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(const std::string &theCommand,
|
||||||
|
const TokenList & tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList);
|
||||||
/*
|
/*
|
||||||
* CommandWordParagraph
|
* CommandWordParagraph
|
||||||
* Format: @command <word> {paragraph}
|
* Format: @command <word> {paragraph}
|
||||||
* Commands such as param
|
* Commands such as param
|
||||||
* "param", "tparam", "throw", "throws", "retval", "exception"
|
* "param", "tparam", "throw", "throws", "retval", "exception"
|
||||||
*/
|
*/
|
||||||
int addCommandWordParagraph(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList);
|
int addCommandWordParagraph(const std::string &theCommand,
|
||||||
|
const TokenList & tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList);
|
||||||
/*
|
/*
|
||||||
* 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(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList);
|
||||||
/*
|
/*
|
||||||
* 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(const std::string &theCommand, const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList);
|
||||||
/*
|
/*
|
||||||
* 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(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList);
|
||||||
/*
|
/*
|
||||||
* 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(const std::string &theCommand,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList);
|
||||||
/*
|
/*
|
||||||
*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(const std::string &theCommand, const TokenList &tokList, std::list < DoxygenEntity > &doxyList);
|
||||||
/*
|
/*
|
||||||
* The actual "meat" of the doxygen parser. Calls the correct addCommand* function
|
* The actual "meat" of the doxygen parser. Calls the correct addCommand* function
|
||||||
*/
|
*/
|
||||||
int addCommand(std::string commandString, TokenList & tokList, std::list < DoxygenEntity > &doxyList);
|
int addCommand(const std::string &commandString,
|
||||||
|
const TokenList &tokList,
|
||||||
|
std::list < DoxygenEntity > &doxyList);
|
||||||
|
|
||||||
std::list < DoxygenEntity > parse(std::list < Token >::iterator endParsingIndex, TokenList & tokList, bool root=false);
|
std::list < DoxygenEntity > parse(TokenListCIt endParsingIndex,
|
||||||
|
const TokenList &tokList,
|
||||||
|
bool root = false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill static doxygenCommands and sectionIndicators containers
|
* Fill static doxygenCommands and sectionIndicators containers
|
||||||
*/
|
*/
|
||||||
void fillTables();
|
void fillTables();
|
||||||
|
|
||||||
/*
|
TokenList tokenizeDoxygenComment(const std::string &doxygenComment,
|
||||||
* Whether to print lots of debug info during parsing
|
const std::string &fileName,
|
||||||
*/
|
int fileLine);
|
||||||
bool noisy;
|
void printList();
|
||||||
|
void printListError(int warningType, const std::string &message);
|
||||||
/*
|
|
||||||
* Map of Doxygen commands to determine if a string is a
|
public:
|
||||||
* command and how it needs to be parsed
|
DoxygenParser(bool noisy = false);
|
||||||
*/
|
virtual ~DoxygenParser();
|
||||||
static std::map<std::string, DoxyCommandEnum> doxygenCommands;
|
std::list < DoxygenEntity > createTree(const std::string &doxygen,
|
||||||
|
const std::string &fileName,
|
||||||
static std::set<std::string> doxygenSectionIndicators;
|
int lineNumber);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include "DoxygenEntity.h"
|
#include "DoxygenEntity.h"
|
||||||
#include "DoxygenParser.h"
|
#include "DoxygenParser.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
#include "DoxygenParser.h"
|
#include "DoxygenParser.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
#include "../../Modules/swigmod.h"
|
#include "../../Modules/swigmod.h"
|
||||||
#define APPROX_LINE_LENGTH 64 //characters per line allowed
|
#define APPROX_LINE_LENGTH 64 //characters per line allowed
|
||||||
#define TAB_SIZE 8 //current tab size in spaces
|
#define TAB_SIZE 8 //current tab size in spaces
|
||||||
|
|
@ -21,6 +22,10 @@
|
||||||
// define static tables, they are filled in JavaDocConverter's constructor
|
// define static tables, they are filled in JavaDocConverter's constructor
|
||||||
std::map<std::string, std::pair<JavaDocConverter::tagHandler, std::string > > JavaDocConverter::tagHandlers;
|
std::map<std::string, std::pair<JavaDocConverter::tagHandler, std::string > > JavaDocConverter::tagHandlers;
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using std::list;
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
void JavaDocConverter::fillStaticTables() {
|
void JavaDocConverter::fillStaticTables() {
|
||||||
if (tagHandlers.size()) // fill only once
|
if (tagHandlers.size()) // fill only once
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
#include "PyDocConverter.h"
|
#include "PyDocConverter.h"
|
||||||
#include "DoxygenParser.h"
|
#include "DoxygenParser.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
@ -21,6 +22,9 @@
|
||||||
std::map<std::string, std::pair<PyDocConverter::tagHandler, std::string > > PyDocConverter::tagHandlers;
|
std::map<std::string, std::pair<PyDocConverter::tagHandler, std::string > > PyDocConverter::tagHandlers;
|
||||||
std::map<std::string, std::string> PyDocConverter::sectionTitles;
|
std::map<std::string, std::string> PyDocConverter::sectionTitles;
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
|
|
||||||
void PyDocConverter::fillStaticTables() {
|
void PyDocConverter::fillStaticTables() {
|
||||||
if (tagHandlers.size()) // fill only once
|
if (tagHandlers.size()) // fill only once
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue