2 # @(#)ptags 1.2 4/11/91, no copyright. Bugfixes to lm@eng.sun.com.
4 #In the hack-of-the-hour catagory, a tags file generator for perl. Differences
7 # 1) Puts a tag in for the filename
8 # 2) Puts in multiple tags for the same symbol (I have a hacked version
9 # of vi that groks this).
11 # tag file <vi expresion to find it>
12 # catch /u/lm/tmp/eintr.c /^catch() {}$/
17 open(STDOUT, ">> TAGS") || die "can't create TAGS"; # partain: NB: APPEND
20 print STDERR "$_\n" if $v;
29 open(F, $name) || return;
35 # skip the word sub in comments
36 next unless /^[^#]*\bsub\b/;
37 # skip the word sub in a string (one line only, I'm lazy)
39 # print "$name: $. $_" if $d;
40 # demand that "sub" is first on the line (partain)
41 # (the initial > is for some literate perl scripts...)
42 next if ! /^>?\s*sub\s+/;
46 # and here's the entry...
47 $entries .= "$_\x7f$lcnt,$ccnt\n";
51 # print tag for filename
52 print "\f\n$name,",length($entries),"\n";
56 ###I've always used this. Don't recall whom I got it from...
60 ###!/usr/local/bin/perl
61 #open(OUTPUT, "| sort >> TAGS");
63 # if (/\bsub\s+(\w+')?(\S+)/) {
66 # s,[\\\[\]/.*],\\$&,g;
67 # print OUTPUT "$func\t", $ARGV, "\t/^$_\$/\n";