changeset 32014:e2ad5720b29e

inputParser.m: Don't alter case of parameter names in error messages. Altering case can be confusing when trying to track an error back to the input string, especially if case sensitivity is enabled in parser. * inputParser.m (parse, validate_arg): Remove calls to upper() on names before passing to error function.
author Rik <rik@octave.org>
date Fri, 14 Apr 2023 08:34:40 -0700
parents 398cba1c3971
children 652a8eb4821f
files scripts/miscellaneous/inputParser.m
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/inputParser.m	Fri Apr 14 11:31:29 2023 +0200
+++ b/scripts/miscellaneous/inputParser.m	Fri Apr 14 08:34:40 2023 -0700
@@ -455,7 +455,7 @@
           else
             this.error (sprintf (["failed validation of %s\n", ...
                                   "Validation function: %s"],
-                                 upper (opt.name), disp (opt.val)));
+                                 opt.name, disp (opt.val)));
           endif
         endif
         this.Results.(opt.name) = in;
@@ -490,8 +490,7 @@
 
         if (this.is_argname ("Parameter", name))
           if (vidx++ > pnargin)
-            this.error (sprintf ("no matching value for option '%s'",
-                                 upper (name)));
+            this.error (sprintf ("no matching value for option '%s'", name));
           endif
           this.validate_arg (this.last_name,
                              this.Parameter.(this.last_name).val,
@@ -502,8 +501,7 @@
           if (vidx++ < pnargin && this.KeepUnmatched)
             this.Unmatched.(name) = varargin{vidx};
           else
-            this.error (sprintf ("argument '%s' is not a valid parameter",
-                                 upper (name)));
+            this.error (sprintf ("argument '%s' is not a valid parameter", name));
           endif
         endif
       endwhile
@@ -577,8 +575,7 @@
         endif
       end_try_catch
       if (! ok)
-        this.error (sprintf ("failed validation of %s. %s",
-                             upper (name), err));
+        this.error (sprintf ("failed validation of %s.  %s", name, err));
       endif
       this.Results.(name) = in;