Renamed _tokType to mTokType

This commit is contained in:
Daniel Marjamäki 2018-06-16 16:40:02 +02:00
parent 8e2b18a75a
commit aeea2e7427
2 changed files with 36 additions and 36 deletions

View File

@ -47,7 +47,7 @@ Token::Token(TokensFrontBack *tokensFrontBack) :
_linenr(0), _linenr(0),
_col(0), _col(0),
_progressValue(0), _progressValue(0),
_tokType(eNone), mTokType(eNone),
mFlags(0), mFlags(0),
_bits(0), _bits(0),
mAstOperand1(nullptr), mAstOperand1(nullptr),
@ -90,7 +90,7 @@ void Token::update_property_info()
else if (std::isalpha((unsigned char)_str[0]) || _str[0] == '_' || _str[0] == '$') { // Name else if (std::isalpha((unsigned char)_str[0]) || _str[0] == '_' || _str[0] == '$') { // Name
if (mVarId) if (mVarId)
tokType(eVariable); tokType(eVariable);
else if (_tokType != eVariable && _tokType != eFunction && _tokType != eType && _tokType != eKeyword) else if (mTokType != eVariable && mTokType != eFunction && mTokType != eType && mTokType != eKeyword)
tokType(eName); tokType(eName);
} else if (std::isdigit((unsigned char)_str[0]) || (_str.length() > 1 && _str[0] == '-' && std::isdigit((unsigned char)_str[1]))) } else if (std::isdigit((unsigned char)_str[0]) || (_str.length() > 1 && _str[0] == '-' && std::isdigit((unsigned char)_str[1])))
tokType(eNumber); tokType(eNumber);
@ -183,7 +183,7 @@ void Token::concatStr(std::string const& b)
std::string Token::strValue() const std::string Token::strValue() const
{ {
assert(_tokType == eString); assert(mTokType == eString);
std::string ret(_str.substr(1, _str.length() - 2)); std::string ret(_str.substr(1, _str.length() - 2));
std::string::size_type pos = 0U; std::string::size_type pos = 0U;
while ((pos = ret.find('\\', pos)) != std::string::npos) { while ((pos = ret.find('\\', pos)) != std::string::npos) {
@ -247,7 +247,7 @@ void Token::swapWithNext()
{ {
if (mNext) { if (mNext) {
std::swap(_str, mNext->_str); std::swap(_str, mNext->_str);
std::swap(_tokType, mNext->_tokType); 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(_fileIndex, mNext->_fileIndex);
@ -269,7 +269,7 @@ void Token::swapWithNext()
void Token::takeData(Token *fromToken) void Token::takeData(Token *fromToken)
{ {
_str = fromToken->_str; _str = fromToken->_str;
tokType(fromToken->_tokType); tokType(fromToken->mTokType);
mFlags = fromToken->mFlags; mFlags = fromToken->mFlags;
mVarId = fromToken->mVarId; mVarId = fromToken->mVarId;
_fileIndex = fromToken->_fileIndex; _fileIndex = fromToken->_fileIndex;
@ -710,7 +710,7 @@ bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)
std::size_t Token::getStrLength(const Token *tok) std::size_t Token::getStrLength(const Token *tok)
{ {
assert(tok != nullptr); assert(tok != nullptr);
assert(tok->_tokType == eString); assert(tok->mTokType == eString);
std::size_t len = 0; std::size_t len = 0;
std::string::const_iterator it = tok->str().begin() + 1U; std::string::const_iterator it = tok->str().begin() + 1U;
@ -1001,7 +1001,7 @@ void Token::stringify(std::ostream& os, bool varid, bool attributes, bool macro)
if (isComplex()) if (isComplex())
os << "_Complex "; os << "_Complex ";
if (isLong()) { if (isLong()) {
if (_tokType == eString || _tokType == eChar) if (mTokType == eString || mTokType == eChar)
os << "L"; os << "L";
else else
os << "long "; os << "long ";
@ -1670,7 +1670,7 @@ void Token::type(const ::Type *t)
if (t) { if (t) {
tokType(eType); tokType(eType);
isEnumType(_type->isEnumType()); isEnumType(_type->isEnumType());
} else if (_tokType == eType) } else if (mTokType == eType)
tokType(eName); tokType(eName);
} }

View File

@ -246,28 +246,28 @@ public:
} }
Token::Type tokType() const { Token::Type tokType() const {
return _tokType; return mTokType;
} }
void tokType(Token::Type t) { void tokType(Token::Type t) {
_tokType = t; mTokType = t;
const bool memoizedIsName = (_tokType == eName || _tokType == eType || _tokType == eVariable || const bool memoizedIsName = (mTokType == eName || mTokType == eType || mTokType == eVariable ||
_tokType == eFunction || _tokType == eKeyword || _tokType == eBoolean || mTokType == eFunction || mTokType == eKeyword || mTokType == eBoolean ||
_tokType == eEnumerator); // TODO: "true"/"false" aren't really a name... mTokType == eEnumerator); // TODO: "true"/"false" aren't really a name...
setFlag(fIsName, memoizedIsName); setFlag(fIsName, memoizedIsName);
const bool memoizedIsLiteral = (_tokType == eNumber || _tokType == eString || _tokType == eChar || const bool memoizedIsLiteral = (mTokType == eNumber || mTokType == eString || mTokType == eChar ||
_tokType == eBoolean || _tokType == eLiteral || _tokType == eEnumerator); mTokType == eBoolean || mTokType == eLiteral || mTokType == eEnumerator);
setFlag(fIsLiteral, memoizedIsLiteral); setFlag(fIsLiteral, memoizedIsLiteral);
} }
void isKeyword(const bool kwd) { void isKeyword(const bool kwd) {
if (kwd) if (kwd)
tokType(eKeyword); tokType(eKeyword);
else if (_tokType == eKeyword) else if (mTokType == eKeyword)
tokType(eName); tokType(eName);
} }
bool isKeyword() const { bool isKeyword() const {
return _tokType == eKeyword; return mTokType == eKeyword;
} }
bool isName() const { bool isName() const {
return getFlag(fIsName); return getFlag(fIsName);
@ -277,37 +277,37 @@ public:
return getFlag(fIsLiteral); return getFlag(fIsLiteral);
} }
bool isNumber() const { bool isNumber() const {
return _tokType == eNumber; return mTokType == eNumber;
} }
bool isEnumerator() const { bool isEnumerator() const {
return _tokType == eEnumerator; return mTokType == eEnumerator;
} }
bool isOp() const { bool isOp() const {
return (isConstOp() || return (isConstOp() ||
isAssignmentOp() || isAssignmentOp() ||
_tokType == eIncDecOp); mTokType == eIncDecOp);
} }
bool isConstOp() const { bool isConstOp() const {
return (isArithmeticalOp() || return (isArithmeticalOp() ||
_tokType == eLogicalOp || mTokType == eLogicalOp ||
_tokType == eComparisonOp || mTokType == eComparisonOp ||
_tokType == eBitOp); mTokType == eBitOp);
} }
bool isExtendedOp() const { bool isExtendedOp() const {
return isConstOp() || return isConstOp() ||
_tokType == eExtendedOp; mTokType == eExtendedOp;
} }
bool isArithmeticalOp() const { bool isArithmeticalOp() const {
return _tokType == eArithmeticalOp; return mTokType == eArithmeticalOp;
} }
bool isComparisonOp() const { bool isComparisonOp() const {
return _tokType == eComparisonOp; return mTokType == eComparisonOp;
} }
bool isAssignmentOp() const { bool isAssignmentOp() const {
return _tokType == eAssignmentOp; return mTokType == eAssignmentOp;
} }
bool isBoolean() const { bool isBoolean() const {
return _tokType == eBoolean; return mTokType == eBoolean;
} }
bool isUnaryPreOp() const; bool isUnaryPreOp() const;
@ -679,7 +679,7 @@ public:
_function = f; _function = f;
if (f) if (f)
tokType(eFunction); tokType(eFunction);
else if (_tokType == eFunction) else if (mTokType == eFunction)
tokType(eName); tokType(eName);
} }
@ -687,7 +687,7 @@ public:
* @return a pointer to the Function associated with this token. * @return a pointer to the Function associated with this token.
*/ */
const Function *function() const { const Function *function() const {
return _tokType == eFunction ? _function : nullptr; return mTokType == eFunction ? _function : nullptr;
} }
/** /**
@ -698,7 +698,7 @@ public:
_variable = v; _variable = v;
if (v || mVarId) if (v || mVarId)
tokType(eVariable); tokType(eVariable);
else if (_tokType == eVariable) else if (mTokType == eVariable)
tokType(eName); tokType(eName);
} }
@ -706,7 +706,7 @@ public:
* @return a pointer to the variable associated with this token. * @return a pointer to the variable associated with this token.
*/ */
const Variable *variable() const { const Variable *variable() const {
return _tokType == eVariable ? _variable : nullptr; return mTokType == eVariable ? _variable : nullptr;
} }
/** /**
@ -719,14 +719,14 @@ public:
* @return a pointer to the type associated with this token. * @return a pointer to the type associated with this token.
*/ */
const ::Type *type() const { const ::Type *type() const {
return _tokType == eType ? _type : nullptr; return mTokType == eType ? _type : nullptr;
} }
/** /**
* @return a pointer to the Enumerator associated with this token. * @return a pointer to the Enumerator associated with this token.
*/ */
const Enumerator *enumerator() const { const Enumerator *enumerator() const {
return _tokType == eEnumerator ? _enumerator : nullptr; return mTokType == eEnumerator ? _enumerator : nullptr;
} }
/** /**
@ -737,7 +737,7 @@ public:
_enumerator = e; _enumerator = e;
if (e) if (e)
tokType(eEnumerator); tokType(eEnumerator);
else if (_tokType == eEnumerator) else if (mTokType == eEnumerator)
tokType(eName); tokType(eName);
} }
@ -929,7 +929,7 @@ private:
*/ */
unsigned int _progressValue; unsigned int _progressValue;
Token::Type _tokType; Token::Type mTokType;
enum { enum {
fIsUnsigned = (1 << 0), fIsUnsigned = (1 << 0),