fparser
fparser copied to clipboard
namelist false match error
The f2003 namelist match rule r552 produces an assertion error when a variable starting with the name `namelist' is initialised ...
program test
NamelistFile = "dummy file"
end program
Just tried to make a PR to fix this, based on the issue 4 fix and the above snippet, but the error does not occur. (What I think is) the bug is still there, if string[:8].upper() != 'NAMELIST':
, but it seems it's no longer being triggered, perhaps because things are being called in a different order now.
There still seems to be a problem around this issue. Here is my test case:
program test
type(foo_type), pointer :: namelist_ptr
namelist_ptr => null()
end program test
Parsing this using fparser2 <filename>
gives
File "/net/home/h06/mhambley/Woomera/PointerAssignment/venv/lib/python3.7/site-packages/fparser/two/Fortran2003.py", line 4677, in match
assert not fst, repr((fst, parts))
AssertionError: ('_ptr => null()', [])
It looks like the "namelist" at the start of the variable name is being interpreted as a "namelist" keyword.
I still get an error for both examples on master. I'll take it on as I have a fix, but it will take a little while to tidy up the class and add the required tests.
Created branch 165_namelist_error