Skip to content

Commit 83415a7

Browse files
authored
Merge pull request #2978 from diffblue/format_expr_beautification
format(expr) beautification for quantifiers and = on booleans
2 parents fe2e118 + 37f5b8e commit 83415a7

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/util/format_expr.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ static std::ostream &format_rec(std::ostream &os, const multi_ary_exprt &src)
7878
operator_str = u8"\u2260"; // /=, U+2260
7979
else if(src.id() == ID_implies)
8080
operator_str = u8"\u21d2"; // =>, U+21D2
81+
else if(src.id() == ID_equal)
82+
{
83+
if(!src.operands().empty() && src.op0().type().id() == ID_bool)
84+
operator_str = u8"\u21d4"; // <=>, U+21D4
85+
else
86+
operator_str = "=";
87+
}
8188
else
8289
operator_str = id2string(src.id());
8390

@@ -217,13 +224,13 @@ std::ostream &format_rec(std::ostream &os, const exprt &expr)
217224
else if(id == ID_type)
218225
return format_rec(os, expr.type());
219226
else if(id == ID_forall)
220-
return os << id << u8" \u2200 : "
221-
<< format(to_quantifier_expr(expr).symbol().type()) << " . "
222-
<< format(to_quantifier_expr(expr).where());
227+
return os << u8"\u2200 " << format(to_quantifier_expr(expr).symbol())
228+
<< " : " << format(to_quantifier_expr(expr).symbol().type())
229+
<< " . " << format(to_quantifier_expr(expr).where());
223230
else if(id == ID_exists)
224-
return os << id << u8" \u2203 : "
225-
<< format(to_quantifier_expr(expr).symbol().type()) << " . "
226-
<< format(to_quantifier_expr(expr).where());
231+
return os << u8"\u2203 " << format(to_quantifier_expr(expr).symbol())
232+
<< " : " << format(to_quantifier_expr(expr).symbol().type())
233+
<< " . " << format(to_quantifier_expr(expr).where());
227234
else if(id == ID_let)
228235
return os << "LET " << format(to_let_expr(expr).symbol()) << " = "
229236
<< format(to_let_expr(expr).value()) << " IN "

0 commit comments

Comments
 (0)