Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Strip-block-comments/Tcl/strip-block-comments-1.tcl
Normal file
8
Task/Strip-block-comments/Tcl/strip-block-comments-1.tcl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
proc stripBlockComment {string {openDelimiter "/*"} {closeDelimiter "*/"}} {
|
||||
# Convert the delimiters to REs by backslashing all non-alnum characters
|
||||
set openAsRE [regsub -all {\W} $openDelimiter {\\&}]
|
||||
set closeAsRE [regsub -all {\W} $closeDelimiter {\\&}]
|
||||
|
||||
# Now remove the blocks using a dynamic non-greedy regular expression
|
||||
regsub -all "$openAsRE.*?$closeAsRE" $string ""
|
||||
}
|
||||
17
Task/Strip-block-comments/Tcl/strip-block-comments-2.tcl
Normal file
17
Task/Strip-block-comments/Tcl/strip-block-comments-2.tcl
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
puts [stripBlockComment " /**
|
||||
* Some comments
|
||||
* longer comments here that we can parse.
|
||||
*
|
||||
* Rahoo
|
||||
*/
|
||||
function subroutine() {
|
||||
a = /* inline comment */ b + c ;
|
||||
}
|
||||
/*/ <-- tricky comments */
|
||||
|
||||
/**
|
||||
* Another comment.
|
||||
*/
|
||||
function something() {
|
||||
}
|
||||
"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue