mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix guessing of numbers.
This commit is contained in:
parent
27261f6703
commit
4098661b89
@ -640,7 +640,10 @@ namespace
|
||||
{
|
||||
bool isNumber(string const& _expr)
|
||||
{
|
||||
return !_expr.empty() && (isDigit(_expr.front()) || _expr.front() == '.');
|
||||
for (char c: _expr)
|
||||
if (!isDigit(c) && c != '.')
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
rational parseRational(string const& _atom)
|
||||
{
|
||||
|
@ -129,13 +129,24 @@ string_view command(SMTLib2Expression const& _expr)
|
||||
return get<string_view>(items.front().data);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
bool isNumber(string_view const& _expr)
|
||||
{
|
||||
for (char c: _expr)
|
||||
if (!isDigit(c) && c != '.')
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
smtutil::Expression toSMTUtilExpression(SMTLib2Expression const& _expr, map<string, SortPointer> const& _variableSorts)
|
||||
{
|
||||
return std::visit(GenericVisitor{
|
||||
[&](string_view const& _atom) {
|
||||
if (_atom == "true" || _atom == "false")
|
||||
return Expression(_atom == "true");
|
||||
else if (isDigit(_atom.front()) || _atom.front() == '.')
|
||||
else if (isNumber(_atom))
|
||||
return Expression(string(_atom), {}, SortProvider::realSort);
|
||||
else
|
||||
return Expression(string(_atom), {}, _variableSorts.at(string(_atom)));
|
||||
|
Loading…
Reference in New Issue
Block a user