about summary refs log tree commit diff stats
path: root/050scenario.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-14 16:24:37 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-14 16:24:37 -0700
commit7c0d16a79fba21e67d3b46f12f29042f84f997ba (patch)
tree4c843b229bb359a21940cb64f69961823f58c008 /050scenario.cc
parent7fb3fccbb8f2a4b068a0e4bffa46a935e11db3a4 (diff)
downloadmu-7c0d16a79fba21e67d3b46f12f29042f84f997ba.tar.gz
1565
Diffstat (limited to '050scenario.cc')
-rw-r--r--050scenario.cc35
1 files changed, 4 insertions, 31 deletions
diff --git a/050scenario.cc b/050scenario.cc
index 0f463cfc..ae35b8dd 100644
--- a/050scenario.cc
+++ b/050scenario.cc
@@ -79,7 +79,10 @@ scenario parse_scenario(istream& in) {
   assert(in.peek() == '[');
   // scenarios are take special 'code' strings so we need to ignore brackets
   // inside comments
-  result.to_run = slurp_quoted_ignoring_comments(in);
+  result.to_run = slurp_quoted(in);
+  // delete [] delimiters
+  result.to_run.erase(0, 1);
+  result.to_run.erase(SIZE(result.to_run)-1);
   return result;
 }
 
@@ -522,33 +525,3 @@ void run_mu_scenario(const string& form) {
   scenario s = parse_scenario(in);
   run_mu_scenario(s);
 }
-
-string slurp_quoted_ignoring_comments(istream& in) {
-  assert(in.get() == '[');  // drop initial '['
-  char c;
-  ostringstream out;
-  while (in >> c) {
-//?     cerr << c << '\n'; //? 3
-    if (c == '#') {
-      // skip comment
-      in.putback(c);
-      skip_comment(in);
-      continue;
-    }
-    if (c == '[') {
-      // nested strings won't detect comments
-      // can't yet handle scenarios inside strings inside scenarios..
-      in.putback(c);
-      out << slurp_quoted(in);
-//?       cerr << "snapshot: ^" << out.str() << "$\n"; //? 2
-      continue;
-    }
-    if (c == ']') {
-      // must be at the outermost level; drop final ']'
-      break;
-    }
-    out << c;
-  }
-//?   cerr << "done\n"; //? 2
-  return out.str();
-}