aboutsummaryrefslogtreecommitdiffstats
path: root/src/pprint.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-09 17:58:43 +0000
committerDavid Robillard <d@drobilla.net>2010-12-09 17:58:43 +0000
commitacf13b1df559c6187d270ef7e31890201c191b12 (patch)
tree4a3d07f257efac1cd5ef51b21af2e55d4fd798b5 /src/pprint.cpp
parentd92de14f7d8354004edb14ed5658d5f434ce1e31 (diff)
downloadresp-acf13b1df559c6187d270ef7e31890201c191b12.tar.gz
resp-acf13b1df559c6187d270ef7e31890201c191b12.tar.bz2
resp-acf13b1df559c6187d270ef7e31890201c191b12.zip
Add let form.
git-svn-id: http://svn.drobilla.net/resp/resp@328 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/pprint.cpp')
-rw-r--r--src/pprint.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/pprint.cpp b/src/pprint.cpp
index d082b5d..5ceb039 100644
--- a/src/pprint.cpp
+++ b/src/pprint.cpp
@@ -141,6 +141,31 @@ print_to(ostream& out, const AST* ast, unsigned indent, CEnv* cenv, bool types)
newline(out, 0);
return out;
+ } else if (form == "let") {
+ out << (*i++) << " (";
+ const ATuple* vars = (*i)->as_tuple();
+ for (ATuple::const_iterator v = vars->begin(); v != vars->end();) {
+ out << (*v);
+
+ if (types)
+ out << " :" << cenv->tsubst.apply(cenv->tenv.var(*v));
+
+ out << " " << (*++v);
+
+ if (++v != vars->end())
+ newline(out, indent + 6);
+ else
+ out << ")";
+ }
+ newline(out, indent + 2);
+ for (ATuple::const_iterator i = tup->iter_at(2); i != tup->end(); ++i)
+ print_to(out, *i, indent + 2, cenv, types);
+ out << ")";
+ if (types)
+ out << " :" << cenv->tsubst.apply(cenv->tenv.var(tup->list_last()));
+
+ return out;
+
} else {
return print_tuple(out, tup, i, indent + 1, false, cenv, types, false);
}
@@ -157,7 +182,7 @@ print_to(ostream& out, const AST* ast, unsigned indent, CEnv* cenv, bool types)
case T_SYMBOL:
return out << ((const ASymbol*)ast)->sym();
}
-
+
return out << "?";
}