From: Dave Mitchell Date: Wed, 25 Sep 2002 23:40:23 +0000 (+0100) Subject: better handling of whitespace in autodoc declarations; fragment from: X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=78c9d76351ef2d0f7047846bbf29e303753d3fda;p=p5sagit%2Fp5-mst-13.2.git better handling of whitespace in autodoc declarations; fragment from: 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 --- diff --git a/autodoc.pl b/autodoc.pl index 33c2223..c898c85 100644 --- a/autodoc.pl +++ b/autodoc.pl @@ -36,7 +36,7 @@ sub walk_table (&@) { while () { chomp; next if /^:/; - while (s|\\$||) { + while (s|\\\s*$||) { $_ .= ; 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 "";