Get a handler from a script
Alex Tweedly
alex at tweedly.net
Sun Mar 19 18:41:57 EST 2006
Dick Kriesel wrote:
>
>Here's a way:
>
>on mouseUp
> put removeBlockComments(the script of me)
>end mouseUp
>
>/* 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
>end if
>return tText
>end removeBlockComments
>
>
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
mailing list