Posted to tcl by sebres at Thu Oct 17 21:57:46 GMT 2019view raw

  1. proc ldeclare l {
  2. uplevel "list [string map [list \n "\\\n"] \
  3. [regsub -all -line {^\s*\#[^\n]*} $l {}]
  4. ]"
  5. }
  6.  
  7. % set a 5; set b "test test"
  8. % ldeclare {
  9. a $a
  10. b $b
  11. c [list $a $b]
  12. # comment:
  13. d [list $a {*}$b]
  14. }]
  15.  
  16. a 5 b {test test} c {5 {test test}} d {5 test test}
  17.