[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add fortran 90 modules indexing to etags
From: |
lucatrv |
Subject: |
Re: Add fortran 90 modules indexing to etags |
Date: |
Tue, 5 Jun 2007 10:15:39 +0200 |
A module statement in fortran 90 is quite simple:
module module-name
...
end [module [module-name]]
module-name can be alphanum and _
[] means optional.
Of course, fortran is case insensitive.
Be careful that the following statement:
module procedure procedure-name
is not a module statement, but rather a procedure declaration in a fortran
interface (which should not be tagged).
I actually realized now that the regexp I was using is not correct, since it
would tag "procedure" in this case.
Here is what I think is the most correct regexp to tag module declarations:
--regex="{fortran}/[[:blank:]]*module[[:blank:]]+[_[:alnum:]]+[[:blank:]]*$/i"
Here is a sample code:
MODULE TEST
USE TEST2 ! use a module "test2", declared somewhere else
IMPLICIT NONE
REAL :: A, B, C
INTERFACE TWICE
MODULE PROCEDURE STWICE, DTWICE
END INTERFACE TWICE
CONTAINS
REAL FUNCTION STWICE(X)
REAL, INTENT(IN) :: X
STWICE = 2.0*X
END FUNCTION STWICE
DOUBLE PRECISION DTWICE(X)
DOUBLE PRECISION, INTENT(IN) :: X
DTWICE = 2.0D0*X
END FUNCTION DTWICE
END MODULE TEST
It provides three functions. STWICE and DTWICE are specific respectively for
real od double precision arguments. TWICE is a generic interface which
actually calls the right one depending on the argument type.
Now, I think the best would be to add also interface statement support to
etags...
In this case the situation is similar, the statements which should be tagged
are like this:
interface procedure-name
...
end interface [interface-name]
interface-name can be alphanum and _
Take care that the "interface" statement can also not declare a
procedure-name, in this case it should not be tagged, since it does not
provide any new function name (it is used only to check arguments during
compilation).
So the following should not be tagged:
interface
....
end interface
Finally, the interface statement can also provide overloading to an operator
or to the assignment. for instance
interface operator(+)
...
end interface [operator(+)]
interface assignment(=)
...
end interface [assignment(=)]
In this case, I'm not sure what should be tagged... it depends on what etags
does whith similar statements in C and C++.
Let me know if you need more information.
Thank you very much,
Luca
----- Original Message -----
From: "Francesco Potorti`" <address@hidden>
To: "lucatrv" <address@hidden>
Cc: <address@hidden>
Sent: Monday, June 04, 2007 11:16 PM
Subject: Re: Add fortran 90 modules indexing to etags
I will try to implement support for Fortran 90 modules.
Please send me a sample Fortran 90 source with modules, with some
explanations of what should be tagged exactly and what are the possible
cases.
_______________________________________________
Emacs-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-devel