From 9ba1ca23fb217c747117c5bbff3fcaac98f5f261 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 27 Jun 2009 00:09:30 +0000 Subject: More CPS conversion work. git-svn-id: http://svn.drobilla.net/resp/tuplr@151 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- write.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'write.cpp') diff --git a/write.cpp b/write.cpp index ba000f3..04e3401 100644 --- a/write.cpp +++ b/write.cpp @@ -65,24 +65,24 @@ pprint_internal(ostream& out, const AST* ast, unsigned indent) ASymbol* headSym = tup->at(0)->to(); out << "("; pprint_internal(out, tup->at(0), indent); + unsigned child_indent = 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); + if (headSym && headSym->cppstr == "fn") { + out << tup->at(1); + child_indent = indent + 4; + } else { + child_indent += head.length() + 1; + pprint_internal(out, tup->at(1), child_indent); + } } 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 << endl << string().insert(0, child_indent, ' '); + pprint_internal(out, tup->at(i), child_indent); } out << ")"; if (headSym && headSym->cppstr == "fn") - out << endl << string().insert(0, indent, ' '); + out << endl << string().insert(0, indent + 4, ' '); } else { out << ast; } -- cgit v1.2.1