diff options
author | David Robillard <d@drobilla.net> | 2009-06-26 05:54:43 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-06-26 05:54:43 +0000 |
commit | 91d2737207d328647e1eb6c66ffca2dcc9277a46 (patch) | |
tree | 47d652f7c827a52f6f72b6d6856c9354a4a0ba48 /write.cpp | |
parent | 755c9629ec34ca5536a49d88821b8b11460756ce (diff) | |
download | resp-91d2737207d328647e1eb6c66ffca2dcc9277a46.tar.gz resp-91d2737207d328647e1eb6c66ffca2dcc9277a46.tar.bz2 resp-91d2737207d328647e1eb6c66ffca2dcc9277a46.zip |
More CPS conversion work.
git-svn-id: http://svn.drobilla.net/resp/tuplr@150 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'write.cpp')
-rw-r--r-- | write.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -59,18 +59,30 @@ operator<<(ostream& out, const AST* ast) void pprint_internal(ostream& out, const AST* ast, unsigned indent) { - out << string().insert(0, indent, ' '); const ATuple* tup = ast->to<const ATuple*>(); - if (tup) { + if (tup && tup->size() > 0) { const string head = tup->at(0)->str(); - out << "(" << head; - if (tup->size() > 1) - out << " " << tup->at(1); - for (size_t i = 2; i != tup->size(); ++i) { - out << endl; + ASymbol* headSym = tup->at(0)->to<ASymbol*>(); + out << "("; + pprint_internal(out, tup->at(0), indent); + if (tup->size() > 1) { + out << " "; + if (headSym && headSym->cppstr == "fn") + out << tup->at(1) << " "; + else + pprint_internal(out, tup->at(1), indent + head.length() + 1); + } + for (size_t i = 2; i < tup->size(); ++i) { + //if (!headSym || headSym->cppstr != "def") + out << endl; + //else + // out << " "; + out << string().insert(0, indent, ' '); pprint_internal(out, tup->at(i), indent + head.length() + 2); } out << ")"; + if (headSym && headSym->cppstr == "fn") + out << endl << string().insert(0, indent, ' '); } else { out << ast; } |