unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "lucatrv" <lucatrv@hotmail.com>
To: "Francesco Potorti`" <pot@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Add fortran 90 modules indexing to etags
Date: Tue, 5 Jun 2007 10:15:39 +0200	[thread overview]
Message-ID: <BAY103-DAV6E4FAF36511EA2C47EFADA4200@phx.gbl> (raw)
In-Reply-To: E1HvJuo-0007DH-Bo@tucano.isti.cnr.it

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
>

  reply	other threads:[~2007-06-05  8:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2007-06-05  8:35     ` lucatrv
2007-06-05 12:13       ` lucatrv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY103-DAV6E4FAF36511EA2C47EFADA4200@phx.gbl \
    --to=lucatrv@hotmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=pot@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).