ENH: support "one-shot" changes to the dictionary inputMode (issue #429)

- Instead of relying on #inputMode to effect a global change it is now
  possible (and recommended) to a temporary change in the inputMode
  for the following entry.

     #default   : provide default value if entry is not already defined
     #overwrite : silently remove a previously existing entry
     #warn      : warn about duplicate entries
     #error     : error if any duplicate entries occur
     #merge     : merge sub-dictionaries when possible (the default mode)

  This is generally less cumbersome than the switching the global
  inputMode. For example to provide a set of fallback values.

      #includeIfPresent "user-files"
      ...
      #default value uniform 10;

  vs.

      #includeIfPresent "user-files"
      #inputMode protect
      ...
      value uniform 10;
      #inputMode merge    // _Assuming_ we actually had this before

  These directives can also be used to suppress the normal dictionary
  merge semantics:

     #overwrite dict { entry val; ... }
This commit is contained in:
Mark Olesen
2017-07-29 17:44:22 +02:00
parent 2fdc6b161a
commit 4e48beffd4
12 changed files with 185 additions and 25 deletions

View File

@ -12,6 +12,4 @@ maxCo 12;
maxDeltaT 1;
#inputMode merge
// ************************************************************************* //

View File

@ -12,6 +12,4 @@ maxCo 2.5;
maxDeltaT 0.3;
#inputMode merge
// ************************************************************************* //

View File

@ -12,6 +12,4 @@ maxCo 8;
maxDeltaT 1;
#inputMode merge
// ************************************************************************* //

View File

@ -12,6 +12,4 @@ maxCo 5;
maxDeltaT 1;
#inputMode merge
// ************************************************************************* //

View File

@ -12,6 +12,4 @@ maxCo 12;
maxDeltaT 1;
#inputMode merge
// ************************************************************************* //