Get a handler from a script
alex at tweedly.net
Sun Mar 19 18:41:57 EST 2006
Dick Kriesel wrote:
>Here's a way:
> put removeBlockComments(the script of me)
>/* this is a comment
>as is this */function removeBlockComments pText
>put pText into tText
>put offset("/*",tText) into tOffset
>if tOffset > 0 then
> delete char tOffset to tOffset + offset("*/",tText,tOffset) + 1 of tText
> put removeBlockComments(tText) into tText
You should try that script on itself :-)
The "/*" in the first 'offset' line, and the "*/" in the second 'offset'
line are (incorrectly) recognized as a block comment, with fairly
disastrous results. I suspect that proper recognition of block comments
isn't as easy as it might seem - need to handle all forms of string
delimiter, which themselves may be inside comments.
Alex Tweedly http://www.tweedly.net
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.2.5/284 - Release Date: 17/03/2006
More information about the Use-livecode