about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--013literal_string.cc2
-rw-r--r--050scenario.cc35
2 files changed, 5 insertions, 32 deletions
diff --git a/013literal_string.cc b/013literal_string.cc
index f1416384..60fbd266 100644
--- a/013literal_string.cc
+++ b/013literal_string.cc
@@ -109,7 +109,7 @@ void slurp_quoted_comment_aware(istream& in, ostream& out) {
     assert(*s.rbegin() == ']');
     // delete [] delimiters
     s.erase(0, 1);
-    s.erase(SIZE(s)-1, SIZE(s));
+    s.erase(SIZE(s)-1);
     name = s;
     types.push_back(0);
     properties.push_back(pair<string, vector<string> >(name, vector<string>()));
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();
-}