about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-02-19 14:27:01 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-02-19 14:27:01 -0800
commit8a3d101e3d617107596c3eed393571eb5cbddbd6 (patch)
tree1de86675b679e387f8ba5f27f84fa1f69dd08d66
parent2cdf4a049f282d07273d2ce83853ee315be6b361 (diff)
downloadmu-8a3d101e3d617107596c3eed393571eb5cbddbd6.tar.gz
2689 - consistently use s-exp syntax in traces
-rw-r--r--010vm.cc28
-rw-r--r--011load.cc8
-rw-r--r--014literal_string.cc2
-rw-r--r--031address.cc2
-rw-r--r--055parse_tree.cc6
5 files changed, 24 insertions, 22 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) {
diff --git a/011load.cc b/011load.cc
index fc097e63..532eb417 100644
--- a/011load.cc
+++ b/011load.cc
@@ -321,7 +321,7 @@ recipe main [
   1:number <- copy 23/foo:bar:baz
 ]
 +parse: instruction: copy
-+parse:   ingredient: {"23": "literal", "foo": <"bar" : <"baz" : <>>>}
++parse:   ingredient: {"23": "literal", "foo": ("bar" "baz")}
 +parse:   product: {"1": "number"}
 
 :(scenario parse_multiple_products)
@@ -351,13 +351,13 @@ recipe main [
 +parse:   ingredient: {"23": "literal"}
 +parse:   ingredient: {"4": "number"}
 +parse:   product: {"1": "number"}
-+parse:   product: {"2": <"address" : <"number" : <>>>}
++parse:   product: {"2": ("address" "number")}
 
 :(scenario parse_properties)
 recipe main [
-  1:number:address/lookup <- copy 23
+  1:address:number/lookup <- copy 23
 ]
-+parse:   product: {"1": <"number" : <"address" : <>>>, "lookup": <>}
++parse:   product: {"1": ("address" "number"), "lookup": ()}
 
 //: this test we can't represent with a scenario
 :(code)
diff --git a/014literal_string.cc b/014literal_string.cc
index a94d5451..d089250e 100644
--- a/014literal_string.cc
+++ b/014literal_string.cc
@@ -172,7 +172,7 @@ recipe main [
 +parse: instruction: copy
 +parse:   number of ingredients: 1
 +parse:   ingredient: {"abc": "literal-string"}
-+parse:   product: {"1": <"address" : <"array" : <"character" : <>>>>}
++parse:   product: {"1": ("address" "array" "character")}
 
 :(scenario string_literal_escapes_newlines_in_trace)
 recipe main [
diff --git a/031address.cc b/031address.cc
index be4dd8f8..335dcd6c 100644
--- a/031address.cc
+++ b/031address.cc
@@ -194,7 +194,7 @@ recipe main [
   2:number <- copy 34
   3:number <- copy *1:address:number
 ]
-+parse: ingredient: {"1": <"address" : <"number" : <>>>, "lookup": <>}
++parse: ingredient: {"1": ("address" "number"), "lookup": ()}
 +mem: storing 34 in location 3
 
 :(before "End Parsing reagent")
diff --git a/055parse_tree.cc b/055parse_tree.cc
index f9b15adb..61cacc2f 100644
--- a/055parse_tree.cc
+++ b/055parse_tree.cc
@@ -7,7 +7,7 @@
 recipe main [
   {1: number, foo: (bar (baz quux))} <- copy 34
 ]
-+parse:   product: {"1": "number", "foo": <"bar" : <<"baz" : <"quux" : <>>> : <>>>}
++parse:   product: {"1": "number", "foo": ("bar" ("baz" "quux"))}
 
 :(before "End Parsing Reagent Property(value)")
 value = parse_string_tree(value);
@@ -65,7 +65,7 @@ container foo [
 ]
 container bar [
 ]
-+parse:   product: {"1": <"foo" : <<"address" : <"array" : <"character" : <>>>> : <<"bar" : <"number" : <>>> : <>>>>}
++parse:   product: {"1": ("foo" ("address" "array" "character") ("bar" "number"))}
 
 //: an exception is 'new', which takes a type tree as its ingredient *value*
 
@@ -73,7 +73,7 @@ container bar [
 recipe main [
   x:address:shared:address:number <- new {(address number): type}
 ]
-+new: size of <"address" : <"number" : <>>> is 1
++new: size of ("address" "number") is 1
 
 :(before "End Post-processing(expected_product) When Checking 'new'")
 expected_product.properties.at(0).second = parse_string_tree(expected_product.properties.at(0).second);