You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying out f90nml on a project, and like the patch functionality a lot.
I encountered what looks like a bug though. If I patch an array that assigns one index per line, it corrupts the output. I made a test case to illustrate.
On the third line, the name of the array was replaced with the value, and the value was left unpatched. After that, nothing else in the array got patched, but it recovered afterward for y.
The text was updated successfully, but these errors were encountered:
There are a lot of known problems with the patch feature, some nearly unsolvable without a rewrite (see #77, #80 for some examples). The underlying problem is that patch does a simple token substitution while scanning/parsing the input file, and often lacks sufficient context to do even simple manipulations. Arrays are a perfect example of this.
This one feels slightly plausible, since it does not require backtracking and we could perhaps track both name and index, rather than just name, while checking substitution. But patch is such an odd function that problems could easily pop up.
As with the other issues, the correct solution is to introduce a whitespace-preserving tokenizer, which has been on the TODO list for several years. Unfortunately, I just find it hard to prioritize such projects these days.
I've been trying out f90nml on a project, and like the patch functionality a lot.
I encountered what looks like a bug though. If I patch an array that assigns one index per line, it corrupts the output. I made a test case to illustrate.
In
template.nml
:In a Python script:
When I ran the script, I expected to get the following in
output.nml
:Instead, I got this:
On the third line, the name of the array was replaced with the value, and the value was left unpatched. After that, nothing else in the array got patched, but it recovered afterward for
y
.The text was updated successfully, but these errors were encountered: