[m-dev.] diff: fix infinite loop in mtags
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Oct 7 21:53:38 AEST 1999
Estimated hours taken: 0.5
scripts/mtags:
Fix a bug: take care to avoid infinite loops when processing
typeclass and instance declarations.
Workspace: /d-drive/home/hg/fjh/mercury
Index: scripts/mtags
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mtags,v
retrieving revision 1.18
diff -u -r1.18 mtags
--- scripts/mtags 1998/08/10 06:54:59 1.18
+++ scripts/mtags 1999/10/07 11:49:55
@@ -294,12 +294,10 @@
# skip declarations which are not definitions
next unless (
- # pred, func, typeclass and instance declarations are always
- # definitions
+ # pred, func, and typeclass declarations are always definitions
$decl eq "pred" ||
$decl eq "func" ||
$decl eq "typeclass" ||
- $decl eq "instance" ||
# if it doesn't end in a `.' (i.e if it doesn't fit on one line),
# then it's probably a definition
@@ -347,7 +345,7 @@
$body =~ s/[^;]*;[ \t]*//;
if ($body =~ /^[ \t]*$/) {
- $_ = <srcfile>;
+ $_ = <srcfile> || last;
chop;
$body = $_;
}
@@ -366,7 +364,7 @@
}
last if $_ =~ /\.[ \t]*$/ || $_ =~ /\.[ \t]*%.*$/;
- $_ = <srcfile>;
+ $_ = <srcfile> || last;
chop;
$body = $_;
}
@@ -379,7 +377,7 @@
$body =~ s/^.*\b(pred|func)[ \t]*//;
if ($body =~ /^[ \t]*$/) {
- $_ = <srcfile>;
+ $_ = <srcfile> || last;
chop;
$body = $_;
}
@@ -390,9 +388,9 @@
do output_name();
}
- last if $_ =~ /\]/;
+ last if $_ =~ /\.[ \t]*$/ || $_ =~ /\]/;
- $_ = <srcfile>;
+ $_ = <srcfile> || last;
chop;
$body = $_;
}
@@ -404,7 +402,7 @@
$body =~ s/.*\b(pred\(|func\()//;
if ($body =~ /^[ \t]*$/) {
- $_ = <srcfile>;
+ $_ = <srcfile> || last;
chop;
$body = $_;
}
@@ -415,9 +413,9 @@
do output_name();
}
- last if $_ =~ /\]/;
+ last if $_ =~ /\.[ \t]*$/ || $_ =~ /\]/;
- $_ = <srcfile>;
+ $_ = <srcfile> || last;
chop;
$body = $_;
}
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- 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