Author: coke
Date: Wed Jul 23 19:12:59 2008
New Revision: 29716

Modified:
   trunk/languages/tcl/runtime/options.pir

Log:
[tcl] pass another spec test in dict.test (and elsewhere, no doubt.) The
error message for an invalid subcommand is slightly different than that
for the options.



Modified: trunk/languages/tcl/runtime/options.pir
==============================================================================
--- trunk/languages/tcl/runtime/options.pir     (original)
+++ trunk/languages/tcl/runtime/options.pir     Wed Jul 23 19:12:59 2008
@@ -50,14 +50,19 @@
 
 check_partial:
   $I1 = elements partials
-  if $I1 == 0 goto no_match
-  if $I1 >1 goto ambiguous
+  if type_name == 'subcommand' goto check_subcommand
+  if $I1 == 0 goto no_match_option
+  if $I1 >1 goto ambiguous_option
+  option = partials[0]
+
+check_subcommand:
+  if $I1 != 1 goto unknown_subcommand
   option = partials[0]
 
 got_match:
   .return (option)
 
-no_match:
+no_match_option:
   error = 'bad '
   error .= type_name
   error .= ' "'
@@ -67,7 +72,7 @@
   error .= $S1
   tcl_error error
 
-ambiguous:
+ambiguous_option:
   error = 'ambiguous '
   error .= type_name
   error .= ' "'
@@ -76,6 +81,16 @@
   $S1 = optionsToString(options)
   error .= $S1
   tcl_error error
+
+unknown_subcommand:
+  error = 'unknown or ambiguous '
+  error .= type_name
+  error .= ' "'
+  error .= choice
+  error .= '": must be '
+  $S1 = optionsToString(options)
+  error .= $S1
+  tcl_error error
 .end
 
 =head1 hash options = _Tcl::select_switches(array switches, array argv, 
?endswitch:0?, ?catchbad:0?, ?name: 'switch'?)

Reply via email to