camfort / fortran-src

Fortran parsing and static analysis infrastructure
https://hackage.haskell.org/package/fortran-src
Other
48 stars 20 forks source link

Improve newline behaviour in parsers #229

Open raehik opened 2 years ago

raehik commented 2 years ago

@RaoulHC noted in #228 that the ProgramUnit and Block parsing in F77 is written in a way that requires trailing newlines, which breaks for include-d files that don't end with a newline. In full parser context, it doesn't matter as much, because the different statements need to be on newlines, and the ProgramFile parser doesn't require a terminating newline. But include parsing works at the Block or ProgramUnit level.

Raoul fixed this for F77 (the only parser supporting includes currently) via improved newline behaviour. It'd be nice to have this for the other parsers too. Should only involve adapting the work for the free-form parsers.