From ad8e984fd4590740cb6dc23e951848108f671aac Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 6 Apr 2015 12:02:38 -0700 Subject: 1024 - basic skeleton for running scenarios For now every scenario parses to the same dummy scenario. --- cpp/011load | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'cpp/011load') diff --git a/cpp/011load b/cpp/011load index eb8ed8f1..8cbf2e53 100644 --- a/cpp/011load +++ b/cpp/011load @@ -22,9 +22,13 @@ vector add_recipes(istream& in) { if (in.eof()) break; string command = next_word(in); // Command Handlers - if (command == "recipe") + if (command == "recipe") { result.push_back(add_recipe(in)); + } // End Command Handlers + else { + raise << "unknown top-level command: " << command; + } } return result; } @@ -32,7 +36,7 @@ vector add_recipes(istream& in) { recipe_number add_recipe(istream& in) { skip_comments_and_newlines(in); string recipe_name = next_word(in); -//? cout << "recipe name: ^" << recipe_name << "$\n"; //? 1 +//? cout << "recipe name: ^" << recipe_name << "$\n"; //? 2 if (recipe_name.empty()) raise << "empty recipe name\n"; //? raise << "empty recipe name in " << in.str() << '\n'; @@ -114,6 +118,7 @@ bool next_instruction(istream& in, instruction* curr) { } string next_word(istream& in) { +//? cout << "AAA next_word\n"; //? 1 ostringstream out; skip_whitespace(in); slurp_word(in, out); @@ -123,6 +128,7 @@ string next_word(istream& in) { } void slurp_word(istream& in, ostream& out) { +//? cout << "AAA slurp_word\n"; //? 1 char c; if (in.peek() == ',') { in >> c; @@ -130,6 +136,7 @@ void slurp_word(istream& in, ostream& out) { return; } while (in >> c) { +//? cout << c << '\n'; //? 1 if (isspace(c) || c == ',') { in.putback(c); break; -- cgit 1.4.1-2-gfad0