Skip to content

Commit 963b866

Browse files
author
Daniel Kroening
committed
format_expr now produces unicode
1 parent 01b7418 commit 963b866

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/util/format_expr.cpp

+28-3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,27 @@ static std::ostream &format_rec(std::ostream &os, const multi_ary_exprt &src)
6262
{
6363
bool first = true;
6464

65+
std::string operator_str;
66+
67+
if(src.id() == ID_and)
68+
operator_str = u8"\u2227"; // wedge, U+2227
69+
else if(src.id() == ID_or)
70+
operator_str = u8"\u2228"; // vee, U+2228
71+
else if(src.id() == ID_xor)
72+
operator_str = u8"\u2295"; // + in circle, U+2295
73+
else if(src.id() == ID_le)
74+
operator_str = u8"\u2264"; // <=, U+2264
75+
else if(src.id() == ID_ge)
76+
operator_str = u8"\u2265"; // >=, U+2265
77+
else if(src.id() == ID_notequal)
78+
operator_str = u8"\u2260"; // /=, U+2260
79+
else if(src.id() == ID_implies)
80+
operator_str = u8"\u21d2"; // =>, U+21D2
81+
else if(src.id() == ID_iff)
82+
operator_str = u8"\u21d4"; // <=>, U+21D4
83+
else
84+
operator_str = id2string(src.id());
85+
6586
for(const auto &op : src.operands())
6687
{
6788
if(first)
@@ -95,7 +116,7 @@ static std::ostream &format_rec(std::ostream &os, const binary_exprt &src)
95116
static std::ostream &format_rec(std::ostream &os, const unary_exprt &src)
96117
{
97118
if(src.id() == ID_not)
98-
os << '!';
119+
os << u8"\u00ac"; // neg, U+00AC
99120
else if(src.id() == ID_unary_minus)
100121
os << '-';
101122
else
@@ -197,8 +218,12 @@ std::ostream &format_rec(std::ostream &os, const exprt &expr)
197218
}
198219
else if(id == ID_type)
199220
return format_rec(os, expr.type());
200-
else if(id == ID_forall || id == ID_exists)
201-
return os << id << ' ' << format(to_quantifier_expr(expr).symbol()) << " : "
221+
else if(id == ID_forall)
222+
return os << id << u8" \u2200 : "
223+
<< format(to_quantifier_expr(expr).symbol().type()) << " . "
224+
<< format(to_quantifier_expr(expr).where());
225+
else if(id == ID_exists)
226+
return os << id << u8" \u2203 : "
202227
<< format(to_quantifier_expr(expr).symbol().type()) << " . "
203228
<< format(to_quantifier_expr(expr).where());
204229
else if(id == ID_let)

0 commit comments

Comments
 (0)