about summary refs log tree commit diff stats
path: root/014literal_string.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-02-21 20:30:02 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-02-21 20:40:06 -0800
commitc4e143d6ea0635cdb164cec1c62afd7461e605ad (patch)
tree06fbb672ce95f1d5152c113cdb40685148b57d0c /014literal_string.cc
parentf22250a174d5ad5abf8bf99ad140ced52563aee2 (diff)
downloadmu-c4e143d6ea0635cdb164cec1c62afd7461e605ad.tar.gz
2681 - drop reagent types from reagent properties
All my attempts at staging this change failed with this humongous commit
that took all day and involved debugging three monstrous bugs. Two of
the bugs had to do with forgetting to check the type name in the
implementation of shape-shifting recipes. Bug #2 in particular would
cause core tests in layer 59 to fail -- only when I loaded up edit/! It
got me to just hack directly on mu.cc until I figured out the cause
(snapshot saved in mu.cc.modified). The problem turned out to be that I
accidentally saved a type ingredient in the Type table during
specialization. Now I know that that can be very bad.

I've checked the traces for any stray type numbers (rather than names).

I also found what might be a bug from last November (labeled TODO), but
we'll verify after this commit.
Diffstat (limited to '014literal_string.cc')
-rw-r--r--014literal_string.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/014literal_string.cc b/014literal_string.cc
index 7975d63e..4250772b 100644
--- a/014literal_string.cc
+++ b/014literal_string.cc
@@ -10,13 +10,13 @@
 recipe main [
   1:address:array:character <- copy [abc def]  # copy can't really take a string
 ]
-+parse:   ingredient: {"abc def": "literal-string"}
++parse:   ingredient: "abc def": "literal-string"
 
 :(scenario string_literal_with_colons)
 recipe main [
   1:address:array:character <- copy [abc:def/ghi]
 ]
-+parse:   ingredient: {"abc:def/ghi": "literal-string"}
++parse:   ingredient: "abc:def/ghi": "literal-string"
 
 :(before "End Mu Types Initialization")
 put(Type_ordinal, "literal-string", 0);
@@ -111,7 +111,6 @@ if (s.at(0) == '[') {
   strip_last(s);
   name = s;
   type = new type_tree("literal-string", 0);
-  properties.push_back(pair<string, string_tree*>(name, new string_tree("literal-string")));
   return;
 }
 
@@ -131,7 +130,7 @@ string emit_literal_string(string name) {
   size_t pos = 0;
   while (pos != string::npos)
     pos = replace(name, "\n", "\\n", pos);
-  return "{\""+name+"\": \"literal-string\"}";
+  return '"'+name+"\": \"literal-string\"";
 }
 
 size_t replace(string& str, const string& from, const string& to, size_t n) {
@@ -149,20 +148,20 @@ void strip_last(string& s) {
 recipe main [
   1:address:array:character <- copy [abc [def]]
 ]
-+parse:   ingredient: {"abc [def]": "literal-string"}
++parse:   ingredient: "abc [def]": "literal-string"
 
 :(scenario string_literal_escaped)
 recipe main [
   1:address:array:character <- copy [abc \[def]
 ]
-+parse:   ingredient: {"abc [def": "literal-string"}
++parse:   ingredient: "abc [def": "literal-string"
 
 :(scenario string_literal_escaped_comment_aware)
 recipe main [
   1:address:array:character <- copy [
 abc \\\[def]
 ]
-+parse:   ingredient: {"\nabc \[def": "literal-string"}
++parse:   ingredient: "\nabc \[def": "literal-string"
 
 :(scenario string_literal_and_comment)
 recipe main [
@@ -171,15 +170,15 @@ recipe main [
 +parse: --- defining main
 +parse: instruction: copy
 +parse:   number of ingredients: 1
-+parse:   ingredient: {"abc": "literal-string"}
-+parse:   product: {"1": ("address" "array" "character")}
++parse:   ingredient: "abc": "literal-string"
++parse:   product: 1: ("address" "array" "character")
 
 :(scenario string_literal_escapes_newlines_in_trace)
 recipe main [
   copy [abc
 def]
 ]
-+parse:   ingredient: {"abc\ndef": "literal-string"}
++parse:   ingredient: "abc\ndef": "literal-string"
 
 :(scenario string_literal_can_skip_past_comments)
 recipe main [
@@ -188,10 +187,10 @@ recipe main [
     bar
   ]
 ]
-+parse:   ingredient: {"\n    # ']' inside comment\n    bar\n  ": "literal-string"}
++parse:   ingredient: "\n    # ']' inside comment\n    bar\n  ": "literal-string"
 
 :(scenario string_literal_empty)
 recipe main [
   copy []
 ]
-+parse:   ingredient: {"": "literal-string"}
++parse:   ingredient: "": "literal-string"