On 20 Mar 2006, at 02:12, Geoff Canyon wrote:
I feel like the harbinger of doom here (with Alex as my able
partner in doomsaying) but:
This would still be subject to failure if, anywhere in the script, /
* or */ appeared _not_ as block comment delimiters, but as part of
a string.
gc
-snip-
and what about this first draft ?:
on mouseUp
put removeBlockComments(the script of me) into fld 1
end mouseUp
/* this is a comment
#as is this */function removeBlockComments pText --toggle the #
put true into tFlag
repeat for each line i in pText
if char 1 to 2 of word 1 of i = "/*" then
put false into tFlag
end if
if tFlag and token 1 of i is among the items of
"on,function,setprop,getprop" then put i & cr after tList
else if tFlag = false then
if 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
next repeat
end if
end if
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 repeat
return tList
end removeBlockComments
greetings,
Wouter
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution