diff --git a/simplecpp.cpp b/simplecpp.cpp index 5bd5cac..67e59ab 100755 --- a/simplecpp.cpp +++ b/simplecpp.cpp @@ -1002,7 +1002,7 @@ void simplecpp::TokenList::combineOperators() continue; } // float literals.. - if (tok->previous && tok->previous->number && sameline(tok->previous, tok)) { + if (tok->previous && tok->previous->number && sameline(tok->previous, tok) && tok->previous->str().find_first_of("._") == std::string::npos) { tok->setstr(tok->previous->str() + '.'); deleteToken(tok->previous); if (sameline(tok, tok->next) && (isFloatSuffix(tok->next) || (tok->next && tok->next->startsWithOneOf("AaBbCcDdEeFfPp")))) { diff --git a/test.cpp b/test.cpp index d8e359e..5b88978 100644 --- a/test.cpp +++ b/test.cpp @@ -390,6 +390,8 @@ static void combineOperators_floatliteral() ASSERT_EQUALS("0x1p+3f", preprocess("0x1p+3f")); ASSERT_EQUALS("0x1p+3L", preprocess("0x1p+3L")); ASSERT_EQUALS("1p + 3", preprocess("1p+3")); + ASSERT_EQUALS("1.0_a . b", preprocess("1.0_a.b")); + ASSERT_EQUALS("1_a . b", preprocess("1_a.b")); } static void combineOperators_increment()