about summary refs log tree commit diff stats
path: root/cpp
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-17 21:55:04 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-17 21:58:47 -0700
commit75845f2230fa998c9fdf71b4711bcbc2794daa4b (patch)
tree7b8c79936195dac26f2169cf7d72400b6258eeaa /cpp
parentb38e581993c4e7ae001572cbdb1855bc8d8db5b3 (diff)
downloadmu-75845f2230fa998c9fdf71b4711bcbc2794daa4b.tar.gz
1091
Diffstat (limited to 'cpp')
-rw-r--r--cpp/014types21
-rw-r--r--cpp/050scenario14
2 files changed, 17 insertions, 18 deletions
diff --git a/cpp/014types b/cpp/014types
index 867cb28d..226be5ee 100644
--- a/cpp/014types
+++ b/cpp/014types
@@ -31,10 +31,8 @@ void insert_container(const string& command, kind_of_type kind, istream& in) {
   t.name = name;
   t.kind = kind;
   while (!in.eof()) {
-    skip_comments_and_newlines(in);
-    skip_whitespace(in);
+    skip_whitespace_and_comments(in);
     string element = next_word(in);
-    skip_comments_and_newlines(in);
     if (element == "]") break;
     istringstream inner(element);
     t.element_names.push_back(slurp_until(inner, ':'));
@@ -81,9 +79,24 @@ for (size_t i = 0; i < recently_added_types.size(); ++i) {
   Type.erase(recently_added_types[i]);
 }
 recently_added_types.clear();
+//: lastly, ensure scenarios are consistent by always starting them at the
+//: same type number.
 Next_type_number = 1000;
 :(before "End One-time Setup")
 assert(Next_type_number < 1000);
 Next_type_number = 1000;
 
-//: lastly, ensure scenarios are consistent by always starting 
+:(code)
+void skip_bracket(istream& in, string message) {
+  skip_whitespace(in);  skip_comments_and_newlines(in);  skip_whitespace(in);
+  if (in.get() != '[')
+    raise << message << '\n';
+}
+
+void skip_whitespace_and_comments(istream& in) {
+  while (true) {
+    if (isspace(in.peek())) in.get();
+    else if (in.peek() == '#') skip_comment(in);
+    else break;
+  }
+}
diff --git a/cpp/050scenario b/cpp/050scenario
index ab057ccc..c51afa59 100644
--- a/cpp/050scenario
+++ b/cpp/050scenario
@@ -120,17 +120,3 @@ void slurp_until_matching_bracket(istream& in, ostream& out) {
     out << c;
   }
 }
-
-void skip_bracket(istream& in, string message) {
-  skip_whitespace(in);  skip_comments_and_newlines(in);  skip_whitespace(in);
-  if (in.get() != '[')
-    raise << message << '\n';
-}
-
-void skip_whitespace_and_comments(istream& in) {
-  while (true) {
-    if (isspace(in.peek())) in.get();
-    else if (in.peek() == '#') skip_comment(in);
-    else break;
-  }
-}