unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Add fortran 90 modules indexing to etags
@ 2007-06-04 20:55 lucatrv
  2007-06-04 21:16 ` Francesco Potorti`
  0 siblings, 1 reply; 5+ messages in thread
From: lucatrv @ 2007-06-04 20:55 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 440 bytes --]

Hi, I regularily use etags, but I found annoying that it doesn't index fortran 90 modules.
An option is to use "ctags -e", which actually has support for fortran 90 modules.
However, since I support emacs, I rather prefer using etags with the option --regex="{fortran}/[[:blank:]]*module[[:blank:]]+[_[:alnum:]]+/i"
I wonder if this regex could be added to etags, so that it could index fortran 90 modules by default.

Thank you,
Luca

[-- Attachment #1.2: Type: text/html, Size: 1036 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Add fortran 90 modules indexing to etags
  2007-06-04 20:55 Add fortran 90 modules indexing to etags lucatrv
@ 2007-06-04 21:16 ` Francesco Potorti`
  2007-06-05  8:15   ` lucatrv
  0 siblings, 1 reply; 5+ messages in thread
From: Francesco Potorti` @ 2007-06-04 21:16 UTC (permalink / raw)
  To: lucatrv; +Cc: emacs-devel

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. 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Add fortran 90 modules indexing to etags
  2007-06-04 21:16 ` Francesco Potorti`
@ 2007-06-05  8:15   ` lucatrv
  2007-06-05  8:35     ` lucatrv
  0 siblings, 1 reply; 5+ messages in thread
From: lucatrv @ 2007-06-05  8:15 UTC (permalink / raw)
  To: Francesco Potorti`; +Cc: emacs-devel

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`" <pot@gnu.org>
To: "lucatrv" <lucatrv@hotmail.com>
Cc: <emacs-devel@gnu.org>
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
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Add fortran 90 modules indexing to etags
  2007-06-05  8:15   ` lucatrv
@ 2007-06-05  8:35     ` lucatrv
  2007-06-05 12:13       ` lucatrv
  0 siblings, 1 reply; 5+ messages in thread
From: lucatrv @ 2007-06-05  8:35 UTC (permalink / raw)
  To: Francesco Potorti`; +Cc: emacs-devel

Sorry, of course I forgot the beginning of line in the regexp, here is the 
correct one:

--regex="{fortran}/^[[:blank:]]*module[[:blank:]]+[_[:alnum:]]+[[:blank:]]*$/i"

Luca 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Add fortran 90 modules indexing to etags
  2007-06-05  8:35     ` lucatrv
@ 2007-06-05 12:13       ` lucatrv
  0 siblings, 0 replies; 5+ messages in thread
From: lucatrv @ 2007-06-05 12:13 UTC (permalink / raw)
  To: Francesco Potorti`; +Cc: emacs-devel

Sorry, I had to change it again into:

--regex="{fortran}/^[[:blank:]]*module[[:blank:]]+[_[:alnum:]]+[[:blank:]]*\\($\\|!\\)/i"

Luca 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-06-05 12:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-04 20:55 Add fortran 90 modules indexing to etags lucatrv
2007-06-04 21:16 ` Francesco Potorti`
2007-06-05  8:15   ` lucatrv
2007-06-05  8:35     ` lucatrv
2007-06-05 12:13       ` lucatrv

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).