{"thread":{"id":"57512","subject":"[PATCH v5] userdiff: add builtin diff driver for kotlin language.","startedAt":"2022-03-06T11:11:36Z","lastAt":"2022-03-06T11:22:18Z","messageCount":3,"participants":["Jaydeep P Das","Jaydeep Das"],"isPatch":true,"patchVersion":5,"patchTotal":null},"messages":[{"id":"450500","messageId":"20220306111031.335489-2-jaydeepjd.8914@gmail.com","threadId":"57512","inReplyTo":"20220306111031.335489-1-jaydeepjd.8914@gmail.com","subject":"[PATCH v5] userdiff: add builtin diff driver for kotlin language.","fromName":"Jaydeep P Das","fromEmail":"jaydeepjd.8914@gmail.com","sentAt":"2022-03-06T11:10:31Z","receivedAt":"2022-03-06T11:11:36Z","isPatch":true,"sender":{"key":"jaydeepjd.8914@gmail.com","avatar":"https://avatars.githubusercontent.com/u/64089730?v=4"},"body":"The xfuncname pattern finds func/class declarations\nin diffs to display as a hunk header. The word_regex\npattern finds individual tokens in Kotlin code to generate\nappropriate diffs.\n\nThis patch adds xfuncname regex and word_regex for Kotlin\nlanguage.\n\nSigned-off-by: Jaydeep P Das <jaydeepjd.8914@gmail.com>\n---\n Documentation/gitattributes.txt |  2 ++\n t/t4018/kotlin-class            |  5 ++++\n t/t4018/kotlin-enum-class       |  5 ++++\n t/t4018/kotlin-fun              |  5 ++++\n t/t4018/kotlin-inheritace-class |  5 ++++\n t/t4018/kotlin-inline-class     |  5 ++++\n t/t4018/kotlin-interface        |  5 ++++\n t/t4018/kotlin-nested-fun       |  9 +++++++\n t/t4018/kotlin-public-class     |  5 ++++\n t/t4018/kotlin-sealed-class     |  5 ++++\n t/t4034-diff-words.sh           |  1 +\n t/t4034/kotlin/expect           | 42 +++++++++++++++++++++++++++++++++\n t/t4034/kotlin/post             | 29 +++++++++++++++++++++++\n t/t4034/kotlin/pre              | 29 +++++++++++++++++++++++\n userdiff.c                      | 12 ++++++++++\n 15 files changed, 164 insertions(+)\n create mode 100644 t/t4018/kotlin-class\n create mode 100644 t/t4018/kotlin-enum-class\n create mode 100644 t/t4018/kotlin-fun\n create mode 100644 t/t4018/kotlin-inheritace-class\n create mode 100644 t/t4018/kotlin-inline-class\n create mode 100644 t/t4018/kotlin-interface\n create mode 100644 t/t4018/kotlin-nested-fun\n create mode 100644 t/t4018/kotlin-public-class\n create mode 100644 t/t4018/kotlin-sealed-class\n create mode 100644 t/t4034/kotlin/expect\n create mode 100644 t/t4034/kotlin/post\n create mode 100644 t/t4034/kotlin/pre\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex a71dad2674..4b36d51beb 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -829,6 +829,8 @@ patterns are available:\n \n - `java` suitable for source code in the Java language.\n \n+- `kotlin` suitable for source code in the Kotlin language.\n+\n - `markdown` suitable for Markdown documents.\n \n - `matlab` suitable for source code in the MATLAB and Octave languages.\ndiff --git a/t/t4018/kotlin-class b/t/t4018/kotlin-class\nnew file mode 100644\nindex 0000000000..bb864f22e6\n--- /dev/null\n+++ b/t/t4018/kotlin-class\n@@ -0,0 +1,5 @@\n+class RIGHT {\n+\t//comment\n+\t//comment\n+\treturn ChangeMe\n+}\ndiff --git a/t/t4018/kotlin-enum-class b/t/t4018/kotlin-enum-class\nnew file mode 100644\nindex 0000000000..8885f908fd\n--- /dev/null\n+++ b/t/t4018/kotlin-enum-class\n@@ -0,0 +1,5 @@\n+enum class RIGHT{\n+\t// Left\n+\t// a comment\n+\tChangeMe\n+}\ndiff --git a/t/t4018/kotlin-fun b/t/t4018/kotlin-fun\nnew file mode 100644\nindex 0000000000..2a60280256\n--- /dev/null\n+++ b/t/t4018/kotlin-fun\n@@ -0,0 +1,5 @@\n+fun RIGHT(){\n+\t//a comment\n+\t//b comment\n+    return ChangeMe()\n+}\ndiff --git a/t/t4018/kotlin-inheritace-class b/t/t4018/kotlin-inheritace-class\nnew file mode 100644\nindex 0000000000..77376c1f05\n--- /dev/null\n+++ b/t/t4018/kotlin-inheritace-class\n@@ -0,0 +1,5 @@\n+open class RIGHT{\n+\t// a comment\n+\t// b comment\n+\t// ChangeMe\n+}\ndiff --git a/t/t4018/kotlin-inline-class b/t/t4018/kotlin-inline-class\nnew file mode 100644\nindex 0000000000..7bf46dd8d4\n--- /dev/null\n+++ b/t/t4018/kotlin-inline-class\n@@ -0,0 +1,5 @@\n+value class RIGHT(Args){\n+\t// a comment\n+\t// b comment\n+\tChangeMe\n+}\ndiff --git a/t/t4018/kotlin-interface b/t/t4018/kotlin-interface\nnew file mode 100644\nindex 0000000000..f686ba7770\n--- /dev/null\n+++ b/t/t4018/kotlin-interface\n@@ -0,0 +1,5 @@\n+interface RIGHT{\n+\t//another comment\n+\t//another comment\n+\t//ChangeMe\n+}\ndiff --git a/t/t4018/kotlin-nested-fun b/t/t4018/kotlin-nested-fun\nnew file mode 100644\nindex 0000000000..12186858cb\n--- /dev/null\n+++ b/t/t4018/kotlin-nested-fun\n@@ -0,0 +1,9 @@\n+class LEFT{\n+\tclass CENTER{\n+\t\tfun RIGHT(  a:Int){\n+\t\t\t//comment\n+\t\t\t//comment\n+\t\t\tChangeMe\n+\t\t}\n+\t}\n+}\ndiff --git a/t/t4018/kotlin-public-class b/t/t4018/kotlin-public-class\nnew file mode 100644\nindex 0000000000..9433fcc226\n--- /dev/null\n+++ b/t/t4018/kotlin-public-class\n@@ -0,0 +1,5 @@\n+public class RIGHT{\n+\t//comment1\n+\t//comment2\n+\tChangeMe\n+}\ndiff --git a/t/t4018/kotlin-sealed-class b/t/t4018/kotlin-sealed-class\nnew file mode 100644\nindex 0000000000..0efa4a4eaf\n--- /dev/null\n+++ b/t/t4018/kotlin-sealed-class\n@@ -0,0 +1,5 @@\n+sealed class RIGHT {\n+\t// a comment\n+\t// b comment\n+\tChangeMe\n+}\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex d5abcf4b4c..15764ee9ac 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -324,6 +324,7 @@ test_language_driver dts\n test_language_driver fortran\n test_language_driver html\n test_language_driver java\n+test_language_driver kotlin\n test_language_driver matlab\n test_language_driver objc\n test_language_driver pascal\ndiff --git a/t/t4034/kotlin/expect b/t/t4034/kotlin/expect\nnew file mode 100644\nindex 0000000000..d80e17d2c5\n--- /dev/null\n+++ b/t/t4034/kotlin/expect\n@@ -0,0 +1,42 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index 1db2197..ec0a891 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,29 +1,29 @@<RESET>\n+println(\"Hello World<RED>!\\n<RESET><GREEN>?<RESET>\")\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>)<RESET> '<RED>x<RESET><GREEN>y<RESET>'\n+[<RED>a<RESET><GREEN>x<RESET>] <RED>a<RESET><GREEN>x<RESET>-><RED>b a<RESET><GREEN>y x<RESET>.<RED>b<RESET><GREEN>y<RESET>\n+!<RED>a a<RESET><GREEN>x x<RESET>.inv() <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET><GREEN>y<RESET>\n+a <RED>shr<RESET><GREEN>shl<RESET> b\n+<RED>a<RESET><GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b a<RESET><GREEN>y x<RESET>===<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET> and <RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>^<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET> or <RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>&&<RED>b a<RESET><GREEN>y x<RESET>||<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>+=<RED>b a<RESET><GREEN>y x<RESET>-=<RED>b a<RESET><GREEN>y x<RESET>*=<RED>b a<RESET><GREEN>y x<RESET>/=<RED>b a<RESET><GREEN>y x<RESET>%=<RED>b a<RESET><GREEN>y x<RESET><<=<RED>b a<RESET><GREEN>y x<RESET>>>=<RED>b a<RESET><GREEN>y x<RESET>&=<RED>b a<RESET><GREEN>y x<RESET>^=<RED>b a<RESET><GREEN>y x<RESET>|=<RED>b<RESET><GREEN>y<RESET>\n+a<RED>=<RESET><GREEN>+=<RESET>b c<RED>+=<RESET><GREEN>=<RESET>d e<RED>-=<RESET><GREEN><=<RESET>f g<RED>*=<RESET><GREEN>>=<RESET>h i<RED>/=<RESET><GREEN>/<RESET>j k<RED>%=<RESET><GREEN>%<RESET>l m<RED><<=<RESET><GREEN><<<RESET>n o<RED>>>=<RESET><GREEN>>><RESET>p q<RED>&=<RESET><GREEN>&<RESET>r s<RED>^=<RESET><GREEN>^<RESET>t u<RED>|=<RESET><GREEN>|<RESET>v\n+a<RED><<=<RESET><GREEN><=<RESET>b\n+a<RED>||<RESET><GREEN>|<RESET>b a<RED>&&<RESET><GREEN>&<RESET>b\n+<RED>a<RESET><GREEN>x<RESET>,y\n+--a<RED>==<RESET><GREEN>!=<RESET>--b\n+a++<RED>==<RESET><GREEN>!=<RESET>++b\n+<RED>0xFF_EC_DE_5E 0b100_000 100_000<RESET><GREEN>0xFF_E1_DE_5E 0b100_100 200_000<RESET>\n+a<RED>==<RESET><GREEN>===<RESET>b\n+a<RED>!!<RESET><GREEN>!=<RESET>b\n+<RED>_32<RESET><GREEN>_33<RESET>.find(arr)\n+X.<RED>fill<RESET><GREEN>find<RESET>()\n+X.<RED>u<RESET><GREEN>f<RESET>+1\n+X.u<RED>-<RESET><GREEN>+<RESET>2\n+a<RED>.<RESET><GREEN>..<RESET>b\n+a<RED>?.<RESET><GREEN>?:<RESET>b\ndiff --git a/t/t4034/kotlin/post b/t/t4034/kotlin/post\nnew file mode 100644\nindex 0000000000..ec0a8919e9\n--- /dev/null\n+++ b/t/t4034/kotlin/post\n@@ -0,0 +1,29 @@\n+println(\"Hello World?\")\n+(1) (-1e10) (0xabcdef) 'y'\n+[x] x->y x.y\n+!x x.inv() x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+a shl b\n+x<y x<=y x>y x>=y\n+x==y x!=y x===y\n+x and y\n+x^y\n+x or y\n+x&&y x||y\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+a+=b c=d e<=f g>=h i/j k%l m<<n o>>p q&r s^t u|v\n+a<=b\n+a|b a&b\n+x,y\n+--a!=--b\n+a++!=++b\n+0xFF_E1_DE_5E 0b100_100 200_000\n+a===b\n+a!=b\n+_33.find(arr)\n+X.find()\n+X.f+1\n+X.u+2\n+a..b\n+a?:b\ndiff --git a/t/t4034/kotlin/pre b/t/t4034/kotlin/pre\nnew file mode 100644\nindex 0000000000..1db2197baa\n--- /dev/null\n+++ b/t/t4034/kotlin/pre\n@@ -0,0 +1,29 @@\n+println(\"Hello World!\\n\")\n+1 -1e10 0xabcdef 'x'\n+[a] a->b a.b\n+!a a.inv() a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a shr b\n+a<b a<=b a>b a>=b\n+a==b a!=b a===b\n+a and b\n+a^b\n+a or b\n+a&&b a||b\n+a=b a+=b a-=b a*=b a/=b a%=b a<<=b a>>=b a&=b a^=b a|=b\n+a=b c+=d e-=f g*=h i/=j k%=l m<<=n o>>=p q&=r s^=t u|=v\n+a<<=b\n+a||b a&&b\n+a,y\n+--a==--b\n+a++==++b\n+0xFF_EC_DE_5E 0b100_000 100_000\n+a==b\n+a!!b\n+_32.find(arr)\n+X.fill()\n+X.u+1\n+X.u-2\n+a.b\n+a?.b\ndiff --git a/userdiff.c b/userdiff.c\nindex 8578cb0d12..cd2155bbfe 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -168,6 +168,18 @@ PATTERNS(\"java\",\n \t \"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?\"\n \t \"|[-+*/<>%&^|=!]=\"\n \t \"|--|\\\\+\\\\+|<<=?|>>>?=?|&&|\\\\|\\\\|\"),\n+PATTERNS(\"kotlin\",\n+\t \"^[ \\t]*(([a-z]+[ \\t]+)*(fun|class|interface)[ \\t]+.*)$\",\n+\t /* -- */\n+\t \"[a-zA-Z_][a-zA-Z0-9_]*\"\n+\t /* hexadecimal and binary numbers */\n+\t \"|0[xXbB][0-9a-fA-F_]+[lLuU]*\"\n+\t /* integers and floats */\n+\t \"|[0-9][.]?[0-9_]+([Ee][-+]?[0-9]+)?[fFlL]*\"\n+\t /* floating point numbers beginning with decimal point */\n+\t \"|[.][0-9][0-9]*([Ee][-+]?[0-9]+)?[fFlLuU]?\"\n+\t /* unary and binary operators */\n+\t \"|[-+*/<>%&^|=!]?==?|--|\\\\+\\\\+|<<?=?|>>?=?|&&|\\\\|[|]?|->|\\\\.\\\\*|!!|::|[?:.][.:]\"),\n PATTERNS(\"markdown\",\n \t \"^ {0,3}#{1,6}[ \\t].*\",\n \t /* -- */\n-- \n2.35.1\n\n"},{"id":"450628","messageId":"20220306111031.335489-1-jaydeepjd.8914@gmail.com","threadId":"57512","inReplyTo":"20220301070226.2477769-1-jaydeepjd.8914","subject":"","fromName":"Jaydeep P Das","fromEmail":"jaydeepjd.8914@gmail.com","sentAt":"2022-03-06T11:10:30Z","receivedAt":"2022-03-06T11:11:36Z","isPatch":false,"sender":{"key":"jaydeepjd.8914@gmail.com","avatar":"https://avatars.githubusercontent.com/u/64089730?v=4"},"body":"This patch removes the previously implemented regex\nfor matching method calls and adds a new regex\nfor specially matching floating numbers starting with\na decimal point. \n\nAdded some more compound operators and their tests.\n\n--\nThanks :-]\nJaydeep\n\n\n"},{"id":"450502","messageId":"bb69a6f4-56ca-2f36-49a7-af4b6ac3990e@gmail.com","threadId":"57512","inReplyTo":"20220306111031.335489-1-jaydeepjd.8914@gmail.com","subject":"Re:","fromName":"Jaydeep Das","fromEmail":"jaydeepjd.8914@gmail.com","sentAt":"2022-03-06T11:22:12Z","receivedAt":"2022-03-06T11:22:18Z","isPatch":false,"sender":{"key":"jaydeepjd.8914@gmail.com","avatar":"https://avatars.githubusercontent.com/u/64089730?v=4"},"body":"Please ignore this patch. I think I made some mistake\nwhen copy-pasting the In-reply-to code.\n\nSorry for the trouble. I have sent this same patch on\nthe appropriate thread.\n\nThanks,\nJaydeep.\n"}]}