Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
36
Task/Strip-block-comments/Wren/strip-block-comments.wren
Normal file
36
Task/Strip-block-comments/Wren/strip-block-comments.wren
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
var stripper = Fn.new { |start, end|
|
||||
if (start == "" || end == "") {
|
||||
start = "/*"
|
||||
end = "*/"
|
||||
}
|
||||
return Fn.new { |source|
|
||||
while (true) {
|
||||
var cs = source.indexOf(start)
|
||||
if (cs == -1) break
|
||||
var ce = source[cs+2..-1].indexOf(end)
|
||||
if (ce == -1) break
|
||||
source = source[0...cs] + source[cs+ce+4..-1]
|
||||
}
|
||||
return source
|
||||
}
|
||||
}
|
||||
|
||||
var source = "/**
|
||||
* Some comments
|
||||
* longer comments here that we can parse.
|
||||
*
|
||||
* Rahoo
|
||||
*/
|
||||
function subroutine() {
|
||||
a = /* inline comment */ b + c ;
|
||||
}
|
||||
/*/ <-- tricky comments */
|
||||
|
||||
/**
|
||||
* Another comment.
|
||||
*/
|
||||
function something() {
|
||||
}"
|
||||
|
||||
var stripC = stripper.call("", "")
|
||||
System.print(stripC.call(source))
|
||||
Loading…
Add table
Add a link
Reference in a new issue