diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-11-02 22:17:46 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-11-02 22:17:46 +0100 |
commit | 292e53fa9d2cf6d0b6d6adbbdc6dfc665bd4babe (patch) | |
tree | c6cf86a42e4386b3c37bd23903c672669e8e8bdf /userdiff.c | |
parent | Merge branch 'bc/svn-hash-oid-fix' (diff) | |
parent | userdiff: support Bash (diff) | |
download | git-292e53fa9d2cf6d0b6d6adbbdc6dfc665bd4babe.tar.xz git-292e53fa9d2cf6d0b6d6adbbdc6dfc665bd4babe.zip |
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
Diffstat (limited to 'userdiff.c')
-rw-r--r-- | userdiff.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/userdiff.c b/userdiff.c index 9c63be9fb8..3f81a2261c 100644 --- a/userdiff.c +++ b/userdiff.c @@ -23,6 +23,27 @@ IPATTERN("ada", "[a-zA-Z][a-zA-Z0-9_]*" "|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?" "|=>|\\.\\.|\\*\\*|:=|/=|>=|<=|<<|>>|<>"), +PATTERNS("bash", + /* Optional leading indentation */ + "^[ \t]*" + /* Start of captured text */ + "(" + "(" + /* POSIX identifier with mandatory parentheses */ + "[a-zA-Z_][a-zA-Z0-9_]*[ \t]*\\([ \t]*\\))" + "|" + /* Bashism identifier with optional parentheses */ + "(function[ \t]+[a-zA-Z_][a-zA-Z0-9_]*(([ \t]*\\([ \t]*\\))|([ \t]+))" + ")" + /* Optional whitespace */ + "[ \t]*" + /* Compound command starting with `{`, `(`, `((` or `[[` */ + "(\\{|\\(\\(?|\\[\\[)" + /* End of captured text */ + ")", + /* -- */ + /* Characters not in the default $IFS value */ + "[^ \t]+"), PATTERNS("dts", "!;\n" "!=\n" |