about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-28 16:38:37 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-28 16:38:37 -0700
commit1f59be846a68a5a4ec456b4104a94e421d135cf1 (patch)
treee85bf0dcc344b906b8cbf47da43a5e5d2fa9db81
parent86d99645dcd8ab83a68f10c30d8321d353ae93ac (diff)
downloadmu-1f59be846a68a5a4ec456b4104a94e421d135cf1.tar.gz
1876
-rw-r--r--010vm.cc2
-rw-r--r--013literal_string.cc25
-rw-r--r--014literal_noninteger.cc18
3 files changed, 23 insertions, 22 deletions
diff --git a/010vm.cc b/010vm.cc
index 827e673e..9e6b4e24 100644
--- a/010vm.cc
+++ b/010vm.cc
@@ -176,6 +176,7 @@ void instruction::clear() { is_label=false; label.clear(); operation=IDLE; ingre
 
 // Reagents have the form <name>:<type>:<type>:.../<property>/<property>/...
 reagent::reagent(string s) :original_string(s), value(0), initialized(false) {
+  // Parsing reagent(string s)
   istringstream in(s);
   in >> std::noskipws;
   // properties
@@ -206,6 +207,7 @@ reagent::reagent(string s) :original_string(s), value(0), initialized(false) {
     types.push_back(0);
     properties.at(0).second.push_back("dummy");
   }
+  // End Parsing reagent
 }
 
 reagent::reagent() :value(0), initialized(false) {
diff --git a/013literal_string.cc b/013literal_string.cc
index 29a185b2..8054d60f 100644
--- a/013literal_string.cc
+++ b/013literal_string.cc
@@ -113,19 +113,18 @@ void slurp_quoted_comment_aware(istream& in, ostringstream& out) {
   out.clear();
 }
 
-:(after "reagent::reagent(string s)")
-//?   cout << s.at(0) << '\n'; //? 1
-  if (s.at(0) == '[') {
-    assert(*s.rbegin() == ']');
-    // delete [] delimiters
-    s.erase(0, 1);
-    s.erase(SIZE(s)-1);
-    name = s;
-    types.push_back(0);
-    properties.push_back(pair<string, vector<string> >(name, vector<string>()));
-    properties.back().second.push_back("literal-string");
-    return;
-  }
+:(after "Parsing reagent(string s)")
+if (s.at(0) == '[') {
+  assert(*s.rbegin() == ']');
+  // delete [] delimiters
+  s.erase(0, 1);
+  s.erase(SIZE(s)-1);
+  name = s;
+  types.push_back(0);
+  properties.push_back(pair<string, vector<string> >(name, vector<string>()));
+  properties.back().second.push_back("literal-string");
+  return;
+}
 
 //: Two tweaks to printing literal strings compared to other reagents:
 //:   a) Don't print the string twice in the representation, just put '_' in
diff --git a/014literal_noninteger.cc b/014literal_noninteger.cc
index 7c6e19d3..11a3fc70 100644
--- a/014literal_noninteger.cc
+++ b/014literal_noninteger.cc
@@ -7,15 +7,15 @@ recipe main [
 ]
 +parse:   ingredient: {name: "3.14159", properties: ["3.14159": "literal-number"]}
 
-:(after "reagent::reagent(string s)")
-  if (is_noninteger(s)) {
-    name = s;
-    types.push_back(0);
-    properties.push_back(pair<string, vector<string> >(name, vector<string>()));
-    properties.back().second.push_back("literal-number");
-    set_value(to_double(s));
-    return;
-  }
+:(after "Parsing reagent(string s)")
+if (is_noninteger(s)) {
+  name = s;
+  types.push_back(0);
+  properties.push_back(pair<string, vector<string> >(name, vector<string>()));
+  properties.back().second.push_back("literal-number");
+  set_value(to_double(s));
+  return;
+}
 
 :(code)
 bool is_noninteger(const string& s) {