[m-rev.] diff: mtags type declarations with comments before constructor

Peter Wang novalazy at gmail.com
Wed Jul 22 12:09:03 AEST 2009


Branches: main

Make mtags skip comment and blank lines in type declarations before the
first constructor, e.g.

        :- type foo
            % Blah.

            --->    ctor.

scripts/mtags.in:
        As above.

diff --git a/scripts/mtags.in b/scripts/mtags.in
index 8b5575d..1fa5ecc 100755
--- a/scripts/mtags.in
+++ b/scripts/mtags.in
@@ -444,8 +444,12 @@ while ($#ARGV >= 0)
 
         if ($decl eq "type") {
             # Make sure we're at the line with the `--->'.
-            if ($body !~ /--->/) {
-                next if $_ =~ /\.[ \t]*$/ || $_ =~ /\.[ \t]*%.*$/;
+            while ($body !~ /--->/) {
+                # Skip blank lines and comments but stop if we see the end of
+                # the term.
+                unless ($body =~ /^[ \t]*$/ || $body =~ /^[ \t]*%.*$/) {
+                    last if $_ =~ /\.[ \t]*$/ || $_ =~ /\.[ \t]*%.*$/;
+                }
                 $_ = <SRCFILE>;
                 chop;
                 $body = $_;

--------------------------------------------------------------------------
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