Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
34
Task/Strip-block-comments/Phix/strip-block-comments.phix
Normal file
34
Task/Strip-block-comments/Phix/strip-block-comments.phix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
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 1 do
|
||||
integer startp = match(startc,text)
|
||||
if startp=0 then exit end if
|
||||
integer endp = match(endc,text,startp+length(startc))
|
||||
if endp=0 then
|
||||
puts(1,"error, aborting...")
|
||||
abort(0)
|
||||
end if
|
||||
text[startp..endp+length(endc)-1] = ""
|
||||
end while
|
||||
return text
|
||||
end function
|
||||
|
||||
puts(1,strip_comments(test))
|
||||
Loading…
Add table
Add a link
Reference in a new issue