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
64 stars 29 forks source link

Some `Fortran2003.Intrinsic_Function_Reference` in declarations are parsed as `Fortran2003.Function_Reference`. #447

Open JulienRemy opened 5 months ago

JulienRemy commented 5 months ago

Using e.g. (see src/psyclone/tests/psyir/frontend/fparser2_test.py in PSyclone)

reader = FortranStringReader("integer, pointer :: l1 => null()")
node = Specification_Part(reader).content[0]

yields node == Type_Declaration_Stmt(Intrinsic_Type_Spec('INTEGER', None), Attr_Spec_List(',', (Attr_Spec('POINTER'),)), Entity_Decl_List(',', (Entity_Decl(Name('l1'), None, None, Initialization('=>', Function_Reference(Name('null'), None))),))) where Function_Reference(Name('null'), None) should I think be Intrinsic_Function_Reference(Name('null'), None) instead.

For now this requires redirecting these explicitly from Fparser2Reader()._call_handler to Fparser2Reader()._intrinsic_handler in branch PSyclone 2586_fparser_function_reference.