diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-02-18 10:56:19 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-02-18 10:56:19 -0800 |
commit | 96ac511e9e789dfe0dd16e5216b7a957338fe3d3 (patch) | |
tree | 01366400d222244c0131df465e7a8aea900473cb /cpp/literate | |
parent | 36594a43e0503bef1a894320deb3182af74902dc (diff) | |
download | mu-96ac511e9e789dfe0dd16e5216b7a957338fe3d3.tar.gz |
780 - some more scenarios
Diffstat (limited to 'cpp/literate')
-rw-r--r-- | cpp/literate/011load | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/cpp/literate/011load b/cpp/literate/011load index 5811f77a..4bc73365 100644 --- a/cpp/literate/011load +++ b/cpp/literate/011load @@ -1,5 +1,6 @@ // It's often convenient to express recipes in a textual fashion. -:(scenario add_recipe) +:(scenarios add_recipe) +:(scenario first_recipe) recipe main [ 1:integer <- copy 23:literal ] @@ -8,10 +9,6 @@ recipe main [ +parse: product: {name: "1", type: 1} :(code) -void run(string text) { - add_recipe(text); -} - void add_recipe(string form) { istringstream in(form); in >> std::noskipws; @@ -124,3 +121,29 @@ void skip_comma(istream& in) { if (in.peek() == ',') in.get(); skip_whitespace(in); } + +:(scenario parse_label) +recipe main [ + foo: +] ++parse: label: foo +-parse: instruction: 1 + +:(scenario parse_multiple_products) +recipe main [ + 1:integer, 2:integer <- copy 23:literal +] ++parse: instruction: 1 ++parse: ingredient: {name: "23", type: 0} ++parse: product: {name: "1", type: 1} ++parse: product: {name: "2", type: 1} + +:(scenario parse_multiple_ingredients) +recipe main [ + 1:integer, 2:integer <- copy 23:literal, 4:integer +] ++parse: instruction: 1 ++parse: ingredient: {name: "23", type: 0} ++parse: ingredient: {name: "4", type: 1} ++parse: product: {name: "1", type: 1} ++parse: product: {name: "2", type: 1} |