Git fork

Merge branch 've/userdiff-bash'

The userdiff pattern learned to identify the function definition in
POSIX shells and bash.

* ve/userdiff-bash:
userdiff: support Bash

+91
+3
Documentation/gitattributes.txt
··· 802 802 803 803 - `ada` suitable for source code in the Ada language. 804 804 805 + - `bash` suitable for source code in the Bourne-Again SHell language. 806 + Covers a superset of POSIX shell function definitions. 807 + 805 808 - `bibtex` suitable for files with BibTeX coded references. 806 809 807 810 - `cpp` suitable for source code in the C and C++ languages.
+1
t/t4018-diff-funcname.sh
··· 27 27 28 28 diffpatterns=" 29 29 ada 30 + bash 30 31 bibtex 31 32 cpp 32 33 csharp
+4
t/t4018/bash-arithmetic-function
··· 1 + RIGHT() (( 2 + 3 + ChangeMe = "$x" + "$y" 4 + ))
+6
t/t4018/bash-bashism-style-compact
··· 1 + function RIGHT { 2 + function InvalidSyntax{ 3 + : 4 + echo 'ChangeMe' 5 + } 6 + }
+4
t/t4018/bash-bashism-style-function
··· 1 + function RIGHT { 2 + : 3 + echo 'ChangeMe' 4 + }
+4
t/t4018/bash-bashism-style-whitespace
··· 1 + function RIGHT ( ) { 2 + 3 + ChangeMe 4 + }
+4
t/t4018/bash-conditional-function
··· 1 + RIGHT() [[ \ 2 + 3 + "$a" > "$ChangeMe" 4 + ]]
+6
t/t4018/bash-missing-parentheses
··· 1 + function RIGHT { 2 + functionInvalidSyntax { 3 + : 4 + echo 'ChangeMe' 5 + } 6 + }
+4
t/t4018/bash-mixed-style-compact
··· 1 + function RIGHT(){ 2 + : 3 + echo 'ChangeMe' 4 + }
+4
t/t4018/bash-mixed-style-function
··· 1 + function RIGHT() { 2 + 3 + ChangeMe 4 + }
+6
t/t4018/bash-nested-functions
··· 1 + outer() { 2 + RIGHT() { 3 + : 4 + echo 'ChangeMe' 5 + } 6 + }
+4
t/t4018/bash-other-characters
··· 1 + _RIGHT_0n() { 2 + 3 + ChangeMe 4 + }
+4
t/t4018/bash-posix-style-compact
··· 1 + RIGHT(){ 2 + 3 + ChangeMe 4 + }
+4
t/t4018/bash-posix-style-function
··· 1 + RIGHT() { 2 + 3 + ChangeMe 4 + }
+4
t/t4018/bash-posix-style-whitespace
··· 1 + RIGHT ( ) { 2 + 3 + ChangeMe 4 + }
+4
t/t4018/bash-subshell-function
··· 1 + RIGHT() ( 2 + 3 + ChangeMe=2 4 + )
+4
t/t4018/bash-trailing-comment
··· 1 + RIGHT() { # Comment 2 + 3 + ChangeMe 4 + }
+21
userdiff.c
··· 23 23 "[a-zA-Z][a-zA-Z0-9_]*" 24 24 "|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?" 25 25 "|=>|\\.\\.|\\*\\*|:=|/=|>=|<=|<<|>>|<>"), 26 + PATTERNS("bash", 27 + /* Optional leading indentation */ 28 + "^[ \t]*" 29 + /* Start of captured text */ 30 + "(" 31 + "(" 32 + /* POSIX identifier with mandatory parentheses */ 33 + "[a-zA-Z_][a-zA-Z0-9_]*[ \t]*\\([ \t]*\\))" 34 + "|" 35 + /* Bashism identifier with optional parentheses */ 36 + "(function[ \t]+[a-zA-Z_][a-zA-Z0-9_]*(([ \t]*\\([ \t]*\\))|([ \t]+))" 37 + ")" 38 + /* Optional whitespace */ 39 + "[ \t]*" 40 + /* Compound command starting with `{`, `(`, `((` or `[[` */ 41 + "(\\{|\\(\\(?|\\[\\[)" 42 + /* End of captured text */ 43 + ")", 44 + /* -- */ 45 + /* Characters not in the default $IFS value */ 46 + "[^ \t]+"), 26 47 PATTERNS("dts", 27 48 "!;\n" 28 49 "!=\n"