[m-rev.] diff: mtags: handle long `:- type' decls

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 1 01:56:58 AEDT 2001


This change fixes a bug that caused mtags to miss 1500 tags
in the Mercury compiler directory.

----------

Branches: main, release
Estimated hours taken: 1

scripts/mtags:
	Allow for the possibility of comments and blank lines in `:- type'
	declarations.

Workspace: /home/earth/fjh/ws-earth3/mercury
Index: scripts/mtags
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mtags,v
retrieving revision 1.28
diff -u -d -r1.28 mtags
--- scripts/mtags	5 Jul 2001 18:13:52 -0000	1.28
+++ scripts/mtags	31 Oct 2001 14:52:27 -0000
@@ -437,10 +437,17 @@
 		    # delete the leading `;'
 		    $body =~ s/[^;]*;[ \t]*//;
 
-		    if ($body =~ /^[ \t]*$/) {
+		    # skip blank lines and comments
+		    while ($body =~ /^[ \t]*$/ || $body =~ /^[ \t]*%.*$/) {
 			$_ = <srcfile> || last;
 			chop;
 			$body = $_;
+
+		        # delete leading whitespace
+		        $body =~ s/^[ \t]*//;
+
+		        # delete the leading `;', if any
+		        $body =~ s/[^;%]*;[ \t]*//;
 		    }
 
 		    $name = $body;
@@ -474,7 +481,7 @@
 		   }
 		}
 
-		last if $_ =~ /\.[ \t]*$/ || $_ =~ /\.[ \t]*%.*$/;
+		last if $_ =~ /^[^%]*\.[ \t]*$/ || $_ =~ /\.[ \t]*%.*$/;
 		$_ = <srcfile> || last;
 		chop;
 		$body = $_;

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  | "... it seems to me that 15 years of
The University of Melbourne         | email is plenty for one lifetime."
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- Prof. Donald E. Knuth
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list