Skip to content

format(expr) beautification for quantifiers and = on booleans #2978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/util/format_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ static std::ostream &format_rec(std::ostream &os, const multi_ary_exprt &src)
operator_str = u8"\u2260"; // /=, U+2260
else if(src.id() == ID_implies)
operator_str = u8"\u21d2"; // =>, U+21D2
else if(src.id() == ID_equal)
{
if(!src.operands().empty() && src.op0().type().id() == ID_bool)
operator_str = u8"\u21d4"; // <=>, U+21D4
else
operator_str = "=";
}
else
operator_str = id2string(src.id());

Expand Down Expand Up @@ -217,13 +224,13 @@ std::ostream &format_rec(std::ostream &os, const exprt &expr)
else if(id == ID_type)
return format_rec(os, expr.type());
else if(id == ID_forall)
return os << id << u8" \u2200 : "
<< format(to_quantifier_expr(expr).symbol().type()) << " . "
<< format(to_quantifier_expr(expr).where());
return os << u8"\u2200 " << format(to_quantifier_expr(expr).symbol())
<< " : " << format(to_quantifier_expr(expr).symbol().type())
<< " . " << format(to_quantifier_expr(expr).where());
else if(id == ID_exists)
return os << id << u8" \u2203 : "
<< format(to_quantifier_expr(expr).symbol().type()) << " . "
<< format(to_quantifier_expr(expr).where());
return os << u8"\u2203 " << format(to_quantifier_expr(expr).symbol())
<< " : " << format(to_quantifier_expr(expr).symbol().type())
<< " . " << format(to_quantifier_expr(expr).where());
else if(id == ID_let)
return os << "LET " << format(to_let_expr(expr).symbol()) << " = "
<< format(to_let_expr(expr).value()) << " IN "
Expand Down