about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--010vm.cc8
-rw-r--r--013literal_string.cc10
2 files changed, 13 insertions, 5 deletions
diff --git a/010vm.cc b/010vm.cc
index ffc92c60..5be84982 100644
--- a/010vm.cc
+++ b/010vm.cc
@@ -203,6 +203,9 @@ reagent::reagent() :value(0), initialized(false) {
   properties.push_back(pair<string, vector<string> >("", vector<string>()));
 }
 string reagent::to_string() const {
+  if (!properties.at(0).second.empty() && properties.at(0).second.at(0) == "literal-string") {
+    return emit_literal_string(name);
+  }
   ostringstream out;
   out << "{name: \"" << name << "\"";
   if (!properties.empty()) {
@@ -218,9 +221,14 @@ string reagent::to_string() const {
     }
   }
   out << "}";
+//?   if (properties.at(0).second.empty()) cerr << out.str(); //? 1
   return out.str();
 }
 
+string emit_literal_string(string name) {
+  return "{name: \""+name+"\", properties: [_: \"literal-string\"]}";
+}
+
 string instruction::to_string() const {
   if (is_label) return label;
   ostringstream out;
diff --git a/013literal_string.cc b/013literal_string.cc
index b31bc702..41644b1c 100644
--- a/013literal_string.cc
+++ b/013literal_string.cc
@@ -10,13 +10,13 @@
 recipe main [
   1:address:array:character <- copy [abc def]  # copy can't really take a string
 ]
-+parse:   ingredient: {name: "abc def", properties: ["abc def": "literal-string"]}
++parse:   ingredient: {name: "abc def", properties: [_: "literal-string"]}
 
 :(scenario string_literal_with_colons)
 recipe main [
   1:address:array:character <- copy [abc:def/ghi]
 ]
-+parse:   ingredient: {name: "abc:def/ghi", properties: ["abc:def/ghi": "literal-string"]}
++parse:   ingredient: {name: "abc:def/ghi", properties: [_: "literal-string"]}
 
 :(before "End Mu Types Initialization")
 Type_number["literal-string"] = 0;
@@ -73,20 +73,20 @@ string slurp_quoted(istream& in) {
 recipe main [
   1:address:array:character <- copy [abc [def]]
 ]
-+parse:   ingredient: {name: "abc [def]", properties: ["abc [def]": "literal-string"]}
++parse:   ingredient: {name: "abc [def]", properties: [_: "literal-string"]}
 
 :(scenario string_literal_escaped)
 recipe main [
   1:address:array:character <- copy [abc \[def]
 ]
-+parse:   ingredient: {name: "abc [def", properties: ["abc [def": "literal-string"]}
++parse:   ingredient: {name: "abc [def", properties: [_: "literal-string"]}
 
 :(scenario string_literal_and_comment)
 recipe main [
   1:address:array:character <- copy [abc]  # comment
 ]
 +parse: instruction: copy
-+parse:   ingredient: {name: "abc", properties: ["abc": "literal-string"]}
++parse:   ingredient: {name: "abc", properties: [_: "literal-string"]}
 +parse:   product: {name: "1", properties: ["1": "address":"array":"character"]}
 # no other ingredients
 $parse: 3