Version 6 of info complete

Updated 2010-10-23 16:05:13 by dkf
info complete command

Returns 1 if command is a complete Tcl command in the sense of having no unclosed quotes, braces, brackets or array element names, If the command doesn't appear to be complete then 0 is returned. This command is typically used in line-oriented input environments to allow users to type in commands that span multiple lines; if the command isn't complete, the script can delay evaluating it until additional lines have been typed to complete the command.

RS: Could it be that info complete can be used generally to check whether a string can be parsed as a list? I used to use

 expr {![catch {llength $x}]}

for that purpose...

The answer: "no". It is possible for a string to be "info complete" but not be a list. To wit:

  % set foo "{this is a test}{more stuff}"
  {this is a test}{more stuff}
  % llength $foo
  list element in braces followed by "{more" instead of space
  % info complete $foo
  1