Refactor `parse_input` func in Octopus parser, and add function to parse a string.
This MR refactors the parse_input
function in the octopus parser to be more modular. Specifically, the function is now composed of
parse_input_block
and parse_and_set_random_seed
, such that it's more readable.
The motivation behind this was to write two wrappers that allow one to parse from file, and from string. See parse_input
and parse_input_string
, respectively. The latter has uses in unit testing, allowing an input to be defined and parsed within a .f90 file.
I had considered making parse_input_string
more restrictive (i.e do not parse include lines), and this required making the existing function more composable to avoid copy-paste. However I ultimately kept all the behaviour the same. This may change in the future.
I note that there are NO new tests added, however the wrappers should be correct by inspection, and if the octopus application tests all pass, this suggests that I have not broken anything with the input parsing (assuming all features are covered by existing tests). Perhaps I should first include these changes in the standalone repo for oct-parser, and confirm the unit tests are not broken?
As I do not have alot of C experience, it would be helpful if the reviewers could pay special attention to my dereferencing of pointers, and how I've passed args.
Update
The regression tests caught a couple of bugs, so my rational w.r.t. not needing to add additional test coverage was valid.