diff options
author | David Robillard <d@drobilla.net> | 2009-10-15 19:24:00 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-10-15 19:24:00 +0000 |
commit | c139e62f1fa1341eaa9c6f7b7d8e54601721a329 (patch) | |
tree | a20204e68f4ed3128973cd32f443cb9a8f91a9c4 /src/pprint.cpp | |
parent | 7743d332e41c7795dcbaa49511293f22597e4db7 (diff) | |
download | resp-c139e62f1fa1341eaa9c6f7b7d8e54601721a329.tar.gz resp-c139e62f1fa1341eaa9c6f7b7d8e54601721a329.tar.bz2 resp-c139e62f1fa1341eaa9c6f7b7d8e54601721a329.zip |
Remove all use of ATuple::at().
git-svn-id: http://svn.drobilla.net/resp/tuplr@229 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/pprint.cpp')
-rw-r--r-- | src/pprint.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/pprint.cpp b/src/pprint.cpp index 1632f02..3f2a5b8 100644 --- a/src/pprint.cpp +++ b/src/pprint.cpp @@ -56,8 +56,12 @@ operator<<(ostream& out, const AST* ast) const ATuple* tup = ast->to<const ATuple*>(); if (tup) { out << "("; - for (size_t i = 0; i != tup->size(); ++i) - out << tup->at(i) << ((i != tup->size() - 1) ? " " : ""); + for (ATuple::const_iterator i = tup->begin(); i != tup->end(); ) { + ATuple::const_iterator next = i; + ++next; + out << (*i) << ((next != tup->end()) ? " " : ""); + i = next; + } return out << ")"; } @@ -69,6 +73,7 @@ pprint_internal(ostream& out, const AST* ast, unsigned indent) { const ATuple* tup = ast->to<const ATuple*>(); if (tup && tup->size() > 0) { + ATuple::const_iterator i = tup->begin() + 1; const string head = tup->head()->str(); const ASymbol* headSym = tup->head()->to<const ASymbol*>(); out << "("; @@ -77,16 +82,16 @@ pprint_internal(ostream& out, const AST* ast, unsigned indent) if (tup->size() > 1) { out << " "; if (headSym && headSym->cppstr == "fn") { - out << tup->at(1); + out << *i; child_indent = indent + 4; } else { child_indent += head.length() + 1; - pprint_internal(out, tup->at(1), child_indent); + pprint_internal(out, *i, child_indent); } } - for (size_t i = 2; i < tup->size(); ++i) { + while (++i != tup->end()) { out << endl << string().insert(0, child_indent, ' '); - pprint_internal(out, tup->at(i), child_indent); + pprint_internal(out, *i, child_indent); } out << ")"; if (headSym && headSym->cppstr == "fn") |