feat(kernel/formatter): improve simple printer support for Pi and lambda

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-05-19 08:16:32 -07:00
parent 28b70b4e04
commit 39e101d323

View file

@ -116,23 +116,31 @@ struct print_expr_fn {
print_child(b); print_child(b);
} }
void print_binding(char const * bname, expr const & e) { void print_binding(char const * bname, expr e) {
auto p = binding_body_fresh(e); expr_kind k = e.kind();
expr const & b = p.first; out() << bname;
expr const & n = p.second; while (e.kind() == k) {
out() << bname << " "; out() << " ";
if (binding_info(e).is_implicit()) auto p = binding_body_fresh(e);
out() << "{"; expr const & n = p.second;
else if (binding_info(e).is_cast()) if (binding_info(e).is_implicit())
out() << "["; out() << "{";
out() << n << " : "; else if (binding_info(e).is_cast())
print_child(binding_domain(e)); out() << "[";
if (binding_info(e).is_implicit()) else
out() << "}"; out() << "(";
else if (binding_info(e).is_cast()) out() << n << " : ";
out() << "]"; print(binding_domain(e));
if (binding_info(e).is_implicit())
out() << "}";
else if (binding_info(e).is_cast())
out() << "]";
else
out() << ")";
e = p.first;
}
out() << ", "; out() << ", ";
print_child(b); print_child(e);
} }
void print_const(expr const & a) { void print_const(expr const & a) {