:(scenarios load)
:(scenario first_recipe)
recipe main [
1:number <- copy 23:literal
]
+parse: instruction: copy
+parse: ingredient: {name: "23", properties: ["23": "literal"]}
+parse: product: {name: "1", properties: ["1": "number"]}
:(code)
vector<recipe_number> load(string form) {
istringstream in(form);
in >> std::noskipws;
return load(in);
}
vector<recipe_number> load(istream& in) {
vector<recipe_number> result;
while (!in.eof()) {
skip_whitespace_and_comments(in);
if (in.eof()) break;
string command = next_word(in);
if (command == "recipe") {
string recipe_name = next_word(in);
if (recipe_name.empty())
raise << "empty recipe name\n"