fparser icon indicating copy to clipboard operation
fparser copied to clipboard

Structure-constructor matching is incorrect

Open arporter opened this issue 5 years ago • 2 comments

As described in #252, fparser2's matching of structure constructors seems to be somewhat broken. In particular, it has a Structure_Constructor_2 class that refers to R457.b. However I've been unable to find any such rule in the Fortran2003 standard and because it matches "keyword = value" type patterns we end up with a=1 etc. being matched as a structure constructor.

There is also an explicit test (in test_fortran2003.py) that "some_var(a=1, b)" matches as a structure constructor when in fact this is forbidden by C486 (R458):

The keyword= may be omitted from a component-spec only if the keyword= has been
omitted from each preceding component-spec in the constructor.

arporter avatar Apr 08 '20 08:04 arporter

If I remove Structure_Constructor_2 from the subclass_names of Structure_Constructor (which seems like the right thing to do) then we get three test failures. This requires investigation.

arporter avatar Apr 08 '20 08:04 arporter

Issue #283 and PR #285 are removing Structure_Constructor_2.

rupertford avatar Jan 09 '21 02:01 rupertford