diff options
Diffstat (limited to 'html/011load.cc.html')
-rw-r--r-- | html/011load.cc.html | 126 |
1 files changed, 60 insertions, 66 deletions
diff --git a/html/011load.cc.html b/html/011load.cc.html index 205faacf..180cda8d 100644 --- a/html/011load.cc.html +++ b/html/011load.cc.html @@ -40,8 +40,8 @@ recipe main [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">23</span> ] <span class="traceContains">+parse: instruction: copy</span> -<span class="traceContains">+parse: ingredient: {"23": "literal"}</span> -<span class="traceContains">+parse: product: {"1": "number"}</span> +<span class="traceContains">+parse: ingredient: 23: "literal"</span> +<span class="traceContains">+parse: product: 1: "number"</span> <span class="Delimiter">:(code)</span> vector<recipe_ordinal> load<span class="Delimiter">(</span>string form<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -62,9 +62,9 @@ vector<recipe_ordinal> load<span class="Delimiter">(</span>istream& in result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>slurp_recipe<span class="Delimiter">(</span>in<span class="Delimiter">));</span> <span class="Delimiter">}</span> else if <span class="Delimiter">(</span>command == <span class="Constant">"recipe!"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> - Disable_redefine_warnings = <span class="Constant">true</span><span class="Delimiter">;</span> + Disable_redefine_checks = <span class="Constant">true</span><span class="Delimiter">;</span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>slurp_recipe<span class="Delimiter">(</span>in<span class="Delimiter">));</span> - Disable_redefine_warnings = <span class="Constant">false</span><span class="Delimiter">;</span> + Disable_redefine_checks = <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> <span class="Comment">// End Command Handlers</span> else <span class="Delimiter">{</span> @@ -77,22 +77,22 @@ vector<recipe_ordinal> load<span class="Delimiter">(</span>istream& in long long int slurp_recipe<span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> recipe result<span class="Delimiter">;</span> result<span class="Delimiter">.</span>name = next_word<span class="Delimiter">(</span>in<span class="Delimiter">);</span> + <span class="Comment">// End Load Recipe Name</span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>in<span class="Delimiter">);</span> - <span class="Comment">// End recipe Refinements</span> + <span class="Comment">// End Recipe Refinements</span> if <span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> raise_error << <span class="Constant">"empty result.name</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> trace<span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"--- defining "</span> << result<span class="Delimiter">.</span>name << end<span class="Delimiter">();</span> - if <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">,</span> Next_recipe_ordinal++<span class="Delimiter">);</span> - <span class="Delimiter">}</span> if <span class="Delimiter">(</span>Recipe<span class="Delimiter">.</span>find<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> != Recipe<span class="Delimiter">.</span>end<span class="Delimiter">())</span> <span class="Delimiter">{</span> trace<span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"already exists"</span> << end<span class="Delimiter">();</span> - if <span class="Delimiter">(</span>warn_on_redefine<span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> - raise << <span class="Constant">"redefining recipe "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + if <span class="Delimiter">(</span>should_check_for_redefine<span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> + raise_error << <span class="Constant">"redefining recipe "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> Recipe<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">));</span> <span class="Delimiter">}</span> slurp_body<span class="Delimiter">(</span>in<span class="Delimiter">,</span> result<span class="Delimiter">);</span> - <span class="Comment">// End recipe Body(result)</span> + <span class="Comment">// End Recipe Body(result)</span> put<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">),</span> result<span class="Delimiter">);</span> <span class="Comment">// track added recipes because we may need to undo them in tests; see below</span> Recently_added_recipes<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">));</span> @@ -108,9 +108,9 @@ void slurp_body<span class="Delimiter">(</span>istream& in<span class="Delim instruction curr<span class="Delimiter">;</span> while <span class="Delimiter">(</span>next_instruction<span class="Delimiter">(</span>in<span class="Delimiter">,</span> &curr<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// End Rewrite Instruction(curr, recipe result)</span> - trace<span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"load"</span><span class="Delimiter">)</span> << <span class="Constant">"after rewriting: "</span> << curr<span class="Delimiter">.</span>to_string<span class="Delimiter">()</span> << end<span class="Delimiter">();</span> - if <span class="Delimiter">(</span>!curr<span class="Delimiter">.</span>is_clear<span class="Delimiter">())</span> <span class="Delimiter">{</span> - curr<span class="Delimiter">.</span>original_string = curr<span class="Delimiter">.</span>to_string<span class="Delimiter">();</span> + trace<span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"load"</span><span class="Delimiter">)</span> << <span class="Constant">"after rewriting: "</span> << to_string<span class="Delimiter">(</span>curr<span class="Delimiter">)</span> << end<span class="Delimiter">();</span> + if <span class="Delimiter">(</span>!curr<span class="Delimiter">.</span>is_empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> + curr<span class="Delimiter">.</span>original_string = to_string<span class="Delimiter">(</span>curr<span class="Delimiter">);</span> result<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>curr<span class="Delimiter">);</span> <span class="Delimiter">}</span> <span class="Delimiter">}</span> @@ -136,9 +136,8 @@ bool next_instruction<span class="Delimiter">(</span>istream& in<span class= skip_whitespace_but_not_newline<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span class="Delimiter">}</span> skip_whitespace_and_comments<span class="Delimiter">(</span>in<span class="Delimiter">);</span> - if <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>words<span class="Delimiter">)</span> == <span class="Constant">1</span> && words<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> == <span class="Constant">"]"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>words<span class="Delimiter">)</span> == <span class="Constant">1</span> && words<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> == <span class="Constant">"]"</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Comment">// end of recipe</span> - <span class="Delimiter">}</span> if <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>words<span class="Delimiter">)</span> == <span class="Constant">1</span> && !isalnum<span class="Delimiter">(</span>words<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> && words<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> != <span class="Constant">'$'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> curr<span class="Delimiter">-></span>is_label = <span class="Constant">true</span><span class="Delimiter">;</span> @@ -153,9 +152,8 @@ bool next_instruction<span class="Delimiter">(</span>istream& in<span class= vector<string>::iterator p = words<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> if <span class="Delimiter">(</span>find<span class="Delimiter">(</span>words<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> words<span class="Delimiter">.</span>end<span class="Delimiter">(),</span> <span class="Constant">"<-"</span><span class="Delimiter">)</span> != words<span class="Delimiter">.</span>end<span class="Delimiter">())</span> <span class="Delimiter">{</span> - for <span class="Delimiter">(;</span> *p != <span class="Constant">"<-"</span><span class="Delimiter">;</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> + for <span class="Delimiter">(;</span> *p != <span class="Constant">"<-"</span><span class="Delimiter">;</span> ++p<span class="Delimiter">)</span> curr<span class="Delimiter">-></span>products<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span>*p<span class="Delimiter">));</span> - <span class="Delimiter">}</span> ++p<span class="Delimiter">;</span> <span class="Comment">// skip <-</span> <span class="Delimiter">}</span> @@ -166,18 +164,15 @@ bool next_instruction<span class="Delimiter">(</span>istream& in<span class= curr<span class="Delimiter">-></span>old_name = curr<span class="Delimiter">-></span>name = *p<span class="Delimiter">;</span> p++<span class="Delimiter">;</span> <span class="Comment">// curr->operation will be set in a later layer</span> - for <span class="Delimiter">(;</span> p != words<span class="Delimiter">.</span>end<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> + for <span class="Delimiter">(;</span> p != words<span class="Delimiter">.</span>end<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> curr<span class="Delimiter">-></span>ingredients<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span>*p<span class="Delimiter">));</span> - <span class="Delimiter">}</span> trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"instruction: "</span> << curr<span class="Delimiter">-></span>name << end<span class="Delimiter">();</span> trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" number of ingredients: "</span> << SIZE<span class="Delimiter">(</span>curr<span class="Delimiter">-></span>ingredients<span class="Delimiter">)</span> << end<span class="Delimiter">();</span> - for <span class="Delimiter">(</span>vector<reagent>::iterator p = curr<span class="Delimiter">-></span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != curr<span class="Delimiter">-></span>ingredients<span class="Delimiter">.</span>end<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> - trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" ingredient: "</span> << p<span class="Delimiter">-></span>to_string<span class="Delimiter">()</span> << end<span class="Delimiter">();</span> - <span class="Delimiter">}</span> - for <span class="Delimiter">(</span>vector<reagent>::iterator p = curr<span class="Delimiter">-></span>products<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != curr<span class="Delimiter">-></span>products<span class="Delimiter">.</span>end<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> - trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" product: "</span> << p<span class="Delimiter">-></span>to_string<span class="Delimiter">()</span> << end<span class="Delimiter">();</span> - <span class="Delimiter">}</span> + for <span class="Delimiter">(</span>vector<reagent>::iterator p = curr<span class="Delimiter">-></span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != curr<span class="Delimiter">-></span>ingredients<span class="Delimiter">.</span>end<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> + trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" ingredient: "</span> << to_string<span class="Delimiter">(</span>*p<span class="Delimiter">)</span> << end<span class="Delimiter">();</span> + for <span class="Delimiter">(</span>vector<reagent>::iterator p = curr<span class="Delimiter">-></span>products<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != curr<span class="Delimiter">-></span>products<span class="Delimiter">.</span>end<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> + trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" product: "</span> << to_string<span class="Delimiter">(</span>*p<span class="Delimiter">)</span> << end<span class="Delimiter">();</span> if <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> raise_error << <span class="Constant">"9: unbalanced '[' for recipe</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> @@ -245,14 +240,14 @@ void skip_comment<span class="Delimiter">(</span>istream& in<span class="Del <span class="Comment">//: Warn if a recipe gets redefined, because large codebases can accidentally</span> <span class="Comment">//: step on their own toes. But there'll be many occasions later where</span> -<span class="Comment">//: we'll want to disable the warnings.</span> +<span class="Comment">//: we'll want to disable the errors.</span> <span class="Delimiter">:(before "End Globals")</span> -bool Disable_redefine_warnings = <span class="Constant">false</span><span class="Delimiter">;</span> +bool Disable_redefine_checks = <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Delimiter">:(before "End Setup")</span> -Disable_redefine_warnings = <span class="Constant">false</span><span class="Delimiter">;</span> +Disable_redefine_checks = <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Delimiter">:(code)</span> -bool warn_on_redefine<span class="Delimiter">(</span>const string& recipe_name<span class="Delimiter">)</span> <span class="Delimiter">{</span> - if <span class="Delimiter">(</span>Disable_redefine_warnings<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> +bool should_check_for_redefine<span class="Delimiter">(</span>const string& recipe_name<span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>Disable_redefine_checks<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -261,9 +256,8 @@ bool warn_on_redefine<span class="Delimiter">(</span>const string& recipe_na void show_rest_of_stream<span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> cerr << <span class="Constant">'^'</span><span class="Delimiter">;</span> char c<span class="Delimiter">;</span> - while <span class="Delimiter">(</span>in >> c<span class="Delimiter">)</span> <span class="Delimiter">{</span> + while <span class="Delimiter">(</span>in >> c<span class="Delimiter">)</span> cerr << c<span class="Delimiter">;</span> - <span class="Delimiter">}</span> cerr << <span class="Constant">"$</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> exit<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span class="Delimiter">}</span> @@ -294,8 +288,8 @@ recipe main [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">23</span> ] <span class="traceContains">+parse: instruction: copy</span> -<span class="traceContains">+parse: ingredient: {"23": "literal"}</span> -<span class="traceContains">+parse: product: {"1": "number"}</span> +<span class="traceContains">+parse: ingredient: 23: "literal"</span> +<span class="traceContains">+parse: product: 1: "number"</span> <span class="Delimiter">:(scenario parse_comment_amongst_instruction)</span> recipe main [ @@ -303,8 +297,8 @@ recipe main [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">23</span> ] <span class="traceContains">+parse: instruction: copy</span> -<span class="traceContains">+parse: ingredient: {"23": "literal"}</span> -<span class="traceContains">+parse: product: {"1": "number"}</span> +<span class="traceContains">+parse: ingredient: 23: "literal"</span> +<span class="traceContains">+parse: product: 1: "number"</span> <span class="Delimiter">:(scenario parse_comment_amongst_instruction_2)</span> recipe main [ @@ -313,8 +307,8 @@ recipe main [ <span class="Comment"># comment</span> ] <span class="traceContains">+parse: instruction: copy</span> -<span class="traceContains">+parse: ingredient: {"23": "literal"}</span> -<span class="traceContains">+parse: product: {"1": "number"}</span> +<span class="traceContains">+parse: ingredient: 23: "literal"</span> +<span class="traceContains">+parse: product: 1: "number"</span> <span class="Delimiter">:(scenario parse_comment_amongst_instruction_3)</span> recipe main [ @@ -323,19 +317,19 @@ recipe main [ <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">23</span> ] <span class="traceContains">+parse: instruction: copy</span> -<span class="traceContains">+parse: ingredient: {"23": "literal"}</span> -<span class="traceContains">+parse: product: {"1": "number"}</span> +<span class="traceContains">+parse: ingredient: 23: "literal"</span> +<span class="traceContains">+parse: product: 1: "number"</span> <span class="traceContains">+parse: instruction: copy</span> -<span class="traceContains">+parse: ingredient: {"23": "literal"}</span> -<span class="traceContains">+parse: product: {"2": "number"}</span> +<span class="traceContains">+parse: ingredient: 23: "literal"</span> +<span class="traceContains">+parse: product: 2: "number"</span> <span class="Delimiter">:(scenario parse_comment_after_instruction)</span> recipe main [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">23</span> <span class="Comment"># comment</span> ] <span class="traceContains">+parse: instruction: copy</span> -<span class="traceContains">+parse: ingredient: {"23": "literal"}</span> -<span class="traceContains">+parse: product: {"1": "number"}</span> +<span class="traceContains">+parse: ingredient: 23: "literal"</span> +<span class="traceContains">+parse: product: 1: "number"</span> <span class="Delimiter">:(scenario parse_label)</span> recipe main [ @@ -354,43 +348,43 @@ recipe main [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">23</span>/foo:bar:baz ] <span class="traceContains">+parse: instruction: copy</span> -<span class="traceContains">+parse: ingredient: {"23": "literal", "foo": <"bar" : <"baz" : <>>>}</span> -<span class="traceContains">+parse: product: {"1": "number"}</span> +<span class="traceContains">+parse: ingredient: 23: "literal", {"foo": ("bar" "baz")}</span> +<span class="traceContains">+parse: product: 1: "number"</span> <span class="Delimiter">:(scenario parse_multiple_products)</span> recipe main [ <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">23</span> ] <span class="traceContains">+parse: instruction: copy</span> -<span class="traceContains">+parse: ingredient: {"23": "literal"}</span> -<span class="traceContains">+parse: product: {"1": "number"}</span> -<span class="traceContains">+parse: product: {"2": "number"}</span> +<span class="traceContains">+parse: ingredient: 23: "literal"</span> +<span class="traceContains">+parse: product: 1: "number"</span> +<span class="traceContains">+parse: product: 2: "number"</span> <span class="Delimiter">:(scenario parse_multiple_ingredients)</span> recipe main [ <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">23</span><span class="Delimiter">,</span> <span class="Constant">4</span>:number ] <span class="traceContains">+parse: instruction: copy</span> -<span class="traceContains">+parse: ingredient: {"23": "literal"}</span> -<span class="traceContains">+parse: ingredient: {"4": "number"}</span> -<span class="traceContains">+parse: product: {"1": "number"}</span> -<span class="traceContains">+parse: product: {"2": "number"}</span> +<span class="traceContains">+parse: ingredient: 23: "literal"</span> +<span class="traceContains">+parse: ingredient: 4: "number"</span> +<span class="traceContains">+parse: product: 1: "number"</span> +<span class="traceContains">+parse: product: 2: "number"</span> <span class="Delimiter">:(scenario parse_multiple_types)</span> recipe main [ <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:address:number<span class="Special"> <- </span>copy <span class="Constant">23</span><span class="Delimiter">,</span> <span class="Constant">4</span>:number ] <span class="traceContains">+parse: instruction: copy</span> -<span class="traceContains">+parse: ingredient: {"23": "literal"}</span> -<span class="traceContains">+parse: ingredient: {"4": "number"}</span> -<span class="traceContains">+parse: product: {"1": "number"}</span> -<span class="traceContains">+parse: product: {"2": <"address" : <"number" : <>>>}</span> +<span class="traceContains">+parse: ingredient: 23: "literal"</span> +<span class="traceContains">+parse: ingredient: 4: "number"</span> +<span class="traceContains">+parse: product: 1: "number"</span> +<span class="traceContains">+parse: product: 2: ("address" "number")</span> <span class="Delimiter">:(scenario parse_properties)</span> recipe main [ - <span class="Constant">1</span>:number:address/lookup<span class="Special"> <- </span>copy <span class="Constant">23</span> + <span class="Constant">1</span>:address:number/lookup<span class="Special"> <- </span>copy <span class="Constant">23</span> ] -<span class="traceContains">+parse: product: {"1": <"number" : <"address" : <>>>, "lookup": <>}</span> +<span class="traceContains">+parse: product: 1: ("address" "number"), {"lookup": ()}</span> <span class="Comment">//: this test we can't represent with a scenario</span> <span class="Delimiter">:(code)</span> @@ -403,26 +397,26 @@ void test_parse_comment_terminated_by_eof<span class="Delimiter">()</span> <span cerr << <span class="Constant">"."</span><span class="Delimiter">;</span> <span class="Comment">// termination = success</span> <span class="Delimiter">}</span> -<span class="Delimiter">:(scenario warn_on_redefine)</span> -<span class="Special">% Hide_warnings = true;</span> +<span class="Delimiter">:(scenario forbid_redefining_recipes)</span> +<span class="Special">% Hide_errors = true;</span> recipe main [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">23</span> ] recipe main [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">24</span> ] -<span class="traceContains">+warn: redefining recipe main</span> +<span class="traceContains">+error: redefining recipe main</span> -<span class="Delimiter">:(scenario redefine_without_warning)</span> -<span class="Special">% Hide_warnings = true;</span> +<span class="Delimiter">:(scenario permit_forcibly_redefining_recipes)</span> +<span class="Special">% Hide_errors = true;</span> recipe main [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">23</span> ] recipe! main [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">24</span> ] -<span class="traceAbsent">-warn: redefining recipe main</span> -$warn: <span class="Constant">0</span> +<span class="traceAbsent">-error: redefining recipe main</span> +$error: <span class="Constant">0</span> </pre> </body> </html> |