stfc / fparser

This project maintains and develops a Fortran parser called fparser2 written purely in Python which supports Fortran 2003 and some Fortran 2008. A legacy parser fparser1 is also available but is not supported. The parsers were originally part of the f2py project by Pearu Peterson.
https://fparser.readthedocs.io
Other
63 stars 29 forks source link

Inconsistent parse tree for allocate statements #383

Open arporter opened 1 year ago

arporter commented 1 year ago
allocate(grid%data(ndof))

gives:

Allocation(Data_Ref('%', (Name('grid'), Name('data'))), Allocate_Shape_Spec_List(',', (Allocate_Shape_Spec(None, Name('ndof')),)))

while

allocate(grid%coords, mold=grid%data)

gives:

Data_Ref('%', (Name('grid'), Name('coords')))

My reading of the standard is that both of these cases should give an Allocation object whereas the second one gives a bare Data_Ref. I suspect the parse tree should be:

Allocation(Data_Ref('%', (Name('grid'), Name('data'))), )
arporter commented 1 year ago

image