[m-dev.] diff: mtags: output tags for field names
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Dec 11 20:57:59 AEDT 2000
Estimated hours taken: 0.5
scripts/mtags:
Output tags for field names.
Workspace: /home/pgrad/fjh/ws/hg3
Index: scripts/mtags
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mtags,v
retrieving revision 1.25
diff -u -d -r1.25 mtags
--- scripts/mtags 2000/12/04 05:43:38 1.25
+++ scripts/mtags 2000/12/11 09:54:15
@@ -108,6 +108,7 @@
\`func' for function declarations
\`type' for type definitions
\`cons' for type constructors
+ \`fld' for field names
\`inst' for inst definitions
\`mode' for mode definitions
\`tc' for typeclass declarations
@@ -444,14 +445,32 @@
$kind = "cons";
do output_name();
+ # Look for field names on the same line as the
+ # constructor name
+ while ($body =~ /^[^;%]*([a-z][a-zA-Z0-9]*)[ \t]*::/) {
+ $name = $1;
+ $kind = "fld";
+ do output_name();
+ $body =~ s/^[^:]*:://;
+ }
+
# if there are more constructor definitions on the
# same line, process the next one
if ($body =~ /;/) {
$body =~ s/[^;]*;/;/;
next;
}
+ } else {
+ # Look for field names that are not on the
+ # same line as the constructor name
+ while ($body =~ /^[^%]*([a-z][a-zA-Z0-9]*)[ \t]*::/) {
+ $name = $1;
+ $kind = "fld";
+ do output_name();
+ $body =~ s/^[^:]*:://;
+ }
}
-
+
last if $_ =~ /\.[ \t]*$/ || $_ =~ /\.[ \t]*%.*$/;
$_ = <srcfile> || last;
chop;
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list