Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,6 @@
|
|||
proc stripLineComments {inputString {commentChars ";#"}} {
|
||||
# Switch the RE engine into line-respecting mode instead of the default whole-string mode
|
||||
regsub -all -line "\[$commentChars\].*$" $inputString "" commentStripped
|
||||
# Now strip the whitespace
|
||||
regsub -all -line {^[ \t\r]*(.*\S)?[ \t\r]*$} $commentStripped {\1}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# Multi-line string constant
|
||||
set input "apples, pears # and bananas
|
||||
apples, pears ; and bananas"
|
||||
# Do the stripping
|
||||
puts [stripLineComments $input]
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
proc stripLineComments {inputString {commentChars ";#"}} {
|
||||
# Convert the character set into a transformation
|
||||
foreach c [split $commentChars ""] {lappend map $c "\uFFFF"}; # *very* rare character!
|
||||
# Apply transformation and then use a simpler constant RE to strip
|
||||
regsub -all -line {\uFFFF.*$} [string map $map $inputString] "" commentStripped
|
||||
# Now strip the whitespace
|
||||
regsub -all -line {^[ \t\r]*(.*\S)?[ \t\r]*$} $commentStripped {\1}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue