Skip to content

Improve config parser

Replaces !72 (closed).

Adds a simple recursive configuration parser which makes it easier to read both arrays and matrices. It works, but it does not always rejects wrong input properly. How we want to handle this depends on how strict we want to enforce the grammar. Following changes might be useful:

  • Require strings to be in either single or double quotation marks (currently we also support non-enclosed strings)
  • Require a comma to split an array. This is already the default now. Spaces are still valid to split ROOT and Geant4 vectors, which we want to keep.
  • Require arrays to be enclosed in [ brackets ]. Now an pair of brackets is automatically added on the outer scope when parsing an array, meaning only comma's have to be added as delimiters. If we change this it becomes impossible to read arrays as single values and vice-versa. This we probably do not want, because there are some keys which we usually specify as single values and it is nicer if we can keep that while still supporting arrays.
  • Require the number of [ and ] not enclosed in quotation marks to be balanced. Currently some quotation marks are ignored if they cannot be matched.

The ConfigReader is also updated to be a more strict and conforming to the specifications in the manual. The string split function does not take quotation marks into account anymore, this is now handled by the configuration itself (where it belongs I think...)

Documentation still needs some updates depending on choices.

Now also resolves #70 (closed). Key value pairs can now be passed in three different ways on the command line. Examples:

  • -o output_directory="test" sets a global parameter
  • -o DepositionGeant4.particle_type='e+' sets a module specific parameter
  • -o GenericPropagation:dut.charge_per_step=1 sets an instantiation specific parameter
Edited by Koen Wolters

Merge request reports