mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Refactor Z3 read callback.
This commit is contained in:
@@ -95,10 +95,11 @@ void SMTLib2Interface::addAssertion(Expression const& _expr)
|
||||
|
||||
pair<CheckResult, vector<string>> SMTLib2Interface::check(vector<Expression> const& _expressionsToEvaluate)
|
||||
{
|
||||
string response = m_communicator.communicate(
|
||||
string response = querySolver(
|
||||
boost::algorithm::join(m_accumulatedOutput, "\n") +
|
||||
checkSatAndGetValuesCommand(_expressionsToEvaluate)
|
||||
);
|
||||
|
||||
CheckResult result;
|
||||
// TODO proper parsing
|
||||
if (boost::starts_with(response, "sat\n"))
|
||||
@@ -173,3 +174,14 @@ vector<string> SMTLib2Interface::parseValues(string::const_iterator _start, stri
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
string SMTLib2Interface::querySolver(string const& _input)
|
||||
{
|
||||
if (!m_queryCallback)
|
||||
BOOST_THROW_EXCEPTION(SolverError() << errinfo_comment("No SMT solver available."));
|
||||
|
||||
ReadCallback::Result queryResult = m_queryCallback(_input);
|
||||
if (!queryResult.success)
|
||||
BOOST_THROW_EXCEPTION(SolverError() << errinfo_comment(queryResult.responseOrErrorMessage));
|
||||
return queryResult.responseOrErrorMessage;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user