Tcl and Code Folding
Posted: 20 Aug 2011 04:49
Hello,
I just started working on a Tcl syntax file, but I'm struggling a bit with the code folding. First, here's some sample code:
Below is an image of how I'd like it to fold in TextEd (the screenshot is from another editor).
Any input would be appreciated.
Jeff
I just started working on a Tcl syntax file, but I'm struggling a bit with the code folding. First, here's some sample code:
Code: Select all
proc resolveMacros {string} {
set serial [file tail $::globals(serialDir)]
if {$serial eq ""} {set serial "Undefined"}
set part [file tail $::globals(partDir)]
if {$part eq ""} {set part "Undefined"}
set time [clock seconds]
set mapString [list]
# --- build up a string map of all possible substitutions
set macroList [dbMem eval {select macro from macro}]
set sortedList [lsortby {string length} -int -decreasing $macroList]
foreach macro $sortedList {
if {$macro eq "%part"} {
lappend mapString $macro $part
} elseif {$macro eq "%serial"} {
lappend mapString $macro $serial
} else {
set val [clock format $time -format $macro]
lappend mapString $macro $val
}
}
# --- return the substituted result
return [string map $mapString $string]
}
Any input would be appreciated.
Jeff