Browse Source

Merge branch 'jn/perl-funcname'

* jn/perl-funcname:
  userdiff/perl: catch BEGIN/END/... and POD as headers
  diff: funcname and word patterns for perl
maint
Junio C Hamano 14 years ago
parent
commit
17e1c9e2fd
  1. 2
      Documentation/gitattributes.txt
  2. 2
      t/t4018-diff-funcname.sh
  3. 17
      userdiff.c

2
Documentation/gitattributes.txt

@ -504,6 +504,8 @@ patterns are available: @@ -504,6 +504,8 @@ patterns are available:

- `pascal` suitable for source code in the Pascal/Delphi language.

- `perl` suitable for source code in the Perl language.

- `php` suitable for source code in the PHP language.

- `python` suitable for source code in the Python language.

2
t/t4018-diff-funcname.sh

@ -32,7 +32,7 @@ EOF @@ -32,7 +32,7 @@ EOF

sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java

builtin_patterns="bibtex cpp csharp fortran html java objc pascal php python ruby tex"
builtin_patterns="bibtex cpp csharp fortran html java objc pascal perl php python ruby tex"
for p in $builtin_patterns
do
test_expect_success "builtin $p pattern compiles" '

17
userdiff.c

@ -61,6 +61,23 @@ PATTERNS("pascal", @@ -61,6 +61,23 @@ PATTERNS("pascal",
"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+"
"|<>|<=|>=|:=|\\.\\."
"|[^[:space:]]|[\x80-\xff]+"),
PATTERNS("perl",
"^[ \t]*package .*;\n"
"^[ \t]*sub .* \\{\n"
"^[A-Z]+ \\{\n" /* BEGIN, END, ... */
"^=head[0-9] ", /* POD */
/* -- */
"[[:alpha:]_'][[:alnum:]_']*"
"|0[xb]?[0-9a-fA-F_]*"
/* taking care not to interpret 3..5 as (3.)(.5) */
"|[0-9a-fA-F_]+(\\.[0-9a-fA-F_]+)?([eE][-+]?[0-9_]+)?"
"|=>|-[rwxoRWXOezsfdlpSugkbctTBMAC>]|~~|::"
"|&&=|\\|\\|=|//=|\\*\\*="
"|&&|\\|\\||//|\\+\\+|--|\\*\\*|\\.\\.\\.?"
"|[-+*/%.^&<>=!|]="
"|=~|!~"
"|<<|<>|<=>|>>"
"|[^[:space:]]"),
PATTERNS("php",
"^[\t ]*(((public|protected|private|static)[\t ]+)*function.*)$\n"
"^[\t ]*(class.*)$",

Loading…
Cancel
Save