diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-12-02 15:39:49 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-12-02 15:39:49 -0800 |
commit | f8997ec06c0cdda1a16c5d99f96c447ce6809185 (patch) | |
tree | 480901cd458f013ab5c67a81535e9a08dd610c75 | |
parent | cc20549cfd14beea249a05617931c99d55ed0440 (diff) | |
download | mu-f8997ec06c0cdda1a16c5d99f96c447ce6809185.tar.gz |
2613 - stop dying on missing bracket
Thanks Caleb Couch.
-rw-r--r-- | 056recipe_header.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/056recipe_header.cc b/056recipe_header.cc index db2aebbe..f0d448b2 100644 --- a/056recipe_header.cc +++ b/056recipe_header.cc @@ -32,14 +32,14 @@ if (in.peek() != '[') { :(code) void load_recipe_header(istream& in, recipe& result) { result.has_header = true; - while (in.peek() != '[') { + while (has_data(in) && in.peek() != '[' && in.peek() != '\n') { string s = next_word(in); if (s == "->") break; result.ingredients.push_back(reagent(s)); trace(9999, "parse") << "header ingredient: " << result.ingredients.back().original_string << end(); skip_whitespace_and_comments(in); } - while (in.peek() != '[') { + while (has_data(in) && in.peek() != '[' && in.peek() != '\n') { string s = next_word(in); result.products.push_back(reagent(s)); trace(9999, "parse") << "header product: " << result.products.back().original_string << end(); @@ -72,6 +72,12 @@ recipe bar [ ] +mem: storing 4 in location 1 +:(scenario recipe_handles_missing_bracket) +% Hide_errors = true; +recipe main +] ++error: recipe body must begin with '[' + :(after "Begin debug_string(recipe x)") out << "ingredients:\n"; for (long long int i = 0; i < SIZE(x.ingredients); ++i) |