parent
a3ff6d53c4
commit
4ba19c42ba
2
Makefile
2
Makefile
|
@ -627,7 +627,7 @@ $(libcppdir)/templatesimplifier.o: lib/templatesimplifier.cpp lib/color.h lib/co
|
|||
$(libcppdir)/timer.o: lib/timer.cpp lib/config.h lib/timer.h lib/utils.h
|
||||
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/timer.cpp
|
||||
|
||||
$(libcppdir)/token.o: lib/token.cpp lib/astutils.h lib/config.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/tokenrange.h lib/utils.h lib/valueflow.h lib/vfvalue.h
|
||||
$(libcppdir)/token.o: lib/token.cpp externals/simplecpp/simplecpp.h lib/astutils.h lib/config.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/tokenrange.h lib/utils.h lib/valueflow.h lib/vfvalue.h
|
||||
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/token.cpp
|
||||
|
||||
$(libcppdir)/tokenlist.o: lib/tokenlist.cpp externals/simplecpp/simplecpp.h lib/astutils.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/keywords.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenlist.h lib/utils.h lib/vfvalue.h
|
||||
|
|
|
@ -949,7 +949,7 @@ void simplecpp::TokenList::combineOperators()
|
|||
if (tok->previous && tok->previous->number && sameline(tok->previous, tok)) {
|
||||
tok->setstr(tok->previous->str() + '.');
|
||||
deleteToken(tok->previous);
|
||||
if (isFloatSuffix(tok->next) || (tok->next && tok->next->startsWithOneOf("AaBbCcDdEeFfPp"))) {
|
||||
if (sameline(tok, tok->next) && (isFloatSuffix(tok->next) || (tok->next && tok->next->startsWithOneOf("AaBbCcDdEeFfPp")))) {
|
||||
tok->setstr(tok->str() + tok->next->str());
|
||||
deleteToken(tok->next);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace simplecpp {
|
|||
name = (std::isalpha(static_cast<unsigned char>(string[0])) || string[0] == '_' || string[0] == '$')
|
||||
&& (std::memchr(string.c_str(), '\'', string.size()) == nullptr);
|
||||
comment = string.size() > 1U && string[0] == '/' && (string[1] == '/' || string[1] == '*');
|
||||
number = std::isdigit(static_cast<unsigned char>(string[0])) || (string.size() > 1U && (string[0] == '-' || string[0] == '+') && std::isdigit(static_cast<unsigned char>(string[1])));
|
||||
number = isNumberLike(string);
|
||||
op = (string.size() == 1U && !name && !comment && !number) ? string[0] : '\0';
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,10 @@ namespace simplecpp {
|
|||
bool isOneOf(const char ops[]) const;
|
||||
bool startsWithOneOf(const char c[]) const;
|
||||
bool endsWithOneOf(const char c[]) const;
|
||||
static bool isNumberLike(const std::string& str) {
|
||||
return std::isdigit(static_cast<unsigned char>(str[0])) ||
|
||||
(str.size() > 1U && (str[0] == '-' || str[0] == '+') && std::isdigit(static_cast<unsigned char>(str[1])));
|
||||
}
|
||||
|
||||
TokenString macro;
|
||||
char op;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "errortypes.h"
|
||||
#include "library.h"
|
||||
#include "settings.h"
|
||||
#include "simplecpp.h"
|
||||
#include "symboldatabase.h"
|
||||
#include "tokenlist.h"
|
||||
#include "utils.h"
|
||||
|
@ -143,7 +144,7 @@ void Token::update_property_info()
|
|||
tokType(eKeyword);
|
||||
else if (mTokType != eVariable && mTokType != eFunction && mTokType != eType && mTokType != eKeyword)
|
||||
tokType(eName);
|
||||
} else if (std::isdigit((unsigned char)mStr[0]) || (mStr.length() > 1 && mStr[0] == '-' && std::isdigit((unsigned char)mStr[1]))) {
|
||||
} else if (simplecpp::Token::isNumberLike(mStr)) {
|
||||
if (MathLib::isInt(mStr) || MathLib::isFloat(mStr))
|
||||
tokType(eNumber);
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue