@@ -215,7 +215,7 @@ exprt smt2_parsert::let_expression()
215215 return let_exprt (variables, values, where);
216216}
217217
218- exprt smt2_parsert::quantifier_expression (irep_idt id)
218+ std::pair<binding_exprt::variablest, exprt> smt2_parsert::binding (irep_idt id)
219219{
220220 if (next_token () != smt2_tokenizert::OPEN)
221221 throw error () << " expected bindings after " << id;
@@ -264,8 +264,6 @@ exprt smt2_parsert::quantifier_expression(irep_idt id)
264264 if (next_token () != smt2_tokenizert::CLOSE)
265265 throw error () << " expected ')' after " << id;
266266
267- exprt result=expr;
268-
269267 // remove bindings from id_map
270268 for (const auto &b : bindings)
271269 id_map.erase (b.get_identifier ());
@@ -274,14 +272,17 @@ exprt smt2_parsert::quantifier_expression(irep_idt id)
274272 for (auto &saved_id : saved_ids)
275273 id_map.insert (std::move (saved_id));
276274
277- // go backwards, build quantified expression
278- for (auto r_it=bindings.rbegin (); r_it!=bindings.rend (); r_it++)
279- {
280- quantifier_exprt quantifier (id, *r_it, result);
281- result=quantifier;
282- }
275+ return {std::move (bindings), std::move (expr)};
276+ }
283277
284- return result;
278+ exprt smt2_parsert::quantifier_expression (irep_idt id)
279+ {
280+ auto binding = this ->binding (id);
281+
282+ if (binding.second .type ().id () != ID_bool)
283+ throw error () << id << " expects a boolean term" ;
284+
285+ return quantifier_exprt (id, binding.first , binding.second );
285286}
286287
287288exprt smt2_parsert::function_application (
0 commit comments