parsing comments in scripts

Mark Wieder mwieder at ahsoftware.net
Fri Dec 10 15:28:23 EST 2004


Robert-

Friday, December 10, 2004, 5:22:49 AM, you wrote:

RB> In these cases it matters whether you first check for # or -- so you
RB> should really check both cases and see which has has lower offset.

I don't think so. They're interchangeable at that level.

RB> In general, I think you need to use the offset function for each line
RB> and check for either -- or # and count whether there is an even 
RB> number of double-quotes before it (setting for example itemdelim to
RB> quote and get the item count). If count is odd, you are within 
RB> literal and should continue. If count is even, then you hit a 
RB> beginning of comment. I think this approach will work with all cases.

Yes - I was doing something complicated like that and hit on the
tokens thing as a way to simplify and speed things up. I'll probably
have to go back that way again. BTW - the item count thing won't work
because you still don't know the order, especially in cases where
there are multiple quotes and/or possible comment chars.

-- 
-Mark Wieder
 mwieder at ahsoftware.net



More information about the use-livecode mailing list