diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-02-19 14:27:01 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-02-19 14:27:01 -0800 |
commit | 8a3d101e3d617107596c3eed393571eb5cbddbd6 (patch) | |
tree | 1de86675b679e387f8ba5f27f84fa1f69dd08d66 /010vm.cc | |
parent | 2cdf4a049f282d07273d2ce83853ee315be6b361 (diff) | |
download | mu-8a3d101e3d617107596c3eed393571eb5cbddbd6.tar.gz |
2689 - consistently use s-exp syntax in traces
Diffstat (limited to '010vm.cc')
-rw-r--r-- | 010vm.cc | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/010vm.cc b/010vm.cc index 0d244090..a14bd0d7 100644 --- a/010vm.cc +++ b/010vm.cc @@ -486,7 +486,7 @@ void dump(const string_tree* x, ostream& out) { } string debug_string(const string_tree* property) { - if (!property) return "<>"; + if (!property) return "()"; ostringstream out; if (!property->left && !property->right) // abbreviate a single-node tree to just its contents @@ -496,18 +496,20 @@ string debug_string(const string_tree* property) { return out.str(); } -void dump_debug(const string_tree* property, ostream& out) { - out << "<"; - if (property->left) - dump_debug(property->left, out); - else - out << '"' << property->value << '"'; - out << " : "; - if (property->right) - dump_debug(property->right, out); - else - out << "<>"; - out << ">"; +void dump_debug(const string_tree* x, ostream& out) { + if (!x->left && !x->right) { + out << x->value; + return; + } + out << '('; + for (const string_tree* curr = x; curr; curr = curr->right) { + if (curr != x) out << ' '; + if (curr->left) + dump_debug(curr->left, out); + else + out << '"' << curr->value << '"'; + } + out << ')'; } string debug_string(const type_tree* type) { |