diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-09-06 16:35:46 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-09-06 16:35:46 -0700 |
commit | 0e4a335edc7d4e584924fd6b298156e45d2626c8 (patch) | |
tree | 4bde00176d6d00b72462e856974fecd4411ef025 /html/040brace.cc.html | |
parent | 3cf4cc43f2622816777c22c49c32e5159574a1d3 (diff) | |
download | mu-0e4a335edc7d4e584924fd6b298156e45d2626c8.tar.gz |
2175
Diffstat (limited to 'html/040brace.cc.html')
-rw-r--r-- | html/040brace.cc.html | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/html/040brace.cc.html b/html/040brace.cc.html index 223e7923..eb62a889 100644 --- a/html/040brace.cc.html +++ b/html/040brace.cc.html @@ -13,7 +13,6 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 1.05em; } -.CommentedCode { color: #6c6c6c; } .cSpecial { color: #008000; } .Comment { color: #9090ff; } .Delimiter { color: #a04060; } @@ -71,8 +70,6 @@ recipe main [ <span class="Delimiter">:(code)</span> void transform_braces<span class="Delimiter">(</span>const recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span class="CommentedCode">//? cout << "AAA transform_braces\n"; //? 1</span> -<span class="CommentedCode">//? exit(0); //? 1</span> const int OPEN = <span class="Constant">0</span><span class="Delimiter">,</span> CLOSE = <span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// use signed integer for step index because we'll be doing arithmetic on it</span> list<pair<int<span class="Comment">/*</span><span class="Comment">OPEN/CLOSE</span><span class="Comment">*/</span><span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">step</span><span class="Comment">*/</span>long long int> > braces<span class="Delimiter">;</span> @@ -109,6 +106,13 @@ void transform_braces<span class="Delimiter">(</span>const recipe_ordinal r<span trace<span class="Delimiter">(</span><span class="Constant">"after-brace"</span><span class="Delimiter">)</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">" ..."</span> << end<span class="Delimiter">();</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> + <span class="Comment">// check for errors</span> + if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"-if"</span><span class="Delimiter">)</span> != string::npos || inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"-unless"</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> + raise << inst<span class="Delimiter">.</span>name << <span class="Constant">" expects 1 or 2 ingredients, but got none</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Identifier">continue</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Delimiter">}</span> <span class="Comment">// update instruction operation</span> if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"-if"</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> inst<span class="Delimiter">.</span>operation = Recipe_ordinal[<span class="Constant">"jump-if"</span>]<span class="Delimiter">;</span> @@ -375,7 +379,6 @@ recipe main [ <span class="Comment">//: test how things actually run</span> <span class="Delimiter">:(scenarios run)</span> <span class="Delimiter">:(scenario brace_conversion_and_run)</span> -<span class="CommentedCode">#? % Trace_stream->dump_layer = "run";</span> recipe test-factorial [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">5</span> <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span> @@ -397,6 +400,15 @@ recipe main [ <span class="Identifier">break</span> ] <span class="traceContains">+warn: break needs a '{' before</span> + +<span class="Delimiter">:(scenario break_conditional_without_ingredient_warns)</span> +<span class="Special">% Hide_warnings = true;</span> +recipe main [ + <span class="Delimiter">{</span> + <span class="Identifier">break</span>-if + <span class="Delimiter">}</span> +] +<span class="traceContains">+warn: break-if expects 1 or 2 ingredients, but got none</span> </pre> </body> </html> |