[m-rev.] diff: fix mtags processing of instance and typeclass bodys

Peter Ross pro at missioncriticalit.com
Tue Nov 18 17:33:34 AEDT 2008


Hi,


===================================================================


Fix a bug that inside typeclass or instance declarations, mtags
was incorrectly detecting the body was detected on all lines
which ended with a full stop followed by optional whitespace.

This meant that comment lines such as
	% This is a comment.
were terminating the processing of the body, rather
than being ignored.

Note the following will still cause mtags to finish
processing the body prematurely.

  /*
   * This is a comment.
  */

scripts/mtags.in:
	When processing instance and typeclass declarations
	skip blank lines and comments.


Index: scripts/mtags.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mtags.in,v
retrieving revision 1.1
diff -u -r1.1 mtags.in
--- scripts/mtags.in	18 Dec 2007 22:35:36 -0000	1.1
+++ scripts/mtags.in	18 Nov 2008 06:27:28 -0000
@@ -523,6 +523,13 @@
                     output_name();
                 }
 
+                # Skip blank lines and comments.
+                while ($body =~ /^[ \t]*$/ || $body =~ /^[ \t]*%.*$/) {
+                    $_ = <SRCFILE> || last;
+                    chop;
+                    $body = $_;
+                }
+
                 last if $_ =~ /\.[ \t]*$/ || $_ =~ /\]/;
 
                 $_ = <SRCFILE> || last;
@@ -547,6 +554,13 @@
                     output_name();
                 }
 
+                # Skip blank lines and comments.
+                while ($body =~ /^[ \t]*$/ || $body =~ /^[ \t]*%.*$/) {
+                    $_ = <SRCFILE> || last;
+                    chop;
+                    $body = $_;
+                }
+
                 last if $_ =~ /\.[ \t]*$/ || $_ =~ /\]/;
 
                 $_ = <SRCFILE> || last;

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list