Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
33
Task/Strip-block-comments/11l/strip-block-comments.11l
Normal file
33
Task/Strip-block-comments/11l/strip-block-comments.11l
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
F strip_comments(s, b_delim = ‘/*’, e_delim = ‘*/’)
|
||||
V r = ‘’
|
||||
V i = 0
|
||||
L
|
||||
V? p = s.find(b_delim, i)
|
||||
I p == N
|
||||
L.break
|
||||
r ‘’= s[i .< p]
|
||||
V? e = s.find(e_delim, p + b_delim.len)
|
||||
assert(e != N)
|
||||
i = e + e_delim.len
|
||||
r ‘’= s[i..]
|
||||
R r
|
||||
|
||||
V text = ‘
|
||||
/**
|
||||
* Some comments
|
||||
* longer comments here that we can parse.
|
||||
*
|
||||
* Rahoo
|
||||
*/
|
||||
function subroutine() {
|
||||
a = /* inline comment */ b + c ;
|
||||
}
|
||||
/*/ <-- tricky comments */
|
||||
|
||||
/**
|
||||
* Another comment.
|
||||
*/
|
||||
function something() {
|
||||
}’
|
||||
|
||||
print(strip_comments(text))
|
||||
Loading…
Add table
Add a link
Reference in a new issue