stfc / PSyclone

Domain-specific compiler and code transformation system for Finite Difference/Volume/Element Earth-system models in Fortran
BSD 3-Clause "New" or "Revised" License
103 stars 28 forks source link

Alter ModuleManager to use fparser2 FortranReader? #2597

Open arporter opened 4 months ago

arporter commented 4 months ago

In #2564 I've extended the ModuleManager to use a regex on the contents of a file in order to determine whether it contains a given module. However, that could be defeated if someone was to choose to do, e.g.:

module & ! something perverse
    my_mod

The simplest solution may be just to use fparser's FortranReader as that will handle comments, line continuations and include files. Hopefully this would add much cost on top of just reading the file as we do now.

hiker commented 3 months ago

While this is true, my feeling is that we should focus on improvements in usability first, and we can tackle this issue if we actually have source code that has the problem. Yes, not perfect, but we only have limited resources :(

We have many new users (thanks to NG-ARCH), and we already had one case where people just can't find the reason for an error and needed our help. There are some existing tickets (e.g. getting code-blocks instead of PSyIR, which is not immediately obvious), and maybe we need to add some script-design tips (use stdout and stderr appropriately? Then we need to make sure PSyclone does the same :) ). That should be a much higher priority imho.