diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-12-01 14:13:33 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-12-01 14:13:33 -0800 |
commit | e4ac3c9e6e5464a0fc0f8fd3763a572e0e180c04 (patch) | |
tree | 7f6ca26afcdf8e3bf54459c6592ebf26fb968133 /html/011load.cc.html | |
parent | 54e5128a14dcea5b93a8a9402558f0736fb7dba3 (diff) | |
download | mu-e4ac3c9e6e5464a0fc0f8fd3763a572e0e180c04.tar.gz |
4814
Diffstat (limited to 'html/011load.cc.html')
-rw-r--r-- | html/011load.cc.html | 91 |
1 files changed, 47 insertions, 44 deletions
diff --git a/html/011load.cc.html b/html/011load.cc.html index 9319045a..1f42e841 100644 --- a/html/011load.cc.html +++ b/html/011load.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .traceAbsent { color: #c00000; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/011load.cc'>https://github.com/akkartik/mu/blob/master/011load.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Phase 1 of running Mu code: load it from a textual representation.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> @@ -99,10 +102,10 @@ if ('onhashchange' in window) { <span id="L36" class="LineNr"> 36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r > <span class="Constant">0</span><span class="Delimiter">)</span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>r<span class="Delimiter">);</span> <span id="L37" class="LineNr"> 37 </span> <span class="Delimiter">}</span> <span id="L38" class="LineNr"> 38 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>command == <span class="Constant">"recipe!"</span> || command == <span class="Constant">"def!"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L39" class="LineNr"> 39 </span> Disable_redefine_checks =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L39" class="LineNr"> 39 </span> <span class="Special">Disable_redefine_checks</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L40" class="LineNr"> 40 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r = <a href='011load.cc.html#L53'>slurp_recipe</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L41" class="LineNr"> 41 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r > <span class="Constant">0</span><span class="Delimiter">)</span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>r<span class="Delimiter">);</span> -<span id="L42" class="LineNr"> 42 </span> Disable_redefine_checks =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L42" class="LineNr"> 42 </span> <span class="Special">Disable_redefine_checks</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L43" class="LineNr"> 43 </span> <span class="Delimiter">}</span> <span id="L44" class="LineNr"> 44 </span> <span class="Comment">// End Command Handlers</span> <span id="L45" class="LineNr"> 45 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> @@ -118,36 +121,36 @@ if ('onhashchange' in window) { <span id="L55" class="LineNr"> 55 </span> result<span class="Delimiter">.</span>name = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L56" class="LineNr"> 56 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L57" class="LineNr"> 57 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"file ended with 'recipe'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"file ended with 'recipe'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L59" class="LineNr"> 59 </span> <span class="Identifier">return</span> -<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L60" class="LineNr"> 60 </span> <span class="Delimiter">}</span> <span id="L61" class="LineNr"> 61 </span> <span class="Comment">// End Load Recipe Name</span> <span id="L62" class="LineNr"> 62 </span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L63" class="LineNr"> 63 </span> <span class="Comment">// End Recipe Refinements</span> <span id="L64" class="LineNr"> 64 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> -<span id="L65" class="LineNr"> 65 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"empty result.name</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L65" class="LineNr"> 65 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"empty result.name\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L66" class="LineNr"> 66 </span> <a href='003trace.cc.html#L189'>trace</a><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 << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L67" class="LineNr"> 67 </span> <span class="Normal">if</span> <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 id="L68" class="LineNr"> 68 </span> <a href='001help.cc.html#L221'>put</a><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 id="L69" class="LineNr"> 69 </span> result<span class="Delimiter">.</span>ordinal = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> -<span id="L70" class="LineNr"> 70 </span> ++Next_recipe_ordinal<span class="Delimiter">;</span> -<span id="L71" class="LineNr"> 71 </span> <span class="Normal">if</span> <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><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> +<span id="L67" class="LineNr"> 67 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> +<span id="L68" class="LineNr"> 68 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">,</span> <span class="Special">Next_recipe_ordinal</span><span class="Delimiter">);</span> +<span id="L69" class="LineNr"> 69 </span> result<span class="Delimiter">.</span>ordinal = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> +<span id="L70" class="LineNr"> 70 </span> ++<span class="Special">Next_recipe_ordinal</span><span class="Delimiter">;</span> +<span id="L71" class="LineNr"> 71 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> != <span class="Special">Recipe</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L72" class="LineNr"> 72 </span> <a href='003trace.cc.html#L189'>trace</a><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> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L73" class="LineNr"> 73 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='011load.cc.html#L380'>should_check_for_redefine</a><span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> -<span id="L74" class="LineNr"> 74 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"redefining <a href='010vm.cc.html#L19'>recipe</a> "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L75" class="LineNr"> 75 </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 id="L74" class="LineNr"> 74 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"redefining <a href='010vm.cc.html#L19'>recipe</a> "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">"\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L75" class="LineNr"> 75 </span> <span class="Special">Recipe</span><span class="Delimiter">.</span>erase<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">));</span> <span id="L76" class="LineNr"> 76 </span> <span class="Delimiter">}</span> <span id="L77" class="LineNr"> 77 </span> <a href='011load.cc.html#L83'>slurp_body</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> result<span class="Delimiter">);</span> <span id="L78" class="LineNr"> 78 </span> <span class="Comment">// End Recipe Body(result)</span> -<span id="L79" class="LineNr"> 79 </span> <a href='001help.cc.html#L221'>put</a><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 id="L80" class="LineNr"> 80 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> +<span id="L79" class="LineNr"> 79 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">),</span> result<span class="Delimiter">);</span> +<span id="L80" class="LineNr"> 80 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> <span id="L81" class="LineNr"> 81 </span><span class="Delimiter">}</span> <span id="L82" class="LineNr"> 82 </span> <span id="L83" class="LineNr"> 83 </span><span class="Normal">void</span> <a href='011load.cc.html#L83'>slurp_body</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">,</span> recipe& result<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L84" class="LineNr"> 84 </span> in >> std::noskipws<span class="Delimiter">;</span> <span id="L85" class="LineNr"> 85 </span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L86" class="LineNr"> 86 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>get<span class="Delimiter">()</span> != <span class="Constant">'['</span><span class="Delimiter">)</span> -<span id="L87" class="LineNr"> 87 </span> <a href='003trace.cc.html#L196'>raise</a> << result<span class="Delimiter">.</span>name << <span class="Constant">": <a href='010vm.cc.html#L19'>recipe</a> body must begin with '['</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L87" class="LineNr"> 87 </span> <a href='003trace.cc.html#L196'>raise</a> << result<span class="Delimiter">.</span>name << <span class="Constant">": <a href='010vm.cc.html#L19'>recipe</a> body must begin with '['\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L88" class="LineNr"> 88 </span> <a href='011load.cc.html#L211'>skip_whitespace_and_comments</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span class="Comment">// permit trailing comment after '['</span> <span id="L89" class="LineNr"> 89 </span> <a href='010vm.cc.html#L33'>instruction</a> curr<span class="Delimiter">;</span> <span id="L90" class="LineNr"> 90 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='011load.cc.html#L98'>next_instruction</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> &curr<span class="Delimiter">))</span> <span class="Delimiter">{</span> @@ -162,7 +165,7 @@ if ('onhashchange' in window) { <span id="L99" class="LineNr"> 99 </span> curr<span class="Delimiter">-></span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L100" class="LineNr">100 </span> <a href='011load.cc.html#L211'>skip_whitespace_and_comments</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L101" class="LineNr">101 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (0)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (0)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L103" class="LineNr">103 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L104" class="LineNr">104 </span> <span class="Delimiter">}</span> <span id="L105" class="LineNr">105 </span> @@ -170,13 +173,13 @@ if ('onhashchange' in window) { <span id="L107" class="LineNr">107 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L108" class="LineNr">108 </span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L109" class="LineNr">109 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L110" class="LineNr">110 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (1)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L110" class="LineNr">110 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (1)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L111" class="LineNr">111 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L112" class="LineNr">112 </span> <span class="Delimiter">}</span> <span id="L113" class="LineNr">113 </span> string word = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L114" class="LineNr">114 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>word<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L115" class="LineNr">115 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L116" class="LineNr">116 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (2)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L116" class="LineNr">116 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (2)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L117" class="LineNr">117 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L118" class="LineNr">118 </span> <span class="Delimiter">}</span> <span id="L119" class="LineNr">119 </span> words<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>word<span class="Delimiter">);</span> @@ -191,7 +194,7 @@ if ('onhashchange' in window) { <span id="L128" class="LineNr">128 </span> curr<span class="Delimiter">-></span>label = words<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L129" class="LineNr">129 </span> <a href='003trace.cc.html#L189'>trace</a><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">"label: "</span> << curr<span class="Delimiter">-></span>label << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L130" class="LineNr">130 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L131" class="LineNr">131 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (3)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L131" class="LineNr">131 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (3)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L132" class="LineNr">132 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L133" class="LineNr">133 </span> <span class="Delimiter">}</span> <span id="L134" class="LineNr">134 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> @@ -205,7 +208,7 @@ if ('onhashchange' in window) { <span id="L142" class="LineNr">142 </span> <span class="Delimiter">}</span> <span id="L143" class="LineNr">143 </span> <span id="L144" class="LineNr">144 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>p == words<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L145" class="LineNr">145 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"instruction prematurely ended with '<-'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L145" class="LineNr">145 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"instruction prematurely ended with '<-'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L146" class="LineNr">146 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L147" class="LineNr">147 </span> <span class="Delimiter">}</span> <span id="L148" class="LineNr">148 </span> curr<span class="Delimiter">-></span>name = *p<span class="Delimiter">;</span> ++p<span class="Delimiter">;</span> @@ -221,7 +224,7 @@ if ('onhashchange' in window) { <span id="L158" class="LineNr">158 </span> <span class="Normal">for</span> <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><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span id="L159" class="LineNr">159 </span> <a href='003trace.cc.html#L189'>trace</a><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> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>*p<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L160" class="LineNr">160 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L161" class="LineNr">161 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"9: unbalanced '[' for <a href='010vm.cc.html#L19'>recipe</a></span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L161" class="LineNr">161 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"9: unbalanced '[' for recipe\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L162" class="LineNr">162 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L163" class="LineNr">163 </span> <span class="Delimiter">}</span> <span id="L164" class="LineNr">164 </span> <span class="Comment">// End next_instruction(curr)</span> @@ -237,7 +240,7 @@ if ('onhashchange' in window) { <span id="L174" class="LineNr">174 </span> <a href='011load.cc.html#L222'>skip_whitespace_and_comments_but_not_newline</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L175" class="LineNr">175 </span> string result = out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L176" class="LineNr">176 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result != <span class="Constant">"["</span> && <a href='011load.cc.html#L186'>ends_with</a><span class="Delimiter">(</span>result<span class="Delimiter">,</span> <span class="Constant">'['</span><span class="Delimiter">))</span> -<span id="L177" class="LineNr">177 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"insert a space before '[' in '"</span> << result << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L177" class="LineNr">177 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"insert a space before '[' in '"</span> << result << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L178" class="LineNr">178 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L179" class="LineNr">179 </span><span class="Delimiter">}</span> <span id="L180" class="LineNr">180 </span> @@ -253,17 +256,17 @@ if ('onhashchange' in window) { <span id="L190" class="LineNr">190 </span> <span id="L191" class="LineNr">191 </span><span class="Delimiter">:(before "End Globals")</span> <span id="L192" class="LineNr">192 </span><span class="Comment">// word boundaries</span> -<span id="L193" class="LineNr">193 </span><span class="Normal">extern</span> <span class="Normal">const</span> string Terminators<span class="Delimiter">(</span><span class="Constant">"(){}"</span><span class="Delimiter">);</span> +<span id="L193" class="LineNr">193 </span><span class="Normal">extern</span> <span class="Normal">const</span> string <span class="Special">Terminators</span><span class="Delimiter">(</span><span class="Constant">"(){}"</span><span class="Delimiter">);</span> <span id="L194" class="LineNr">194 </span><span class="Delimiter">:(code)</span> <span id="L195" class="LineNr">195 </span><span class="Normal">void</span> <a href='011load.cc.html#L195'>slurp_word</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L196" class="LineNr">196 </span> <span class="Normal">char</span> c<span class="Delimiter">;</span> -<span id="L197" class="LineNr">197 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && Terminators<span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L197" class="LineNr">197 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && <span class="Special">Terminators</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L198" class="LineNr">198 </span> in >> c<span class="Delimiter">;</span> <span id="L199" class="LineNr">199 </span> out << c<span class="Delimiter">;</span> <span id="L200" class="LineNr">200 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L201" class="LineNr">201 </span> <span class="Delimiter">}</span> <span id="L202" class="LineNr">202 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>in >> c<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L203" class="LineNr">203 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>isspace<span class="Delimiter">(</span>c<span class="Delimiter">)</span> || Terminators<span class="Delimiter">.</span>find<span class="Delimiter">(</span>c<span class="Delimiter">)</span> != string::npos || Ignore<span class="Delimiter">.</span>find<span class="Delimiter">(</span>c<span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L203" class="LineNr">203 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>isspace<span class="Delimiter">(</span>c<span class="Delimiter">)</span> || <span class="Special">Terminators</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>c<span class="Delimiter">)</span> != string::npos || <span class="Special">Ignore</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>c<span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L204" class="LineNr">204 </span> in<span class="Delimiter">.</span>putback<span class="Delimiter">(</span>c<span class="Delimiter">);</span> <span id="L205" class="LineNr">205 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L206" class="LineNr">206 </span> <span class="Delimiter">}</span> @@ -275,7 +278,7 @@ if ('onhashchange' in window) { <span id="L212" class="LineNr">212 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><span class="Constant">true</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L213" class="LineNr">213 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L214" class="LineNr">214 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>isspace<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()))</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> -<span id="L215" class="LineNr">215 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Ignore<span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> +<span id="L215" class="LineNr">215 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Ignore</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> <span id="L216" class="LineNr">216 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">'#'</span><span class="Delimiter">)</span> <a href='011load.cc.html#L233'>skip_comment</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L217" class="LineNr">217 </span> <span class="Normal">else</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L218" class="LineNr">218 </span> <span class="Delimiter">}</span> @@ -287,7 +290,7 @@ if ('onhashchange' in window) { <span id="L224" class="LineNr">224 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L225" class="LineNr">225 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L226" class="LineNr">226 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>isspace<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()))</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> -<span id="L227" class="LineNr">227 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Ignore<span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> +<span id="L227" class="LineNr">227 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Ignore</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> <span id="L228" class="LineNr">228 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">'#'</span><span class="Delimiter">)</span> <a href='011load.cc.html#L233'>skip_comment</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L229" class="LineNr">229 </span> <span class="Normal">else</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L230" class="LineNr">230 </span> <span class="Delimiter">}</span> @@ -418,9 +421,9 @@ if ('onhashchange' in window) { <span id="L355" class="LineNr">355 </span><span class="Comment">//: this test we can't represent with a scenario</span> <span id="L356" class="LineNr">356 </span><span class="Delimiter">:(code)</span> <span id="L357" class="LineNr">357 </span><span class="Normal">void</span> <a href='011load.cc.html#L357'>test_parse_comment_terminated_by_eof</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L358" class="LineNr">358 </span> load<span class="Delimiter">(</span><span class="Constant">"recipe <a href='000organization.cc.html#L113'>main</a> [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L359" class="LineNr">359 </span> <span class="Constant">" a:number <- copy 34</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L360" class="LineNr">360 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span> +<span id="L358" class="LineNr">358 </span> load<span class="Delimiter">(</span><span class="Constant">"recipe <a href='000organization.cc.html#L113'>main</a> [\n"</span> +<span id="L359" class="LineNr">359 </span> <span class="Constant">" a:number <- copy 34\n"</span> +<span id="L360" class="LineNr">360 </span> <span class="Constant">"]\n"</span> <span id="L361" class="LineNr">361 </span> <span class="Constant">"# abc"</span><span class="Delimiter">);</span> <span class="Comment">// no newline after comment</span> <span id="L362" class="LineNr">362 </span> cerr << <span class="Constant">"."</span><span class="Delimiter">;</span> <span class="Comment">// termination = success</span> <span id="L363" class="LineNr">363 </span><span class="Delimiter">}</span> @@ -436,12 +439,12 @@ if ('onhashchange' in window) { <span id="L373" class="LineNr">373 </span><span class="Comment">//: step on their own toes. But there'll be many occasions later where</span> <span id="L374" class="LineNr">374 </span><span class="Comment">//: we'll want to disable the errors.</span> <span id="L375" class="LineNr">375 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L376" class="LineNr">376 </span><span class="Normal">bool</span> Disable_redefine_checks =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L376" class="LineNr">376 </span><span class="Normal">bool</span> <span class="Special">Disable_redefine_checks</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L377" class="LineNr">377 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L378" class="LineNr">378 </span>Disable_redefine_checks =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L378" class="LineNr">378 </span><span class="Special">Disable_redefine_checks</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L379" class="LineNr">379 </span><span class="Delimiter">:(code)</span> <span id="L380" class="LineNr">380 </span><span class="Normal">bool</span> <a href='011load.cc.html#L380'>should_check_for_redefine</a><span class="Delimiter">(</span><span class="Normal">const</span> string& recipe_name<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L381" class="LineNr">381 </span> <span class="Normal">if</span> <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 id="L381" class="LineNr">381 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Disable_redefine_checks</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L382" class="LineNr">382 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L383" class="LineNr">383 </span><span class="Delimiter">}</span> <span id="L384" class="LineNr">384 </span> @@ -472,7 +475,7 @@ if ('onhashchange' in window) { <span id="L409" class="LineNr">409 </span> <span class="Normal">char</span> c<span class="Delimiter">;</span> <span id="L410" class="LineNr">410 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>in >> c<span class="Delimiter">)</span> <span id="L411" class="LineNr">411 </span> cerr << c<span class="Delimiter">;</span> -<span id="L412" class="LineNr">412 </span> cerr << <span class="Constant">"$</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L412" class="LineNr">412 </span> cerr << <span class="Constant">"$\n"</span><span class="Delimiter">;</span> <span id="L413" class="LineNr">413 </span> exit<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L414" class="LineNr">414 </span><span class="Delimiter">}</span> </pre> |