title: parsing html comments correctly
body: <p>Is there a good reference on how to parse html comments robustly especially 
  where the html contains javascript which could break the comment</p>
  
  <p>for example:</p>
  
  <pre><code>         &lt;!--
           &lt;script type="text/javascript"&gt;
           for( var i = 10; i &gt; 0; i-- ) {
                        if( myar[i].status &gt; 3 ) {
                                     ntlp++;
                        }
           }
           &lt;/script&gt;
           --&gt;
  </code></pre>
  
  <p>the two minus's and the greater than 3 in the script could be considered
  a concatenation that is interpreted as '-->' ( if you follow the html/sgml spec
  correctly ).</p>
  
  <p>Anyway, is there a list of rules/gotchas to process all this ? 
  In C would be preferable, otherwise pseudo-code is great too.</p>
  
  <p>thanks</p>
  
  <p>Ashod</p>