removed files with classes wich were made obsolete by previous commit
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13723 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ed6df45c0a
commit
a753f3e799
4 changed files with 0 additions and 275 deletions
|
|
@ -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() {
|
|
||||||
}
|
|
||||||
|
|
@ -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 <string>
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
@ -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 <cstdlib>
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#include <list>
|
|
||||||
#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<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;
|
|
||||||
}
|
|
||||||
tokList.m_tokenList.push_back(Token(COMMAND, 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.m_tokenList.push_back(Token(PLAINSTRING, currentWord));
|
|
||||||
|
|
||||||
prevChar = doxygenComment[pos];
|
|
||||||
lastPos = pos + 1;
|
|
||||||
if (lastPos >= 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());
|
|
||||||
}
|
|
||||||
|
|
@ -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 <cstdlib>
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#include <list>
|
|
||||||
#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
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue