(phixonline)-->
with javascript_semantics
constant test = """
/**
* Some comments
* longer comments here that we can parse.
*
* Rahoo
*/
function subroutine() {
a = /* inline comment */ b + c ;
}
/*/ <-- tricky comments */
/**
* Another comment.
*/
function something() {
}
"""
function strip_comments(string text, startc="/*", endc="*/")
while true do
integer startp = match(startc,text), endp
if startp=0 then exit end if
endp = match(endc,text,startp+length(startc))
assert(endp!=0,"error")
text[startp..endp+length(endc)-1] = ""
end while
return text
end function
puts(1,strip_comments(test))