aboutsummaryrefslogtreecommitdiffstats
path: root/src/pprint.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-30 23:23:04 +0000
committerDavid Robillard <d@drobilla.net>2010-12-30 23:23:04 +0000
commit0c50a9b37e2f30dd4b3800017ebdd87481fcfa09 (patch)
treee34374e04024336ec2b4ac7f7892c232e5a26b66 /src/pprint.cpp
parent03b9284e4b451ba748b196657d2d21c463421627 (diff)
downloadresp-0c50a9b37e2f30dd4b3800017ebdd87481fcfa09.tar.gz
resp-0c50a9b37e2f30dd4b3800017ebdd87481fcfa09.tar.bz2
resp-0c50a9b37e2f30dd4b3800017ebdd87481fcfa09.zip
Abbreviate (def (fn ...))
git-svn-id: http://svn.drobilla.net/resp/resp@381 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/pprint.cpp')
-rw-r--r--src/pprint.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/pprint.cpp b/src/pprint.cpp
index 0ea80ef..718e43b 100644
--- a/src/pprint.cpp
+++ b/src/pprint.cpp
@@ -137,14 +137,24 @@ print_to(ostream& out, const AST* ast, unsigned indent, CEnv* cenv, bool types)
}
if (form == "def") {
- out << (*i++); // Print symbol
- unsigned child_indent = types ? indent + 2 : indent;
- if (types) {
- print_annotation(out, tup->list_ref(2), indent + head_width + 1, cenv, true);
- newline(out, child_indent);
+ if (tup->rrst() && is_form(tup->frrst(), "fn")) {
+ // Abreviate (def (fn (...) ...))
+ out << "(" << (*i++) << " ";
+ const ATuple* const fn = tup->frrst()->as_tuple();
+ const ATuple* const prot = fn->frst()->as_tuple();
+ print_list_one_line(out, prot, prot->begin(), indent + 7, cenv, types, types);
+ newline(out, indent + 2);
+ print_list(out, fn, fn->iter_at(2), indent + 2, cenv, types, false);
+ } else {
+ const unsigned child_indent = types ? indent + 2 : indent;
+ out << (*i++); // Print symbol
+ if (types) {
+ print_annotation(out, tup->list_ref(2), indent + head_width + 1, cenv, true);
+ newline(out, child_indent);
+ }
+ out << " ";
+ print_to(out, *i++, child_indent, cenv, types);
}
- out << " ";
- print_to(out, *i++, child_indent, cenv, types);
out << ")";
} else if (form == "def-type") {