diff options
author | Jaydeep P Das <jaydeepjd.8914@gmail.com> | 2022-03-12 05:48:32 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-13 03:15:47 +0100 |
commit | 09188ed930bcb08e56d1846fbf9f5cb972a2d188 (patch) | |
tree | b4fec1636c1447a69ad3527ffb3edb456802ce7b /userdiff.c | |
parent | The eighth batch (diff) | |
download | git-09188ed930bcb08e56d1846fbf9f5cb972a2d188.tar.xz git-09188ed930bcb08e56d1846fbf9f5cb972a2d188.zip |
userdiff: add builtin diff driver for kotlin language.
The xfuncname pattern finds func/class declarations
in diffs to display as a hunk header. The word_regex
pattern finds individual tokens in Kotlin code to generate
appropriate diffs.
This patch adds xfuncname regex and word_regex for Kotlin
language.
Signed-off-by: Jaydeep P Das <jaydeepjd.8914@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r-- | userdiff.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/userdiff.c b/userdiff.c index 8578cb0d12..0f6c14659b 100644 --- a/userdiff.c +++ b/userdiff.c @@ -168,6 +168,18 @@ PATTERNS("java", "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?" "|[-+*/<>%&^|=!]=" "|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"), +PATTERNS("kotlin", + "^[ \t]*(([a-z]+[ \t]+)*(fun|class|interface)[ \t]+.*)$", + /* -- */ + "[a-zA-Z_][a-zA-Z0-9_]*" + /* hexadecimal and binary numbers */ + "|0[xXbB][0-9a-fA-F_]+[lLuU]*" + /* integers and floats */ + "|[0-9][0-9_]*([.][0-9_]*)?([Ee][-+]?[0-9]+)?[fFlLuU]*" + /* floating point numbers beginning with decimal point */ + "|[.][0-9][0-9_]*([Ee][-+]?[0-9]+)?[fFlLuU]?" + /* unary and binary operators */ + "|[-+*/<>%&^|=!]==?|--|\\+\\+|<<=|>>=|&&|\\|\\||->|\\.\\*|!!|[?:.][.:]"), PATTERNS("markdown", "^ {0,3}#{1,6}[ \t].*", /* -- */ |