On Fri, 8 Jul 2005, David Mitchell wrote:

> Ok, I don't think the example I posted falls outside the bounds of simple. 
> Maybe it makes your script a little more complicated but not the syntax that 
> the end user must use. I suspect if you hold off the actual evaluation of the 
> comments until the page is output then you might find this task simpler.

I guess where I started was I wanted to loop on the rows of a table.

<table>
   <!-- (0..5).each { |i| -->
     <tr>
       <td>
          #{i} - <!-- @name[i] -->
       </td>
       <td>
          <img src="#{i}.jpg" alt="#{i}"/>
       </td>
     </tr>
   <!-- } -->
</table>


But then I'm holding all kind of state and what happens if I want to 
iterate over the columns of the table as well? (Nested loops.)


<table>
   <!-- (0..5).each { |i| -->
     <tr>
       <td>
          #{i} - <!-- @name[i] -->
       </td>
       <!-- (0..6).each do |j| -->
         <td>
            #{i*10 + j}
         </td>
       <!-- end -->
     </tr>
   <!-- } -->
</table>


I'm then operating a fairly hairy state machine in my Listener class or 
I'm no longer using the one (longish) line StreamParser.

However, if anyone gets the urge to embellish what I have done, as I say, 
that's what Wiki's are for.





John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter / tait.co.nz
New Zealand

Carter's Clarification of Murphy's Law.

"Things only ever go right so that they may go more spectacularly wrong later."

From this principle, all of life and physics may be deduced.