diff options
Diffstat (limited to 'write.cpp')
-rw-r--r-- | write.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -65,24 +65,24 @@ pprint_internal(ostream& out, const AST* ast, unsigned indent) ASymbol* headSym = tup->at(0)->to<ASymbol*>(); 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; } |