@@ -215,7 +215,7 @@ exprt smt2_parsert::let_expression()
215
215
return let_exprt (variables, values, where);
216
216
}
217
217
218
- exprt smt2_parsert::quantifier_expression (irep_idt id)
218
+ std::pair<binding_exprt::variablest, exprt> smt2_parsert::binding (irep_idt id)
219
219
{
220
220
if (next_token () != smt2_tokenizert::OPEN)
221
221
throw error () << " expected bindings after " << id;
@@ -264,8 +264,6 @@ exprt smt2_parsert::quantifier_expression(irep_idt id)
264
264
if (next_token () != smt2_tokenizert::CLOSE)
265
265
throw error () << " expected ')' after " << id;
266
266
267
- exprt result=expr;
268
-
269
267
// remove bindings from id_map
270
268
for (const auto &b : bindings)
271
269
id_map.erase (b.get_identifier ());
@@ -274,14 +272,17 @@ exprt smt2_parsert::quantifier_expression(irep_idt id)
274
272
for (auto &saved_id : saved_ids)
275
273
id_map.insert (std::move (saved_id));
276
274
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
+ }
283
277
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 );
285
286
}
286
287
287
288
exprt smt2_parsert::function_application (
0 commit comments