slang.tcl: fix parsing.

also minor refactoring/clean up.