home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.emacs:2687 comp.lang.functional:944
- Path: sparky!uunet!darwin.sura.net!Sirius.dfn.de!zrz.tu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!uknet!icdoc!news!dbh
- From: dbh@doc.ic.ac.uk (Denis Howe)
- Newsgroups: comp.emacs,comp.lang.functional
- Subject: Re: Emacs TAGS for haskell / gofer
- Message-ID: <DBH.92Jul23150006@wombat.doc.ic.ac.uk>
- Date: 23 Jul 92 15:00:06 GMT
- References: <1834@miranda>
- Sender: usenet@doc.ic.ac.uk
- Distribution: eunet
- Organization: Computing Department, Imperial College, London, UK
- Lines: 57
- In-Reply-To: eglen@uk.co.gec-mrc's message of 22 Jul 92 14:12:16 GMT
- Nntp-Posting-Host: wombat.doc.ic.ac.uk
-
- In article <1834@miranda> eglen@uk.co.gec-mrc (Stephen Eglen) wrote:
-
- >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.
- #Denis Howe <dbh@doc.ic.ac.uk>
- #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
- --
- Denis Howe <dbh@doc.ic.ac.uk>
- Does this question have an answer?
-