This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
better handling of whitespace in autodoc declarations; fragment from:
authorDave Mitchell <davem@fdisolutions.com>
Wed, 25 Sep 2002 23:40:23 +0000 (00:40 +0100)
committerhv <hv@crypt.org>
Wed, 2 Oct 2002 11:23:38 +0000 (11:23 +0000)
Subject: [PATCH pad.c,h] move all pad-related code to its own src file
Message-ID: <20020925234023.A20044@fdgroup.com>

p4raw-id: //depot/perl@17952

autodoc.pl

index 33c2223..c898c85 100644 (file)
@@ -36,7 +36,7 @@ sub walk_table (&@) {
     while (<IN>) {
        chomp;
        next if /^:/;
-       while (s|\\$||) {
+       while (s|\\\s*$||) {
            $_ .= <IN>;
            chomp;
        }
@@ -69,7 +69,7 @@ FUNC:
             next FUNC;
         }
        $line++;
-       if ($in =~ /^=for\s+apidoc\s+(.*)\n/) {
+       if ($in =~ /^=for\s+apidoc\s+(.*?)\s*\n/) {
            my $proto = $1;
            $proto = "||$proto" unless $proto =~ /\|/;
            my($flags, $ret, $name, @args) = split /\|/, $proto;
@@ -155,16 +155,20 @@ walk_table {      # load documented functions into approriate hash
        return "" unless $flags =~ /d/;
        $func =~ s/\t//g; $flags =~ s/p//; # clean up fields from embed.pl
        $retval =~ s/\t//;
-       if ($flags =~ /A/) {
-           my $docref = delete $docfuncs{$func};
+       my $docref = delete $docfuncs{$func};
+       if ($docref and @$docref) {
+           if ($flags =~ /A/) {
+               $docref->[0].="x" if $flags =~ /M/;
+               $apidocs{$docref->[4]}{$func} = 
+                   [$docref->[0] . 'A', $docref->[1], $retval,
+                                               $docref->[3], @args];
+           } else {
+               $gutsdocs{$docref->[4]}{$func} = 
+                   [$docref->[0], $docref->[1], $retval, $docref->[3], @args];
+           }
+       }
+       else {
            warn "no docs for $func\n" unless $docref and @$docref;
-            $docref->[0].="x" if $flags =~ /M/;
-           $apidocs{$docref->[4]}{$func} = 
-                [$docref->[0] . 'A', $docref->[1], $retval, $docref->[3], @args];
-       } else {
-           my $docref = delete $docfuncs{$func};
-           $gutsdocs{$docref->[4]}{$func} = 
-                [$docref->[0], $docref->[1], $retval, $docref->[3], @args];
        }
     }
     return "";