mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
more qualifying
This commit is contained in:
@@ -42,11 +42,10 @@ namespace
|
||||
|
||||
int parseUnsignedInteger(string::iterator& _it, string::iterator _end)
|
||||
{
|
||||
auto isDigit = [](char _c) -> bool {return isdigit(_c, std::locale::classic());};
|
||||
if (_it == _end || !isDigit(*_it))
|
||||
if (_it == _end || !util::isDigit(*_it))
|
||||
BOOST_THROW_EXCEPTION(runtime_error("Invalid test expectation. Source location expected."));
|
||||
int result = 0;
|
||||
while (_it != _end && isDigit(*_it))
|
||||
while (_it != _end && util::isDigit(*_it))
|
||||
{
|
||||
result *= 10;
|
||||
result += *_it - '0';
|
||||
@@ -195,7 +194,6 @@ string CommonSyntaxTest::errorMessage(Exception const& _e)
|
||||
|
||||
vector<SyntaxTestError> CommonSyntaxTest::parseExpectations(istream& _stream)
|
||||
{
|
||||
auto isDigit = [](char _c) -> bool {return isdigit(_c, std::locale::classic());};
|
||||
vector<SyntaxTestError> expectations;
|
||||
string line;
|
||||
while (getline(_stream, line))
|
||||
@@ -215,7 +213,7 @@ vector<SyntaxTestError> CommonSyntaxTest::parseExpectations(istream& _stream)
|
||||
skipWhitespace(it, line.end());
|
||||
|
||||
optional<ErrorId> errorId;
|
||||
if (it != line.end() && isDigit(*it))
|
||||
if (it != line.end() && util::isDigit(*it))
|
||||
errorId = ErrorId{static_cast<unsigned long long>(parseUnsignedInteger(it, line.end()))};
|
||||
|
||||
expect(it, line.end(), ':');
|
||||
@@ -228,7 +226,7 @@ vector<SyntaxTestError> CommonSyntaxTest::parseExpectations(istream& _stream)
|
||||
if (it != line.end() && *it == '(')
|
||||
{
|
||||
++it;
|
||||
if (it != line.end() && !isDigit(*it))
|
||||
if (it != line.end() && !util::isDigit(*it))
|
||||
{
|
||||
auto sourceNameStart = it;
|
||||
while (it != line.end() && *it != ':')
|
||||
|
||||
@@ -763,12 +763,11 @@ string TestFileParser::Scanner::scanString()
|
||||
char TestFileParser::Scanner::scanHexPart()
|
||||
{
|
||||
auto toLower = [](char _c) -> char { return tolower(_c, locale::classic()); };
|
||||
auto isDigit = [](char _c) -> bool { return isdigit(_c, locale::classic()); };
|
||||
|
||||
advance(); // skip 'x'
|
||||
|
||||
int value{};
|
||||
if (isDigit(current()))
|
||||
if (util::isDigit(current()))
|
||||
value = current() - '0';
|
||||
else if (toLower(current()) >= 'a' && toLower(current()) <= 'f')
|
||||
value = toLower(current()) - 'a' + 10;
|
||||
@@ -780,7 +779,7 @@ char TestFileParser::Scanner::scanHexPart()
|
||||
return static_cast<char>(value);
|
||||
|
||||
value <<= 4;
|
||||
if (isDigit(current()))
|
||||
if (util::isDigit(current()))
|
||||
value |= current() - '0';
|
||||
else if (toLower(current()) >= 'a' && toLower(current()) <= 'f')
|
||||
value |= toLower(current()) - 'a' + 10;
|
||||
|
||||
Reference in New Issue
Block a user