camfort / fortran-src

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

Improve reporting, mostly around type information but also source spans #292

Closed dorchard closed 2 months ago

dorchard commented 2 months ago

This PR does two things:

  1. Improves the reporting of type information, e.g. previously we'd get things like:
_area_of_circle_1                - Function
area_of_circle_area_2           Real 4 Variable
area_of_circle_pi_4             Real 4 Parameter
area_of_circle_r_3              Real 4 Variable
main_area_6             Real 4 Variable
main_r_5                Real 4 Variable

now we get:

4:12     r              Real 4 Variable
4:15     area           Real 4 Variable
11:4     area_of_circle          - Function
12:27    pi             Real 4 Parameter
13:28    r              Real 4 Variable
14:16    area           Real 4 Variable
  1. This PR deals with the long standing issues that source span column numbers are always 1 bigger than they should be! This is now fixed in the Show instance (as fixing it deeper down causes issues with the way the lexer automata works).