Improve lambda/pi formatting
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
5f1c12feb8
commit
90678566b4
1 changed files with 8 additions and 4 deletions
|
@ -574,12 +574,16 @@ class pp_fn {
|
||||||
auto p = collect_nested(e, T, e.kind(), nested);
|
auto p = collect_nested(e, T, e.kind(), nested);
|
||||||
expr b = p.first;
|
expr b = p.first;
|
||||||
T = p.second;
|
T = p.second;
|
||||||
|
unsigned head_indent = m_indent;
|
||||||
format head;
|
format head;
|
||||||
if (!T) {
|
if (!T) {
|
||||||
if (m_notation)
|
if (m_notation) {
|
||||||
head = is_lambda(e) ? g_lambda_n_fmt : g_Pi_n_fmt;
|
head = is_lambda(e) ? g_lambda_n_fmt : g_Pi_n_fmt;
|
||||||
else
|
head_indent = 2;
|
||||||
|
} else {
|
||||||
head = is_lambda(e) ? g_lambda_fmt : g_Pi_fmt;
|
head = is_lambda(e) ? g_lambda_fmt : g_Pi_fmt;
|
||||||
|
head_indent = is_lambda(e) ? 4 : 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
format body_sep;
|
format body_sep;
|
||||||
if (T) {
|
if (T) {
|
||||||
|
@ -597,7 +601,7 @@ class pp_fn {
|
||||||
format sig = format{names, space(), colon(), space(), p_domain.first};
|
format sig = format{names, space(), colon(), space(), p_domain.first};
|
||||||
if (T)
|
if (T)
|
||||||
sig = format{lp(), sig, rp()};
|
sig = format{lp(), sig, rp()};
|
||||||
format r_format = group(nest(m_indent, format{head, space(), sig, body_sep, line(), p_body.first}));
|
format r_format = group(nest(head_indent, format{head, space(), sig, body_sep, line(), p_body.first}));
|
||||||
return mk_result(r_format, p_domain.second + p_body.second + 1);
|
return mk_result(r_format, p_domain.second + p_body.second + 1);
|
||||||
} else {
|
} else {
|
||||||
auto it = nested.begin();
|
auto it = nested.begin();
|
||||||
|
@ -624,7 +628,7 @@ class pp_fn {
|
||||||
it = it2;
|
it = it2;
|
||||||
}
|
}
|
||||||
result p_body = pp_scoped_child(b, depth);
|
result p_body = pp_scoped_child(b, depth);
|
||||||
format r_format = group(nest(m_indent, format{head, space(), group(bindings), body_sep, line(), p_body.first}));
|
format r_format = group(nest(head_indent, format{head, space(), group(bindings), body_sep, line(), p_body.first}));
|
||||||
return mk_result(r_format, r_weight + p_body.second);
|
return mk_result(r_format, r_weight + p_body.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue