diff --git a/Source/DoxygenTranslator/src/Token.cpp b/Source/DoxygenTranslator/src/Token.cpp deleted file mode 100644 index 6ade97163..000000000 --- a/Source/DoxygenTranslator/src/Token.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * - * Token.cpp - * ----------------------------------------------------------------------------- */ - -#include "Token.h" -#include "DoxygenEntity.h" -using namespace std; - - -Token::Token(int tType, string tString) { - tokenType = tType; - tokenString = tString; -} - -string Token::toString() { - if (tokenType == END_LINE) { - return "{END OF LINE}"; - } - if (tokenType == PARAGRAPH_END) { - return "{END OF PARAGRAPH}"; - } - if (tokenType == PLAINSTRING) { - return "{PLAINSTRING :" + tokenString + "}"; - } - if (tokenType == COMMAND) { - return "{COMMAND : " + tokenString + "}"; - } - return ""; -} - -Token::~Token() { -} diff --git a/Source/DoxygenTranslator/src/Token.h b/Source/DoxygenTranslator/src/Token.h deleted file mode 100644 index 6e10fd338..000000000 --- a/Source/DoxygenTranslator/src/Token.h +++ /dev/null @@ -1,28 +0,0 @@ -/* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * - * Token.h - * ----------------------------------------------------------------------------- */ - -#ifndef TOKEN_H_ -#define TOKEN_H_ -#include - -using namespace std; - -class Token { -public: - Token(int tType, string tString); - ~Token(); - - int tokenType; /* currently can be END_LINE, PLAINSTRING, or COMMAND */ - string tokenString; /* the data , such as param for @param */ - string toString(); -}; - -#endif diff --git a/Source/DoxygenTranslator/src/TokenList.cpp b/Source/DoxygenTranslator/src/TokenList.cpp deleted file mode 100644 index ceea0ba17..000000000 --- a/Source/DoxygenTranslator/src/TokenList.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * - * TokenList.cpp - * ----------------------------------------------------------------------------- */ - -#include "TokenList.h" -#include -#include -#include -#include -#include "swig.h" -#include "Token.h" -#include "DoxygenEntity.h" -#define TOKENSPERLINE 8; //change this to change the printing behaviour of the token list - -using namespace std; - -TokenList TokenList::tokenizeDoxygenComment(const std::string &doxygenComment, const std::string &fileName, int fileLine) { - TokenList tokList; - tokList.fileLine = fileLine; - tokList.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.m_tokenList.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= doxygenComment.size()) - break; - } - tokList.m_tokenListIter = tokList.m_tokenList.begin(); - return tokList; -} - -TokenList::TokenList() -: fileName(""), fileLine(0) { - m_tokenListIter = m_tokenList.begin(); -} - - -TokenList::~TokenList() { -} - -Token TokenList::peek() { - if (m_tokenListIter != m_tokenList.end()) { - Token returnedToken = (*m_tokenListIter); - return returnedToken; - } else - return Token(0, ""); -} - - -Token TokenList::next() { - if (m_tokenListIter != m_tokenList.end()) { - Token returnedToken = (*m_tokenListIter); - m_tokenListIter++; - return (returnedToken); - } else - return Token(0, ""); -} - - -list < Token >::iterator TokenList::end() { - return m_tokenList.end(); -} - - -list < Token >::iterator TokenList::current() { - return m_tokenListIter; -} - - -list < Token >::iterator TokenList::iteratorCopy() { - return m_tokenListIter; -} - - -void TokenList::setIterator(list < Token >::iterator newPosition) { - m_tokenListIter = newPosition; -} - - -void TokenList::printList() { - list < Token >::iterator 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++; - } -} - -void TokenList::printListError(int warningType, std::string message) { - int curLine = fileLine; - for (list< Token >::iterator it = m_tokenList.begin(); it != current(); it++) - if (it->tokenType == END_LINE) - curLine++; - Swig_warning(warningType, fileName.c_str(), curLine, "Doxygen parser warning: %s. \n", message.c_str()); -} diff --git a/Source/DoxygenTranslator/src/TokenList.h b/Source/DoxygenTranslator/src/TokenList.h deleted file mode 100644 index 69580f11c..000000000 --- a/Source/DoxygenTranslator/src/TokenList.h +++ /dev/null @@ -1,56 +0,0 @@ -/* ----------------------------------------------------------------------------- - * This file is part of SWIG, which is licensed as a whole under version 3 - * (or any later version) of the GNU General Public License. Some additional - * terms also apply to certain portions of SWIG. The full details of the SWIG - * license and copyrights can be found in the LICENSE and COPYRIGHT files - * included with the SWIG source code as distributed by the SWIG developers - * and at http://www.swig.org/legal.html. - * - * TokenList.h - * ----------------------------------------------------------------------------- */ - -#ifndef TOKENLIST_H_ -#define TOKENLIST_H_ -#include -#include -#include -#include -#include "Token.h" -#include "swigwarn.h" - -/* a small class used to represent the sequence of tokens - * that can be derived from a formatted doxygen string - */ - -class TokenList { -private: - std::list < Token > m_tokenList; - std::list < Token >::iterator m_tokenListIter; - // location info for error output - std::string fileName; - int fileLine; - -public: - TokenList(); // construct an empty TokenList - ~TokenList(); - - Token peek(); /* returns next token without advancing */ - Token next(); /* returns next token and advances */ - - std::list < Token >::iterator end(); /* returns an end iterator */ - std::list < Token >::iterator current(); /* returns the current iterator */ - - std::list < Token >::iterator iteratorCopy(); /* returns a copy of the current iterator */ - void setIterator(list < Token >::iterator newPosition); /*moves up the iterator */ - - void printList(); /* prints out the sequence of tokens */ - void printListError(int warningType, std::string message); /* prints properly formatted error message */ - - /* - * Create TokenList and populate it with tokens from - * a blob of Doxygen comment - */ - static TokenList tokenizeDoxygenComment(const std::string &doxygenComment, const std::string &fileName, int fileLine); -}; - -#endif