Merge pull request #808 from simartin/ticket_7565

Ticket #7565: Handle numbers with several C++14 integer literals.
This commit is contained in:
amai2012 2016-07-02 22:03:47 +02:00 committed by GitHub
commit d7bf0f4e4e
2 changed files with 4 additions and 1 deletions

View File

@ -1280,6 +1280,8 @@ bool MathLib::isDigitSeparator(const std::string& iCode, std::string::size_type
case '~': case '~':
case '=': case '=':
return true; return true;
case '\'':
return isDigitSeparator(iCode, i);
default: default:
return false; return false;
} }

View File

@ -1145,7 +1145,7 @@ private:
ASSERT_THROW(MathLib::normalizeCharacterLiteral("\\c"), InternalError); ASSERT_THROW(MathLib::normalizeCharacterLiteral("\\c"), InternalError);
} }
void CPP14DigitSeparators() { // Ticket #7137 void CPP14DigitSeparators() { // Ticket #7137, #7565
ASSERT(MathLib::isDigitSeparator("'", 0) == false); ASSERT(MathLib::isDigitSeparator("'", 0) == false);
ASSERT(MathLib::isDigitSeparator("123'0;", 3)); ASSERT(MathLib::isDigitSeparator("123'0;", 3));
ASSERT(MathLib::isDigitSeparator("foo(1'2);", 5)); ASSERT(MathLib::isDigitSeparator("foo(1'2);", 5));
@ -1160,6 +1160,7 @@ private:
ASSERT(MathLib::isDigitSeparator("if (120|1'2) { char c = 'c'; }", 9)); ASSERT(MathLib::isDigitSeparator("if (120|1'2) { char c = 'c'; }", 9));
ASSERT(MathLib::isDigitSeparator("if (120%1'2) { char c = 'c'; }", 24) == false); ASSERT(MathLib::isDigitSeparator("if (120%1'2) { char c = 'c'; }", 24) == false);
ASSERT(MathLib::isDigitSeparator("if (120%1'2) { char c = 'c'; }", 26) == false); ASSERT(MathLib::isDigitSeparator("if (120%1'2) { char c = 'c'; }", 26) == false);
ASSERT(MathLib::isDigitSeparator("0b0000001'0010'01110", 14));
} }
}; };