Emacs TAGS for haskell / gofer 
Author Message
 Emacs TAGS for haskell / gofer

Hello,
        I am writing some Haskell code within the emacs editor.  Does anyone
know of a program that will create a TAGS file, given some haskell files?
Alternatively, does anyone know what the format of the TAGS file is so
that I can try to generate one?
Thanks in advance,

Stephen Eglen.



Sun, 08 Jan 1995 22:12:16 GMT  
 Emacs TAGS for haskell / gofer

Quote:

>    I am writing some Haskell code within the emacs editor.  Does anyone
>know of a program that will create a TAGS file, given some haskell files?

Yes, the parser for the new Glasgow compiler will do this.  Use the -E option.
The Glasgow Haskell compiler is available from ftp.dcs.glasgow.ac.uk [130.209.240.50]
in pub/haskell/glasgow/ghc-0.08.tar.Z (remember to use binary mode for transfer).
The parser can be run independently of the compiler.  If there's sufficient
interest, we could make this available separately.  We use it to navigate our
Haskell compiler (many thousands of lines), so you should find it fairly reliable.
It handles data, type, class, instance and where declarations, as well as top-level
definitions.  It understands multiple clauses for the same function.

Since the Gofer syntax is similar to Haskell, it will probably handle
most Gofer scripts, too, but that's not something I've bothered to
try.

There's also a sed script for tagging (offhand, I've forgotten the
author, sorry) available from the Manchester archive.  It may be in our
release too, but it's not easy for me to check...

Quote:
>Alternatively, does anyone know what the format of the TAGS file is so
>that I can try to generate one?

It's fairly simple, but to do a really good job you need to write a
Haskell parser, anyway!

Kevin

--

                                                           ^^^



Mon, 09 Jan 1995 17:58:45 GMT  
 Emacs TAGS for haskell / gofer

Quote:

>I am writing some Haskell code within the emacs editor.  Does anyone
>know of a program that will create a TAGS file, given some haskell files?

Your wish is my command :-)
--------8<---------8<-------- CUT HERE --------8<---------8<--------
: fptags 0.01 09-Apr-1992

#Create an emacs tags file for functional programs

#Please send me a copy of any modifications you make.

#0.00 20-Sep-1991 created
#0.01 09-Apr-1992 don't count ==, <=, >= as definition

#The algorithm for spotting identifiers is crude to the point of
#vulgarity.  Any line containing an = is assumed to define an
#identifier.  If there are no non-white characters before the = then
#the definition is assumed to start on the previous line.  White
#characters are space, tab and > (for literate programs).

#The tags file is not in the format produced by ctags but rather,
#that produced by etags and used by GNU-Emacs's find-tag command.

#Does not tag constructors in sum data types.

#The tags file, TAGS, is created in the current directory.  It
#contains an entry for each argument file.  The entry begins with a
#line containing just ^L.  The next line contains the filename, a
#comma and the number of following bytes before the next ^L or EOF.
#Subsequent lines should give the location within the argument file of
#identifier definitions.  Each line contains a prefix of a line from
#the argument file, a ^?, the line number within the argument file, a
#comma and the position of the start of that line in bytes from the
#start of the argument file.

[ -z "$1" ] && echo usage: $0 files && exit 1
exec > TAGS
tf=/tmp/fp$$
for f
do      echo " "
        sed 's/==//g
        s/>=/=/g
        s/<=//g' $f | awk '
        /^[>         ]*\=/{ print prevline "" NR-1 "," prevpos; }
        /[^>         ].*\=/{ print $0 "" NR "," pos; }
        { prevline = $0; prevpos = pos; pos += length($0); }
        ' | sed 's/[     )]*=.*//
        s//=/g' > $tf
        echo -n $f,; echo `wc -c < $tf`              #lose spaces
        cat $tf
done
rm -f $tf
--

Does this question have an answer?



Mon, 09 Jan 1995 23:00:06 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Is there an emacs mode for Haskell/Gofer?

2. Numericall Software in Gofer/Haskell/SML

3. Fokker's jpeg gofer code to haskell?

4. FAQ for GOFER or HASKELL

5. Help with Haskell/Gofer

6. hugs/haskell/gofer/fudgets for the nt environment

7. Information about Gofer & Haskell

8. haskell/gofer pretty-printer (latex)

9. Haskell/Gofer teaching texts - summary

10. Textbooks on Gofer/Haskell?

11. Overriding of Default Definitions in Subclasses (Haskell, Gofer)

12. Gofer/Haskell - Where?

 

 
Powered by phpBB® Forum Software