Renamed _fileIndex, _linenr, _col
This commit is contained in:
parent
a6e4663445
commit
31f137f24d
|
@ -43,9 +43,9 @@ Token::Token(TokensFrontBack *tokensFrontBack) :
|
||||||
_scope(nullptr),
|
_scope(nullptr),
|
||||||
_function(nullptr), // Initialize whole union
|
_function(nullptr), // Initialize whole union
|
||||||
mVarId(0),
|
mVarId(0),
|
||||||
_fileIndex(0),
|
mFileIndex(0),
|
||||||
_linenr(0),
|
mLineNumber(0),
|
||||||
_col(0),
|
mColumn(0),
|
||||||
mProgressValue(0),
|
mProgressValue(0),
|
||||||
mTokType(eNone),
|
mTokType(eNone),
|
||||||
mFlags(0),
|
mFlags(0),
|
||||||
|
@ -250,8 +250,8 @@ void Token::swapWithNext()
|
||||||
std::swap(mTokType, mNext->mTokType);
|
std::swap(mTokType, mNext->mTokType);
|
||||||
std::swap(mFlags, mNext->mFlags);
|
std::swap(mFlags, mNext->mFlags);
|
||||||
std::swap(mVarId, mNext->mVarId);
|
std::swap(mVarId, mNext->mVarId);
|
||||||
std::swap(_fileIndex, mNext->_fileIndex);
|
std::swap(mFileIndex, mNext->mFileIndex);
|
||||||
std::swap(_linenr, mNext->_linenr);
|
std::swap(mLineNumber, mNext->mLineNumber);
|
||||||
if (mNext->_link)
|
if (mNext->_link)
|
||||||
mNext->_link->_link = this;
|
mNext->_link->_link = this;
|
||||||
if (this->_link)
|
if (this->_link)
|
||||||
|
@ -272,8 +272,8 @@ void Token::takeData(Token *fromToken)
|
||||||
tokType(fromToken->mTokType);
|
tokType(fromToken->mTokType);
|
||||||
mFlags = fromToken->mFlags;
|
mFlags = fromToken->mFlags;
|
||||||
mVarId = fromToken->mVarId;
|
mVarId = fromToken->mVarId;
|
||||||
_fileIndex = fromToken->_fileIndex;
|
mFileIndex = fromToken->mFileIndex;
|
||||||
_linenr = fromToken->_linenr;
|
mLineNumber = fromToken->mLineNumber;
|
||||||
_link = fromToken->_link;
|
_link = fromToken->_link;
|
||||||
_scope = fromToken->_scope;
|
_scope = fromToken->_scope;
|
||||||
_function = fromToken->_function;
|
_function = fromToken->_function;
|
||||||
|
@ -932,8 +932,8 @@ void Token::insertToken(const std::string &tokenStr, const std::string &original
|
||||||
newToken->originalName(originalNameStr);
|
newToken->originalName(originalNameStr);
|
||||||
|
|
||||||
if (newToken != this) {
|
if (newToken != this) {
|
||||||
newToken->_linenr = _linenr;
|
newToken->mLineNumber = mLineNumber;
|
||||||
newToken->_fileIndex = _fileIndex;
|
newToken->mFileIndex = mFileIndex;
|
||||||
newToken->mProgressValue = mProgressValue;
|
newToken->mProgressValue = mProgressValue;
|
||||||
|
|
||||||
if (prepend) {
|
if (prepend) {
|
||||||
|
@ -1035,21 +1035,21 @@ std::string Token::stringifyList(bool varid, bool attributes, bool linenumbers,
|
||||||
|
|
||||||
std::ostringstream ret;
|
std::ostringstream ret;
|
||||||
|
|
||||||
unsigned int lineNumber = _linenr - (linenumbers ? 1U : 0U);
|
unsigned int lineNumber = mLineNumber - (linenumbers ? 1U : 0U);
|
||||||
unsigned int fileInd = files ? ~0U : _fileIndex;
|
unsigned int fileInd = files ? ~0U : mFileIndex;
|
||||||
std::map<int, unsigned int> lineNumbers;
|
std::map<int, unsigned int> lineNumbers;
|
||||||
for (const Token *tok = this; tok != end; tok = tok->next()) {
|
for (const Token *tok = this; tok != end; tok = tok->next()) {
|
||||||
bool fileChange = false;
|
bool fileChange = false;
|
||||||
if (tok->_fileIndex != fileInd) {
|
if (tok->mFileIndex != fileInd) {
|
||||||
if (fileInd != ~0U) {
|
if (fileInd != ~0U) {
|
||||||
lineNumbers[fileInd] = tok->_fileIndex;
|
lineNumbers[fileInd] = tok->mFileIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileInd = tok->_fileIndex;
|
fileInd = tok->mFileIndex;
|
||||||
if (files) {
|
if (files) {
|
||||||
ret << "\n\n##file ";
|
ret << "\n\n##file ";
|
||||||
if (fileNames && fileNames->size() > tok->_fileIndex)
|
if (fileNames && fileNames->size() > tok->mFileIndex)
|
||||||
ret << fileNames->at(tok->_fileIndex);
|
ret << fileNames->at(tok->mFileIndex);
|
||||||
else
|
else
|
||||||
ret << fileInd;
|
ret << fileInd;
|
||||||
ret << '\n';
|
ret << '\n';
|
||||||
|
@ -1060,7 +1060,7 @@ std::string Token::stringifyList(bool varid, bool attributes, bool linenumbers,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linebreaks && (lineNumber != tok->linenr() || fileChange)) {
|
if (linebreaks && (lineNumber != tok->linenr() || fileChange)) {
|
||||||
if (lineNumber+4 < tok->linenr() && fileInd == tok->_fileIndex) {
|
if (lineNumber+4 < tok->linenr() && fileInd == tok->mFileIndex) {
|
||||||
ret << '\n' << lineNumber+1 << ":\n|\n";
|
ret << '\n' << lineNumber+1 << ":\n|\n";
|
||||||
ret << tok->linenr()-1 << ":\n";
|
ret << tok->linenr()-1 << ":\n";
|
||||||
ret << tok->linenr() << ": ";
|
ret << tok->linenr() << ": ";
|
||||||
|
|
18
lib/token.h
18
lib/token.h
|
@ -509,24 +509,24 @@ public:
|
||||||
static int multiCompare(const Token *tok, const char *haystack, unsigned int varid);
|
static int multiCompare(const Token *tok, const char *haystack, unsigned int varid);
|
||||||
|
|
||||||
unsigned int fileIndex() const {
|
unsigned int fileIndex() const {
|
||||||
return _fileIndex;
|
return mFileIndex;
|
||||||
}
|
}
|
||||||
void fileIndex(unsigned int indexOfFile) {
|
void fileIndex(unsigned int indexOfFile) {
|
||||||
_fileIndex = indexOfFile;
|
mFileIndex = indexOfFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int linenr() const {
|
unsigned int linenr() const {
|
||||||
return _linenr;
|
return mLineNumber;
|
||||||
}
|
}
|
||||||
void linenr(unsigned int lineNumber) {
|
void linenr(unsigned int lineNumber) {
|
||||||
_linenr = lineNumber;
|
mLineNumber = lineNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int col() const {
|
unsigned int col() const {
|
||||||
return _col;
|
return mColumn;
|
||||||
}
|
}
|
||||||
void col(unsigned int c) {
|
void col(unsigned int c) {
|
||||||
_col = c;
|
mColumn = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
Token *next() const {
|
Token *next() const {
|
||||||
|
@ -919,9 +919,9 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int mVarId;
|
unsigned int mVarId;
|
||||||
unsigned int _fileIndex;
|
unsigned int mFileIndex;
|
||||||
unsigned int _linenr;
|
unsigned int mLineNumber;
|
||||||
unsigned int _col;
|
unsigned int mColumn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A value from 0-100 that provides a rough idea about where in the token
|
* A value from 0-100 that provides a rough idea about where in the token
|
||||||
|
|
Loading…
Reference in New Issue