summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-10-04 21:34:54 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-10-04 21:34:54 -0400
commita201ff9a72ed8cccedf27ef712bae00e4532b48c (patch)
tree96710bbc3b95b5e8981b8b52c07e4e57deb161fd
parent4d906d76669dcaf823c0964bda83667307bd8e2e (diff)
downloadpython-coveragepy-a201ff9a72ed8cccedf27ef712bae00e4532b48c.tar.gz
Updated sample html report.coverage-3.1
-rw-r--r--doc/sample_html/_ned_py_path.html1508
-rw-r--r--doc/sample_html/cogapp_cogapp.html1418
-rw-r--r--doc/sample_html/cogapp_makefiles.html128
-rw-r--r--doc/sample_html/cogapp_test_cogapp.html3920
-rw-r--r--doc/sample_html/cogapp_whiteutils.html126
-rw-r--r--doc/sample_html/index.html18
-rw-r--r--doc/sample_html/style.css21
7 files changed, 4337 insertions, 2802 deletions
diff --git a/doc/sample_html/_ned_py_path.html b/doc/sample_html/_ned_py_path.html
new file mode 100644
index 0000000..78637ee
--- /dev/null
+++ b/doc/sample_html/_ned_py_path.html
@@ -0,0 +1,1508 @@
+<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<title>Coverage for c:\ned\py\path</title>
+<link rel='stylesheet' href='style.css' type='text/css'>
+<script src='jquery-1.3.2.min.js'></script>
+<script>
+function toggle_lines(btn, cls) {
+ var btn = $(btn);
+ if (btn.hasClass("hide")) {
+ $("#source ."+cls).removeClass("hide");
+ btn.removeClass("hide");
+ }
+ else {
+ $("#source ."+cls).addClass("hide");
+ btn.addClass("hide");
+ }
+}
+</script>
+</head>
+<body>
+<div id='header'>
+ <div class='content'>
+ <h1>Coverage for <b>c:\ned\py\path</b> :
+ <span class='pc_cov'>40%</span>
+ </h1>
+ <h2 class='stats'>
+ 286 statements
+ <span class='run hide' onclick='toggle_lines(this, "run")'>114 run</span>
+ <span class='exc' onclick='toggle_lines(this, "exc")'>0 excluded</span>
+ <span class='mis' onclick='toggle_lines(this, "mis")'>172 missing</span>
+ </h2>
+ </div>
+</div>
+
+<div id='source'>
+<table cellspacing='0' cellpadding='0'>
+<tr>
+<td class='linenos' valign='top'>
+<p class='pln'>1</p>
+<p class='pln'>2</p>
+<p class='pln'>3</p>
+<p class='pln'>4</p>
+<p class='pln'>5</p>
+<p class='pln'>6</p>
+<p class='pln'>7</p>
+<p class='pln'>8</p>
+<p class='pln'>9</p>
+<p class='pln'>10</p>
+<p class='pln'>11</p>
+<p class='pln'>12</p>
+<p class='pln'>13</p>
+<p class='pln'>14</p>
+<p class='pln'>15</p>
+<p class='pln'>16</p>
+<p class='pln'>17</p>
+<p class='pln'>18</p>
+<p class='pln'>19</p>
+<p class='pln'>20</p>
+<p class='pln'>21</p>
+<p class='pln'>22</p>
+<p class='pln'>23</p>
+<p class='pln'>24</p>
+<p class='pln'>25</p>
+<p class='pln'>26</p>
+<p class='pln'>27</p>
+<p class='pln'>28</p>
+<p class='pln'>29</p>
+<p class='pln'>30</p>
+<p class='pln'>31</p>
+<p class='stm run hide'>32</p>
+<p class='pln'>33</p>
+<p class='stm run hide'>34</p>
+<p class='pln'>35</p>
+<p class='stm run hide'>36</p>
+<p class='stm run hide'>37</p>
+<p class='pln'>38</p>
+<p class='pln'>39</p>
+<p class='stm run hide'>40</p>
+<p class='stm run hide'>41</p>
+<p class='stm run hide'>42</p>
+<p class='stm run hide'>43</p>
+<p class='stm mis'>44</p>
+<p class='stm mis'>45</p>
+<p class='pln'>46</p>
+<p class='pln'>47</p>
+<p class='stm run hide'>48</p>
+<p class='stm run hide'>49</p>
+<p class='stm mis'>50</p>
+<p class='stm mis'>51</p>
+<p class='pln'>52</p>
+<p class='pln'>53</p>
+<p class='stm run hide'>54</p>
+<p class='stm run hide'>55</p>
+<p class='stm run hide'>56</p>
+<p class='pln'>57</p>
+<p class='pln'>58</p>
+<p class='stm run hide'>59</p>
+<p class='pln'>60</p>
+<p class='pln'>61</p>
+<p class='pln'>62</p>
+<p class='pln'>63</p>
+<p class='pln'>64</p>
+<p class='pln'>65</p>
+<p class='pln'>66</p>
+<p class='pln'>67</p>
+<p class='stm run hide'>68</p>
+<p class='stm mis'>69</p>
+<p class='pln'>70</p>
+<p class='pln'>71</p>
+<p class='stm run hide'>72</p>
+<p class='stm mis'>73</p>
+<p class='pln'>74</p>
+<p class='stm run hide'>75</p>
+<p class='stm mis'>76</p>
+<p class='pln'>77</p>
+<p class='pln'>78</p>
+<p class='stm run hide'>79</p>
+<p class='pln'>80</p>
+<p class='pln'>81</p>
+<p class='pln'>82</p>
+<p class='pln'>83</p>
+<p class='pln'>84</p>
+<p class='stm mis'>85</p>
+<p class='pln'>86</p>
+<p class='pln'>87</p>
+<p class='stm run hide'>88</p>
+<p class='pln'>89</p>
+<p class='stm run hide'>90</p>
+<p class='pln'>91</p>
+<p class='stm mis'>92</p>
+<p class='stm run hide'>93</p>
+<p class='pln'>94</p>
+<p class='pln'>95</p>
+<p class='pln'>96</p>
+<p class='pln'>97</p>
+<p class='stm run hide'>98</p>
+<p class='stm run hide'>99</p>
+<p class='stm run hide'>100</p>
+<p class='stm run hide'>101</p>
+<p class='stm run hide'>102</p>
+<p class='stm run hide'>103</p>
+<p class='stm run hide'>104</p>
+<p class='stm run hide'>105</p>
+<p class='pln'>106</p>
+<p class='stm run hide'>107</p>
+<p class='pln'>108</p>
+<p class='pln'>109</p>
+<p class='pln'>110</p>
+<p class='pln'>111</p>
+<p class='pln'>112</p>
+<p class='pln'>113</p>
+<p class='stm mis'>114</p>
+<p class='pln'>115</p>
+<p class='stm run hide'>116</p>
+<p class='stm mis'>117</p>
+<p class='stm mis'>118</p>
+<p class='pln'>119</p>
+<p class='stm run hide'>120</p>
+<p class='stm mis'>121</p>
+<p class='stm mis'>122</p>
+<p class='pln'>123</p>
+<p class='stm run hide'>124</p>
+<p class='stm mis'>125</p>
+<p class='stm mis'>126</p>
+<p class='pln'>127</p>
+<p class='stm run hide'>128</p>
+<p class='pln'>129</p>
+<p class='pln'>130</p>
+<p class='pln'>131</p>
+<p class='pln'>132</p>
+<p class='pln'>133</p>
+<p class='pln'>134</p>
+<p class='stm run hide'>135</p>
+<p class='pln'>136</p>
+<p class='pln'>137</p>
+<p class='pln'>138</p>
+<p class='pln'>139</p>
+<p class='pln'>140</p>
+<p class='pln'>141</p>
+<p class='stm run hide'>142</p>
+<p class='pln'>143</p>
+<p class='pln'>144</p>
+<p class='pln'>145</p>
+<p class='pln'>146</p>
+<p class='pln'>147</p>
+<p class='pln'>148</p>
+<p class='pln'>149</p>
+<p class='stm run hide'>150</p>
+<p class='pln'>151</p>
+<p class='pln'>152</p>
+<p class='pln'>153</p>
+<p class='stm run hide'>154</p>
+<p class='pln'>155</p>
+<p class='pln'>156</p>
+<p class='pln'>157</p>
+<p class='pln'>158</p>
+<p class='pln'>159</p>
+<p class='stm run hide'>160</p>
+<p class='pln'>161</p>
+<p class='stm mis'>162</p>
+<p class='stm mis'>163</p>
+<p class='pln'>164</p>
+<p class='stm run hide'>165</p>
+<p class='pln'>166</p>
+<p class='pln'>167</p>
+<p class='pln'>168</p>
+<p class='pln'>169</p>
+<p class='pln'>170</p>
+<p class='pln'>171</p>
+<p class='stm mis'>172</p>
+<p class='stm mis'>173</p>
+<p class='pln'>174</p>
+<p class='stm run hide'>175</p>
+<p class='pln'>176</p>
+<p class='pln'>177</p>
+<p class='pln'>178</p>
+<p class='pln'>179</p>
+<p class='pln'>180</p>
+<p class='pln'>181</p>
+<p class='pln'>182</p>
+<p class='pln'>183</p>
+<p class='pln'>184</p>
+<p class='pln'>185</p>
+<p class='pln'>186</p>
+<p class='pln'>187</p>
+<p class='pln'>188</p>
+<p class='stm mis'>189</p>
+<p class='stm mis'>190</p>
+<p class='pln'>191</p>
+<p class='stm run hide'>192</p>
+<p class='pln'>193</p>
+<p class='pln'>194</p>
+<p class='pln'>195</p>
+<p class='pln'>196</p>
+<p class='pln'>197</p>
+<p class='stm mis'>198</p>
+<p class='pln'>199</p>
+<p class='stm run hide'>200</p>
+<p class='stm run hide'>201</p>
+<p class='stm mis'>202</p>
+<p class='stm mis'>203</p>
+<p class='pln'>204</p>
+<p class='stm run hide'>205</p>
+<p class='stm mis'>206</p>
+<p class='stm mis'>207</p>
+<p class='pln'>208</p>
+<p class='stm run hide'>209</p>
+<p class='pln'>210</p>
+<p class='pln'>211</p>
+<p class='pln'>212</p>
+<p class='pln'>213</p>
+<p class='stm run hide'>214</p>
+<p class='pln'>215</p>
+<p class='pln'>216</p>
+<p class='pln'>217</p>
+<p class='pln'>218</p>
+<p class='stm mis'>219</p>
+<p class='pln'>220</p>
+<p class='stm run hide'>221</p>
+<p class='pln'>222</p>
+<p class='pln'>223</p>
+<p class='pln'>224</p>
+<p class='pln'>225</p>
+<p class='pln'>226</p>
+<p class='pln'>227</p>
+<p class='pln'>228</p>
+<p class='pln'>229</p>
+<p class='pln'>230</p>
+<p class='stm mis'>231</p>
+<p class='stm mis'>232</p>
+<p class='stm mis'>233</p>
+<p class='stm mis'>234</p>
+<p class='stm mis'>235</p>
+<p class='stm mis'>236</p>
+<p class='stm mis'>237</p>
+<p class='stm mis'>238</p>
+<p class='stm mis'>239</p>
+<p class='stm mis'>240</p>
+<p class='stm mis'>241</p>
+<p class='pln'>242</p>
+<p class='stm run hide'>243</p>
+<p class='pln'>244</p>
+<p class='pln'>245</p>
+<p class='pln'>246</p>
+<p class='stm mis'>247</p>
+<p class='stm mis'>248</p>
+<p class='pln'>249</p>
+<p class='stm run hide'>250</p>
+<p class='pln'>251</p>
+<p class='pln'>252</p>
+<p class='pln'>253</p>
+<p class='pln'>254</p>
+<p class='pln'>255</p>
+<p class='pln'>256</p>
+<p class='stm mis'>257</p>
+<p class='stm mis'>258</p>
+<p class='pln'>259</p>
+<p class='stm mis'>260</p>
+<p class='pln'>261</p>
+<p class='stm mis'>262</p>
+<p class='pln'>263</p>
+<p class='stm mis'>264</p>
+<p class='pln'>265</p>
+<p class='stm mis'>266</p>
+<p class='pln'>267</p>
+<p class='pln'>268</p>
+<p class='stm mis'>269</p>
+<p class='stm mis'>270</p>
+<p class='stm mis'>271</p>
+<p class='stm mis'>272</p>
+<p class='stm mis'>273</p>
+<p class='pln'>274</p>
+<p class='pln'>275</p>
+<p class='pln'>276</p>
+<p class='pln'>277</p>
+<p class='stm mis'>278</p>
+<p class='pln'>279</p>
+<p class='stm mis'>280</p>
+<p class='stm mis'>281</p>
+<p class='pln'>282</p>
+<p class='stm mis'>283</p>
+<p class='pln'>284</p>
+<p class='stm mis'>285</p>
+<p class='pln'>286</p>
+<p class='pln'>287</p>
+<p class='pln'>288</p>
+<p class='pln'>289</p>
+<p class='stm run hide'>290</p>
+<p class='pln'>291</p>
+<p class='pln'>292</p>
+<p class='pln'>293</p>
+<p class='pln'>294</p>
+<p class='pln'>295</p>
+<p class='pln'>296</p>
+<p class='pln'>297</p>
+<p class='pln'>298</p>
+<p class='pln'>299</p>
+<p class='pln'>300</p>
+<p class='stm mis'>301</p>
+<p class='stm mis'>302</p>
+<p class='stm mis'>303</p>
+<p class='stm mis'>304</p>
+<p class='pln'>305</p>
+<p class='stm run hide'>306</p>
+<p class='pln'>307</p>
+<p class='pln'>308</p>
+<p class='pln'>309</p>
+<p class='pln'>310</p>
+<p class='pln'>311</p>
+<p class='pln'>312</p>
+<p class='pln'>313</p>
+<p class='pln'>314</p>
+<p class='pln'>315</p>
+<p class='pln'>316</p>
+<p class='stm mis'>317</p>
+<p class='pln'>318</p>
+<p class='stm run hide'>319</p>
+<p class='pln'>320</p>
+<p class='pln'>321</p>
+<p class='pln'>322</p>
+<p class='pln'>323</p>
+<p class='pln'>324</p>
+<p class='pln'>325</p>
+<p class='pln'>326</p>
+<p class='pln'>327</p>
+<p class='pln'>328</p>
+<p class='pln'>329</p>
+<p class='stm mis'>330</p>
+<p class='pln'>331</p>
+<p class='stm run hide'>332</p>
+<p class='pln'>333</p>
+<p class='pln'>334</p>
+<p class='pln'>335</p>
+<p class='pln'>336</p>
+<p class='pln'>337</p>
+<p class='pln'>338</p>
+<p class='pln'>339</p>
+<p class='pln'>340</p>
+<p class='pln'>341</p>
+<p class='stm mis'>342</p>
+<p class='stm mis'>343</p>
+<p class='stm mis'>344</p>
+<p class='stm mis'>345</p>
+<p class='stm mis'>346</p>
+<p class='stm mis'>347</p>
+<p class='pln'>348</p>
+<p class='stm run hide'>349</p>
+<p class='pln'>350</p>
+<p class='pln'>351</p>
+<p class='pln'>352</p>
+<p class='pln'>353</p>
+<p class='pln'>354</p>
+<p class='pln'>355</p>
+<p class='pln'>356</p>
+<p class='stm mis'>357</p>
+<p class='stm mis'>358</p>
+<p class='stm mis'>359</p>
+<p class='stm mis'>360</p>
+<p class='stm mis'>361</p>
+<p class='pln'>362</p>
+<p class='stm run hide'>363</p>
+<p class='pln'>364</p>
+<p class='pln'>365</p>
+<p class='pln'>366</p>
+<p class='pln'>367</p>
+<p class='pln'>368</p>
+<p class='pln'>369</p>
+<p class='pln'>370</p>
+<p class='stm mis'>371</p>
+<p class='stm mis'>372</p>
+<p class='stm mis'>373</p>
+<p class='stm mis'>374</p>
+<p class='stm mis'>375</p>
+<p class='stm mis'>376</p>
+<p class='stm mis'>377</p>
+<p class='pln'>378</p>
+<p class='stm run hide'>379</p>
+<p class='pln'>380</p>
+<p class='pln'>381</p>
+<p class='pln'>382</p>
+<p class='pln'>383</p>
+<p class='pln'>384</p>
+<p class='stm mis'>385</p>
+<p class='pln'>386</p>
+<p class='stm run hide'>387</p>
+<p class='pln'>388</p>
+<p class='pln'>389</p>
+<p class='pln'>390</p>
+<p class='pln'>391</p>
+<p class='pln'>392</p>
+<p class='pln'>393</p>
+<p class='pln'>394</p>
+<p class='stm mis'>395</p>
+<p class='pln'>396</p>
+<p class='pln'>397</p>
+<p class='pln'>398</p>
+<p class='pln'>399</p>
+<p class='stm run hide'>400</p>
+<p class='pln'>401</p>
+<p class='stm mis'>402</p>
+<p class='pln'>403</p>
+<p class='stm run hide'>404</p>
+<p class='pln'>405</p>
+<p class='stm mis'>406</p>
+<p class='stm mis'>407</p>
+<p class='stm mis'>408</p>
+<p class='pln'>409</p>
+<p class='stm mis'>410</p>
+<p class='pln'>411</p>
+<p class='stm run hide'>412</p>
+<p class='pln'>413</p>
+<p class='pln'>414</p>
+<p class='pln'>415</p>
+<p class='pln'>416</p>
+<p class='pln'>417</p>
+<p class='stm mis'>418</p>
+<p class='stm mis'>419</p>
+<p class='pln'>420</p>
+<p class='stm mis'>421</p>
+<p class='stm mis'>422</p>
+<p class='stm mis'>423</p>
+<p class='stm mis'>424</p>
+<p class='pln'>425</p>
+<p class='stm mis'>426</p>
+<p class='pln'>427</p>
+<p class='stm run hide'>428</p>
+<p class='pln'>429</p>
+<p class='pln'>430</p>
+<p class='pln'>431</p>
+<p class='pln'>432</p>
+<p class='pln'>433</p>
+<p class='pln'>434</p>
+<p class='pln'>435</p>
+<p class='pln'>436</p>
+<p class='pln'>437</p>
+<p class='pln'>438</p>
+<p class='pln'>439</p>
+<p class='pln'>440</p>
+<p class='pln'>441</p>
+<p class='pln'>442</p>
+<p class='stm mis'>443</p>
+<p class='pln'>444</p>
+<p class='stm mis'>445</p>
+<p class='stm mis'>446</p>
+<p class='stm mis'>447</p>
+<p class='pln'>448</p>
+<p class='stm mis'>449</p>
+<p class='pln'>450</p>
+<p class='pln'>451</p>
+<p class='stm mis'>452</p>
+<p class='pln'>453</p>
+<p class='pln'>454</p>
+<p class='stm mis'>455</p>
+<p class='stm mis'>456</p>
+<p class='pln'>457</p>
+<p class='stm mis'>458</p>
+<p class='stm mis'>459</p>
+<p class='pln'>460</p>
+<p class='stm run hide'>461</p>
+<p class='pln'>462</p>
+<p class='pln'>463</p>
+<p class='pln'>464</p>
+<p class='pln'>465</p>
+<p class='pln'>466</p>
+<p class='pln'>467</p>
+<p class='pln'>468</p>
+<p class='pln'>469</p>
+<p class='pln'>470</p>
+<p class='pln'>471</p>
+<p class='pln'>472</p>
+<p class='pln'>473</p>
+<p class='pln'>474</p>
+<p class='pln'>475</p>
+<p class='pln'>476</p>
+<p class='pln'>477</p>
+<p class='pln'>478</p>
+<p class='pln'>479</p>
+<p class='pln'>480</p>
+<p class='pln'>481</p>
+<p class='pln'>482</p>
+<p class='pln'>483</p>
+<p class='pln'>484</p>
+<p class='pln'>485</p>
+<p class='pln'>486</p>
+<p class='pln'>487</p>
+<p class='pln'>488</p>
+<p class='pln'>489</p>
+<p class='pln'>490</p>
+<p class='pln'>491</p>
+<p class='pln'>492</p>
+<p class='pln'>493</p>
+<p class='pln'>494</p>
+<p class='stm mis'>495</p>
+<p class='stm mis'>496</p>
+<p class='stm mis'>497</p>
+<p class='stm mis'>498</p>
+<p class='stm mis'>499</p>
+<p class='stm mis'>500</p>
+<p class='pln'>501</p>
+<p class='stm mis'>502</p>
+<p class='stm mis'>503</p>
+<p class='pln'>504</p>
+<p class='stm mis'>505</p>
+<p class='stm mis'>506</p>
+<p class='stm mis'>507</p>
+<p class='stm mis'>508</p>
+<p class='pln'>509</p>
+<p class='stm mis'>510</p>
+<p class='pln'>511</p>
+<p class='stm run hide'>512</p>
+<p class='pln'>513</p>
+<p class='pln'>514</p>
+<p class='pln'>515</p>
+<p class='pln'>516</p>
+<p class='pln'>517</p>
+<p class='pln'>518</p>
+<p class='pln'>519</p>
+<p class='pln'>520</p>
+<p class='pln'>521</p>
+<p class='pln'>522</p>
+<p class='pln'>523</p>
+<p class='pln'>524</p>
+<p class='pln'>525</p>
+<p class='pln'>526</p>
+<p class='pln'>527</p>
+<p class='pln'>528</p>
+<p class='stm mis'>529</p>
+<p class='stm mis'>530</p>
+<p class='stm mis'>531</p>
+<p class='stm mis'>532</p>
+<p class='pln'>533</p>
+<p class='stm mis'>534</p>
+<p class='pln'>535</p>
+<p class='stm mis'>536</p>
+<p class='pln'>537</p>
+<p class='stm run hide'>538</p>
+<p class='pln'>539</p>
+<p class='pln'>540</p>
+<p class='pln'>541</p>
+<p class='pln'>542</p>
+<p class='pln'>543</p>
+<p class='pln'>544</p>
+<p class='pln'>545</p>
+<p class='pln'>546</p>
+<p class='pln'>547</p>
+<p class='pln'>548</p>
+<p class='pln'>549</p>
+<p class='stm mis'>550</p>
+<p class='stm mis'>551</p>
+<p class='stm mis'>552</p>
+<p class='stm mis'>553</p>
+<p class='stm mis'>554</p>
+<p class='stm mis'>555</p>
+<p class='stm mis'>556</p>
+<p class='stm mis'>557</p>
+<p class='stm mis'>558</p>
+<p class='stm mis'>559</p>
+<p class='pln'>560</p>
+<p class='stm mis'>561</p>
+<p class='pln'>562</p>
+<p class='pln'>563</p>
+<p class='pln'>564</p>
+<p class='pln'>565</p>
+<p class='stm run hide'>566</p>
+<p class='stm run hide'>567</p>
+<p class='stm run hide'>568</p>
+<p class='stm run hide'>569</p>
+<p class='stm run hide'>570</p>
+<p class='stm run hide'>571</p>
+<p class='pln'>572</p>
+<p class='stm run hide'>573</p>
+<p class='stm mis'>574</p>
+<p class='pln'>575</p>
+<p class='stm run hide'>576</p>
+<p class='stm run hide'>577</p>
+<p class='pln'>578</p>
+<p class='pln'>579</p>
+<p class='pln'>580</p>
+<p class='stm run hide'>581</p>
+<p class='stm run hide'>582</p>
+<p class='pln'>583</p>
+<p class='pln'>584</p>
+<p class='pln'>585</p>
+<p class='stm run hide'>586</p>
+<p class='stm run hide'>587</p>
+<p class='stm run hide'>588</p>
+<p class='pln'>589</p>
+<p class='pln'>590</p>
+<p class='pln'>591</p>
+<p class='stm run hide'>592</p>
+<p class='stm run hide'>593</p>
+<p class='pln'>594</p>
+<p class='pln'>595</p>
+<p class='pln'>596</p>
+<p class='stm run hide'>597</p>
+<p class='stm run hide'>598</p>
+<p class='pln'>599</p>
+<p class='pln'>600</p>
+<p class='pln'>601</p>
+<p class='pln'>602</p>
+<p class='stm mis'>603</p>
+<p class='pln'>604</p>
+<p class='stm run hide'>605</p>
+<p class='pln'>606</p>
+<p class='stm mis'>607</p>
+<p class='pln'>608</p>
+<p class='stm run hide'>609</p>
+<p class='pln'>610</p>
+<p class='stm mis'>611</p>
+<p class='pln'>612</p>
+<p class='stm run hide'>613</p>
+<p class='stm mis'>614</p>
+<p class='pln'>615</p>
+<p class='stm mis'>616</p>
+<p class='pln'>617</p>
+<p class='stm run hide'>618</p>
+<p class='stm mis'>619</p>
+<p class='stm mis'>620</p>
+<p class='pln'>621</p>
+<p class='pln'>622</p>
+<p class='pln'>623</p>
+<p class='pln'>624</p>
+<p class='stm run hide'>625</p>
+<p class='pln'>626</p>
+<p class='stm mis'>627</p>
+<p class='pln'>628</p>
+<p class='stm run hide'>629</p>
+<p class='stm mis'>630</p>
+<p class='pln'>631</p>
+<p class='stm run hide'>632</p>
+<p class='stm mis'>633</p>
+<p class='stm mis'>634</p>
+<p class='pln'>635</p>
+<p class='stm run hide'>636</p>
+<p class='stm mis'>637</p>
+<p class='pln'>638</p>
+<p class='stm run hide'>639</p>
+<p class='stm mis'>640</p>
+<p class='pln'>641</p>
+<p class='pln'>642</p>
+<p class='pln'>643</p>
+<p class='pln'>644</p>
+<p class='stm run hide'>645</p>
+<p class='stm mis'>646</p>
+<p class='pln'>647</p>
+<p class='stm run hide'>648</p>
+<p class='stm mis'>649</p>
+<p class='pln'>650</p>
+<p class='stm run hide'>651</p>
+<p class='stm mis'>652</p>
+<p class='pln'>653</p>
+<p class='stm run hide'>654</p>
+<p class='stm mis'>655</p>
+<p class='pln'>656</p>
+<p class='pln'>657</p>
+<p class='pln'>658</p>
+<p class='pln'>659</p>
+<p class='stm run hide'>660</p>
+<p class='pln'>661</p>
+<p class='pln'>662</p>
+<p class='pln'>663</p>
+<p class='stm mis'>664</p>
+<p class='stm mis'>665</p>
+<p class='stm mis'>666</p>
+<p class='pln'>667</p>
+<p class='stm run hide'>668</p>
+<p class='stm mis'>669</p>
+<p class='pln'>670</p>
+<p class='stm run hide'>671</p>
+<p class='stm mis'>672</p>
+<p class='pln'>673</p>
+<p class='pln'>674</p>
+<p class='pln'>675</p>
+<p class='pln'>676</p>
+<p class='stm run hide'>677</p>
+<p class='stm mis'>678</p>
+<p class='pln'>679</p>
+<p class='stm mis'>680</p>
+<p class='pln'>681</p>
+<p class='stm run hide'>682</p>
+<p class='stm mis'>683</p>
+<p class='pln'>684</p>
+<p class='stm mis'>685</p>
+<p class='pln'>686</p>
+<p class='stm run hide'>687</p>
+<p class='stm mis'>688</p>
+<p class='pln'>689</p>
+<p class='pln'>690</p>
+<p class='pln'>691</p>
+<p class='pln'>692</p>
+<p class='stm mis'>693</p>
+<p class='pln'>694</p>
+<p class='stm mis'>695</p>
+<p class='pln'>696</p>
+<p class='pln'>697</p>
+<p class='pln'>698</p>
+<p class='pln'>699</p>
+<p class='stm mis'>700</p>
+<p class='stm mis'>701</p>
+<p class='stm mis'>702</p>
+<p class='pln'>703</p>
+<p class='stm mis'>704</p>
+<p class='pln'>705</p>
+<p class='pln'>706</p>
+<p class='pln'>707</p>
+<p class='pln'>708</p>
+<p class='stm run hide'>709</p>
+<p class='stm run hide'>710</p>
+<p class='stm run hide'>711</p>
+<p class='stm run hide'>712</p>
+<p class='stm run hide'>713</p>
+<p class='stm run hide'>714</p>
+<p class='stm run hide'>715</p>
+<p class='stm run hide'>716</p>
+<p class='stm run hide'>717</p>
+<p class='pln'>718</p>
+<p class='pln'>719</p>
+<p class='pln'>720</p>
+<p class='pln'>721</p>
+<p class='stm run hide'>722</p>
+<p class='stm mis'>723</p>
+<p class='stm mis'>724</p>
+<p class='pln'>725</p>
+<p class='stm run hide'>726</p>
+<p class='stm run hide'>727</p>
+<p class='stm mis'>728</p>
+<p class='pln'>729</p>
+
+</td>
+<td class='text' valign='top'>
+<p class='pln'><span class='str'>&quot;&quot;&quot; path.py - An object representing a path to a file or directory.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>Example:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>from path import path</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>d = path(&#39;/home/guido/bin&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>for f in d.files(&#39;*.py&#39;):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; f.chmod(0755)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>This module requires Python 2.2 or later.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>URL:&nbsp; &nbsp;&nbsp; http://www.jorendorff.com/articles/python/path</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>Author:&nbsp; Jason Orendorff &lt;jason@jorendorff.com&gt; (and others - see the url!)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>Date:&nbsp; &nbsp; 29 Feb 2004</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># TODO</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp;&nbsp; - Bug in write_text().&nbsp; It doesn&#39;t support Universal newline mode.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp;&nbsp; - Better error message in listdir() when self isn&#39;t a</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp;&nbsp; directory. (On Windows, the error message really sucks.)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp;&nbsp; - Make sure everything has a good docstring.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp;&nbsp; - Add methods for regex find and replace.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp;&nbsp; - guess_content_type() method?</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp;&nbsp; - Perhaps support arguments to touch().</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp;&nbsp; - Could add split() and join() methods that generate warnings.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp;&nbsp; - Note:&nbsp; __add__() technically has a bug, I think, where</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp;&nbsp; it doesn&#39;t play nice with other types that implement</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp;&nbsp; __radd__().&nbsp; Test this.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>__future__</span> <span class='key'>import</span> <span class='nam'>generators</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>import</span> <span class='nam'>sys</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>,</span> <span class='nam'>fnmatch</span><span class='op'>,</span> <span class='nam'>glob</span><span class='op'>,</span> <span class='nam'>shutil</span><span class='op'>,</span> <span class='nam'>codecs</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='nam'>__version__</span> <span class='op'>=</span> <span class='str'>&#39;2.0.2&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='nam'>__all__</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;path&#39;</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># Pre-2.3 support.&nbsp; Are unicode filenames supported?</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='nam'>_base</span> <span class='op'>=</span> <span class='nam'>str</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>supports_unicode_filenames</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>_base</span> <span class='op'>=</span> <span class='nam'>unicode</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'><span class='key'>except</span> <span class='nam'>AttributeError</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; <span class='key'>pass</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># Pre-2.3 workaround for basestring.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>basestring</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'><span class='key'>except</span> <span class='nam'>NameError</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; <span class='nam'>basestring</span> <span class='op'>=</span> <span class='op'>(</span><span class='nam'>str</span><span class='op'>,</span> <span class='nam'>unicode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># Universal newline support</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='nam'>_textmode</span> <span class='op'>=</span> <span class='str'>&#39;r&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>file</span><span class='op'>,</span> <span class='str'>&#39;newlines&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>_textmode</span> <span class='op'>=</span> <span class='str'>&#39;U&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Represents a filesystem path.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; For documentation on individual methods, consult their</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; counterparts in os.path.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># --- Special Python methods.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__repr__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&#39;path(%s)&#39;</span> <span class='op'>%</span> <span class='nam'>_base</span><span class='op'>.</span><span class='nam'>__repr__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># Adding a path and a string yields a path.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__add__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>more</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span> <span class='op'>+</span> <span class='nam'>more</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__radd__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>other</span> <span class='op'>+</span> <span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># The / operator joins paths.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__div__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>rel</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; fp.__div__(rel) == fp / rel == fp.joinpath(rel)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Join two path components, adding a separator character if</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; needed.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>rel</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># Make the / operator work even when true division is enabled.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>__truediv__</span> <span class='op'>=</span> <span class='nam'>__div__</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Return the current working directory as a path object. &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>getcwd</span> <span class='op'>=</span> <span class='nam'>staticmethod</span><span class='op'>(</span><span class='nam'>getcwd</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># --- Operations on path strings.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>abspath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span>&nbsp; &nbsp; &nbsp;&nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span>&nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>normpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span>&nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>realpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span>&nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>realpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>expanduser</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>expanduser</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>expandvars</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>expandvars</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>dirname</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span>&nbsp; &nbsp; &nbsp;&nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>dirname</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>basename</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>basename</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>expand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Clean up a filename by calling expandvars(),</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; expanduser(), and normpath() on it.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; This is commonly everything needed to clean up a filename</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; read from a configuration file, for example.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>expandvars</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>expanduser</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>normpath</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_get_namebase</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>base</span><span class='op'>,</span> <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>name</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>base</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_get_ext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>,</span> <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>ext</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_get_drive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>drive</span><span class='op'>,</span> <span class='nam'>r</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitdrive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>drive</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>parent</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dirname</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; This path&#39;s parent directory, as a new path object.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; For example, path(&#39;/usr/local/lib/libpython.so&#39;).parent == path(&#39;/usr/local/lib&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>name</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>basename</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; The name of this file or directory without the full path.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; For example, path(&#39;/usr/local/lib/libpython.so&#39;).name == &#39;libpython.so&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>namebase</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>_get_namebase</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; The same as path.name, but with one file extension stripped off.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; For example, path(&#39;/home/guido/python.tar.gz&#39;).name&nbsp; &nbsp;&nbsp; == &#39;python.tar.gz&#39;,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; but&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path(&#39;/home/guido/python.tar.gz&#39;).namebase == &#39;python.tar&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>_get_ext</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; The file extension, for example &#39;.py&#39;. &quot;&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>drive</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>_get_drive</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; The drive specifier, for example &#39;C:&#39;.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; This is always empty on systems that don&#39;t use drive specifiers.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>splitpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; p.splitpath() -&gt; Return (p.parent, p.name). &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parent</span><span class='op'>,</span> <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>parent</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>child</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>splitdrive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; p.splitdrive() -&gt; Return (p.drive, &lt;the rest of p&gt;).</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Split the drive specifier from this path.&nbsp; If there is</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; no drive specifier, p.drive is empty, so the return value</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; is simply (path(&#39;&#39;), p).&nbsp; This is always the case on Unix.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>drive</span><span class='op'>,</span> <span class='nam'>rel</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitdrive</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>drive</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>rel</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; p.splitext() -&gt; Return (p.stripext(), p.ext).</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Split the filename extension from this path and return</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; the two parts.&nbsp; Either part may be empty.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; The extension is everything from &#39;.&#39; to the end of the</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; last path segment.&nbsp; This has the property that if</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; (a, b) == p.splitext(), then a + b == p.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Cast to plain string using _base because Python 2.2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># implementations of os.path.splitext use &quot;for c in path:...&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># which means something different when applied to a path</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># object.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>filename</span><span class='op'>,</span> <span class='nam'>ext</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>filename</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>ext</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>stripext</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; p.stripext() -&gt; Remove one file extension from the path.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; For example, path(&#39;/home/guido/python.tar.gz&#39;).stripext()</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; returns path(&#39;/home/guido/python.tar&#39;).</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>splitext</span><span class='op'>(</span><span class='op'>)</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>,</span> <span class='str'>&#39;splitunc&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>splitunc</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>unc</span><span class='op'>,</span> <span class='nam'>rest</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitunc</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>unc</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>rest</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_get_uncshare</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>unc</span><span class='op'>,</span> <span class='nam'>r</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>splitunc</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>unc</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>uncshare</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>_get_uncshare</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; The UNC mount point for this path.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is empty for paths on local drives. &quot;&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>joinpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Join two or more path components, adding a separator</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; character (os.sep) if needed.&nbsp; Returns a new path</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; object.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>splitall</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Return a list of the path components in this path.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; The first item in the list will be a path.&nbsp; Its value will be</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; either os.curdir, os.pardir, empty, or the root directory of</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; this path (for example, &#39;/&#39; or &#39;C:\\&#39;).&nbsp; The other items in</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; the list will be strings.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; path.path.joinpath(*result) will yield the original path.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parts</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>loc</span> <span class='op'>=</span> <span class='nam'>self</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>loc</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>curdir</span> <span class='key'>and</span> <span class='nam'>loc</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>pardir</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>prev</span> <span class='op'>=</span> <span class='nam'>loc</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>loc</span><span class='op'>,</span> <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>prev</span><span class='op'>.</span><span class='nam'>splitpath</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>loc</span> <span class='op'>==</span> <span class='nam'>prev</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>break</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parts</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>child</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parts</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>loc</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parts</span><span class='op'>.</span><span class='nam'>reverse</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>parts</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>relpath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Return this path as a relative path,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; based from the current working directory.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cwd</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>cwd</span><span class='op'>.</span><span class='nam'>relpathto</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>relpathto</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Return a relative path from self to dest.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; If there is no relative path from self to dest, for example if</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; they reside on different drives in Windows, then this returns</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; dest.abspath().</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>origin</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>dest</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>orig_list</span> <span class='op'>=</span> <span class='nam'>origin</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>splitall</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Don&#39;t normcase dest!&nbsp; We want to preserve the case.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest_list</span> <span class='op'>=</span> <span class='nam'>dest</span><span class='op'>.</span><span class='nam'>splitall</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>orig_list</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>dest_list</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Can&#39;t get here from there.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>dest</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Find the location where the two paths start to differ.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>i</span> <span class='op'>=</span> <span class='num'>0</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>start_seg</span><span class='op'>,</span> <span class='nam'>dest_seg</span> <span class='key'>in</span> <span class='nam'>zip</span><span class='op'>(</span><span class='nam'>orig_list</span><span class='op'>,</span> <span class='nam'>dest_list</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>start_seg</span> <span class='op'>!=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>normcase</span><span class='op'>(</span><span class='nam'>dest_seg</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>break</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>i</span> <span class='op'>+=</span> <span class='num'>1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Now i is the point where the two paths diverge.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Need a certain number of &quot;os.pardir&quot;s to work up</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># from the origin to the point of divergence.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>segments</span> <span class='op'>=</span> <span class='op'>[</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>pardir</span><span class='op'>]</span> <span class='op'>*</span> <span class='op'>(</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>orig_list</span><span class='op'>)</span> <span class='op'>-</span> <span class='nam'>i</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Need to add the diverging part of dest_list.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>segments</span> <span class='op'>+=</span> <span class='nam'>dest_list</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>:</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>segments</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># If they happen to be identical, use os.curdir.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>curdir</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='op'>*</span><span class='nam'>segments</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># --- Listing, searching, walking, and matching</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; D.listdir() -&gt; List of items in this directory.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Use D.files() or D.dirs() instead if you want a listing</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; of just files or just subdirectories.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; The elements of the list are path objects.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; With the optional &#39;pattern&#39; argument, this only lists</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; items whose names match the given pattern.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>names</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='key'>not</span> <span class='nam'>None</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>names</span> <span class='op'>=</span> <span class='nam'>fnmatch</span><span class='op'>.</span><span class='nam'>filter</span><span class='op'>(</span><span class='nam'>names</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='op'>[</span><span class='nam'>self</span> <span class='op'>/</span> <span class='nam'>child</span> <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>names</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>dirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; D.dirs() -&gt; List of this directory&#39;s subdirectories.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; The elements of the list are path objects.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; This does not walk recursively into subdirectories</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; (but see path.walkdirs).</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; With the optional &#39;pattern&#39; argument, this only lists</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; directories whose names match the given pattern.&nbsp; For</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; example, d.dirs(&#39;build-*&#39;).</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='op'>[</span><span class='nam'>p</span> <span class='key'>for</span> <span class='nam'>p</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span> <span class='key'>if</span> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>isdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>files</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; D.files() -&gt; List of the files in this directory.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; The elements of the list are path objects.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; This does not walk into subdirectories (see path.walkfiles).</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; With the optional &#39;pattern&#39; argument, this only lists files</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; whose names match the given pattern.&nbsp; For example,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; d.files(&#39;*.pyc&#39;).</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='op'>[</span><span class='nam'>p</span> <span class='key'>for</span> <span class='nam'>p</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span> <span class='key'>if</span> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>isfile</span><span class='op'>(</span><span class='op'>)</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>walk</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; D.walk() -&gt; iterator over files and subdirs, recursively.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; The iterator yields path objects naming each child item of</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; this directory and its descendants.&nbsp; This requires that</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; D.isdir().</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; This performs a depth-first traversal of the directory tree.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Each directory is returned just before all its children.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>or</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>yield</span> <span class='nam'>child</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>isdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>item</span> <span class='key'>in</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>walk</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>yield</span> <span class='nam'>item</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>walkdirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; D.walkdirs() -&gt; iterator over subdirs, recursively.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; With the optional &#39;pattern&#39; argument, this yields only</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; directories whose names match the given pattern.&nbsp; For</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; example, mydir.walkdirs(&#39;*test&#39;) yields only directories</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; with names ending in &#39;test&#39;.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>dirs</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>or</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>yield</span> <span class='nam'>child</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>subsubdir</span> <span class='key'>in</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>walkdirs</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>yield</span> <span class='nam'>subsubdir</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>walkfiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; D.walkfiles() -&gt; iterator over files in D, recursively.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; The optional argument, pattern, limits the results to files</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; with names that match the pattern.&nbsp; For example,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; mydir.walkfiles(&#39;*.tmp&#39;) yields only files with the .tmp</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; extension.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>child</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>listdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>isfile</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>pattern</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>or</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>yield</span> <span class='nam'>child</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>isdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>f</span> <span class='key'>in</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>walkfiles</span><span class='op'>(</span><span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>yield</span> <span class='nam'>f</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Return True if self.name matches the given pattern.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; pattern - A filename pattern with wildcards,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for example &#39;*.py&#39;.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>fnmatch</span><span class='op'>.</span><span class='nam'>fnmatch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>name</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>glob</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>pattern</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Return a list of path objects that match the pattern.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; pattern - a path relative to this directory, with wildcards.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; For example, path(&#39;/users&#39;).glob(&#39;*/bin/*&#39;) returns a list</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; of all the files users have in their bin directories.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>map</span><span class='op'>(</span><span class='nam'>path</span><span class='op'>,</span> <span class='nam'>glob</span><span class='op'>.</span><span class='nam'>glob</span><span class='op'>(</span><span class='nam'>_base</span><span class='op'>(</span><span class='nam'>self</span> <span class='op'>/</span> <span class='nam'>pattern</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># --- Reading or writing an entire file at once.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>=</span><span class='str'>&#39;r&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Open this file.&nbsp; Return a file object. &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>file</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>bytes</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Open this file, read all bytes, return them as a string. &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='str'>&#39;rb&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>write_bytes</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>bytes</span><span class='op'>,</span> <span class='nam'>append</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Open this file and write the given bytes to it.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Default behavior is to overwrite any existing file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Call this with write_bytes(bytes, append=True) to append instead.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>append</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>&#39;ab&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>&#39;wb&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>mode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>bytes</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>text</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>&#39;strict&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Open this file, read it in, return the content as a string.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; This uses &#39;U&#39; mode in Python 2.3 and later, so &#39;\r\n&#39; and &#39;\r&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; are automatically translated to &#39;\n&#39;.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Optional arguments:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; encoding - The Unicode encoding (or character set) of</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the file.&nbsp; If present, the content of the file is</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; decoded and returned as a unicode object; otherwise</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; it is returned as an 8-bit str.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; errors - How to handle Unicode errors; see help(str.decode)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for the options.&nbsp; Default is &#39;strict&#39;.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># 8-bit</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>_textmode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Unicode</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>codecs</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='str'>&#39;r&#39;</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># (Note - Can&#39;t use &#39;U&#39; mode here, since codecs.open</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># doesn&#39;t support &#39;U&#39; mode, even in Python 2.3.)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>t</span> <span class='op'>=</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>t</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>u&#39;\r\n&#39;</span><span class='op'>,</span> <span class='str'>u&#39;\n&#39;</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>u&#39;\r&#39;</span><span class='op'>,</span> <span class='str'>u&#39;\n&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>write_text</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>text</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>&#39;strict&#39;</span><span class='op'>,</span> <span class='nam'>append</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Write the given text to this file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; The default behavior is to overwrite any existing file;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; to append instead, use the &#39;append=True&#39; keyword argument.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; There are two differences between path.write_text() and</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; path.write_bytes(): Unicode handling and newline handling.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; --- Unicode</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; If &#39;text&#39; isn&#39;t Unicode, this essentially just does</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; open(self, &#39;w&#39;).write(text).&nbsp; The &#39;encoding&#39; and &#39;errors&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; arguments are ignored.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; If &#39;text&#39; is Unicode, it is first converted to bytes using the</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; specified &#39;encoding&#39; (or the default encoding if &#39;encoding&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; isn&#39;t specified).&nbsp; The &#39;errors&#39; argument applies only to this</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; conversion.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; --- Newlines</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; write_text() converts from programmer-friendly newlines</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; (always &#39;\n&#39;) to platform-specific newlines (see os.linesep;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; on Windows, for example, the end-of-line marker is &#39;\r\n&#39;).</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; This applies to Unicode text the same as to 8-bit text.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Because of this conversion, the text should only contain plain</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; newlines (&#39;\n&#39;), just like the return value of path.text().</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; If the text contains the characters &#39;\r\n&#39;, it may be written</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; as &#39;\r\r\n&#39; or &#39;\r\r&#39; depending on your platform.&nbsp; (This is</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; exactly the same as when you open a file for writing with</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; fopen(filename, &quot;w&quot;) in C or file(filename, &#39;w&#39;) in Python.)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>text</span><span class='op'>,</span> <span class='nam'>unicode</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>text</span> <span class='op'>=</span> <span class='nam'>text</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>u&#39;\n&#39;</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>encoding</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>getdefaultencoding</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>bytes</span> <span class='op'>=</span> <span class='nam'>text</span><span class='op'>.</span><span class='nam'>encode</span><span class='op'>(</span><span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>write_bytes</span><span class='op'>(</span><span class='nam'>bytes</span><span class='op'>,</span> <span class='nam'>append</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>append</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>&#39;a&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>&#39;w&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>mode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>text</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>lines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>&#39;strict&#39;</span><span class='op'>,</span> <span class='nam'>retain</span><span class='op'>=</span><span class='nam'>True</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Open this file, read all lines, return them in a list.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Optional arguments:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; encoding - The Unicode encoding (or character set) of</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the file.&nbsp; The default is None, meaning the content</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; of the file is read as 8-bit characters and returned</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; as a list of (non-Unicode) str objects.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; errors - How to handle Unicode errors; see help(str.decode)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for the options.&nbsp; Default is &#39;strict&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; retain - If true, retain newline characters; but all newline</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; character combinations (&#39;\r&#39;, &#39;\n&#39;, &#39;\r\n&#39;) are</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; translated to &#39;\n&#39;.&nbsp; If false, newline characters are</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stripped off.&nbsp; Default is True.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; This uses &#39;U&#39; mode in Python 2.3 and later.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span> <span class='key'>and</span> <span class='nam'>retain</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>_textmode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>readlines</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>text</span><span class='op'>(</span><span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>splitlines</span><span class='op'>(</span><span class='nam'>retain</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>write_lines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>lines</span><span class='op'>,</span> <span class='nam'>encoding</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='str'>&#39;strict&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>linesep</span><span class='op'>=</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Overwrite this file with the given lines of text.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; lines - A list of strings.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; encoding - A Unicode encoding to use.&nbsp; This applies only if</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;lines&#39; contains any Unicode strings.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; errors - How to handle errors in Unicode encoding.&nbsp; This</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; also applies only to Unicode strings.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; linesep - A character sequence that will be added at the</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end of every line that doesn&#39;t already have it.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='str'>&#39;wb&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>line</span> <span class='key'>in</span> <span class='nam'>lines</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>line</span><span class='op'>.</span><span class='nam'>endswith</span><span class='op'>(</span><span class='nam'>linesep</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>line</span> <span class='op'>+=</span> <span class='nam'>linesep</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>line</span><span class='op'>,</span> <span class='nam'>unicode</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>encoding</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>encoding</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>getdefaultencoding</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>line</span> <span class='op'>=</span> <span class='nam'>line</span><span class='op'>.</span><span class='nam'>encode</span><span class='op'>(</span><span class='nam'>encoding</span><span class='op'>,</span> <span class='nam'>errors</span><span class='op'>=</span><span class='nam'>errors</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>line</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># --- Methods for querying the filesystem.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>exists</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>exists</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>isabs</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>isabs</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>isdir</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>isdir</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>isfile</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>isfile</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>islink</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>islink</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>ismount</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>ismount</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>,</span> <span class='str'>&#39;samefile&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>samefile</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>samefile</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>getatime</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getatime</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>atime</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>getatime</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Last access time of the file. &quot;&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>getmtime</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getmtime</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>mtime</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>getmtime</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Last-modified time of the file. &quot;&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>,</span> <span class='str'>&#39;getctime&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>getctime</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getctime</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>ctime</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>getctime</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Creation time of the file. &quot;&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>getsize</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>getsize</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>size</span> <span class='op'>=</span> <span class='nam'>property</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>getsize</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Size of the file, in bytes. &quot;&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>&#39;access&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Return true if current user has access to this path.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mode - One of the constants os.F_OK, os.R_OK, os.W_OK, os.X_OK</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>stat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Perform a stat() system call on this path. &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>stat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>lstat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Like path.stat(), but do not follow symbolic links. &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>lstat</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>&#39;statvfs&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>statvfs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Perform a statvfs() system call on this path. &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>statvfs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>&#39;pathconf&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>pathconf</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>name</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>pathconf</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>name</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># --- Modifying operations on files and directories</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>utime</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>times</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Set the access and modified times of this file. &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>utime</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>times</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>&#39;chown&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>chown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>uid</span><span class='op'>,</span> <span class='nam'>gid</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>uid</span><span class='op'>,</span> <span class='nam'>gid</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>rename</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>rename</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>renames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>renames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>new</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># --- Create/delete operations on directories</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>mkdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>=</span><span class='num'>0777</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>mkdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>makedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>=</span><span class='num'>0777</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>makedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>rmdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>rmdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>removedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>removedirs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># --- Modifying operations on files</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>touch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Set the access/modified times of this file to the current time.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Create the file if it does not exist.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fd</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>open</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>O_WRONLY</span> <span class='op'>|</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>O_CREAT</span><span class='op'>,</span> <span class='num'>0666</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='nam'>fd</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>utime</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>None</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>remove</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>remove</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>unlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>unlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># --- Links</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>&#39;link&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>link</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newpath</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Create a hard link at &#39;newpath&#39;, pointing to this file. &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>link</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newpath</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>&#39;symlink&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>symlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newlink</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Create a symbolic link at &#39;newlink&#39;, pointing here. &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>symlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>newlink</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>&#39;readlink&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>readlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Return the path to which this symbolic link points.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The result may be an absolute or a relative path.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>path</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>readlink</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>readlinkabs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Return the path to which this symbolic link points.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The result is always an absolute path.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>readlink</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>p</span><span class='op'>.</span><span class='nam'>isabs</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>p</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>parent</span> <span class='op'>/</span> <span class='nam'>p</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># --- High-level functions from shutil</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>copyfile</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copyfile</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>copymode</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copymode</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>copystat</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copystat</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>copy</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copy</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>copy2</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copy2</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>copytree</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>copytree</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>shutil</span><span class='op'>,</span> <span class='str'>&#39;move&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>move</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>move</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>rmtree</span> <span class='op'>=</span> <span class='nam'>shutil</span><span class='op'>.</span><span class='nam'>rmtree</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># --- Special stuff from os</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>&#39;chroot&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>chroot</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chroot</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>,</span> <span class='str'>&#39;startfile&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>startfile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>startfile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+
+</td>
+</tr>
+</table>
+</div>
+
+</body>
+</html>
diff --git a/doc/sample_html/cogapp_cogapp.html b/doc/sample_html/cogapp_cogapp.html
index 6930fb5..555756f 100644
--- a/doc/sample_html/cogapp_cogapp.html
+++ b/doc/sample_html/cogapp_cogapp.html
@@ -749,715 +749,715 @@ function toggle_lines(btn, cls) {
</td>
<td class='text' valign='top'>
-<p class='pln'>&quot;&quot;&quot; Cog code generation tool.</p>
-<p class='pln'>&nbsp; &nbsp; http://nedbatchelder.com/code/cog</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; Copyright 2004-2009, Ned Batchelder.</p>
-<p class='pln'>&quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>import copy, getopt, imp, os, re, shlex, string, sys, traceback</p>
-<p class='stm run hide'>from cStringIO import StringIO</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'># The recommended way to compute md5&#39;s changed in Python 2.5</p>
-<p class='stm run hide'>try:</p>
-<p class='stm run hide'>&nbsp; &nbsp; import hashlib</p>
-<p class='stm run hide'>&nbsp; &nbsp; hash_factory = hashlib.md5</p>
-<p class='stm mis'>except ImportError:</p>
-<p class='stm mis'>&nbsp; &nbsp; import md5</p>
-<p class='stm mis'>&nbsp; &nbsp; hash_factory = md5.new</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>__all__ = [&#39;Cog&#39;, &#39;CogUsageError&#39;]</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>__version__ = &#39;2.2&#39;&nbsp; &nbsp; &nbsp;&nbsp; # History at the end of the file.</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>usage = &quot;&quot;&quot;\</p>
-<p class='pln'>cog - generate code with inlined Python code.</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>cog [OPTIONS] [INFILE | @FILELIST] ...</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>INFILE is the name of an input file.</p>
-<p class='pln'>FILELIST is the name of a text file containing file names or</p>
-<p class='pln'>&nbsp; &nbsp; other @FILELISTs.</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>OPTIONS:</p>
-<p class='pln'>&nbsp; &nbsp; -c&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Checksum the output to protect it against accidental change.</p>
-<p class='pln'>&nbsp; &nbsp; -d&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Delete the generator code from the output file.</p>
-<p class='pln'>&nbsp; &nbsp; -D name=val Define a global string available to your generator code.</p>
-<p class='pln'>&nbsp; &nbsp; -e&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Warn if a file has no cog code in it.</p>
-<p class='pln'>&nbsp; &nbsp; -I PATH&nbsp; &nbsp;&nbsp; Add PATH to the list of directories for data files and modules.</p>
-<p class='pln'>&nbsp; &nbsp; -o OUTNAME&nbsp; Write the output to OUTNAME.</p>
-<p class='pln'>&nbsp; &nbsp; -r&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Replace the input file with the output.</p>
-<p class='pln'>&nbsp; &nbsp; -s STRING&nbsp;&nbsp; Suffix all generated output lines with STRING.</p>
-<p class='pln'>&nbsp; &nbsp; -U&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write the output with Unix newlines (only LF line-endings).</p>
-<p class='pln'>&nbsp; &nbsp; -w CMD&nbsp; &nbsp; &nbsp; Use CMD if the output file needs to be made writable.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A %s in the CMD will be filled with the filename.</p>
-<p class='pln'>&nbsp; &nbsp; -x&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Excise all the generated output without running the generators.</p>
-<p class='pln'>&nbsp; &nbsp; -z&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The [[[end]]] marker can be omitted, and is assumed at eof.</p>
-<p class='pln'>&nbsp; &nbsp; -v&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Print the version of cog and exit.</p>
-<p class='pln'>&nbsp; &nbsp; -h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Print this help.</p>
-<p class='pln'>&quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'># Other package modules</p>
-<p class='stm run hide'>from whiteutils import *</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogError(Exception):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Any exception raised by Cog.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def __init__(self, msg, file=&#39;&#39;, line=0):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if file:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Exception.__init__(self, &quot;%s(%d): %s&quot; % (file, line, msg))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Exception.__init__(self, msg)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogUsageError(CogError):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; An error in usage of command-line arguments in cog.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='exc'>&nbsp; &nbsp; pass&nbsp; &nbsp; #pragma: no cover</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogInternalError(CogError):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; An error in the coding of Cog. Should never happen.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='exc'>&nbsp; &nbsp; pass&nbsp; &nbsp; #pragma: no cover</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogGeneratedError(CogError):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; An error raised by a user&#39;s cog generator.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='exc'>&nbsp; &nbsp; pass&nbsp; &nbsp; #pragma: no cover</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class Redirectable:</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; An object with its own stdout and stderr files.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def __init__(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.stdout = sys.stdout</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.stderr = sys.stderr</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def setOutput(self, stdout=None, stderr=None):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Assign new files for standard out and/or standard error.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if stdout:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.stdout = stdout</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if stderr:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.stderr = stderr</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogGenerator(Redirectable):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; A generator pulled from a source file.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def __init__(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; Redirectable.__init__(self)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.markers = []</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.lines = []</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def parseMarker(self, l):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.markers.append(l)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def parseLine(self, l):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.lines.append(l.strip(&#39;\n&#39;))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def getCode(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Extract the executable Python code from the generator.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # If the markers and lines all have the same prefix</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # (end-of-line comment chars, for example),</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # then remove it from all the lines.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; prefIn = commonPrefix(self.markers + self.lines)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if prefIn:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.markers = [ l.replace(prefIn, &#39;&#39;, 1) for l in self.markers ]</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.lines = [ l.replace(prefIn, &#39;&#39;, 1) for l in self.lines ]</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return reindentBlock(self.lines, &#39;&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def evaluate(self, cog, globals, fname=&#39;cog generator&#39;):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # figure out the right whitespace prefix for the output</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; prefOut = whitePrefix(self.markers)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; intext = self.getCode()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if not intext:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return &#39;&#39;</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # In Python 2.2, the last line has to end in a newline.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; intext = &quot;import cog\n&quot; + intext + &quot;\n&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; code = compile(intext, str(fname), &#39;exec&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Make sure the &quot;cog&quot; module has our state.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; cog.cogmodule.msg = self.msg</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; cog.cogmodule.out = self.out</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; cog.cogmodule.outl = self.outl</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; cog.cogmodule.error = self.error</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.outstring = &#39;&#39;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; eval(code, globals)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # We need to make sure that the last line in the output</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # ends with a newline, or it will be joined to the</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # end-output line, ruining cog&#39;s idempotency.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if self.outstring and self.outstring[-1] != &#39;\n&#39;:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.outstring += &#39;\n&#39;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return reindentBlock(self.outstring, prefOut)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def msg(self, s):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; print &gt;&gt;self.stdout, &quot;Message: &quot;+s</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def out(self, sOut=&#39;&#39;, dedent=False, trimblanklines=False):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; The cog.out function.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if trimblanklines and (&#39;\n&#39; in sOut):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lines = sOut.split(&#39;\n&#39;)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if lines[0].strip() == &#39;&#39;:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; del lines[0]</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if lines and lines[-1].strip() == &#39;&#39;:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; del lines[-1]</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sOut = &#39;\n&#39;.join(lines)+&#39;\n&#39;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if dedent:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sOut = reindentBlock(sOut)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.outstring += sOut</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def outl(self, sOut=&#39;&#39;, **kw):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; The cog.outl function.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.out(sOut, **kw)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.out(&#39;\n&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def error(self, msg=&#39;Error raised by cog generator.&#39;):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; The cog.error function.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Instead of raising standard python errors, cog generators can use</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this function.&nbsp; It will display the error without a scary Python</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; traceback.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; raise CogGeneratedError(msg)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class NumberedFileReader:</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; A decorator for files that counts the readline()&#39;s called.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def __init__(self, f):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.f = f</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.n = 0</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def readline(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; l = self.f.readline()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if l:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.n += 1</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return l</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def linenumber(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return self.n</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogOptions:</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Options for a run of cog.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def __init__(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Defaults for argument values.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.args = []</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.includePath = []</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.defines = {}</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.bShowVersion = False</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.sMakeWritableCmd = None</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.bReplace = False</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.bNoGenerate = False</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.sOutputName = None</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.bWarnEmpty = False</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.bHashOutput = False</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.bDeleteCode = False</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.bEofCanBeEnd = False</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.sSuffix = None</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.bNewlines = False</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def __cmp__(self, other):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Comparison operator for tests to use.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; return self.__dict__.__cmp__(other.__dict__)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def clone(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Make a clone of these options, for further refinement.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; return copy.deepcopy(self)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def addToIncludePath(self, dirs):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Add directories to the include path.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; dirs = dirs.split(os.pathsep)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.includePath.extend(dirs)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def parseArgs(self, argv):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Parse the command line arguments.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; opts, self.args = getopt.getopt(argv, &#39;cdD:eI:o:rs:Uvw:xz&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; except getopt.error, msg:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogUsageError(msg)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Handle the command line arguments.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; for o, a in opts:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if o == &#39;-c&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.bHashOutput = True</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-d&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.bDeleteCode = True</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-D&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if a.count(&#39;=&#39;) &lt; 1:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogUsageError(&quot;-D takes a name=value argument&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name, value = a.split(&#39;=&#39;, 1)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.defines[name] = value</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-e&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.bWarnEmpty = True</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-I&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.addToIncludePath(a)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-o&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.sOutputName = a</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-r&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.bReplace = True</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-s&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.sSuffix = a</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-U&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.bNewlines = True</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-v&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.bShowVersion = True</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-w&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.sMakeWritableCmd = a</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-x&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.bNoGenerate = True</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif o == &#39;-z&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.bEofCanBeEnd = True</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Since getopt.getopt is given a list of possible flags,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # this is an internal error.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogInternalError(&quot;Don&#39;t understand argument %s&quot; % o)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def validate(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Does nothing if everything is OK, raises CogError&#39;s if it&#39;s not.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if self.bReplace and self.bDeleteCode:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogUsageError(&quot;Can&#39;t use -d with -r (or you would delete all your source!)&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if self.bReplace and self.sOutputName:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogUsageError(&quot;Can&#39;t use -o with -r (they are opposites)&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class Cog(Redirectable):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; The Cog engine.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def __init__(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; Redirectable.__init__(self)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.sBeginSpec = &#39;[[[cog&#39;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.sEndSpec = &#39;]]]&#39;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.sEndOutput = &#39;[[[end]]]&#39;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.reEndOutput = re.compile(r&#39;\[\[\[end]]](?P&lt;hashsect&gt; *\(checksum: (?P&lt;hash&gt;[a-f0-9]+)\))&#39;)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.sEndFormat = &#39;[[[end]]] (checksum: %s)&#39;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.options = CogOptions()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.sOutputMode = &#39;w&#39;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.installCogModule()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def showWarning(self, msg):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; print &gt;&gt;self.stdout, &quot;Warning:&quot;, msg</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def isBeginSpecLine(self, s):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return string.find(s, self.sBeginSpec) &gt;= 0</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def isEndSpecLine(self, s):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return string.find(s, self.sEndSpec) &gt;= 0 and \</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; not self.isEndOutputLine(s)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def isEndOutputLine(self, s):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return string.find(s, self.sEndOutput) &gt;= 0</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def installCogModule(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Magic mumbo-jumbo so that imported Python modules</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; can say &quot;import cog&quot; and get our state.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.cogmodule = imp.new_module(&#39;cog&#39;)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.cogmodule.path = []</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; sys.modules[&#39;cog&#39;] = self.cogmodule</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def processFile(self, fIn, fOut, fname=None, globals=None):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Process an input file object to an output file object.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fIn and fOut can be file objects, or file names.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; sFileIn = fname or &#39;&#39;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; sFileOut = fname or &#39;&#39;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; fInToClose = fOutToClose = None</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Convert filenames to files.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if isinstance(fIn, basestring):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Open the input file.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sFileIn = fIn</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fIn = fInToClose = open(fIn, &#39;r&#39;)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if isinstance(fOut, basestring):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Open the output file.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sFileOut = fOut</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fOut = fOutToClose = open(fOut, self.sOutputMode)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fIn = NumberedFileReader(fIn)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bSawCog = False</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cogmodule.inFile = sFileIn</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cogmodule.outFile = sFileOut</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # The globals dict we&#39;ll use for this file.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if globals is None:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; globals = {}</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # If there are any global defines, put them in the globals.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; globals.update(self.options.defines)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # loop over generator chunks</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = fIn.readline()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while l:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Find the next spec begin</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while l and not self.isBeginSpecLine(l):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.isEndSpecLine(l):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(&quot;Unexpected &#39;%s&#39;&quot; % self.sEndSpec,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file=sFileIn, line=fIn.linenumber())</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.isEndOutputLine(l):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(&quot;Unexpected &#39;%s&#39;&quot; % self.sEndOutput,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file=sFileIn, line=fIn.linenumber())</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fOut.write(l)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = fIn.readline()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not l:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not self.options.bDeleteCode:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fOut.write(l)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # l is the begin spec</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gen = CogGenerator()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gen.setOutput(stdout=self.stdout)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gen.parseMarker(l)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; firstLineNum = fIn.linenumber()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cogmodule.firstLineNum = firstLineNum</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # If the spec begin is also a spec end, then process the single</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # line of code inside.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.isEndSpecLine(l):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; beg = string.find(l, self.sBeginSpec)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end = string.find(l, self.sEndSpec)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if beg &gt; end:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(&quot;Cog code markers inverted&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file=sFileIn, line=firstLineNum)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sCode = l[beg+len(self.sBeginSpec):end].strip()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gen.parseLine(sCode)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Deal with an ordinary code block.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = fIn.readline()</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Get all the lines in the spec</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while l and not self.isEndSpecLine(l):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.isBeginSpecLine(l):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(&quot;Unexpected &#39;%s&#39;&quot; % self.sBeginSpec,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file=sFileIn, line=fIn.linenumber())</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.isEndOutputLine(l):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(&quot;Unexpected &#39;%s&#39;&quot; % self.sEndOutput,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file=sFileIn, line=fIn.linenumber())</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not self.options.bDeleteCode:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fOut.write(l)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gen.parseLine(l)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = fIn.readline()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not l:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Cog block begun but never ended.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file=sFileIn, line=firstLineNum)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not self.options.bDeleteCode:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fOut.write(l)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gen.parseMarker(l)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = fIn.readline()</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Eat all the lines in the output section.&nbsp; While reading past</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # them, compute the md5 hash of the old output.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hasher = hash_factory()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while l and not self.isEndOutputLine(l):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.isBeginSpecLine(l):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(&quot;Unexpected &#39;%s&#39;&quot; % self.sBeginSpec,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file=sFileIn, line=fIn.linenumber())</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.isEndSpecLine(l):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(&quot;Unexpected &#39;%s&#39;&quot; % self.sEndSpec,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file=sFileIn, line=fIn.linenumber())</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hasher.update(l)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = fIn.readline()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curHash = hasher.hexdigest()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not l and not self.options.bEofCanBeEnd:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # We reached end of file before we found the end output line.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(&quot;Missing &#39;%s&#39; before end of file.&quot; % self.sEndOutput,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file=sFileIn, line=fIn.linenumber())</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Write the output of the spec to be the new output if we&#39;re</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # supposed to generate code.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hasher = hash_factory()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not self.options.bNoGenerate:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sFile = &quot;%s+%d&quot; % (sFileIn, firstLineNum)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sGen = gen.evaluate(cog=self, globals=globals, fname=sFile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sGen = self.suffixLines(sGen)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hasher.update(sGen)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fOut.write(sGen)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newHash = hasher.hexdigest()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bSawCog = True</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Write the ending output line</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hashMatch = self.reEndOutput.search(l)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.options.bHashOutput:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if hashMatch:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oldHash = hashMatch.groupdict()[&#39;hash&#39;]</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if oldHash != curHash:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(&quot;Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; file=sFileIn, line=fIn.linenumber())</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Create a new end line with the correct hash.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; endpieces = l.split(hashMatch.group(0), 1)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # There was no old hash, but we want a new hash.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; endpieces = l.split(self.sEndOutput, 1)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = (self.sEndFormat % newHash).join(endpieces)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # We don&#39;t want hashes output, so if there was one, get rid of</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # it.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if hashMatch:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = l.replace(hashMatch.groupdict()[&#39;hashsect&#39;], &#39;&#39;, 1)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not self.options.bDeleteCode:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fOut.write(l)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = fIn.readline()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not bSawCog and self.options.bWarnEmpty:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.showWarning(&quot;no cog code found in %s&quot; % sFileIn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; finally:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if fInToClose:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fInToClose.close()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if fOutToClose:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fOutToClose.close()</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; # A regex for non-empty lines, used by suffixLines.</p>
-<p class='stm run hide'>&nbsp; &nbsp; reNonEmptyLines = re.compile(&quot;^\s*\S+.*$&quot;, re.MULTILINE)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def suffixLines(self, text):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Add suffixes to the lines in text, if our options desire it.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text is many lines, as a single string.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if self.options.sSuffix:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Find all non-blank lines, and add the suffix to the end.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; repl = r&quot;\g&lt;0&gt;&quot; + self.options.sSuffix.replace(&#39;\\&#39;, &#39;\\\\&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text = self.reNonEmptyLines.sub(repl, text)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return text</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def processString(self, sInput, fname=None):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Process sInput as the text to cog.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return the cogged output as a string.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; fOld = StringIO(sInput)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; fNew = StringIO()</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.processFile(fOld, fNew, fname=fname)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; return fNew.getvalue()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def replaceFile(self, sOldPath, sNewText):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Replace file sOldPath with the contents sNewText</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if not os.access(sOldPath, os.W_OK):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Need to ensure we can write.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.options.sMakeWritableCmd:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Use an external command to make the file writable.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmd = self.options.sMakeWritableCmd.replace(&#39;%s&#39;, sOldPath)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.stdout.write(os.popen(cmd).read())</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not os.access(sOldPath, os.W_OK):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(&quot;Couldn&#39;t make %s writable&quot; % sOldPath)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Can&#39;t write!</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogError(&quot;Can&#39;t overwrite %s&quot; % sOldPath)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; f = open(sOldPath, self.sOutputMode)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; f.write(sNewText)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; f.close()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def saveIncludePath(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.savedInclude = self.options.includePath[:]</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.savedSysPath = sys.path[:]</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def restoreIncludePath(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.options.includePath = self.savedInclude</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cogmodule.path = self.options.includePath</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; sys.path = self.savedSysPath</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def addToIncludePath(self, includePath):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cogmodule.path.extend(includePath)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; sys.path.extend(includePath)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def processOneFile(self, sFile):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Process one filename through cog.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.saveIncludePath()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.addToIncludePath(self.options.includePath)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Since we know where the input file came from,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # push its directory onto the include path.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.addToIncludePath([os.path.dirname(sFile)])</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Set the file output mode based on whether we want \n or native</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # line endings.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.sOutputMode = &#39;w&#39;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.options.bNewlines:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.sOutputMode = &#39;wb&#39;</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # How we process the file depends on where the output is going.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.options.sOutputName:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.processFile(sFile, self.options.sOutputName, sFile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif self.options.bReplace:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # We want to replace the cog file with the output,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # but only if they differ.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &gt;&gt;self.stdout, &quot;Cogging %s&quot; % sFile,</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bNeedNewline = True</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fOldFile = open(sFile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sOldText = fOldFile.read()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fOldFile.close()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sNewText = self.processString(sOldText, fname=sFile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if sOldText != sNewText:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &gt;&gt;self.stdout, &quot;&nbsp; (changed)&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bNeedNewline = False</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.replaceFile(sFile, sNewText)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; finally:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # The try-finally block is so we can print a partial line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # with the name of the file, and print (changed) on the</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # same line, but also make sure to break the line before</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # any traceback.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if bNeedNewline:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &gt;&gt;self.stdout</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.processFile(sFile, self.stdout, sFile)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; finally:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.restoreIncludePath()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def processFileList(self, sFileList):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Process the files in a file list.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; flist = open(sFileList)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; lines = flist.readlines()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; flist.close()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; for l in lines:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Use shlex to parse the line like a shell.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lex = shlex.shlex(l, posix=True)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lex.whitespace_split = True</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lex.commenters = &#39;#&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # No escapes, so that backslash can be part of the path</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lex.escape = &#39;&#39;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; args = list(lex)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if args:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.processArguments(args)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def processArguments(self, args):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Process one command-line.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; saved_options = self.options</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.options = self.options.clone()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.options.parseArgs(args[1:])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.options.validate()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if args[0][0] == &#39;@&#39;:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.options.sOutputName:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogUsageError(&quot;Can&#39;t use -o with @file&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.processFileList(args[0][1:])</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.processOneFile(args[0])</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.options = saved_options</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def callableMain(self, argv):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; All of command-line cog, but in a callable form.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is used by main.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; argv is the equivalent of sys.argv.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; argv0 = argv.pop(0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Provide help if asked for anywhere in the command line.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if &#39;-?&#39; in argv or &#39;-h&#39; in argv:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &gt;&gt;self.stderr, usage,</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.options.parseArgs(argv)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.options.validate()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if self.options.bShowVersion:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &gt;&gt;self.stdout, &quot;Cog version %s&quot; % __version__</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if self.options.args:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for a in self.options.args:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.processArguments([a])</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise CogUsageError(&quot;No files to process&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def main(self, argv):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Handle the command-line execution for cog.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.callableMain(argv)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 0</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; except CogUsageError, err:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &gt;&gt;self.stderr, err</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &gt;&gt;self.stderr, &quot;(for help use -?)&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 2</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; except CogGeneratedError, err:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &gt;&gt;self.stderr, &quot;Error: %s&quot; % err</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 3</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; except CogError, err:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print &gt;&gt;self.stderr, err</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 1</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; except:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; traceback.print_exc(None, self.stderr)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 1</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'># History:</p>
-<p class='pln'># 20040210: First public version.</p>
-<p class='pln'># 20040220: Text preceding the start and end marker are removed from Python lines.</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; -v option on the command line shows the version.</p>
-<p class='pln'># 20040311: Make sure the last line of output is properly ended with a newline.</p>
-<p class='pln'># 20040605: Fixed some blank line handling in cog.</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Fixed problems with assigning to xml elements in handyxml.</p>
-<p class='pln'># 20040621: Changed all line-ends to LF from CRLF.</p>
-<p class='pln'># 20041002: Refactor some option handling to simplify unittesting the options.</p>
-<p class='pln'># 20041118: cog.out and cog.outl have optional string arguments.</p>
-<p class='pln'># 20041119: File names weren&#39;t being properly passed around for warnings, etc.</p>
-<p class='pln'># 20041122: Added cog.firstLineNum: a property with the line number of the [[[cog line.</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Added cog.inFile and cog.outFile: the names of the input and output file.</p>
-<p class='pln'># 20041218: Single-line cog generators, with start marker and end marker on</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; the same line.</p>
-<p class='pln'># 20041230: Keep a single globals dict for all the code fragments in a single</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; file so they can share state.</p>
-<p class='pln'># 20050206: Added the -x switch to remove all generated output.</p>
-<p class='pln'># 20050218: Now code can be on the marker lines as well.</p>
-<p class='pln'># 20050219: Added -c switch to checksum the output so that edits can be</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; detected before they are obliterated.</p>
-<p class='pln'># 20050521: Added cog.error, contributed by Alexander Belchenko.</p>
-<p class='pln'># 20050720: Added code deletion and settable globals contributed by Blake Winton.</p>
-<p class='pln'># 20050724: Many tweaks to improve code coverage.</p>
-<p class='pln'># 20050726: Error messages are now printed with no traceback.</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Code can no longer appear on the marker lines,</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; except for single-line style.</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; -z allows omission of the [[[end]]] marker, and it will be assumed</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; at the end of the file.</p>
-<p class='pln'># 20050729: Refactor option parsing into a separate class, in preparation for</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; future features.</p>
-<p class='pln'># 20050805: The cogmodule.path wasn&#39;t being properly maintained.</p>
-<p class='pln'># 20050808: Added the -D option to define a global value.</p>
-<p class='pln'># 20050810: The %s in the -w command is dealt with more robustly.</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Added the -s option to suffix output lines with a marker.</p>
-<p class='pln'># 20050817: Now @files can have arguments on each line to change the cog&#39;s</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; behavior for that line.</p>
-<p class='pln'># 20051006: Version 2.0</p>
-<p class='pln'># 20080521: -U options lets you create Unix newlines on Windows.&nbsp; Thanks,</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Alexander Belchenko.</p>
-<p class='pln'># 20080522: It&#39;s now ok to have -d with output to stdout, and now we validate</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; the args after each line of an @file.</p>
-<p class='pln'># 20090520: Use hashlib where it&#39;s available, to avoid a warning.</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Use the builtin compile() instead of compiler, for Jython.</p>
-<p class='pln'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Explicitly close files we opened, Jython likes this.</p>
+<p class='pln'><span class='str'>&quot;&quot;&quot; Cog code generation tool.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; http://nedbatchelder.com/code/cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; Copyright 2004-2009, Ned Batchelder.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>import</span> <span class='nam'>copy</span><span class='op'>,</span> <span class='nam'>getopt</span><span class='op'>,</span> <span class='nam'>imp</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>,</span> <span class='nam'>re</span><span class='op'>,</span> <span class='nam'>shlex</span><span class='op'>,</span> <span class='nam'>string</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>,</span> <span class='nam'>traceback</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>cStringIO</span> <span class='key'>import</span> <span class='nam'>StringIO</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># The recommended way to compute md5&#39;s changed in Python 2.5</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>import</span> <span class='nam'>hashlib</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>hash_factory</span> <span class='op'>=</span> <span class='nam'>hashlib</span><span class='op'>.</span><span class='nam'>md5</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'><span class='key'>except</span> <span class='nam'>ImportError</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; <span class='key'>import</span> <span class='nam'>md5</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; <span class='nam'>hash_factory</span> <span class='op'>=</span> <span class='nam'>md5</span><span class='op'>.</span><span class='nam'>new</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='nam'>__all__</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;Cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;CogUsageError&#39;</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='nam'>__version__</span> <span class='op'>=</span> <span class='str'>&#39;2.2&#39;</span>&nbsp; &nbsp; &nbsp;&nbsp; <span class='com'># History at the end of the file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='nam'>usage</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>cog - generate code with inlined Python code.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>cog [OPTIONS] [INFILE | @FILELIST] ...</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>INFILE is the name of an input file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>FILELIST is the name of a text file containing file names or</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; other @FILELISTs.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>OPTIONS:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -c&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Checksum the output to protect it against accidental change.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -d&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Delete the generator code from the output file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -D name=val Define a global string available to your generator code.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -e&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Warn if a file has no cog code in it.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -I PATH&nbsp; &nbsp;&nbsp; Add PATH to the list of directories for data files and modules.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -o OUTNAME&nbsp; Write the output to OUTNAME.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -r&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Replace the input file with the output.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -s STRING&nbsp;&nbsp; Suffix all generated output lines with STRING.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -U&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write the output with Unix newlines (only LF line-endings).</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -w CMD&nbsp; &nbsp; &nbsp; Use CMD if the output file needs to be made writable.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A %s in the CMD will be filled with the filename.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -x&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Excise all the generated output without running the generators.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -z&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The [[[end]]] marker can be omitted, and is assumed at eof.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -v&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Print the version of cog and exit.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; -h&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Print this help.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># Other package modules</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>whiteutils</span> <span class='key'>import</span> <span class='op'>*</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='nam'>Exception</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Any exception raised by Cog.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>,</span> <span class='nam'>file</span><span class='op'>=</span><span class='str'>&#39;&#39;</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='num'>0</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>file</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>Exception</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='str'>&quot;%s(%d): %s&quot;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>file</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>Exception</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; An error in usage of command-line arguments in cog.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; <span class='key'>pass</span>&nbsp; &nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogInternalError</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; An error in the coding of Cog. Should never happen.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; <span class='key'>pass</span>&nbsp; &nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogGeneratedError</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; An error raised by a user&#39;s cog generator.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; <span class='key'>pass</span>&nbsp; &nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>Redirectable</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; An object with its own stdout and stderr files.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>stdout</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>stderr</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>stdout</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Assign new files for standard out and/or standard error.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>stdout</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span> <span class='op'>=</span> <span class='nam'>stdout</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>stderr</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>stderr</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogGenerator</span><span class='op'>(</span><span class='nam'>Redirectable</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; A generator pulled from a source file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>Redirectable</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>parseMarker</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>parseLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='str'>&#39;\n&#39;</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>getCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Extract the executable Python code from the generator.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># If the markers and lines all have the same prefix</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># (end-of-line comment chars, for example),</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># then remove it from all the lines.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>prefIn</span> <span class='op'>=</span> <span class='nam'>commonPrefix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>+</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>prefIn</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>=</span> <span class='op'>[</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>prefIn</span><span class='op'>,</span> <span class='str'>&#39;&#39;</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span> <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span> <span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span> <span class='op'>=</span> <span class='op'>[</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>prefIn</span><span class='op'>,</span> <span class='str'>&#39;&#39;</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span> <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span> <span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines</span><span class='op'>,</span> <span class='str'>&#39;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>evaluate</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>cog</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='str'>&#39;cog generator&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># figure out the right whitespace prefix for the output</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>prefOut</span> <span class='op'>=</span> <span class='nam'>whitePrefix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>markers</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>intext</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>intext</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># In Python 2.2, the last line has to end in a newline.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>intext</span> <span class='op'>=</span> <span class='str'>&quot;import cog\n&quot;</span> <span class='op'>+</span> <span class='nam'>intext</span> <span class='op'>+</span> <span class='str'>&quot;\n&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>code</span> <span class='op'>=</span> <span class='nam'>compile</span><span class='op'>(</span><span class='nam'>intext</span><span class='op'>,</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>fname</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;exec&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Make sure the &quot;cog&quot; module has our state.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>msg</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>msg</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>out</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>out</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>outl</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outl</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cog</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>error</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>error</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='op'>=</span> <span class='str'>&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>eval</span><span class='op'>(</span><span class='nam'>code</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># We need to make sure that the last line in the output</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># ends with a newline, or it will be joined to the</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># end-output line, ruining cog&#39;s idempotency.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span><span class='op'>[</span><span class='op'>-</span><span class='num'>1</span><span class='op'>]</span> <span class='op'>!=</span> <span class='str'>&#39;\n&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='op'>+=</span> <span class='str'>&#39;\n&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span><span class='op'>,</span> <span class='nam'>prefOut</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>msg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='op'>&gt;&gt;</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>&quot;Message: &quot;</span><span class='op'>+</span><span class='nam'>s</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>out</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sOut</span><span class='op'>=</span><span class='str'>&#39;&#39;</span><span class='op'>,</span> <span class='nam'>dedent</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>,</span> <span class='nam'>trimblanklines</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; The cog.out function.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>trimblanklines</span> <span class='key'>and</span> <span class='op'>(</span><span class='str'>&#39;\n&#39;</span> <span class='key'>in</span> <span class='nam'>sOut</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>lines</span> <span class='op'>=</span> <span class='nam'>sOut</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>&#39;\n&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>lines</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>==</span> <span class='str'>&#39;&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>del</span> <span class='nam'>lines</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>lines</span> <span class='key'>and</span> <span class='nam'>lines</span><span class='op'>[</span><span class='op'>-</span><span class='num'>1</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>==</span> <span class='str'>&#39;&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>del</span> <span class='nam'>lines</span><span class='op'>[</span><span class='op'>-</span><span class='num'>1</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sOut</span> <span class='op'>=</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>)</span><span class='op'>+</span><span class='str'>&#39;\n&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>dedent</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sOut</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>sOut</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>outstring</span> <span class='op'>+=</span> <span class='nam'>sOut</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>outl</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sOut</span><span class='op'>=</span><span class='str'>&#39;&#39;</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kw</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; The cog.outl function.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>out</span><span class='op'>(</span><span class='nam'>sOut</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kw</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>out</span><span class='op'>(</span><span class='str'>&#39;\n&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>error</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='str'>&#39;Error raised by cog generator.&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; The cog.error function.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Instead of raising standard python errors, cog generators can use</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this function.&nbsp; It will display the error without a scary Python</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; traceback.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogGeneratedError</span><span class='op'>(</span><span class='nam'>msg</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>NumberedFileReader</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; A decorator for files that counts the readline()&#39;s called.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>f</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>f</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>n</span> <span class='op'>=</span> <span class='num'>0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>readline</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>f</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>l</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>n</span> <span class='op'>+=</span> <span class='num'>1</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>l</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>linenumber</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>n</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogOptions</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Options for a run of cog.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Defaults for argument values.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>args</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>includePath</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>defines</span> <span class='op'>=</span> <span class='op'>{</span><span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bShowVersion</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span> <span class='op'>=</span> <span class='nam'>None</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNoGenerate</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputName</span> <span class='op'>=</span> <span class='nam'>None</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bWarnEmpty</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bHashOutput</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bDeleteCode</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bEofCanBeEnd</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sSuffix</span> <span class='op'>=</span> <span class='nam'>None</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNewlines</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__cmp__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>other</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Comparison operator for tests to use.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>__dict__</span><span class='op'>.</span><span class='nam'>__cmp__</span><span class='op'>(</span><span class='nam'>other</span><span class='op'>.</span><span class='nam'>__dict__</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>clone</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Make a clone of these options, for further refinement.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>copy</span><span class='op'>.</span><span class='nam'>deepcopy</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>dirs</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Add directories to the include path.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dirs</span> <span class='op'>=</span> <span class='nam'>dirs</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>pathsep</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>includePath</span><span class='op'>.</span><span class='nam'>extend</span><span class='op'>(</span><span class='nam'>dirs</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>parseArgs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>argv</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Parse the command line arguments.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>args</span> <span class='op'>=</span> <span class='nam'>getopt</span><span class='op'>.</span><span class='nam'>getopt</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>,</span> <span class='str'>&#39;cdD:eI:o:rs:Uvw:xz&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>getopt</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='nam'>msg</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Handle the command line arguments.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>o</span><span class='op'>,</span> <span class='nam'>a</span> <span class='key'>in</span> <span class='nam'>opts</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-c&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bHashOutput</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-d&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bDeleteCode</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-D&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>a</span><span class='op'>.</span><span class='nam'>count</span><span class='op'>(</span><span class='str'>&#39;=&#39;</span><span class='op'>)</span> <span class='op'>&lt;</span> <span class='num'>1</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>&quot;-D takes a name=value argument&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>name</span><span class='op'>,</span> <span class='nam'>value</span> <span class='op'>=</span> <span class='nam'>a</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>&#39;=&#39;</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>defines</span><span class='op'>[</span><span class='nam'>name</span><span class='op'>]</span> <span class='op'>=</span> <span class='nam'>value</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-e&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bWarnEmpty</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-I&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>a</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-o&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputName</span> <span class='op'>=</span> <span class='nam'>a</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-r&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-s&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sSuffix</span> <span class='op'>=</span> <span class='nam'>a</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-U&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNewlines</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-v&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bShowVersion</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-w&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span> <span class='op'>=</span> <span class='nam'>a</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-x&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bNoGenerate</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>o</span> <span class='op'>==</span> <span class='str'>&#39;-z&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bEofCanBeEnd</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Since getopt.getopt is given a list of possible flags,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># this is an internal error.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogInternalError</span><span class='op'>(</span><span class='str'>&quot;Don&#39;t understand argument %s&quot;</span> <span class='op'>%</span> <span class='nam'>o</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>validate</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Does nothing if everything is OK, raises CogError&#39;s if it&#39;s not.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>&quot;Can&#39;t use -d with -r (or you would delete all your source!)&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>bReplace</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>&quot;Can&#39;t use -o with -r (they are opposites)&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>Cog</span><span class='op'>(</span><span class='nam'>Redirectable</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; The Cog engine.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>Redirectable</span><span class='op'>.</span><span class='nam'>__init__</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span> <span class='op'>=</span> <span class='str'>&#39;[[[cog&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span> <span class='op'>=</span> <span class='str'>&#39;]]]&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span> <span class='op'>=</span> <span class='str'>&#39;[[[end]]]&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>reEndOutput</span> <span class='op'>=</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>compile</span><span class='op'>(</span><span class='str'>r&#39;\[\[\[end]]](?P&lt;hashsect&gt; *\(checksum: (?P&lt;hash&gt;[a-f0-9]+)\))&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndFormat</span> <span class='op'>=</span> <span class='str'>&#39;[[[end]]] (checksum: %s)&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span> <span class='op'>=</span> <span class='str'>&#39;w&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>installCogModule</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>showWarning</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='op'>&gt;&gt;</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>&quot;Warning:&quot;</span><span class='op'>,</span> <span class='nam'>msg</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span> <span class='key'>and</span> <span class='xx'>\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>installCogModule</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Magic mumbo-jumbo so that imported Python modules</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; can say &quot;import cog&quot; and get our state.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span> <span class='op'>=</span> <span class='nam'>imp</span><span class='op'>.</span><span class='nam'>new_module</span><span class='op'>(</span><span class='str'>&#39;cog&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>path</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='op'>[</span><span class='str'>&#39;cog&#39;</span><span class='op'>]</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>fIn</span><span class='op'>,</span> <span class='nam'>fOut</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Process an input file object to an output file object.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fIn and fOut can be file objects, or file names.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sFileIn</span> <span class='op'>=</span> <span class='nam'>fname</span> <span class='key'>or</span> <span class='str'>&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sFileOut</span> <span class='op'>=</span> <span class='nam'>fname</span> <span class='key'>or</span> <span class='str'>&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fInToClose</span> <span class='op'>=</span> <span class='nam'>fOutToClose</span> <span class='op'>=</span> <span class='nam'>None</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Convert filenames to files.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>fIn</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Open the input file.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sFileIn</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fIn</span> <span class='op'>=</span> <span class='nam'>fInToClose</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>fIn</span><span class='op'>,</span> <span class='str'>&#39;r&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>fOut</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Open the output file.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sFileOut</span> <span class='op'>=</span> <span class='nam'>fOut</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fOut</span> <span class='op'>=</span> <span class='nam'>fOutToClose</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>fOut</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fIn</span> <span class='op'>=</span> <span class='nam'>NumberedFileReader</span><span class='op'>(</span><span class='nam'>fIn</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>bSawCog</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>inFile</span> <span class='op'>=</span> <span class='nam'>sFileIn</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>outFile</span> <span class='op'>=</span> <span class='nam'>sFileOut</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># The globals dict we&#39;ll use for this file.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>globals</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>globals</span> <span class='op'>=</span> <span class='op'>{</span><span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># If there are any global defines, put them in the globals.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>globals</span><span class='op'>.</span><span class='nam'>update</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>defines</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># loop over generator chunks</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>l</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Find the next spec begin</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>&quot;Unexpected &#39;%s&#39;&quot;</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>&quot;Unexpected &#39;%s&#39;&quot;</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>l</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>break</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># l is the begin spec</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>gen</span> <span class='op'>=</span> <span class='nam'>CogGenerator</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stdout</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseMarker</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>firstLineNum</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>firstLineNum</span> <span class='op'>=</span> <span class='nam'>firstLineNum</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># If the spec begin is also a spec end, then process the single</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># line of code inside.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>beg</span> <span class='op'>=</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>end</span> <span class='op'>=</span> <span class='nam'>string</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>beg</span> <span class='op'>&gt;</span> <span class='nam'>end</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>&quot;Cog code markers inverted&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>firstLineNum</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sCode</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>[</span><span class='nam'>beg</span><span class='op'>+</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>)</span><span class='op'>:</span><span class='nam'>end</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseLine</span><span class='op'>(</span><span class='nam'>sCode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Deal with an ordinary code block.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Get all the lines in the spec</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>&quot;Unexpected &#39;%s&#39;&quot;</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>&quot;Unexpected &#39;%s&#39;&quot;</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>l</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Cog block begun but never ended.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>firstLineNum</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseMarker</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Eat all the lines in the output section.&nbsp; While reading past</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># them, compute the md5 hash of the old output.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>hasher</span> <span class='op'>=</span> <span class='nam'>hash_factory</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndOutputLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBeginSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>&quot;Unexpected &#39;%s&#39;&quot;</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sBeginSpec</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isEndSpecLine</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>&quot;Unexpected &#39;%s&#39;&quot;</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndSpec</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>update</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>curHash</span> <span class='op'>=</span> <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>hexdigest</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bEofCanBeEnd</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># We reached end of file before we found the end output line.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>&quot;Missing &#39;%s&#39; before end of file.&quot;</span> <span class='op'>%</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Write the output of the spec to be the new output if we&#39;re </span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># supposed to generate code.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>hasher</span> <span class='op'>=</span> <span class='nam'>hash_factory</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bNoGenerate</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sFile</span> <span class='op'>=</span> <span class='str'>&quot;%s+%d&quot;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>firstLineNum</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sGen</span> <span class='op'>=</span> <span class='nam'>gen</span><span class='op'>.</span><span class='nam'>evaluate</span><span class='op'>(</span><span class='nam'>cog</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>=</span><span class='nam'>globals</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>sFile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sGen</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>suffixLines</span><span class='op'>(</span><span class='nam'>sGen</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>update</span><span class='op'>(</span><span class='nam'>sGen</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>sGen</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>newHash</span> <span class='op'>=</span> <span class='nam'>hasher</span><span class='op'>.</span><span class='nam'>hexdigest</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>bSawCog</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Write the ending output line</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>hashMatch</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>reEndOutput</span><span class='op'>.</span><span class='nam'>search</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bHashOutput</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hashMatch</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>oldHash</span> <span class='op'>=</span> <span class='nam'>hashMatch</span><span class='op'>.</span><span class='nam'>groupdict</span><span class='op'>(</span><span class='op'>)</span><span class='op'>[</span><span class='str'>&#39;hash&#39;</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>oldHash</span> <span class='op'>!=</span> <span class='nam'>curHash</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>&quot;Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>file</span><span class='op'>=</span><span class='nam'>sFileIn</span><span class='op'>,</span> <span class='nam'>line</span><span class='op'>=</span><span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>linenumber</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Create a new end line with the correct hash.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>endpieces</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>hashMatch</span><span class='op'>.</span><span class='nam'>group</span><span class='op'>(</span><span class='num'>0</span><span class='op'>)</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># There was no old hash, but we want a new hash.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>endpieces</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndOutput</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>sEndFormat</span> <span class='op'>%</span> <span class='nam'>newHash</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>endpieces</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># We don&#39;t want hashes output, so if there was one, get rid of</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># it.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hashMatch</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>hashMatch</span><span class='op'>.</span><span class='nam'>groupdict</span><span class='op'>(</span><span class='op'>)</span><span class='op'>[</span><span class='str'>&#39;hashsect&#39;</span><span class='op'>]</span><span class='op'>,</span> <span class='str'>&#39;&#39;</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fOut</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>fIn</span><span class='op'>.</span><span class='nam'>readline</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>bSawCog</span> <span class='key'>and</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bWarnEmpty</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>showWarning</span><span class='op'>(</span><span class='str'>&quot;no cog code found in %s&quot;</span> <span class='op'>%</span> <span class='nam'>sFileIn</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>fInToClose</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fInToClose</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>fOutToClose</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fOutToClose</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># A regex for non-empty lines, used by suffixLines.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>reNonEmptyLines</span> <span class='op'>=</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>compile</span><span class='op'>(</span><span class='str'>&quot;^\s*\S+.*$&quot;</span><span class='op'>,</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>MULTILINE</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>suffixLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>text</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Add suffixes to the lines in text, if our options desire it.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text is many lines, as a single string.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sSuffix</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Find all non-blank lines, and add the suffix to the end.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>repl</span> <span class='op'>=</span> <span class='str'>r&quot;\g&lt;0&gt;&quot;</span> <span class='op'>+</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sSuffix</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>&#39;\\&#39;</span><span class='op'>,</span> <span class='str'>&#39;\\\\&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>text</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>reNonEmptyLines</span><span class='op'>.</span><span class='nam'>sub</span><span class='op'>(</span><span class='nam'>repl</span><span class='op'>,</span> <span class='nam'>text</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>text</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>processString</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sInput</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Process sInput as the text to cog.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return the cogged output as a string.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fOld</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>(</span><span class='nam'>sInput</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fNew</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>fOld</span><span class='op'>,</span> <span class='nam'>fNew</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>fname</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>fNew</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>replaceFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>sNewText</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Replace file sOldPath with the contents sNewText</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Need to ensure we can write.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Use an external command to make the file writable.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cmd</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sMakeWritableCmd</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>&#39;%s&#39;</span><span class='op'>,</span> <span class='nam'>sOldPath</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>popen</span><span class='op'>(</span><span class='nam'>cmd</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>&quot;Couldn&#39;t make %s writable&quot;</span> <span class='op'>%</span> <span class='nam'>sOldPath</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Can&#39;t write!</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogError</span><span class='op'>(</span><span class='str'>&quot;Can&#39;t overwrite %s&quot;</span> <span class='op'>%</span> <span class='nam'>sOldPath</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sOldPath</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>sNewText</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>saveIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedInclude</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span><span class='op'>[</span><span class='op'>:</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedSysPath</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>[</span><span class='op'>:</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>restoreIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedInclude</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>path</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>savedSysPath</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>includePath</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cogmodule</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>extend</span><span class='op'>(</span><span class='nam'>includePath</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>extend</span><span class='op'>(</span><span class='nam'>includePath</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>processOneFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFile</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Process one filename through cog.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>saveIncludePath</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>includePath</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Since we know where the input file came from,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># push its directory onto the include path.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>addToIncludePath</span><span class='op'>(</span><span class='op'>[</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>dirname</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>)</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Set the file output mode based on whether we want \n or native</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># line endings.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span> <span class='op'>=</span> <span class='str'>&#39;w&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bNewlines</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sOutputMode</span> <span class='op'>=</span> <span class='str'>&#39;wb&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># How we process the file depends on where the output is going.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>,</span> <span class='nam'>sFile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bReplace</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># We want to replace the cog file with the output,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># but only if they differ.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='op'>&gt;&gt;</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>&quot;Cogging %s&quot;</span> <span class='op'>%</span> <span class='nam'>sFile</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>bNeedNewline</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fOldFile</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sOldText</span> <span class='op'>=</span> <span class='nam'>fOldFile</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fOldFile</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sNewText</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>sOldText</span><span class='op'>,</span> <span class='nam'>fname</span><span class='op'>=</span><span class='nam'>sFile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>sOldText</span> <span class='op'>!=</span> <span class='nam'>sNewText</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='op'>&gt;&gt;</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>&quot;&nbsp; (changed)&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>bNeedNewline</span> <span class='op'>=</span> <span class='nam'>False</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>replaceFile</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>,</span> <span class='nam'>sNewText</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># The try-finally block is so we can print a partial line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># with the name of the file, and print (changed) on the</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># same line, but also make sure to break the line before</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># any traceback.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>bNeedNewline</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='op'>&gt;&gt;</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='nam'>sFile</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='nam'>sFile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>restoreIncludePath</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>processFileList</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFileList</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Process the files in a file list.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>flist</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sFileList</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>lines</span> <span class='op'>=</span> <span class='nam'>flist</span><span class='op'>.</span><span class='nam'>readlines</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>flist</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>lines</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Use shlex to parse the line like a shell.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>lex</span> <span class='op'>=</span> <span class='nam'>shlex</span><span class='op'>.</span><span class='nam'>shlex</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>,</span> <span class='nam'>posix</span><span class='op'>=</span><span class='nam'>True</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>lex</span><span class='op'>.</span><span class='nam'>whitespace_split</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>lex</span><span class='op'>.</span><span class='nam'>commenters</span> <span class='op'>=</span> <span class='str'>&#39;#&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># No escapes, so that backslash can be part of the path</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>lex</span><span class='op'>.</span><span class='nam'>escape</span> <span class='op'>=</span> <span class='str'>&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>args</span> <span class='op'>=</span> <span class='nam'>list</span><span class='op'>(</span><span class='nam'>lex</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>args</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processArguments</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>processArguments</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>args</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Process one command-line.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>saved_options</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>clone</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>[</span><span class='num'>1</span><span class='op'>:</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>validate</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>args</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span> <span class='op'>==</span> <span class='str'>&#39;@&#39;</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>sOutputName</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>&quot;Can&#39;t use -o with @file&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processFileList</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>[</span><span class='num'>1</span><span class='op'>:</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processOneFile</span><span class='op'>(</span><span class='nam'>args</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span> <span class='op'>=</span> <span class='nam'>saved_options</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>callableMain</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>argv</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; All of command-line cog, but in a callable form.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is used by main.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; argv is the equivalent of sys.argv.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>argv0</span> <span class='op'>=</span> <span class='nam'>argv</span><span class='op'>.</span><span class='nam'>pop</span><span class='op'>(</span><span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Provide help if asked for anywhere in the command line.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='str'>&#39;-?&#39;</span> <span class='key'>in</span> <span class='nam'>argv</span> <span class='key'>or</span> <span class='str'>&#39;-h&#39;</span> <span class='key'>in</span> <span class='nam'>argv</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='op'>&gt;&gt;</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='nam'>usage</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>validate</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bShowVersion</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='op'>&gt;&gt;</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stdout</span><span class='op'>,</span> <span class='str'>&quot;Cog version %s&quot;</span> <span class='op'>%</span> <span class='nam'>__version__</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>args</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>a</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>args</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>processArguments</span><span class='op'>(</span><span class='op'>[</span><span class='nam'>a</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>CogUsageError</span><span class='op'>(</span><span class='str'>&quot;No files to process&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>main</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>argv</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Handle the command-line execution for cog.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='num'>0</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='op'>&gt;&gt;</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='nam'>err</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='op'>&gt;&gt;</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='str'>&quot;(for help use -?)&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='num'>2</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>CogGeneratedError</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='op'>&gt;&gt;</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='str'>&quot;Error: %s&quot;</span> <span class='op'>%</span> <span class='nam'>err</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='num'>3</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>err</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>print</span> <span class='op'>&gt;&gt;</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>,</span> <span class='nam'>err</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='num'>1</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>traceback</span><span class='op'>.</span><span class='nam'>print_exc</span><span class='op'>(</span><span class='nam'>None</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>stderr</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='num'>1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># History:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20040210: First public version.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20040220: Text preceding the start and end marker are removed from Python lines.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; -v option on the command line shows the version.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20040311: Make sure the last line of output is properly ended with a newline.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20040605: Fixed some blank line handling in cog.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Fixed problems with assigning to xml elements in handyxml.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20040621: Changed all line-ends to LF from CRLF.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20041002: Refactor some option handling to simplify unittesting the options.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20041118: cog.out and cog.outl have optional string arguments.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20041119: File names weren&#39;t being properly passed around for warnings, etc.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20041122: Added cog.firstLineNum: a property with the line number of the [[[cog line.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Added cog.inFile and cog.outFile: the names of the input and output file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20041218: Single-line cog generators, with start marker and end marker on</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; the same line.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20041230: Keep a single globals dict for all the code fragments in a single</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; file so they can share state.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050206: Added the -x switch to remove all generated output.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050218: Now code can be on the marker lines as well.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050219: Added -c switch to checksum the output so that edits can be</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; detected before they are obliterated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050521: Added cog.error, contributed by Alexander Belchenko.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050720: Added code deletion and settable globals contributed by Blake Winton.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050724: Many tweaks to improve code coverage.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050726: Error messages are now printed with no traceback.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Code can no longer appear on the marker lines,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; except for single-line style.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; -z allows omission of the [[[end]]] marker, and it will be assumed</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; at the end of the file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050729: Refactor option parsing into a separate class, in preparation for</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; future features.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050805: The cogmodule.path wasn&#39;t being properly maintained.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050808: Added the -D option to define a global value.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050810: The %s in the -w command is dealt with more robustly.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Added the -s option to suffix output lines with a marker.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20050817: Now @files can have arguments on each line to change the cog&#39;s</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; behavior for that line.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20051006: Version 2.0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20080521: -U options lets you create Unix newlines on Windows.&nbsp; Thanks,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Alexander Belchenko.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20080522: It&#39;s now ok to have -d with output to stdout, and now we validate</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; the args after each line of an @file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># 20090520: Use hashlib where it&#39;s available, to avoid a warning.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Use the builtin compile() instead of compiler, for Jython.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'>#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Explicitly close files we opened, Jython likes this.</span><span class="strut">&nbsp;</span></p>
</td>
</tr>
diff --git a/doc/sample_html/cogapp_makefiles.html b/doc/sample_html/cogapp_makefiles.html
index d1c7e56..4d50521 100644
--- a/doc/sample_html/cogapp_makefiles.html
+++ b/doc/sample_html/cogapp_makefiles.html
@@ -104,70 +104,70 @@ function toggle_lines(btn, cls) {
</td>
<td class='text' valign='top'>
-<p class='pln'>&quot;&quot;&quot; Dictionary-to-filetree functions, to create test files for testing.</p>
-<p class='pln'>&nbsp; &nbsp; http://nedbatchelder.com/code/cog</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; Copyright 2004-2009, Ned Batchelder.</p>
-<p class='pln'>&quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>import path&nbsp; &nbsp;&nbsp; # Non-standard, from http://www.jorendorff.com/articles/python/path</p>
-<p class='stm run hide'>from whiteutils import reindentBlock</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>__version__ = &#39;1.0.20040126&#39;</p>
-<p class='stm run hide'>__all__ = [&#39;makeFiles&#39;, &#39;removeFiles&#39;]</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>def makeFiles(d, basedir=&#39;.&#39;, raw=False):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Create files from the dictionary d, in the directory named by dirpath.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; dirpath = path.path(basedir)</p>
-<p class='stm mis'>&nbsp; &nbsp; for name, contents in d.items():</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; child = dirpath / name</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if isinstance(contents, basestring):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mode = &#39;w&#39;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if raw:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mode = &#39;wb&#39;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f = open(child, mode)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not raw:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; contents = reindentBlock(contents)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.write(contents)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.close()</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not child.exists():</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; child.mkdir()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; makeFiles(contents, child, raw=raw)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>def removeFiles(d, basedir=&#39;.&#39;):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Remove the files created by makeFiles.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; Directories are removed if they are empty.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; dirpath = path.path(basedir)</p>
-<p class='stm mis'>&nbsp; &nbsp; for name, contents in d.items():</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; child = dirpath / name</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; if isinstance(contents, basestring):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; child.remove()</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; removeFiles(contents, child)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not child.files() and not child.dirs():</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; child.rmdir()</p>
-<p class='pln'>&nbsp;</p>
-<p class='exc'>if __name__ == &#39;__main__&#39;:&nbsp; &nbsp; &nbsp; #pragma: no cover</p>
-<p class='pln'>&nbsp; &nbsp; # Try it a little.</p>
-<p class='exc'>&nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;test_makefiles&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;hey.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is hey.txt.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; It&#39;s very simple.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;subdir&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;fooey&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Kablooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Ew.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp; &nbsp; }</p>
-<p class='exc'>&nbsp; &nbsp; makeFiles(d)</p>
+<p class='pln'><span class='str'>&quot;&quot;&quot; Dictionary-to-filetree functions, to create test files for testing.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; http://nedbatchelder.com/code/cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; Copyright 2004-2009, Ned Batchelder.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>import</span> <span class='nam'>path</span>&nbsp; &nbsp;&nbsp; <span class='com'># Non-standard, from http://www.jorendorff.com/articles/python/path</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>whiteutils</span> <span class='key'>import</span> <span class='nam'>reindentBlock</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='nam'>__version__</span> <span class='op'>=</span> <span class='str'>&#39;1.0.20040126&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='nam'>__all__</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;makeFiles&#39;</span><span class='op'>,</span> <span class='str'>&#39;removeFiles&#39;</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>def</span> <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>,</span> <span class='nam'>basedir</span><span class='op'>=</span><span class='str'>&#39;.&#39;</span><span class='op'>,</span> <span class='nam'>raw</span><span class='op'>=</span><span class='nam'>False</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Create files from the dictionary d, in the directory named by dirpath.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; <span class='nam'>dirpath</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>(</span><span class='nam'>basedir</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>name</span><span class='op'>,</span> <span class='nam'>contents</span> <span class='key'>in</span> <span class='nam'>d</span><span class='op'>.</span><span class='nam'>items</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>dirpath</span> <span class='op'>/</span> <span class='nam'>name</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>&#39;w&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>raw</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>mode</span> <span class='op'>=</span> <span class='str'>&#39;wb&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>child</span><span class='op'>,</span> <span class='nam'>mode</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>raw</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>contents</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>exists</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>child</span><span class='op'>.</span><span class='nam'>mkdir</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>child</span><span class='op'>,</span> <span class='nam'>raw</span><span class='op'>=</span><span class='nam'>raw</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>def</span> <span class='nam'>removeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>,</span> <span class='nam'>basedir</span><span class='op'>=</span><span class='str'>&#39;.&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Remove the files created by makeFiles.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Directories are removed if they are empty.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; <span class='nam'>dirpath</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>(</span><span class='nam'>basedir</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>name</span><span class='op'>,</span> <span class='nam'>contents</span> <span class='key'>in</span> <span class='nam'>d</span><span class='op'>.</span><span class='nam'>items</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>child</span> <span class='op'>=</span> <span class='nam'>dirpath</span> <span class='op'>/</span> <span class='nam'>name</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>child</span><span class='op'>.</span><span class='nam'>remove</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>removeFiles</span><span class='op'>(</span><span class='nam'>contents</span><span class='op'>,</span> <span class='nam'>child</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>files</span><span class='op'>(</span><span class='op'>)</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>child</span><span class='op'>.</span><span class='nam'>dirs</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>child</span><span class='op'>.</span><span class='nam'>rmdir</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='exc'><span class='key'>if</span> <span class='nam'>__name__</span> <span class='op'>==</span> <span class='str'>&#39;__main__&#39;</span><span class='op'>:</span>&nbsp; &nbsp; &nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># Try it a little.</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test_makefiles&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;hey.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is hey.txt.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; It&#39;s very simple.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subdir&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;fooey&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Kablooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Ew.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
</td>
</tr>
diff --git a/doc/sample_html/cogapp_test_cogapp.html b/doc/sample_html/cogapp_test_cogapp.html
index 2f19e05..23355ae 100644
--- a/doc/sample_html/cogapp_test_cogapp.html
+++ b/doc/sample_html/cogapp_test_cogapp.html
@@ -2000,1966 +2000,1966 @@ function toggle_lines(btn, cls) {
</td>
<td class='text' valign='top'>
-<p class='pln'>&quot;&quot;&quot; Test cogapp.</p>
-<p class='pln'>&nbsp; &nbsp; http://nedbatchelder.com/code/cog</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; Copyright 2004-2009, Ned Batchelder.</p>
-<p class='pln'>&quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>import unittest</p>
-<p class='stm run hide'>import os, random, re, StringIO, stat, sys, tempfile</p>
-<p class='stm run hide'>import path&nbsp; &nbsp;&nbsp; # Non-standard, from http://www.jorendorff.com/articles/python/path</p>
-<p class='stm run hide'>from cogapp import Cog, CogOptions, CogGenerator</p>
-<p class='stm run hide'>from cogapp import CogError, CogUsageError, CogGeneratedError</p>
-<p class='stm run hide'>from cogapp import usage, __version__</p>
-<p class='stm run hide'>from whiteutils import reindentBlock</p>
-<p class='stm run hide'>from makefiles import *</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class TestCase(unittest.TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Base class for all Cog test cases.&nbsp; Adds utility methods I like.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def assertRaisesMsg(self, excClass, msg, callableObj, *args, **kwargs):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Just like unittest.TestCase.assertRaises,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; but checks that the message is right too.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; callableObj(*args, **kwargs)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; except excClass, exc:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; excMsg = str(exc)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not msg:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # No message provided: it passes.</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return&nbsp; #pragma: no cover</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif excMsg == msg:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Message provided, and we got the right message: it passes.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:&nbsp;&nbsp; #pragma: no cover</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Message provided, and it didn&#39;t match: fail!</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise self.failureException(&quot;Right exception, wrong message: got &#39;%s&#39; expected &#39;%s&#39;&quot; % (excMsg, msg))</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; else:&nbsp;&nbsp; #pragma: no cover</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if hasattr(excClass,&#39;__name__&#39;):</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; excName = excClass.__name__</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; excName = str(excClass)</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise self.failureException(&quot;Expected to raise %s, didn&#39;t get an exception at all&quot; % excName)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogTestsInMemory(TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Test cases for cogapp.Cog()</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoCog(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; strings = [</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39; &#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39; \t \t \tx&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;hello&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;the cat\nin the\nhat.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;Horton\n\tHears A\n\t\tWho&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; for s in strings:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(s), s)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSimple(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some text.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line one\\n&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line two&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gobbledegook.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; outfile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some text.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line one\\n&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line two&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), outfile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testEmptyCog(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # The cog clause can be totally empty.&nbsp; Not sure why you&#39;d want it,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # but it works.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testMultipleCogs(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # One file can have many cog chunks, even abutting each other.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk1&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk2&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; between chunks</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk3&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk3</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTrimBlankLines(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;This is line one\\n&quot;, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;&#39;, dedent=True, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line three&quot;, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line three</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTrimEmptyBlankLines(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;This is line one\\n&quot;, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;&#39;, dedent=True, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;, dedent=True, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line three&quot;, trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line three</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def test22EndOfLine(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # In Python 2.2, this cog file was not parsing because the</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # last line is indented but didn&#39;t end with a newline.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testIndentedCode(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testPrefixedCode(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testPrefixedIndentedCode(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp;&nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp;&nbsp; for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp;&nbsp; cog.out(&quot;xy%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testBogusPrefixMatch(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # This comment should not be clobbered by removing the pound sign.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;xy%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoFinalNewline(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # If the cog&#39;ed output has no final newline,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # it shouldn&#39;t eat up the cog terminator.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;%d&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 012</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoOutputAtAll(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # If there is absolutely no cog output, that&#39;s ok.</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i = 1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testPurelyBlankLine(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # If there is a blank line in the cog code with no whitespace</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # prefix, that should be OK.</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import sys</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;Hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;There&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HelloThere</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile.replace(&#39;$&#39;, &#39;&#39;))</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testEmptyOutl(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Alexander Belchenko suggested the string argument to outl should</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # be optional.&nbsp; Does it work?</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;x&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl()</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;y&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(trimblanklines=True)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;z&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; z</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testFirstLineNum(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;started at line number %d&quot; % cog.firstLineNum)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; started at line number 2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;and again at line %d&quot; % cog.firstLineNum)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and again at line 8</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCompactOneLineCode(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog cog.outl(&quot;hello %d&quot; % (3*3*3*3)) ]]] looky!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get rid of this!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; outfile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog cog.outl(&quot;hello %d&quot; % (3*3*3*3)) ]]] looky!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello 81</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), reindentBlock(outfile))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testInsideOutCompact(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey?: ]]] what is this? [[[cog strange!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get rid of this!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &quot;infile.txt(2): Cog code markers inverted&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; Cog().processString,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; reindentBlock(infile), &quot;infile.txt&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSharingGlobals(self):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog s=&quot;hey there&quot; ]]] looky!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; more literal junk.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.outl(s) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; outfile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog s=&quot;hey there&quot; ]]] looky!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; more literal junk.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.outl(s) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey there</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), reindentBlock(outfile))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogOptionsTests(TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Test the CogOptions class.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testEquality(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(o, p)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o.parseArgs([&#39;-r&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertNotEqual(o, p)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p.parseArgs([&#39;-r&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(o, p)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCloning(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o.parseArgs([&#39;-I&#39;, &#39;fooey&#39;, &#39;-I&#39;, &#39;booey&#39;, &#39;-s&#39;, &#39; /*x*/&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p = o.clone()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(o, p)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p.parseArgs([&#39;-I&#39;, &#39;huey&#39;, &#39;-D&#39;, &#39;foo=quux&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertNotEqual(o, p)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; q = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; q.parseArgs([&#39;-I&#39;, &#39;fooey&#39;, &#39;-I&#39;, &#39;booey&#39;, &#39;-s&#39;, &#39; /*x*/&#39;, &#39;-I&#39;, &#39;huey&#39;, &#39;-D&#39;, &#39;foo=quux&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(p, q)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCombiningFlags(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Single-character flags can be combined.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; o.parseArgs([&#39;-e&#39;, &#39;-r&#39;, &#39;-z&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p = CogOptions()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; p.parseArgs([&#39;-erz&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(o, p)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class FileStructureTests(TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Test cases to check that we&#39;re properly strict about the structure</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; of files.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def isBad(self, infile, msg=None):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cog().processString, (infile), &#39;infile.txt&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testBeginNoEnd(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(2): Cog block begun but never ended.&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoEoo(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(4): Missing &#39;[[[end]]]&#39; before end of file.&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;goodbye&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(5): Unexpected &#39;[[[cog&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testStartWithEnd(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(1): Unexpected &#39;]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(5): Unexpected &#39;]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testStartWithEoo(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(1): Unexpected &#39;[[[end]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(5): Unexpected &#39;[[[end]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoEnd(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(3): Unexpected &#39;[[[end]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(7): Unexpected &#39;[[[end]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTwoBegins(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(2): Unexpected &#39;[[[cog&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(6): Unexpected &#39;[[[cog&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTwoEnds(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile, &quot;infile.txt(4): Unexpected &#39;]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile2 = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.isBad(infile2, &quot;infile.txt(8): Unexpected &#39;]]]&#39;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogErrorTests(TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Test cases for cog.error().</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testErrorMsg(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.error(&quot;This ain&#39;t right!&quot;)]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogGeneratedError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;This ain&#39;t right!&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cog().processString, (infile))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testErrorNoMsg(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.error()]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogGeneratedError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Error raised by cog generator.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Cog().processString, (infile))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoErrorIfErrorNotCalled(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --for i in range(3):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; if i &gt; 10:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp; &nbsp; cog.error(&quot;Something is amiss!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(Cog().processString(infile), infile)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogGeneratorGetCodeTests(TestCase):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Unit tests against CogGenerator to see if its getCode() method works</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; properly.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def setUp(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; All tests get a generator to use, and short same-length names for</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the functions we&#39;re going to use.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.gen = CogGenerator()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m = self.gen.parseMarker</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l = self.gen.parseLine</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testEmpty(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// ]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSimple(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;&nbsp; print &quot;hello&quot;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;&nbsp; print &quot;bye&quot;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// ]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;print &quot;hello&quot;\nprint &quot;bye&quot;&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCompressed1(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # For a while, I supported compressed code blocks, but no longer.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog: print &quot;&quot;&quot;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;// hello&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;// bye&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// &quot;&quot;&quot;)]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;hello\nbye&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCompressed2(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # For a while, I supported compressed code blocks, but no longer.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog: print &quot;&quot;&quot;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;hello&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;bye&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// &quot;&quot;&quot;)]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;hello\nbye&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCompressed3(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # For a while, I supported compressed code blocks, but no longer.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;print &quot;&quot;&quot;hello&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;bye&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// &quot;&quot;&quot;)]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;print &quot;&quot;&quot;hello\nbye&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCompressed4(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # For a while, I supported compressed code blocks, but no longer.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// [[[cog: print &quot;&quot;&quot;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;hello&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;bye&quot;&quot;&quot;)&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;// ]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;hello\nbye&quot;&quot;&quot;)&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoCommonPrefixForMarkers(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # It&#39;s important to be able to use #if 0 to hide lines from a</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # C++ compiler.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;#if 0 //[[[cog&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;\timport cog, sys&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.l(&#39;\tprint sys.argv&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.m(&#39;#endif //]]]&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.gen.getCode(), &#39;import cog, sys\n\nprint sys.argv&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class TestCaseWithTempDir(TestCase):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def newCog(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot; Initialize the cog members for another run.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Create a cog engine, and catch its output.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog = Cog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.output = StringIO.StringIO()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.setOutput(stdout=self.output, stderr=self.output)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def setUp(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Create a temporary directory.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.tempdir = path.path(tempfile.gettempdir()) / (&#39;testcog_tempdir_&#39; + str(random.random())[2:])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.tempdir.mkdir()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.olddir = os.getcwd()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; os.chdir(self.tempdir)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def tearDown(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; os.chdir(self.olddir)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Get rid of the temporary directory.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.tempdir.rmtree()</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def assertFilesSame(self, sFName1, sFName2):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual((self.tempdir / sFName1).text(), (self.tempdir / sFName2).text())</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def assertFileContent(self, sFName, sContent):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; sAbsName = self.tempdir / sFName</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; f = open(sAbsName, &#39;rb&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sFileContent = f.read()</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; finally:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f.close()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(sFileContent, sContent)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class ArgumentHandlingTests(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testArgumentFailure(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Return value 2 means usage problem.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(self.cog.main([&#39;argv0&#39;, &#39;-j&#39;]) == 2)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;option -j not recognized&quot;) &gt;= 0)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-j&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNoDashOAndAtFile(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-o&#39;, &#39;foo&#39;, &#39;@cogfiles.txt&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDashV(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(self.cog.main([&#39;argv0&#39;, &#39;-v&#39;]) == 0)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(&#39;Cog version %s\n&#39; % __version__, output)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def producesHelp(self, args):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; argv = [&#39;argv0&#39;] + args.split()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(self.cog.main(argv) == 0)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEquals(usage, self.output.getvalue())</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDashH(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # -h or -? anywhere on the command line should just print help.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.producesHelp(&quot;-h&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.producesHelp(&quot;-?&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.producesHelp(&quot;fooey.txt -h&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.producesHelp(&quot;-o -r @fooey.txt -? @booey.txt&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDashOAndDashR(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfile.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-o&#39;, &#39;foo&#39;, &#39;-r&#39;, &#39;cogfile.txt&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDashZ(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CogError, &quot;test.cog(6): Missing &#39;[[[end]]]&#39; before end of file.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;test.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-z&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testBadDashD(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-Dfooey&#39;, &#39;cog.txt&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-D&#39;, &#39;fooey&#39;, &#39;cog.txt&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class TestFileHandling(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSimple(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;(changed)&quot;) &gt;= 0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testOutputFile(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # -o sets the output file.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-o&#39;, &#39;test.cogged&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cogged&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testAtFile(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye cruel world</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;@cogfiles.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;one.cog&#39;, &#39;one.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;two.cog&#39;, &#39;two.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;(changed)&quot;) &gt;= 0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNestedAtFile(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye cruel world</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @cogfiles2.txt</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles2.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # This one too, please.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;@cogfiles.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;one.cog&#39;, &#39;one.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;two.cog&#39;, &#39;two.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;(changed)&quot;) &gt;= 0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testAtFileWithArgs(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;both.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one: True // ONE</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two: False // ONE</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one: False // TWO</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two: True // TWO</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -o both.one -s &#39; // ONE&#39; -D one=x</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -o both.two -s &#39; // TWO&#39; -D two=x</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;@cogfiles.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;both.one&#39;, &#39;one.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;both.two&#39;, &#39;two.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testAtFileWithBadArgCombo(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;both.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -d # This is bad: -r and -d</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;@cogfiles.txt&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testAtFileWithTrickyFilenames(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one 1.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;hello world&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;hello world&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world //xxx</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;subdir&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;subback.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with backslashes&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;subfwd.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with slashes&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;subback.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with backslashes&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; down deep with backslashes //yyy</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;subfwd.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with slashes&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; down deep with slashes //zzz</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one 1.cog&#39; -s &#39; //xxx&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subdir\subback.cog -s &#39; //yyy&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subdir/subfwd.cog -s &#39; //zzz&#39;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-z&#39;, &#39;-r&#39;, &#39;@cogfiles.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;one 1.cog&#39;, &#39;one.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;subdir/subback.cog&#39;, &#39;subback.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;subdir/subfwd.cog&#39;, &#39;subfwd.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogTestLineEndings(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;Tests for -U option (force LF line-endings in output).&quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; lines_in = [&#39;Some text.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;//[[[cog&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog.outl(&quot;Cog text&quot;)&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;//]]]&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;gobbledegook.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;//[[[end]]]&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;epilogue.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;]</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; lines_out = [&#39;Some text.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;//[[[cog&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;cog.outl(&quot;Cog text&quot;)&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;//]]]&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;Cog text&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;//[[[end]]]&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;epilogue.&#39;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &#39;&#39;]</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testOutputNativeEol(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles({&#39;infile&#39;: &#39;\n&#39;.join(self.lines_in)})</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-o&#39;, &#39;outfile&#39;, &#39;infile&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFileContent(&#39;outfile&#39;, os.linesep.join(self.lines_out))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testOutputLfEol(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles({&#39;infile&#39;: &#39;\n&#39;.join(self.lines_in)})</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-U&#39;, &#39;-o&#39;, &#39;outfile&#39;, &#39;infile&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFileContent(&#39;outfile&#39;, &#39;\n&#39;.join(self.lines_out))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReplaceNativeEol(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles({&#39;test.cog&#39;: &#39;\n&#39;.join(self.lines_in)})</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFileContent(&#39;test.cog&#39;, os.linesep.join(self.lines_out))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReplaceLfEol(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles({&#39;test.cog&#39;: &#39;\n&#39;.join(self.lines_in)})</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-U&#39;, &#39;-r&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFileContent(&#39;test.cog&#39;, &#39;\n&#39;.join(self.lines_out))</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class TestCaseWithImports(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; When running tests which import modules, the sys.modules list</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; leaks from one test to the next.&nbsp; This test case class scrubs</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; the list after each run to keep the tests isolated from each other.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def setUp(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; TestCaseWithTempDir.setUp(self)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.sysmodulekeys = list(sys.modules)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def tearDown(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; modstoscrub = [</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; modname</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for modname in sys.modules</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if modname not in self.sysmodulekeys</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; for modname in modstoscrub:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; del sys.modules[modname]</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; TestCaseWithTempDir.tearDown(self)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogIncludeTests(TestCaseWithImports):</p>
-<p class='stm run hide'>&nbsp; &nbsp; dincludes = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mymodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;test2.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mymodule in inc2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;include&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;mymodule.py&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mymodule&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;inc2&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;mymodule.py&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mymodule in inc2&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;inc3&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;someothermodule.py&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is some other module.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testNeedIncludePath(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Try it without the -I, to see that an ImportError happens.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.dincludes)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(ImportError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;test.cog&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testIncludePath(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that -I adds include directories properly.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.dincludes)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;include&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTwoIncludePaths(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that two -I&#39;s add include directories properly.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.dincludes)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;include&#39;, &#39;-I&#39;, &#39;inc2&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTwoIncludePaths2(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that two -I&#39;s add include directories properly.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.dincludes)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;inc2&#39;, &#39;-I&#39;, &#39;include&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test2.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testUselessIncludePath(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that the search will continue past the first directory.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.dincludes)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;inc3&#39;, &#39;-I&#39;, &#39;include&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSysPathIsUnchanged(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;bad.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.error(&quot;Oh no!&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;good.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;Oh yes!&quot;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged just by creating a cog engine?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; oldsyspath = sys.path[:]</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a successful run?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;good.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a successful run with includes?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;xyzzy&#39;, &#39;good.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a successful run with two includes?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;xyzzy&#39;, &#39;-I&#39;, &#39;quux&#39;, &#39;good.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a failed run?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;bad.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a failed run with includes?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;xyzzy&#39;, &#39;bad.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Is it unchanged for a failed run with two includes?</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;-I&#39;, &#39;xyzzy&#39;, &#39;-I&#39;, &#39;quux&#39;, &#39;bad.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(oldsyspath, sys.path)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSubDirectories(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that relative paths on the command line work, with includes.</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;code&#39;: {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mysubmodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mysubmodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mysubmodule</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;mysubmodule.py&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mysubmodule&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # We should be able to invoke cog without the -I switch, and it will</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # auto-include the current directory</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;code/test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;code/test.cog&#39;, &#39;code/test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class CogTestsInFiles(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testWarnIfNoCogCode(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that the -e switch warns if there is no Cog code.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;with.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;without.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; There&#39;s no cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; code in this file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-e&#39;, &#39;with.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;Warning&quot;) &lt; 0)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-e&#39;, &#39;without.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;Warning: no cog code found in without.cog&quot;) &gt;= 0)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;without.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;Warning&quot;) &lt; 0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testFileNameProps(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this is cog1.txt in, cog1.txt out</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is cog1.txt in, cog1.txt out</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1out.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is cog1.txt in, cog1out.txt out</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-o&#39;, &#39;cog1out.txt&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1out.txt&#39;, &#39;cog1out.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testGlobalsDontCrossFiles(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Make sure that global values don&#39;t get shared between files.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog s = &quot;This was set in one.cog&quot; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(s) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog s = &quot;This was set in one.cog&quot; ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(s) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This was set in one.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(s)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except NameError:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;s isn&#39;t set!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;two.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(s)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except NameError:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;s isn&#39;t set!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s isn&#39;t set!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cogfiles.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;@cogfiles.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;one.cog&#39;, &#39;one.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;two.cog&#39;, &#39;two.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert(output.find(&quot;(changed)&quot;) &gt;= 0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testRemoveGeneratedOutput(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out2&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Remove generated output.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-x&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Regenerate the generated output.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out2&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.newCog()</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Remove the generated output again.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-x&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testMsgCall(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.msg(&quot;Hello there!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; infile = reindentBlock(infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.cog.processString(infile), infile)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(output, &quot;Message: Hello there!\n&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testErrorMessageHasNoTraceback(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that a Cog error is printed to stderr with no traceback.</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Xhis line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; stderr = StringIO.StringIO()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.setOutput(stderr=stderr)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.main([&#39;argv0&#39;, &#39;-c&#39;, &#39;-r&#39;, &quot;cog1.txt&quot;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(self.output.getvalue(), &quot;Cogging cog1.txt\n&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(stderr.getvalue(), &quot;cog1.txt(9): Output has been edited! Delete old checksum to unprotect.\n&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDashD(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.kablooey&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Defined fooey as kablooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.einstein&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Defined fooey as e=mc2</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-D&#39;, &#39;fooey=kablooey&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.kablooey&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-Dfooey=kablooey&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.kablooey&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-Dfooey=e=mc2&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.einstein&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-Dbar=quux&#39;, &#39;-Dfooey=kablooey&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.kablooey&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-Dfooey=kablooey&#39;, &#39;-Dbar=quux&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.kablooey&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-Dfooey=gooey&#39;, &#39;-Dfooey=kablooey&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.kablooey&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testOutputToStdout(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&#39;Hey there!&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; stderr = StringIO.StringIO()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.setOutput(stderr=stderr)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; outerr = stderr.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(output, &quot;--[[[cog cog.outl(&#39;Hey there!&#39;) ]]]\nHey there!\n--[[[end]]]\n&quot;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(outerr, &quot;&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSuffixOutputLines(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hey there.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\n&nbsp;&nbsp; \\nc&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Good bye.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hey there.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\n&nbsp;&nbsp; \\nc&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a (foo)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b (foo)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c (foo)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Good bye.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-s&#39;, &#39; (foo)&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testEmptySuffix(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\nc&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\nc&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-s&#39;, &#39;&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testHellishSuffix(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\n\\nb&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\n\\nb&#39;) ]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a /\\n*+([)]&gt;&lt;</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b /\\n*+([)]&gt;&lt;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-z&#39;, &#39;-r&#39;, &#39;-s&#39;, r&#39; /\n*+([)]&gt;&lt;&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class WritabilityTests(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='exc'>&nbsp; &nbsp; if os.name == &#39;nt&#39;:&nbsp; &nbsp;&nbsp; # pragma: no cover</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # for Windows</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; cmd_w_args = &#39;attrib -R %s&#39;</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; cmd_w_asterisk = &#39;attrib -R *&#39;</p>
-<p class='exc'>&nbsp; &nbsp; else:&nbsp;&nbsp; # pragma: no cover</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # for unix-like</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; cmd_w_args = &#39;chmod +w %s&#39;</p>
-<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; cmd_w_asterisk = &#39;chmod +w *&#39;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def setUp(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; TestCaseWithTempDir.setUp(self)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(self.d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.testcog = self.tempdir / &#39;test.cog&#39;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.testcog.chmod(stat.S_IREAD)&nbsp;&nbsp; # Make the file readonly.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert not os.access(self.testcog, os.W_OK)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def tearDown(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.testcog.chmod(stat.S_IWRITE)&nbsp;&nbsp; # Make the file writable again.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; TestCaseWithTempDir.tearDown(self)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReadonlyNoCommand(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CogError, &quot;Can&#39;t overwrite test.cog&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;test.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert not os.access(self.testcog, os.W_OK)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReadonlyWithCommand(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-w&#39;, self.cmd_w_args, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert os.access(self.testcog, os.W_OK)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReadonlyWithCommandWithNoSlot(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-w&#39;, self.cmd_w_asterisk, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cog&#39;, &#39;test.out&#39;)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert os.access(self.testcog, os.W_OK)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testReadonlyWithIneffectualCommand(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CogError, &quot;Couldn&#39;t make test.cog writable&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;-w&#39;, &#39;echo %s&#39;, &#39;test.cog&#39;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; assert not os.access(self.testcog, os.W_OK)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class ChecksumTests(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCreateChecksumOutput(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-c&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testCheckChecksumOutput(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;-c&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testRemoveChecksumOutput(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893) fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] fooey</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-r&#39;, &#39;cog1.txt&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;cog1.txt&#39;, &#39;cog1.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testTamperedChecksumOutput(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog1.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Xhis line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog2.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah!</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog3.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog4.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah..</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog5.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; extra</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;cog6.txt&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog1.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog1.txt&quot;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog2.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog2.txt&quot;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog3.txt(10): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog3.txt&quot;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog4.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog4.txt&quot;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog5.txt(10): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog5.txt&quot;]))</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaisesMsg(CogError,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;cog6.txt(6): Output has been edited! Delete old checksum to unprotect.&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain, ([&#39;argv0&#39;, &#39;-c&#39;, &quot;cog6.txt&quot;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class BlakeTests(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; # Blake Winton&#39;s contributions.</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDeleteCode(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # -o sets the output file.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some Sample Code Here</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]Data Data</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; And Some More</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; And Some More</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.callableMain([&#39;argv0&#39;, &#39;-d&#39;, &#39;-o&#39;, &#39;test.cogged&#39;, &#39;test.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cogged&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testDeleteCodeWithDashRFails(self):</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertRaises(CogUsageError, self.cog.callableMain, ([&#39;argv0&#39;, &#39;-r&#39;, &#39;-d&#39;, &#39;test.cog&#39;]))</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testSettingGlobals(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Blake Winton contributed a way to set the globals that will be used in</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # processFile().</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some Sample Code Here</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]&quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;test.out&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoBlake();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoWinton();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoContribution();</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; globals = {}</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; globals[&#39;fnames&#39;] = [&#39;DoBlake&#39;, &#39;DoWinton&#39;, &#39;DoContribution&#39;]</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.options.bDeleteCode = True</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.processFile(&#39;test.cog&#39;, &#39;test.cogged&#39;, globals=globals)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertFilesSame(&#39;test.cogged&#39;, &#39;test.out&#39;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>class ErrorCallTests(TestCaseWithTempDir):</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testErrorCallHasNoTraceback(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that cog.error() doesn&#39;t show a traceback.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;error.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.error(&quot;Something Bad!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.main([&#39;argv0&#39;, &#39;-r&#39;, &#39;error.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assertEqual(output, &quot;Cogging error.cog\nError: Something Bad!\n&quot;)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; def testRealErrorHasTraceback(self):</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; # Test that a genuine error does show a traceback.</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; d = {</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;error.cog&#39;: &quot;&quot;&quot;\</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise RuntimeError(&quot;Hey!&quot;)</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;,</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; makeFiles(d)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.cog.main([&#39;argv0&#39;, &#39;-r&#39;, &#39;error.cog&#39;])</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; output = self.output.getvalue()</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; msg = &#39;Actual output:\n&#39; + output</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assert_(output.startswith(&quot;Cogging error.cog\nTraceback (most recent&quot;), msg)</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; self.assert_(output.find(&quot;RuntimeError: Hey!&quot;) &gt; 0, msg)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp;</p>
-<p class='exc'>if __name__ == &#39;__main__&#39;:&nbsp; &nbsp; &nbsp; #pragma: no cover</p>
-<p class='exc'>&nbsp; &nbsp; unittest.main()</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'># Things not yet tested:</p>
-<p class='pln'># - A bad -w command (currently fails silently).</p>
+<p class='pln'><span class='str'>&quot;&quot;&quot; Test cogapp.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; http://nedbatchelder.com/code/cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; Copyright 2004-2009, Ned Batchelder.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>import</span> <span class='nam'>unittest</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>import</span> <span class='nam'>os</span><span class='op'>,</span> <span class='nam'>random</span><span class='op'>,</span> <span class='nam'>re</span><span class='op'>,</span> <span class='nam'>StringIO</span><span class='op'>,</span> <span class='nam'>stat</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>,</span> <span class='nam'>tempfile</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>import</span> <span class='nam'>path</span>&nbsp; &nbsp;&nbsp; <span class='com'># Non-standard, from http://www.jorendorff.com/articles/python/path</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>Cog</span><span class='op'>,</span> <span class='nam'>CogOptions</span><span class='op'>,</span> <span class='nam'>CogGenerator</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>CogGeneratedError</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>cogapp</span> <span class='key'>import</span> <span class='nam'>usage</span><span class='op'>,</span> <span class='nam'>__version__</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>whiteutils</span> <span class='key'>import</span> <span class='nam'>reindentBlock</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>from</span> <span class='nam'>makefiles</span> <span class='key'>import</span> <span class='op'>*</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestCase</span><span class='op'>(</span><span class='nam'>unittest</span><span class='op'>.</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Base class for all Cog test cases.&nbsp; Adds utility methods I like.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>excClass</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>,</span> <span class='nam'>callableObj</span><span class='op'>,</span> <span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwargs</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Just like unittest.TestCase.assertRaises,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; but checks that the message is right too.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>callableObj</span><span class='op'>(</span><span class='op'>*</span><span class='nam'>args</span><span class='op'>,</span> <span class='op'>**</span><span class='nam'>kwargs</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>excClass</span><span class='op'>,</span> <span class='nam'>exc</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>excMsg</span> <span class='op'>=</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>exc</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>msg</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># No message provided: it passes.</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span>&nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>excMsg</span> <span class='op'>==</span> <span class='nam'>msg</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Message provided, and we got the right message: it passes.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span>&nbsp;&nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Message provided, and it didn&#39;t match: fail!</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>(</span><span class='str'>&quot;Right exception, wrong message: got &#39;%s&#39; expected &#39;%s&#39;&quot;</span> <span class='op'>%</span> <span class='op'>(</span><span class='nam'>excMsg</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span>&nbsp;&nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>excClass</span><span class='op'>,</span><span class='str'>&#39;__name__&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>excName</span> <span class='op'>=</span> <span class='nam'>excClass</span><span class='op'>.</span><span class='nam'>__name__</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>excName</span> <span class='op'>=</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>excClass</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>failureException</span><span class='op'>(</span><span class='str'>&quot;Expected to raise %s, didn&#39;t get an exception at all&quot;</span> <span class='op'>%</span> <span class='nam'>excName</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogTestsInMemory</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Test cases for cogapp.Cog()</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>strings</span> <span class='op'>=</span> <span class='op'>[</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39; &#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39; \t \t \tx&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;hello&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;the cat\nin the\nhat.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;Horton\n\tHears A\n\t\tWho&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>s</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some text.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line one\\n&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line two&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gobbledegook.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some text.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line one\\n&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line two&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>outfile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testEmptyCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># The cog clause can be totally empty.&nbsp; Not sure why you&#39;d want it,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># but it works.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testMultipleCogs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># One file can have many cog chunks, even abutting each other.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk1&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk2&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; between chunks</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;chunk3&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chunk3</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTrimBlankLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;This is line one\\n&quot;, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;&#39;, dedent=True, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line three&quot;, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line three</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTrimEmptyBlankLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;This is line one\\n&quot;, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;&#39;&#39;, dedent=True, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&#39;&#39;, dedent=True, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is line three&quot;, trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line one</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line two</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is line three</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>test22EndOfLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># In Python 2.2, this cog file was not parsing because the</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># last line is indented but didn&#39;t end with a newline.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testIndentedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testPrefixedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testPrefixedIndentedCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp;&nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp;&nbsp; for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp;&nbsp; cog.out(&quot;xy%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testBogusPrefixMatch</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # This comment should not be clobbered by removing the pound sign.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;xy%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xy2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoFinalNewline</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># If the cog&#39;ed output has no final newline,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># it shouldn&#39;t eat up the cog terminator.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;%d&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 012</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoOutputAtAll</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># If there is absolutely no cog output, that&#39;s ok.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i = 1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testPurelyBlankLine</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># If there is a blank line in the cog code with no whitespace</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># prefix, that should be OK.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import sys</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;Hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.out(&quot;There&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HelloThere</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='str'>&#39;$&#39;</span><span class='op'>,</span> <span class='str'>&#39;&#39;</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testEmptyOutl</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Alexander Belchenko suggested the string argument to outl should</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># be optional.&nbsp; Does it work?</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prologue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;x&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl()</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;y&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(trimblanklines=True)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;z&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; y</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; z</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; epilogue</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testFirstLineNum</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;started at line number %d&quot; % cog.firstLineNum)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; started at line number 2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;and again at line %d&quot; % cog.firstLineNum)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and again at line 8</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCompactOneLineCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog cog.outl(&quot;hello %d&quot; % (3*3*3*3)) ]]] looky!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get rid of this!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog cog.outl(&quot;hello %d&quot; % (3*3*3*3)) ]]] looky!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello 81</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>outfile</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testInsideOutCompact</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey?: ]]] what is this? [[[cog strange!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get rid of this!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&quot;infile.txt(2): Cog code markers inverted&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&quot;infile.txt&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSharingGlobals</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog s=&quot;hey there&quot; ]]] looky!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; more literal junk.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.outl(s) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>outfile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; first line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey: [[[cog s=&quot;hey there&quot; ]]] looky!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; more literal junk.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.outl(s) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hey there</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last line</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>outfile</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogOptionsTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Test the CogOptions class.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testEquality</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-r&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertNotEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-r&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCloning</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;fooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;booey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-s&#39;</span><span class='op'>,</span> <span class='str'>&#39; /*x*/&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>o</span><span class='op'>.</span><span class='nam'>clone</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;huey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-D&#39;</span><span class='op'>,</span> <span class='str'>&#39;foo=quux&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertNotEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>q</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>q</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;fooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;booey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-s&#39;</span><span class='op'>,</span> <span class='str'>&#39; /*x*/&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;huey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-D&#39;</span><span class='op'>,</span> <span class='str'>&#39;foo=quux&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>p</span><span class='op'>,</span> <span class='nam'>q</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCombiningFlags</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Single-character flags can be combined.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>o</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-e&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-z&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span> <span class='op'>=</span> <span class='nam'>CogOptions</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>p</span><span class='op'>.</span><span class='nam'>parseArgs</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;-erz&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>o</span><span class='op'>,</span> <span class='nam'>p</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>FileStructureTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Test cases to check that we&#39;re properly strict about the structure</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; of files.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>msg</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;infile.txt&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testBeginNoEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(2): Cog block begun but never ended.&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoEoo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(4): Missing &#39;[[[end]]]&#39; before end of file.&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;goodbye&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(5): Unexpected &#39;[[[cog&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testStartWithEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(1): Unexpected &#39;]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]&nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(5): Unexpected &#39;]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testStartWithEoo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(1): Unexpected &#39;[[[end]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(5): Unexpected &#39;[[[end]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoEnd</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(3): Unexpected &#39;[[[end]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&#39;hello&#39;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(7): Unexpected &#39;[[[end]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTwoBegins</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(2): Unexpected &#39;[[[cog&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(6): Unexpected &#39;[[[cog&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTwoEnds</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(4): Unexpected &#39;]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile2</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>isBad</span><span class='op'>(</span><span class='nam'>infile2</span><span class='op'>,</span> <span class='str'>&quot;infile.txt(8): Unexpected &#39;]]]&#39;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogErrorTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Test cases for cog.error().</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testErrorMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.error(&quot;This ain&#39;t right!&quot;)]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogGeneratedError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;This ain&#39;t right!&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testErrorNoMsg</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[cog cog.error()]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogGeneratedError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;Error raised by cog generator.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoErrorIfErrorNotCalled</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --for i in range(3):</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; if i &gt; 10:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp; &nbsp; cog.error(&quot;Something is amiss!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; cog.out(&quot;xx%d\\n&quot; % i)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx0</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx1</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xx2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogGeneratorGetCodeTests</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Unit tests against CogGenerator to see if its getCode() method works</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; properly.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; All tests get a generator to use, and short same-length names for</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; the functions we&#39;re going to use.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span> <span class='op'>=</span> <span class='nam'>CogGenerator</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseMarker</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>parseLine</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testEmpty</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// ]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;&nbsp; print &quot;hello&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;&nbsp; print &quot;bye&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// ]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;print &quot;hello&quot;\nprint &quot;bye&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCompressed1</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog: print &quot;&quot;&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;// hello&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;// bye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// &quot;&quot;&quot;)]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;hello\nbye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCompressed2</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog: print &quot;&quot;&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;hello&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;bye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// &quot;&quot;&quot;)]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;hello\nbye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCompressed3</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;print &quot;&quot;&quot;hello&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;bye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// &quot;&quot;&quot;)]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;print &quot;&quot;&quot;hello\nbye&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCompressed4</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># For a while, I supported compressed code blocks, but no longer.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// [[[cog: print &quot;&quot;&quot;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;hello&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;bye&quot;&quot;&quot;)&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;// ]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;hello\nbye&quot;&quot;&quot;)&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoCommonPrefixForMarkers</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># It&#39;s important to be able to use #if 0 to hide lines from a</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># C++ compiler.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;#if 0 //[[[cog&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;\timport cog, sys&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>l</span><span class='op'>(</span><span class='str'>&#39;\tprint sys.argv&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>m</span><span class='op'>(</span><span class='str'>&#39;#endif //]]]&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>gen</span><span class='op'>.</span><span class='nam'>getCode</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;import cog, sys\n\nprint sys.argv&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestCaseWithTempDir</span><span class='op'>(</span><span class='nam'>TestCase</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>newCog</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Initialize the cog members for another run.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Create a cog engine, and catch its output.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span> <span class='op'>=</span> <span class='nam'>Cog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stdout</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>,</span> <span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Create a temporary directory.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>=</span> <span class='nam'>path</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>(</span><span class='nam'>tempfile</span><span class='op'>.</span><span class='nam'>gettempdir</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>/</span> <span class='op'>(</span><span class='str'>&#39;testcog_tempdir_&#39;</span> <span class='op'>+</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>random</span><span class='op'>.</span><span class='nam'>random</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='op'>[</span><span class='num'>2</span><span class='op'>:</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>.</span><span class='nam'>mkdir</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>olddir</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>getcwd</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>chdir</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>olddir</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Get rid of the temporary directory.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span><span class='op'>.</span><span class='nam'>rmtree</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFName1</span><span class='op'>,</span> <span class='nam'>sFName2</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName1</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>text</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName2</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>text</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>assertFileContent</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>sFName</span><span class='op'>,</span> <span class='nam'>sContent</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sAbsName</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='nam'>sFName</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>sAbsName</span><span class='op'>,</span> <span class='str'>&#39;rb&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sFileContent</span> <span class='op'>=</span> <span class='nam'>f</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>f</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>sFileContent</span><span class='op'>,</span> <span class='nam'>sContent</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>ArgumentHandlingTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testArgumentFailure</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Return value 2 means usage problem.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-j&#39;</span><span class='op'>]</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>2</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;option -j not recognized&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-j&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNoDashOAndAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;foo&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDashV</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-v&#39;</span><span class='op'>]</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='str'>&#39;Cog version %s\n&#39;</span> <span class='op'>%</span> <span class='nam'>__version__</span><span class='op'>,</span> <span class='nam'>output</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>producesHelp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>,</span> <span class='nam'>args</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>argv</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>]</span> <span class='op'>+</span> <span class='nam'>args</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEquals</span><span class='op'>(</span><span class='nam'>usage</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDashH</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># -h or -? anywhere on the command line should just print help.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>&quot;-h&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>&quot;-?&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>&quot;fooey.txt -h&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>producesHelp</span><span class='op'>(</span><span class='str'>&quot;-o -r @fooey.txt -? @booey.txt&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDashOAndDashR</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfile.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;foo&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;cogfile.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDashZ</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>&quot;test.cog(6): Missing &#39;[[[end]]]&#39; before end of file.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-z&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testBadDashD</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-D&#39;</span><span class='op'>,</span> <span class='str'>&#39;fooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestFileHandling</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSimple</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;(changed)&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testOutputFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># -o sets the output file.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye cruel world</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;one.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;one.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;two.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;two.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;(changed)&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNestedAtFile</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;goodbye cruel world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goodbye cruel world</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @cogfiles2.txt</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles2.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # This one too, please.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;one.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;one.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;two.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;two.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;(changed)&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testAtFileWithArgs</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;both.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one: True // ONE</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two: False // ONE</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one: False // TWO</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two: True // TWO</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -o both.one -s &#39; // ONE&#39; -D one=x</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -o both.two -s &#39; // TWO&#39; -D two=x</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;both.one&#39;</span><span class='op'>,</span> <span class='str'>&#39;one.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;both.two&#39;</span><span class='op'>,</span> <span class='str'>&#39;two.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testAtFileWithBadArgCombo</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;both.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;one: %s&quot; % globals().has_key(&#39;one&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;two: %s&quot; % globals().has_key(&#39;two&#39;))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; both.cog -d # This is bad: -r and -d</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testAtFileWithTrickyFilenames</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one 1.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;hello world&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;hello world&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world //xxx</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subdir&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subback.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with backslashes&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subfwd.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with slashes&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subback.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with backslashes&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; down deep with backslashes //yyy</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subfwd.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;down deep with slashes&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; down deep with slashes //zzz</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;one 1.cog&#39; -s &#39; //xxx&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subdir\subback.cog -s &#39; //yyy&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; subdir/subfwd.cog -s &#39; //zzz&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-z&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;one 1.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;one.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;subdir/subback.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;subback.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;subdir/subfwd.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;subfwd.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogTestLineEndings</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Tests for -U option (force LF line-endings in output).&quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>lines_in</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;Some text.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;//[[[cog&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog.outl(&quot;Cog text&quot;)&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;//]]]&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;gobbledegook.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;//[[[end]]]&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;epilogue.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;&#39;</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>lines_out</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;Some text.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;//[[[cog&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;cog.outl(&quot;Cog text&quot;)&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;//]]]&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;Cog text&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;//[[[end]]]&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;epilogue.&#39;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span class='str'>&#39;&#39;</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testOutputNativeEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>&#39;infile&#39;</span><span class='op'>:</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;outfile&#39;</span><span class='op'>,</span> <span class='str'>&#39;infile&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>&#39;outfile&#39;</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testOutputLfEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>&#39;infile&#39;</span><span class='op'>:</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-U&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;outfile&#39;</span><span class='op'>,</span> <span class='str'>&#39;infile&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>&#39;outfile&#39;</span><span class='op'>,</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReplaceNativeEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>linesep</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReplaceLfEol</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='op'>{</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_in</span><span class='op'>)</span><span class='op'>}</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-U&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFileContent</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>lines_out</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>TestCaseWithImports</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; When running tests which import modules, the sys.modules list</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; leaks from one test to the next.&nbsp; This test case class scrubs</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; the list after each run to keep the tests isolated from each other.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sysmodulekeys</span> <span class='op'>=</span> <span class='nam'>list</span><span class='op'>(</span><span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>modstoscrub</span> <span class='op'>=</span> <span class='op'>[</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>modname</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>modname</span> <span class='key'>in</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>modname</span> <span class='key'>not</span> <span class='key'>in</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>sysmodulekeys</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>modname</span> <span class='key'>in</span> <span class='nam'>modstoscrub</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>del</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>modules</span><span class='op'>[</span><span class='nam'>modname</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogIncludeTests</span><span class='op'>(</span><span class='nam'>TestCaseWithImports</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>dincludes</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mymodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test2.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mymodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mymodule in inc2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;include&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;mymodule.py&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mymodule&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;inc2&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;mymodule.py&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mymodule in inc2&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;inc3&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;someothermodule.py&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is some other module.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testNeedIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Try it without the -I, to see that an ImportError happens.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>ImportError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that -I adds include directories properly.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;include&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTwoIncludePaths</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that two -I&#39;s add include directories properly.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;include&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;inc2&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTwoIncludePaths2</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that two -I&#39;s add include directories properly.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;inc2&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;include&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test2.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testUselessIncludePath</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that the search will continue past the first directory.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>dincludes</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;inc3&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;include&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSysPathIsUnchanged</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;bad.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.error(&quot;Oh no!&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;good.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(&quot;Oh yes!&quot;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged just by creating a cog engine?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>oldsyspath</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>[</span><span class='op'>:</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a successful run?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;good.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a successful run with includes?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;xyzzy&#39;</span><span class='op'>,</span> <span class='str'>&#39;good.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a successful run with two includes?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;xyzzy&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;quux&#39;</span><span class='op'>,</span> <span class='str'>&#39;good.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a failed run?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;bad.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a failed run with includes?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;xyzzy&#39;</span><span class='op'>,</span> <span class='str'>&#39;bad.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Is it unchanged for a failed run with two includes?</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;xyzzy&#39;</span><span class='op'>,</span> <span class='str'>&#39;-I&#39;</span><span class='op'>,</span> <span class='str'>&#39;quux&#39;</span><span class='op'>,</span> <span class='str'>&#39;bad.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>oldsyspath</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSubDirectories</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that relative paths on the command line work, with includes.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;code&#39;</span><span class='op'>:</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mysubmodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import mysubmodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hello from mysubmodule</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;mysubmodule.py&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; import cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;Hello from mysubmodule&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># We should be able to invoke cog without the -I switch, and it will</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># auto-include the current directory</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;code/test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;code/test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;code/test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>CogTestsInFiles</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testWarnIfNoCogCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that the -e switch warns if there is no Cog code.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;with.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;hello world&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hello world</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;without.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; There&#39;s no cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; code in this file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-e&#39;</span><span class='op'>,</span> <span class='str'>&#39;with.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;Warning&quot;</span><span class='op'>)</span> <span class='op'>&lt;</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-e&#39;</span><span class='op'>,</span> <span class='str'>&#39;without.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;Warning: no cog code found in without.cog&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;without.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;Warning&quot;</span><span class='op'>)</span> <span class='op'>&lt;</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testFileNameProps</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this is cog1.txt in, cog1.txt out</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is cog1.txt in, cog1.txt out</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1out.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This is %s in, %s out&quot; % (cog.inFile, cog.outFile))</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This is cog1.txt in, cog1out.txt out</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1out.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1out.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1out.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testGlobalsDontCrossFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Make sure that global values don&#39;t get shared between files.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog s = &quot;This was set in one.cog&quot; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(s) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;one.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog s = &quot;This was set in one.cog&quot; ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog cog.outl(s) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This was set in one.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(s)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except NameError:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;s isn&#39;t set!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;two.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(s)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except NameError:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;s isn&#39;t set!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s isn&#39;t set!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cogfiles.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Please run cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; one.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; two.cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;@cogfiles.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;one.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;one.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;two.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;two.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;(changed)&quot;</span><span class='op'>)</span> <span class='op'>&gt;=</span> <span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testRemoveGeneratedOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out2&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Remove generated output.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-x&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Regenerate the generated output.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out2&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>newCog</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Remove the generated output again.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-x&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testMsgCall</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.msg(&quot;Hello there!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>infile</span> <span class='op'>=</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>processString</span><span class='op'>(</span><span class='nam'>infile</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>infile</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>&quot;Message: Hello there!\n&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testErrorMessageHasNoTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that a Cog error is printed to stderr with no traceback.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Xhis line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>stderr</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog1.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&quot;Cogging cog1.txt\n&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&quot;cog1.txt(9): Output has been edited! Delete old checksum to unprotect.\n&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDashD</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Defined fooey as kablooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.einstein&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&quot;Defined fooey as &quot; + fooey) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Defined fooey as e=mc2</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-D&#39;</span><span class='op'>,</span> <span class='str'>&#39;fooey=kablooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=kablooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=e=mc2&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.einstein&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dbar=quux&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=kablooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=kablooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dbar=quux&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=gooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;-Dfooey=kablooey&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.kablooey&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testOutputToStdout</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[cog cog.outl(&#39;Hey there!&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>stderr</span> <span class='op'>=</span> <span class='nam'>StringIO</span><span class='op'>.</span><span class='nam'>StringIO</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>setOutput</span><span class='op'>(</span><span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>stderr</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>outerr</span> <span class='op'>=</span> <span class='nam'>stderr</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>&quot;--[[[cog cog.outl(&#39;Hey there!&#39;) ]]]\nHey there!\n--[[[end]]]\n&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>outerr</span><span class='op'>,</span> <span class='str'>&quot;&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSuffixOutputLines</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hey there.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\n&nbsp;&nbsp; \\nc&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Good bye.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Hey there.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\n&nbsp;&nbsp; \\nc&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a (foo)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b (foo)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c (foo)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Good bye.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-s&#39;</span><span class='op'>,</span> <span class='str'>&#39; (foo)&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testEmptySuffix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\nc&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\nb\\nc&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-s&#39;</span><span class='op'>,</span> <span class='str'>&#39;&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testHellishSuffix</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\n\\nb&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;[[[cog cog.outl(&#39;a\\n\\nb&#39;) ]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a /\\n*+([)]&gt;&lt;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b /\\n*+([)]&gt;&lt;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-z&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-s&#39;</span><span class='op'>,</span> <span class='str'>r&#39; /\n*+([)]&gt;&lt;&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>WritabilityTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>name</span> <span class='op'>==</span> <span class='str'>&#39;nt&#39;</span><span class='op'>:</span>&nbsp; &nbsp;&nbsp; <span class='com'># pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># for Windows</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cmd_w_args</span> <span class='op'>=</span> <span class='str'>&#39;attrib -R %s&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cmd_w_asterisk</span> <span class='op'>=</span> <span class='str'>&#39;attrib -R *&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span>&nbsp;&nbsp; <span class='com'># pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># for unix-like</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cmd_w_args</span> <span class='op'>=</span> <span class='str'>&#39;chmod +w %s&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>cmd_w_asterisk</span> <span class='op'>=</span> <span class='str'>&#39;chmod +w *&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>setUp</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>tempdir</span> <span class='op'>/</span> <span class='str'>&#39;test.cog&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>.</span><span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>stat</span><span class='op'>.</span><span class='nam'>S_IREAD</span><span class='op'>)</span>&nbsp;&nbsp; <span class='com'># Make the file readonly.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>.</span><span class='nam'>chmod</span><span class='op'>(</span><span class='nam'>stat</span><span class='op'>.</span><span class='nam'>S_IWRITE</span><span class='op'>)</span>&nbsp;&nbsp; <span class='com'># Make the file writable again.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>TestCaseWithTempDir</span><span class='op'>.</span><span class='nam'>tearDown</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReadonlyNoCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>&quot;Can&#39;t overwrite test.cog&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReadonlyWithCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-w&#39;</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cmd_w_args</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReadonlyWithCommandWithNoSlot</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-w&#39;</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cmd_w_asterisk</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testReadonlyWithIneffectualCommand</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>CogError</span><span class='op'>,</span> <span class='str'>&quot;Couldn&#39;t make test.cog writable&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-w&#39;</span><span class='op'>,</span> <span class='str'>&#39;echo %s&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>assert</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>.</span><span class='nam'>testcog</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>ChecksumTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCreateChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was generated.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was not.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testCheckChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testRemoveChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was generated.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: 8adb13fb59b996a1c7f0065ea9f3d893) fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] fooey</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;cog1.txt&#39;</span><span class='op'>,</span> <span class='str'>&#39;cog1.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testTamperedChecksumOutput</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog1.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Xhis line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog2.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah!</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog3.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog4.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah..</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog5.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; This line was newly</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generated by cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; blah blah.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; extra</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;cog6.txt&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;This line was newly&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;generated by cog&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;blah blah.&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]] (checksum: a8540982e5ad6b95c9e9a184b26f4346)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog1.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog1.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog2.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog2.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog3.txt(10): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog3.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog4.txt(9): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog4.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog5.txt(10): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog5.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaisesMsg</span><span class='op'>(</span><span class='nam'>CogError</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&quot;cog6.txt(6): Output has been edited! Delete old checksum to unprotect.&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&quot;cog6.txt&quot;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>BlakeTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># Blake Winton&#39;s contributions.&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDeleteCode</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># -o sets the output file.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fnames = [&#39;DoSomething&#39;, &#39;DoAnotherThing&#39;, &#39;DoLastThing&#39;]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some Sample Code Here</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]Data Data</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; And Some More</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoSomething();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoAnotherThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoLastThing();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; And Some More</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-d&#39;</span><span class='op'>,</span> <span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testDeleteCodeWithDashRFails</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertRaises</span><span class='op'>(</span><span class='nam'>CogUsageError</span><span class='op'>,</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>callableMain</span><span class='op'>,</span> <span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;-d&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testSettingGlobals</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Blake Winton contributed a way to set the globals that will be used in</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># processFile().</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for fn in fnames:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.outl(&quot;void %s();&quot; % fn)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Some Sample Code Here</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]&quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test.out&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // This is my C++ file.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoBlake();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoWinton();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void DoContribution();</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>globals</span> <span class='op'>=</span> <span class='op'>{</span><span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>globals</span><span class='op'>[</span><span class='str'>&#39;fnames&#39;</span><span class='op'>]</span> <span class='op'>=</span> <span class='op'>[</span><span class='str'>&#39;DoBlake&#39;</span><span class='op'>,</span> <span class='str'>&#39;DoWinton&#39;</span><span class='op'>,</span> <span class='str'>&#39;DoContribution&#39;</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>options</span><span class='op'>.</span><span class='nam'>bDeleteCode</span> <span class='op'>=</span> <span class='nam'>True</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>processFile</span><span class='op'>(</span><span class='str'>&#39;test.cog&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='nam'>globals</span><span class='op'>=</span><span class='nam'>globals</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertFilesSame</span><span class='op'>(</span><span class='str'>&#39;test.cogged&#39;</span><span class='op'>,</span> <span class='str'>&#39;test.out&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>class</span> <span class='nam'>ErrorCallTests</span><span class='op'>(</span><span class='nam'>TestCaseWithTempDir</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testErrorCallHasNoTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that cog.error() doesn&#39;t show a traceback.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;error.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cog.error(&quot;Something Bad!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;error.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assertEqual</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>,</span> <span class='str'>&quot;Cogging error.cog\nError: Something Bad!\n&quot;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>testRealErrorHasTraceback</span><span class='op'>(</span><span class='nam'>self</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># Test that a genuine error does show a traceback.</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>d</span> <span class='op'>=</span> <span class='op'>{</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;error.cog&#39;</span><span class='op'>:</span> <span class='str'>&quot;&quot;&quot;\</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise RuntimeError(&quot;Hey!&quot;)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[[[end]]]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;</span><span class='op'>,</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>makeFiles</span><span class='op'>(</span><span class='nam'>d</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>cog</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;argv0&#39;</span><span class='op'>,</span> <span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;error.cog&#39;</span><span class='op'>]</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>output</span> <span class='op'>=</span> <span class='nam'>self</span><span class='op'>.</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>getvalue</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>msg</span> <span class='op'>=</span> <span class='str'>&#39;Actual output:\n&#39;</span> <span class='op'>+</span> <span class='nam'>output</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assert_</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>startswith</span><span class='op'>(</span><span class='str'>&quot;Cogging error.cog\nTraceback (most recent&quot;</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>self</span><span class='op'>.</span><span class='nam'>assert_</span><span class='op'>(</span><span class='nam'>output</span><span class='op'>.</span><span class='nam'>find</span><span class='op'>(</span><span class='str'>&quot;RuntimeError: Hey!&quot;</span><span class='op'>)</span> <span class='op'>&gt;</span> <span class='num'>0</span><span class='op'>,</span> <span class='nam'>msg</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='exc'><span class='key'>if</span> <span class='nam'>__name__</span> <span class='op'>==</span> <span class='str'>&#39;__main__&#39;</span><span class='op'>:</span>&nbsp; &nbsp; &nbsp; <span class='com'>#pragma: no cover</span><span class="strut">&nbsp;</span></p>
+<p class='exc'>&nbsp; &nbsp; <span class='nam'>unittest</span><span class='op'>.</span><span class='nam'>main</span><span class='op'>(</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># Things not yet tested:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='com'># - A bad -w command (currently fails silently).</span><span class="strut">&nbsp;</span></p>
</td>
</tr>
diff --git a/doc/sample_html/cogapp_whiteutils.html b/doc/sample_html/cogapp_whiteutils.html
index e5f8435..b2aaf86 100644
--- a/doc/sample_html/cogapp_whiteutils.html
+++ b/doc/sample_html/cogapp_whiteutils.html
@@ -103,69 +103,69 @@ function toggle_lines(btn, cls) {
</td>
<td class='text' valign='top'>
-<p class='pln'>&quot;&quot;&quot; Indentation utilities for Cog.</p>
-<p class='pln'>&nbsp; &nbsp; http://nedbatchelder.com/code/cog</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; Copyright 2004-2009, Ned Batchelder.</p>
-<p class='pln'>&quot;&quot;&quot;</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>import re</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>def whitePrefix(strings):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Determine the whitespace prefix common to all non-blank lines</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; in the argument list.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='pln'>&nbsp; &nbsp; # Remove all blank lines from the list</p>
-<p class='stm run hide'>&nbsp; &nbsp; strings = [s for s in strings if s.strip() != &#39;&#39;]</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>&nbsp; &nbsp; if not strings: return &#39;&#39;</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; # Find initial whitespace chunk in the first line.</p>
-<p class='pln'>&nbsp; &nbsp; # This is the best prefix we can hope for.</p>
-<p class='stm run hide'>&nbsp; &nbsp; prefix = re.match(r&#39;\s*&#39;, strings[0]).group(0)</p>
-<p class='pln'>&nbsp;</p>
-<p class='pln'>&nbsp; &nbsp; # Loop over the other strings, keeping only as much of</p>
-<p class='pln'>&nbsp; &nbsp; # the prefix as matches each string.</p>
-<p class='stm run hide'>&nbsp; &nbsp; for s in strings:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; for i in range(len(prefix)):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if prefix[i] != s[i]:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prefix = prefix[:i]</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break</p>
-<p class='stm run hide'>&nbsp; &nbsp; return prefix</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>def reindentBlock(lines, newIndent=&#39;&#39;):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Take a block of text as a string or list of lines.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; Remove any common whitespace indentation.</p>
-<p class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; Re-indent using newIndent, and return it as a single string.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; if isinstance(lines, basestring):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; lines = lines.split(&#39;\n&#39;)</p>
-<p class='stm run hide'>&nbsp; &nbsp; oldIndent = whitePrefix(lines)</p>
-<p class='stm run hide'>&nbsp; &nbsp; outLines = []</p>
-<p class='stm run hide'>&nbsp; &nbsp; for l in lines:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if oldIndent:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = l.replace(oldIndent, &#39;&#39;, 1)</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if l and newIndent:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; l = newIndent + l</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; outLines.append(l)</p>
-<p class='stm run hide'>&nbsp; &nbsp; return &#39;\n&#39;.join(outLines)</p>
-<p class='pln'>&nbsp;</p>
-<p class='stm run hide'>def commonPrefix(strings):</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot; Find the longest string that is a prefix of all the strings.</p>
-<p class='pln'>&nbsp; &nbsp; &quot;&quot;&quot;</p>
-<p class='stm run hide'>&nbsp; &nbsp; if not strings:</p>
-<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; return &#39;&#39;</p>
-<p class='stm run hide'>&nbsp; &nbsp; prefix = strings[0]</p>
-<p class='stm run hide'>&nbsp; &nbsp; for s in strings:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if len(s) &lt; len(prefix):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prefix = prefix[:len(s)]</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; if not prefix:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return &#39;&#39;</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; for i in range(len(prefix)):</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if prefix[i] != s[i]:</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prefix = prefix[:i]</p>
-<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break</p>
-<p class='stm run hide'>&nbsp; &nbsp; return prefix</p>
+<p class='pln'><span class='str'>&quot;&quot;&quot; Indentation utilities for Cog.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; http://nedbatchelder.com/code/cog</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; </span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; Copyright 2004-2009, Ned Batchelder.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>import</span> <span class='nam'>re</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>def</span> <span class='nam'>whitePrefix</span><span class='op'>(</span><span class='nam'>strings</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Determine the whitespace prefix common to all non-blank lines</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; in the argument list.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># Remove all blank lines from the list</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>strings</span> <span class='op'>=</span> <span class='op'>[</span><span class='nam'>s</span> <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span> <span class='key'>if</span> <span class='nam'>s</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='op'>!=</span> <span class='str'>&#39;&#39;</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>strings</span><span class='op'>:</span> <span class='key'>return</span> <span class='str'>&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># Find initial whitespace chunk in the first line.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># This is the best prefix we can hope for.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>match</span><span class='op'>(</span><span class='str'>r&#39;\s*&#39;</span><span class='op'>,</span> <span class='nam'>strings</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>group</span><span class='op'>(</span><span class='num'>0</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># Loop over the other strings, keeping only as much of</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='com'># the prefix as matches each string.</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>i</span> <span class='key'>in</span> <span class='nam'>range</span><span class='op'>(</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span> <span class='op'>!=</span> <span class='nam'>s</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='op'>:</span><span class='nam'>i</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>break</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>prefix</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>def</span> <span class='nam'>reindentBlock</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>,</span> <span class='nam'>newIndent</span><span class='op'>=</span><span class='str'>&#39;&#39;</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Take a block of text as a string or list of lines.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Remove any common whitespace indentation.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; Re-indent using newIndent, and return it as a single string.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>,</span> <span class='nam'>basestring</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>lines</span> <span class='op'>=</span> <span class='nam'>lines</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='str'>&#39;\n&#39;</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>oldIndent</span> <span class='op'>=</span> <span class='nam'>whitePrefix</span><span class='op'>(</span><span class='nam'>lines</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>outLines</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>lines</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>oldIndent</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>l</span><span class='op'>.</span><span class='nam'>replace</span><span class='op'>(</span><span class='nam'>oldIndent</span><span class='op'>,</span> <span class='str'>&#39;&#39;</span><span class='op'>,</span> <span class='num'>1</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>l</span> <span class='key'>and</span> <span class='nam'>newIndent</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>l</span> <span class='op'>=</span> <span class='nam'>newIndent</span> <span class='op'>+</span> <span class='nam'>l</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>outLines</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&#39;\n&#39;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>outLines</span><span class='op'>)</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'><span class='key'>def</span> <span class='nam'>commonPrefix</span><span class='op'>(</span><span class='nam'>strings</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Find the longest string that is a prefix of all the strings.</span><span class="strut">&nbsp;</span></p>
+<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>strings</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>strings</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>s</span> <span class='key'>in</span> <span class='nam'>strings</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span> <span class='op'>&lt;</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='op'>:</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>s</span><span class='op'>)</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>prefix</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&#39;&#39;</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>i</span> <span class='key'>in</span> <span class='nam'>range</span><span class='op'>(</span><span class='nam'>len</span><span class='op'>(</span><span class='nam'>prefix</span><span class='op'>)</span><span class='op'>)</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span> <span class='op'>!=</span> <span class='nam'>s</span><span class='op'>[</span><span class='nam'>i</span><span class='op'>]</span><span class='op'>:</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>prefix</span> <span class='op'>=</span> <span class='nam'>prefix</span><span class='op'>[</span><span class='op'>:</span><span class='nam'>i</span><span class='op'>]</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>break</span><span class="strut">&nbsp;</span></p>
+<p class='stm run hide'>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>prefix</span><span class="strut">&nbsp;</span></p>
</td>
</tr>
diff --git a/doc/sample_html/index.html b/doc/sample_html/index.html
index 478229a..c44d355 100644
--- a/doc/sample_html/index.html
+++ b/doc/sample_html/index.html
@@ -9,7 +9,7 @@
<div id='header'>
<div class='content'>
<h1>Coverage report:
- <span class='pc_cov'>44%</span>
+ <span class='pc_cov'>43%</span>
</h1>
</div>
</div>
@@ -25,6 +25,14 @@
</tr>
<tr>
+ <td class='name'><a href='_ned_py_path.html'>c:\ned\py\path</a></td>
+ <td>286</td>
+ <td>114</td>
+ <td>0</td>
+ <td>40%</td>
+</tr>
+
+<tr>
<td class='name'><a href='cogapp_cogapp.html'>cogapp\cogapp</a></td>
<td>387</td>
<td>219</td>
@@ -58,10 +66,10 @@
<tr class='total'>
<td class='name'>Total</td>
-<td>1040</td>
-<td>454</td>
+<td>1326</td>
+<td>568</td>
<td>23</td>
-<td>44%</td>
+<td>43%</td>
</tr>
</table>
</div>
@@ -69,7 +77,7 @@
<div id='footer'>
<div class='content'>
<p>
- <a class='nav' href='http://nedbatchelder.com/code/coverage'>coverage v3.0.1</a>
+ <a class='nav' href='http://nedbatchelder.com/code/coverage'>coverage.py v3.1</a>
</p>
</div>
</div>
diff --git a/doc/sample_html/style.css b/doc/sample_html/style.css
index d9d324c..34ab10e 100644
--- a/doc/sample_html/style.css
+++ b/doc/sample_html/style.css
@@ -54,6 +54,11 @@ a.nav:hover {
}
#footer {
+ margin: 1em 3em;
+ }
+
+#footer .content {
+ padding: 0;
font-size: 85%;
font-family: verdana, sans-serif;
color: #666666;
@@ -65,7 +70,7 @@ a.nav:hover {
}
/* Header styles */
-.content {
+#header .content {
padding: 1em 3em;
}
@@ -124,6 +129,20 @@ td.text {
background: inherit;
}
+/* Syntax coloring */
+.text .com {
+ color: green;
+ font-style: italic;
+ line-height: 1px;
+ }
+.text .key {
+ font-weight: bold;
+ line-height: 1px;
+ }
+.text .str {
+ color: #000080;
+ }
+
/* index styles */
#index td, #index th {
text-align: right;