about summary refs log tree commit diff stats
path: root/cpp/010vm
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-03-30 21:22:29 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-03-30 21:22:29 -0700
commit66b97b4d923274e1b6d2fd97df16cb73d820169b (patch)
tree9d05c3e8301381608d9619eae976c5459fbfa5d2 /cpp/010vm
parenta7b6abf6262c1ac556c2cf9a5890eccb4d6b6872 (diff)
downloadmu-66b97b4d923274e1b6d2fd97df16cb73d820169b.tar.gz
996 - string literals
Diffstat (limited to 'cpp/010vm')
-rw-r--r--cpp/010vm10
1 files changed, 10 insertions, 0 deletions
diff --git a/cpp/010vm b/cpp/010vm
index 76ccc4bf..966b095e 100644
--- a/cpp/010vm
+++ b/cpp/010vm
@@ -148,9 +148,11 @@ void setup_recipes() {
   // Reagents have the form <name>:<type>:<type>:.../<property>/<property>/...
   reagent::reagent(string s) :value(0), initialized(false) {
     istringstream in(s);
+    in >> std::noskipws;
     // properties
     while (!in.eof()) {
       istringstream row(slurp_until(in, '/'));
+      row >> std::noskipws;
       string name = slurp_until(row, ':');
       vector<string> values;
       while (!row.eof())
@@ -162,6 +164,14 @@ void setup_recipes() {
     for (size_t i = 0; i < properties[0].second.size(); ++i) {
       types.push_back(Type_number[properties[0].second[i]]);
     }
+    if (name == "_" && types.empty()) {
+      types.push_back(0);
+      properties[0].second.push_back("dummy");
+    }
+    else if (types.empty()) {  // hacky test for string
+      types.push_back(0);
+      properties[0].second.push_back("literal-string");
+    }
   }
   reagent::reagent() :value(0), initialized(false) {}
   string reagent::to_string() {