Re: [RFC/PATCH] diff: funcname and word patterns for perl
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Dec 26, 2010, 23:14 UTC
- Message-ID
- <201012270014.09962.jnareb@gmail.com>
- In-Reply-To
- <20101226090731.GA21588@burratino>
On Sun, 26 Dec 2010 10:07, Jonathan Nieder wrote:
Show 24 quoted lines
> The default function name discovery already works quite well for Perl
> code... with the exception of here-documents (or rather their ending).
>
> sub foo {
> print <<END
> here-document
> END
> return 1;
> }
>
> The default funcname pattern treats the unindented END line as a
> function declaration and puts it in the @@ line of diff and "grep
> --show-function" output.
>
> With a little knowledge of perl syntax, we can do better. You can
> try it out by adding "*.perl diff=perl" to the gitattributes file.
>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
> Jakub Narebski wrote:
>
> > BTW. do you know how such perl support should look like?
>
> Maybe something like this?Thanks a lot.
Besides here-doc, there are some tricky things that such code should be aware about.
1. BEGIN {
...
}and similar code blocks (END, CHECK, INIT, ...) which I think should be marked as 'BEGIN' in diff chunk.
2. sub foo {
FOO: while (1) {
...
}
} which should be marked with 'sub foo {', I think3. =head1 NAME
Git - Perl interface to the Git version control system
=cut
i.e. POD... which I don't know what to do about.
I have not checked what your code does wrt those.
-- Jakub Narebski Poland