Get a handler from a script

Wouter wouter.abraham at scarlet.be
Tue Mar 21 09:45:32 EST 2006


on Sun Mar 19 16:12:57 CST 2006 Geoff Canyon wrote:

> /* this is a comment
> as is this */on mouseUp
>    answer "yes"
> end mouseUp


Another problem with this kind of commenting is shown in the  
following cases:

/* this is a comment
as is this */-function whatever
return "something"
end whatever

/* this is a comment
as is this */--function whatever
return "something"
end whatever

Both will compile without throwing an error.
Only the second one is a valid comment

Greetings,
Wouter

PS another little update (beware of the mail line wraps):

function retrieveActiveHandlers pScript
   put true into tFlag
   repeat for each line i in pScript
     if char 1 to 2 of word 1 of i = "/*"  then
       put false into tFlag
     else if tFlag and token 1 of i is among the items of  
"on,function,setprop,getprop" then  put token 1 to -1 of  i & cr  
after tList
     else if tFlag = false then
       if (char 1 of word 1 of i is "#" or  char 1 of word 1 of i is  
"-" ) and "*/" is in i then
         put true into tFlag
         get  "/*" &i
         if tFlag and token 1 of it is among the items of  
"on,function,setprop,getprop" then
           put token 1 to -1 of  it & cr after tList
         end if
       else
         repeat for each token j in i
           if j is "*/"  then
             put true into tFlag
             get  "/*" &i
             if tFlag and token 1 of it is among the items of  
"on,function,setprop,getprop" then
               put token 1 to -1 of  it & cr after tList
               exit repeat
             end if
           end if
         end repeat
       end if
     end if --
   end repeat
   return tList
end retrieveActiveHandlers




More information about the use-livecode mailing list