diff options
Diffstat (limited to 'html/050scenario.cc.html')
-rw-r--r-- | html/050scenario.cc.html | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/html/050scenario.cc.html b/html/050scenario.cc.html index 18576b21..ae05aa68 100644 --- a/html/050scenario.cc.html +++ b/html/050scenario.cc.html @@ -12,16 +12,16 @@ <!-- pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-family: monospace; color: #eeeeee; background-color: #080808; } -* { font-size: 1em; } +* { font-size: 1.05em; } .traceContains { color: #008000; } .cSpecial { color: #008000; } -.Constant { color: #008080; } +.Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } .traceAbsent { color: #c00000; } -.Comment { color: #8080ff; } -.Delimiter { color: #c000c0; } +.Comment { color: #9090ff; } +.Delimiter { color: #a04060; } .Special { color: #ff6060; } -.CommentedCode { color: #6c6c6c; } +.Comment { color: #9090ff; } .Identifier { color: #804000; } --> </style> @@ -110,11 +110,18 @@ scenario parse_scenario<span class="Delimiter">(</span>istream& in<span clas <span class="CommentedCode">//? cerr << "parse scenario\n"; //? 1</span> scenario result<span class="Delimiter">;</span> result<span class="Delimiter">.</span>name = next_word<span class="Delimiter">(</span>in<span class="Delimiter">);</span> +<span class="CommentedCode">//? cerr << "scenario: " << result.name << '\n'; //? 2</span> skip_whitespace_and_comments<span class="Delimiter">(</span>in<span class="Delimiter">);</span> assert<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">'['</span><span class="Delimiter">);</span> <span class="Comment">// scenarios are take special 'code' strings so we need to ignore brackets</span> <span class="Comment">// inside comments</span> - result<span class="Delimiter">.</span>to_run = slurp_quoted_ignoring_comments<span class="Delimiter">(</span>in<span class="Delimiter">);</span> + result<span class="Delimiter">.</span>to_run = slurp_quoted<span class="Delimiter">(</span>in<span class="Delimiter">);</span> + <span class="Comment">// delete [] delimiters</span> + assert<span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<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> + result<span class="Delimiter">.</span>to_run<span class="Delimiter">.</span>erase<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> +<span class="CommentedCode">//? cerr << (int)result.to_run.at(SIZE(result.to_run)-1) << '\n'; //? 1</span> + assert<span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">.</span>at<span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">)</span> == <span class="Constant">']'</span><span class="Delimiter">);</span> + result<span class="Delimiter">.</span>to_run<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">);</span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -161,13 +168,16 @@ const scenario* Current_scenario = <span class="Constant">NULL</span><span class void run_mu_scenario<span class="Delimiter">(</span>const scenario& s<span class="Delimiter">)</span> <span class="Delimiter">{</span> Current_scenario = &s<span class="Delimiter">;</span> bool not_already_inside_test = !Trace_stream<span class="Delimiter">;</span> +<span class="CommentedCode">//? cerr << s.name << '\n'; //? 4</span> if <span class="Delimiter">(</span>not_already_inside_test<span class="Delimiter">)</span> <span class="Delimiter">{</span> Trace_file = s<span class="Delimiter">.</span>name<span class="Delimiter">;</span> Trace_stream = new trace_stream<span class="Delimiter">;</span> setup<span class="Delimiter">();</span> <span class="Delimiter">}</span> -<span class="CommentedCode">//? cerr << '^' << s.to_run << "$\n"; //? 1</span> +<span class="CommentedCode">//? cerr << '^' << s.to_run << "$\n"; //? 4</span> + assert<span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> run<span class="Delimiter">(</span><span class="Constant">"recipe "</span>+s<span class="Delimiter">.</span>name+<span class="Constant">" [ "</span> + s<span class="Delimiter">.</span>to_run + <span class="Constant">" ]"</span><span class="Delimiter">);</span> +<span class="CommentedCode">//? cerr << s.name << " done\n"; //? 1</span> if <span class="Delimiter">(</span>not_already_inside_test && Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> teardown<span class="Delimiter">();</span> ofstream fout<span class="Delimiter">((</span>Trace_dir+Trace_file<span class="Delimiter">).</span>c_str<span class="Delimiter">());</span> @@ -557,36 +567,6 @@ void run_mu_scenario<span class="Delimiter">(</span>const string& form<span scenario s = parse_scenario<span class="Delimiter">(</span>in<span class="Delimiter">);</span> run_mu_scenario<span class="Delimiter">(</span>s<span class="Delimiter">);</span> <span class="Delimiter">}</span> - -string slurp_quoted_ignoring_comments<span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> - assert<span class="Delimiter">(</span>in<span class="Delimiter">.</span>get<span class="Delimiter">()</span> == <span class="Constant">'['</span><span class="Delimiter">);</span> <span class="Comment">// drop initial '['</span> - char c<span class="Delimiter">;</span> - ostringstream out<span class="Delimiter">;</span> - while <span class="Delimiter">(</span>in >> c<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span class="CommentedCode">//? cerr << c << '\n'; //? 3</span> - if <span class="Delimiter">(</span>c == <span class="Constant">'#'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> - <span class="Comment">// skip comment</span> - in<span class="Delimiter">.</span>putback<span class="Delimiter">(</span>c<span class="Delimiter">);</span> - skip_comment<span class="Delimiter">(</span>in<span class="Delimiter">);</span> - <span class="Identifier">continue</span><span class="Delimiter">;</span> - <span class="Delimiter">}</span> - if <span class="Delimiter">(</span>c == <span class="Constant">'['</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> - <span class="Comment">// nested strings won't detect comments</span> - <span class="Comment">// can't yet handle scenarios inside strings inside scenarios..</span> - in<span class="Delimiter">.</span>putback<span class="Delimiter">(</span>c<span class="Delimiter">);</span> - out << slurp_quoted<span class="Delimiter">(</span>in<span class="Delimiter">);</span> -<span class="CommentedCode">//? cerr << "snapshot: ^" << out.str() << "$\n"; //? 1</span> - <span class="Identifier">continue</span><span class="Delimiter">;</span> - <span class="Delimiter">}</span> - if <span class="Delimiter">(</span>c == <span class="Constant">']'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> - <span class="Comment">// must be at the outermost level; drop final ']'</span> - <span class="Identifier">break</span><span class="Delimiter">;</span> - <span class="Delimiter">}</span> - out << c<span class="Delimiter">;</span> - <span class="Delimiter">}</span> -<span class="CommentedCode">//? cerr << "done\n"; //? 2</span> - <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> -<span class="Delimiter">}</span> </pre> </body> </html> |