When using xref
with Fortran I noticed that indexing by etags
is highly incomplete; Almost exclusively subroutines (and maybe functions) are index, but modules, types, constants and global variables are all ignored.
This situation is even confirmed by the executable:
$ etags --help --lang=fortran
In Fortran code, functions, subroutines and block data are tags.
I am trying to fix the situation by adding regular expressions manually, e.g.
find -name "*.f90" | \
xargs -d $'\n' etags --append \
--regex='{fortran}/[[:blank:]]*module[[:blank:]]+\([[:alnum:]_]+\)/\1/i' \
--regex='{fortran}/\(?:[^(]*\|.*::.*\)\(?1:\_<.*?\_>\)[[:blank:]]*=/\1/i' \
--regex='{fortran}/[[:blank:]]*type[[:blank:]]*\(?:::\)?[[:blank:]]*\(?1:[[:alnum:]_]+\)/\1/i'
While it works, this makes me wonder if any better method is available -- maybe a specialized tools giving better etags for fortran, or at least a centralized place to store my custom regex list.