-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reducing permissiveness of parser #160
Comments
I think you might be in luck. The standard might actually agree with your interpretation to some extent:
In other words, I even tested this out in a test GFortran program and it had no problem skipping over the I have to say... this really looks like a preprocessing job on your end :P but an error's an error. I will have a crack at it. |
... and we'll just say "No comment" regarding the first requirement. In my experience, compilers have always seemed to be very generous about their handling of the space between namelist groups. |
TBH I am using It would be a pain to effectively re-invent what |
I think this might be the problem: F90nml does a very poor job of detecting what is and isn't a valid namelist. There is a lot of hidden assumptions that the input is a namelist. So it may not actually be well suited to handle namelist groups embedded in other text. (There are similar open issues where people have tried to use F90nml to parse namelist-like files, and it rarely works correctly.) On top of that, But... you have fallen into an interesting corner case with that extra whitespace, so a solution is likely. As for that solution, I have taken a look. There is a small issue because the token iterator automatically skips over whitespace, which is why the |
As long as I'm special that's all I care about. |
I am using
f90nml
to pull namelists out of a model log file.A description and context are available here:
aekiss/run_summary#32
TL;DR the (MOM5) stdout contains the following text:
The parser interprets the
&
in the purely descriptive middle paragraph as the start of a namelist and parses the rest of the text like so:Details
I know this is a tough ask, and not exactly a well supported use-case, but I'd really like it if I could ask the parser to be more strict. The paragraph it had interpreted as a namelist group doesn't have a closing
\
for example.Would it be possible, or desirable, to have a
--strict
mode, or similar, that required what I would describe as "well-formed" namelists, e.g. start of a group is an&
which is the first character on a line, preceded only by whitespace? Similar for the end of a namelist group and\
.The text was updated successfully, but these errors were encountered: