{"thread":{"id":"61155","subject":"[GSoC][PATCH] userdiff: add funcname regex and wordregex for typescript language","startedAt":"2024-03-19T18:59:49Z","lastAt":"2024-04-05T17:47:06Z","messageCount":10,"participants":["Utsav Parmar","Patrick Steinhardt","Karthik Nayak","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"490949","messageId":"20240319185938.243667-1-utsavp0213@gmail.com","threadId":"61155","inReplyTo":null,"subject":"[GSoC][PATCH] userdiff: add funcname regex and wordregex for typescript language","fromName":"Utsav Parmar","fromEmail":"utsavp0213@gmail.com","sentAt":"2024-03-19T18:59:38Z","receivedAt":"2024-03-19T18:59:49Z","isPatch":true,"sender":{"key":"utsavp0213@gmail.com","avatar":null},"body":"This patch adds a builtin driver for typescript language supporting regex for both function name and words. Also updates the `.gitattributes.txt` to reflect this.\n\ngitattributes: add typescript language to hunk headers support\nt4034: add tests for typescript word_regex\nt4018: add tests for typescript funcname regex\nuserdiff: add funcname regex and wordregex for typescript language\n\n---\nIndex: userdiff.c\ndiff --git a/userdiff.c b/userdiff.c\n--- a/userdiff.c\t(revision 2953d95d402b6bff1a59c4712f4d46f1b9ea137f)\n+++ b/userdiff.c\t(revision 6724df99624834d9b7278a0bc95fa319f526a1fe)\n@@ -297,6 +297,22 @@\n \t \"|([^][)(}{[ \\t])+\"),\n PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n \t \"\\\\\\\\[a-zA-Z@]+|\\\\\\\\.|([a-zA-Z0-9]|[^\\x01-\\x7f])+\"),\n+PATTERNS(\"typescript\",\n+         \"^[ \\t]*((enum|interface|type)[ \\t]+([a-zA-Z][a-zA-Z0-9]*)+.*)$\\n\"\n+         /* Method definitions */\n+         \"^[ \\t]*[a-z]+[ \\t]+([A-Za-z_][A-Za-z_0-9]*)+([ \\t]*=[ \\t]*(function)?)?([ \\t]*[A-Za-z_<>&][?&<>|.,A-Za-z_]*[ \\t]*)*[ \\t]*\\\\([^;]*$\",\n+         /* -- */\n+         \"[a-zA-Z_][a-zA-Z0-9_]*\"\n+         /* Integers and floats */\n+         \"|[-+]?[0-9]*\\\\.?[0-9]+([eE][-+]?[0-9]+)?\"\n+         /* Binary */\n+         \"|0[bB][01]+\"\n+         /* Hexadecimals */\n+         \"|0[xX][0-9a-fA-F]+\"\n+         /* Floats starting with a decimal point */\n+         \"|[-+]?([0-9]*\\\\.?[0-9]+|[0-9]+\\\\.?[0-9]*)([eE][-+]?[0-9]+)?\"\n+         /* Operators */\n+         \"[-+*/%&|^!=<>]=?|===|!==|<<=?|>>=?|&&|\\\\|\\\\||\\\\?\\\\?|\\\\+\\\\+|--|~\"),\n { \"default\", NULL, NULL, -1, { NULL, 0 } },\n };\n #undef PATTERNS\nIndex: t/t4018/typescript-arrow-function\ndiff --git a/t/t4018/typescript-arrow-function b/t/t4018/typescript-arrow-function\nnew file mode 100644\n--- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n+++ b/t/t4018/typescript-arrow-function\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n@@ -0,0 +1,4 @@\n+const RIGHT = (one) => {\n+    someMethodCall();\n+    return ChangeMe;\n+}\nIndex: t/t4018/typescript-class-member-function\ndiff --git a/t/t4018/typescript-class-member-function b/t/t4018/typescript-class-member-function\nnew file mode 100644\n--- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n+++ b/t/t4018/typescript-class-member-function\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n@@ -0,0 +1,7 @@\n+class Test {\n+\tvar one;\n+\tfunction RIGHT(two: string) {\n+\t\tsomeMethodCall();\n+\t\treturn ChangeMe;\n+\t}\n+}\nIndex: t/t4018/typescript-enum\ndiff --git a/t/t4018/typescript-enum b/t/t4018/typescript-enum\nnew file mode 100644\n--- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n+++ b/t/t4018/typescript-enum\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n@@ -0,0 +1,6 @@\n+enum RIGHT {\n+    ONE = 1,\n+    TWO,\n+    THREE,\n+    ChangeMe\n+}\nIndex: t/t4018/typescript-function\ndiff --git a/t/t4018/typescript-function b/t/t4018/typescript-function\nnew file mode 100644\n--- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n+++ b/t/t4018/typescript-function\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n@@ -0,0 +1,4 @@\n+function RIGHT<Type implements AnotherType>(one: number): Type {\n+    someMethodCall();\n+    return ChangeMe;\n+}\nIndex: t/t4018/typescript-function-assignment\ndiff --git a/t/t4018/typescript-function-assignment b/t/t4018/typescript-function-assignment\nnew file mode 100644\n--- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n+++ b/t/t4018/typescript-function-assignment\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n@@ -0,0 +1,4 @@\n+const RIGHT = function(one: number): Type {\n+    someMethodCall();\n+    return ChangeMe;\n+}\nIndex: t/t4018/typescript-interface\ndiff --git a/t/t4018/typescript-interface b/t/t4018/typescript-interface\nnew file mode 100644\n--- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n+++ b/t/t4018/typescript-interface\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n@@ -0,0 +1,4 @@\n+interface RIGHT {\n+  one?: string;\n+  [propName: ChangeMe]: any;\n+}\n\\ No newline at end of file\nIndex: t/t4018/typescript-type\ndiff --git a/t/t4018/typescript-type b/t/t4018/typescript-type\nnew file mode 100644\n--- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n+++ b/t/t4018/typescript-type\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n@@ -0,0 +1,4 @@\n+type RIGHT = {\n+  one: number,\n+  ChangeMe: CustomType\n+}\n\\ No newline at end of file\nIndex: t/t4034-diff-words.sh\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\n--- a/t/t4034-diff-words.sh\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n+++ b/t/t4034-diff-words.sh\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n@@ -338,6 +338,7 @@\n test_language_driver ruby\n test_language_driver scheme\n test_language_driver tex\n+test_language_driver typescript\n \n test_expect_success 'word-diff with diff.sbe' '\n \tcat >pre <<-\\EOF &&\nIndex: t/t4034/typescript/expect\ndiff --git a/t/t4034/typescript/expect b/t/t4034/typescript/expect\nnew file mode 100644\n--- /dev/null\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n+++ b/t/t4034/typescript/expect\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n@@ -0,0 +1,57 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index e4a51a2..9c56465 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,16 +1,16 @@<RESET>\n+log(\"Hello World<RED>!\\n<RESET><GREEN>?<RESET>\")\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>) u<RESET>'<RED>x<RESET><GREEN>y<RESET>'\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<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\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<RESET>\n+<GREEN>x<RESET>&<RED>b\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<RESET>\n+<GREEN>x<RESET>^<RED>b\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<RESET>\n+<GREEN>x<RESET>|<RED>b\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<RESET>\n+<GREEN>x<RESET>&&<RED>b\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<RESET>\n+<GREEN>x<RESET>||<RED>b\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\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 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\n+<RESET>\n+<RED>a<RESET><GREEN>y\n+<RESET>\n+<GREEN>x<RESET>,y\nIndex: t/t4034/typescript/post\ndiff --git a/t/t4034/typescript/post b/t/t4034/typescript/post\nnew file mode 100644\n--- /dev/null\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n+++ b/t/t4034/typescript/post\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n@@ -0,0 +1,16 @@\n+log(\"Hello World?\")\n+(1) (-1e10) (0xabcdef) u'y'\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\nIndex: t/t4034/typescript/pre\ndiff --git a/t/t4034/typescript/pre b/t/t4034/typescript/pre\nnew file mode 100644\n--- /dev/null\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n+++ b/t/t4034/typescript/pre\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n@@ -0,0 +1,16 @@\n+log(\"Hello World!\\n\")\n+1 -1e10 0xabcdef 'x'\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\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,y\nIndex: Documentation/gitattributes.txt\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n--- a/Documentation/gitattributes.txt\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n+++ b/Documentation/gitattributes.txt\t(revision 2891f81b087a3f1c89d1417c40ba576aaa30feb9)\n@@ -902,6 +902,8 @@\n \n - `tex` suitable for source code for LaTeX documents.\n \n+- `typescript` suitable for source code for TypeScript language.\n+\n \n Customizing word diff\n ^^^^^^^^^^^^^^^^^^^^^\n"},{"id":"491121","messageId":"ZfwmMKLBjtYvUPUV@tanuki","threadId":"61155","inReplyTo":"20240319185938.243667-1-utsavp0213@gmail.com","subject":"Re: [GSoC][PATCH] userdiff: add funcname regex and wordregex for typescript language","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-03-21T12:21:04Z","receivedAt":"2024-03-21T12:21:09Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Wed, Mar 20, 2024 at 12:29:38AM +0530, Utsav Parmar wrote:\n> This patch adds a builtin driver for typescript language supporting regex for both function name and words. Also updates the `.gitattributes.txt` to reflect this.\n\nPlease be mindful that we typically wrap commit messages at 72 columns\nper line. Furthermore, we don't typically say \"This patch\", but rather\nuse an imperative style. So instead of saying \"This patch adds a biultin\ndriver\", we'd say \"Add a builtin driver\".\n\n> gitattributes: add typescript language to hunk headers support\n> t4034: add tests for typescript word_regex\n> t4018: add tests for typescript funcname regex\n> userdiff: add funcname regex and wordregex for typescript language\n\nWe don't usually provide such bulleted-list-style changes for each of\nthe files. In this case, it shoul be fine to say something \"Add tests\nand documentation for the new driver\".\n\nLast but not least, this message is missing your signoff.\n\nI would recommend you to read \"Documentation/MyFirstContribution.txt\",\nwhich explains all of this.\n\nI can't really say much regarding the remainder of your changes given\nthat I'm neither familiar with \"userdiff.c\" nor with TypeScript. I hope\nthat others can chime in here.\n\nPatrick\n\n> ---\n> Index: userdiff.c\n> diff --git a/userdiff.c b/userdiff.c\n> --- a/userdiff.c\t(revision 2953d95d402b6bff1a59c4712f4d46f1b9ea137f)\n> +++ b/userdiff.c\t(revision 6724df99624834d9b7278a0bc95fa319f526a1fe)\n> @@ -297,6 +297,22 @@\n>  \t \"|([^][)(}{[ \\t])+\"),\n>  PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n>  \t \"\\\\\\\\[a-zA-Z@]+|\\\\\\\\.|([a-zA-Z0-9]|[^\\x01-\\x7f])+\"),\n> +PATTERNS(\"typescript\",\n> +         \"^[ \\t]*((enum|interface|type)[ \\t]+([a-zA-Z][a-zA-Z0-9]*)+.*)$\\n\"\n> +         /* Method definitions */\n> +         \"^[ \\t]*[a-z]+[ \\t]+([A-Za-z_][A-Za-z_0-9]*)+([ \\t]*=[ \\t]*(function)?)?([ \\t]*[A-Za-z_<>&][?&<>|.,A-Za-z_]*[ \\t]*)*[ \\t]*\\\\([^;]*$\",\n> +         /* -- */\n> +         \"[a-zA-Z_][a-zA-Z0-9_]*\"\n> +         /* Integers and floats */\n> +         \"|[-+]?[0-9]*\\\\.?[0-9]+([eE][-+]?[0-9]+)?\"\n> +         /* Binary */\n> +         \"|0[bB][01]+\"\n> +         /* Hexadecimals */\n> +         \"|0[xX][0-9a-fA-F]+\"\n> +         /* Floats starting with a decimal point */\n> +         \"|[-+]?([0-9]*\\\\.?[0-9]+|[0-9]+\\\\.?[0-9]*)([eE][-+]?[0-9]+)?\"\n> +         /* Operators */\n> +         \"[-+*/%&|^!=<>]=?|===|!==|<<=?|>>=?|&&|\\\\|\\\\||\\\\?\\\\?|\\\\+\\\\+|--|~\"),\n>  { \"default\", NULL, NULL, -1, { NULL, 0 } },\n>  };\n>  #undef PATTERNS\n> Index: t/t4018/typescript-arrow-function\n> diff --git a/t/t4018/typescript-arrow-function b/t/t4018/typescript-arrow-function\n> new file mode 100644\n> --- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> +++ b/t/t4018/typescript-arrow-function\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> @@ -0,0 +1,4 @@\n> +const RIGHT = (one) => {\n> +    someMethodCall();\n> +    return ChangeMe;\n> +}\n> Index: t/t4018/typescript-class-member-function\n> diff --git a/t/t4018/typescript-class-member-function b/t/t4018/typescript-class-member-function\n> new file mode 100644\n> --- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> +++ b/t/t4018/typescript-class-member-function\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> @@ -0,0 +1,7 @@\n> +class Test {\n> +\tvar one;\n> +\tfunction RIGHT(two: string) {\n> +\t\tsomeMethodCall();\n> +\t\treturn ChangeMe;\n> +\t}\n> +}\n> Index: t/t4018/typescript-enum\n> diff --git a/t/t4018/typescript-enum b/t/t4018/typescript-enum\n> new file mode 100644\n> --- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> +++ b/t/t4018/typescript-enum\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> @@ -0,0 +1,6 @@\n> +enum RIGHT {\n> +    ONE = 1,\n> +    TWO,\n> +    THREE,\n> +    ChangeMe\n> +}\n> Index: t/t4018/typescript-function\n> diff --git a/t/t4018/typescript-function b/t/t4018/typescript-function\n> new file mode 100644\n> --- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> +++ b/t/t4018/typescript-function\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> @@ -0,0 +1,4 @@\n> +function RIGHT<Type implements AnotherType>(one: number): Type {\n> +    someMethodCall();\n> +    return ChangeMe;\n> +}\n> Index: t/t4018/typescript-function-assignment\n> diff --git a/t/t4018/typescript-function-assignment b/t/t4018/typescript-function-assignment\n> new file mode 100644\n> --- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> +++ b/t/t4018/typescript-function-assignment\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> @@ -0,0 +1,4 @@\n> +const RIGHT = function(one: number): Type {\n> +    someMethodCall();\n> +    return ChangeMe;\n> +}\n> Index: t/t4018/typescript-interface\n> diff --git a/t/t4018/typescript-interface b/t/t4018/typescript-interface\n> new file mode 100644\n> --- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> +++ b/t/t4018/typescript-interface\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> @@ -0,0 +1,4 @@\n> +interface RIGHT {\n> +  one?: string;\n> +  [propName: ChangeMe]: any;\n> +}\n> \\ No newline at end of file\n> Index: t/t4018/typescript-type\n> diff --git a/t/t4018/typescript-type b/t/t4018/typescript-type\n> new file mode 100644\n> --- /dev/null\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> +++ b/t/t4018/typescript-type\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> @@ -0,0 +1,4 @@\n> +type RIGHT = {\n> +  one: number,\n> +  ChangeMe: CustomType\n> +}\n> \\ No newline at end of file\n> Index: t/t4034-diff-words.sh\n> diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\n> --- a/t/t4034-diff-words.sh\t(revision b60d253ea78063d444f7131c3100388a7cdac060)\n> +++ b/t/t4034-diff-words.sh\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n> @@ -338,6 +338,7 @@\n>  test_language_driver ruby\n>  test_language_driver scheme\n>  test_language_driver tex\n> +test_language_driver typescript\n>  \n>  test_expect_success 'word-diff with diff.sbe' '\n>  \tcat >pre <<-\\EOF &&\n> Index: t/t4034/typescript/expect\n> diff --git a/t/t4034/typescript/expect b/t/t4034/typescript/expect\n> new file mode 100644\n> --- /dev/null\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n> +++ b/t/t4034/typescript/expect\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n> @@ -0,0 +1,57 @@\n> +<BOLD>diff --git a/pre b/post<RESET>\n> +<BOLD>index e4a51a2..9c56465 100644<RESET>\n> +<BOLD>--- a/pre<RESET>\n> +<BOLD>+++ b/post<RESET>\n> +<CYAN>@@ -1,16 +1,16 @@<RESET>\n> +log(\"Hello World<RED>!\\n<RESET><GREEN>?<RESET>\")\n> +<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>) u<RESET>'<RED>x<RESET><GREEN>y<RESET>'\n> +!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<RESET>\n> +<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<RESET>\n> +<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<RESET>\n> +<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<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\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<RESET>\n> +<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<RESET>\n> +<GREEN>x<RESET>&<RED>b\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<RESET>\n> +<GREEN>x<RESET>^<RED>b\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<RESET>\n> +<GREEN>x<RESET>|<RED>b\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<RESET>\n> +<GREEN>x<RESET>&&<RED>b\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<RESET>\n> +<GREEN>x<RESET>||<RED>b\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<RESET>\n> +<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\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 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\n> +<RESET>\n> +<RED>a<RESET><GREEN>y\n> +<RESET>\n> +<GREEN>x<RESET>,y\n> Index: t/t4034/typescript/post\n> diff --git a/t/t4034/typescript/post b/t/t4034/typescript/post\n> new file mode 100644\n> --- /dev/null\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n> +++ b/t/t4034/typescript/post\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n> @@ -0,0 +1,16 @@\n> +log(\"Hello World?\")\n> +(1) (-1e10) (0xabcdef) u'y'\n> +!x ~x x++ x-- x*y x&y\n> +x*y x/y x%y\n> +x+y x-y\n> +x<<y x>>y\n> +x<y x<=y x>y x>=y\n> +x==y x!=y\n> +x&y\n> +x^y\n> +x|y\n> +x&&y\n> +x||y\n> +x?y:z\n> +x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n> +x,y\n> Index: t/t4034/typescript/pre\n> diff --git a/t/t4034/typescript/pre b/t/t4034/typescript/pre\n> new file mode 100644\n> --- /dev/null\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n> +++ b/t/t4034/typescript/pre\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n> @@ -0,0 +1,16 @@\n> +log(\"Hello World!\\n\")\n> +1 -1e10 0xabcdef 'x'\n> +!a ~a a++ a-- a*b a&b\n> +a*b a/b a%b\n> +a+b a-b\n> +a<<b a>>b\n> +a<b a<=b a>b a>=b\n> +a==b a!=b\n> +a&b\n> +a^b\n> +a|b\n> +a&&b\n> +a||b\n> +a?b:z\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,y\n> Index: Documentation/gitattributes.txt\n> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> --- a/Documentation/gitattributes.txt\t(revision be6b88ac5ca33921af60ee42f71397011efb1806)\n> +++ b/Documentation/gitattributes.txt\t(revision 2891f81b087a3f1c89d1417c40ba576aaa30feb9)\n> @@ -902,6 +902,8 @@\n>  \n>  - `tex` suitable for source code for LaTeX documents.\n>  \n> +- `typescript` suitable for source code for TypeScript language.\n> +\n>  \n>  Customizing word diff\n>  ^^^^^^^^^^^^^^^^^^^^^\n> \n"},{"id":"491299","messageId":"CAD6u1kgiLmes_CCzr2sp6NFDgxo8c0ZQp793H66+_iMtJ+CdqA@mail.gmail.com","threadId":"61155","inReplyTo":"ZfwmMKLBjtYvUPUV@tanuki","subject":"Re: [GSoC][PATCH] userdiff: add funcname regex and wordregex for typescript language","fromName":"Utsav Parmar","fromEmail":"utsavp0213@gmail.com","sentAt":"2024-03-23T15:07:15Z","receivedAt":"2024-03-23T15:07:31Z","isPatch":true,"sender":{"key":"utsavp0213@gmail.com","avatar":null},"body":"> Please be mindful that we typically wrap commit messages at 72 columns per line. Furthermore, we don't typically say \"This patch\", but rather use an imperative style. So instead of saying \"This patch adds a biultin driver\", we'd say \"Add a builtin driver\".\n\nThank you, I'll keep this in mind. Although that wasn't the intended\ncommit message.\nI tried to create a single patch out of the 4 recent commits and send\nit via email and this is how it came across. So, the 4 lines after\nthat are the actual commit messages.\n\n> > gitattributes: add typescript language to hunk headers support\n> > t4034: add tests for typescript word_regex\n> > t4018: add tests for typescript funcname regex\n> > userdiff: add funcname regex and wordregex for typescript language\n\n> We don't usually provide such bulleted-list-style changes for each of the files. In this case, it shoul be fine to say something \"Add tests and documentation for the new driver\".\n\nThese are the original commit messages ':|. I apologize, I'm still new\nto using a command line mailer, so please bear with me. I'm learning\nhow to use this well. On a side note, is there a mailer that you'd\nrecommend?\n\n> Last but not least, this message is missing your signoff.\n\nI believe I made a blunder while creating a patch file since the\ncommits are signed locally. I'll take extra care to review my mails\nbefore sending from now onwards. Thank you for your direction.\n\nI'll submit a follow up version with patches for each commit.\n"},{"id":"491367","messageId":"20240324174423.55508-1-utsavp0213@gmail.com","threadId":"61155","inReplyTo":"20240319185938.243667-1-utsavp0213@gmail.com","subject":"[PATCH] userdiff: add builtin driver for typescript language","fromName":"Utsav Parmar","fromEmail":"utsavp0213@gmail.com","sentAt":"2024-03-24T17:44:23Z","receivedAt":"2024-03-24T17:44:47Z","isPatch":true,"sender":{"key":"utsavp0213@gmail.com","avatar":null},"body":"There are no implementation or test changes in this patch. It simply relies on the git formatting rather than the IDE git UI formatting that I believe messed up in the parent email.\n\nSigned-off-by: Utsav Parmar <utsavp0213@gmail.com>\n---\n Documentation/gitattributes.txt          |  2 ++\n t/t4018/typescript-arrow-function        |  4 +++\n t/t4018/typescript-class-member-function |  7 +++++\n t/t4018/typescript-enum                  |  6 +++++\n t/t4018/typescript-function              |  4 +++\n t/t4018/typescript-function-assignment   |  4 +++\n t/t4018/typescript-interface             |  4 +++\n t/t4018/typescript-type                  |  4 +++\n t/t4034-diff-words.sh                    |  1 +\n t/t4034/typescript/expect                | 33 ++++++++++++++++++++++++\n t/t4034/typescript/post                  | 16 ++++++++++++\n t/t4034/typescript/pre                   | 16 ++++++++++++\n userdiff.c                               | 16 ++++++++++++\n 13 files changed, 117 insertions(+)\n create mode 100644 t/t4018/typescript-arrow-function\n create mode 100644 t/t4018/typescript-class-member-function\n create mode 100644 t/t4018/typescript-enum\n create mode 100644 t/t4018/typescript-function\n create mode 100644 t/t4018/typescript-function-assignment\n create mode 100644 t/t4018/typescript-interface\n create mode 100644 t/t4018/typescript-type\n create mode 100644 t/t4034/typescript/expect\n create mode 100644 t/t4034/typescript/post\n create mode 100644 t/t4034/typescript/pre\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 4338d023d9..4461c41054 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -902,6 +902,8 @@ patterns are available:\n \n - `tex` suitable for source code for LaTeX documents.\n \n+- `typescript` suitable for source code for TypeScript language.\n+\n \n Customizing word diff\n ^^^^^^^^^^^^^^^^^^^^^\ndiff --git a/t/t4018/typescript-arrow-function b/t/t4018/typescript-arrow-function\nnew file mode 100644\nindex 0000000000..85a3d9cd6b\n--- /dev/null\n+++ b/t/t4018/typescript-arrow-function\n@@ -0,0 +1,4 @@\n+const RIGHT = (one) => {\n+    someMethodCall();\n+    return ChangeMe;\n+}\ndiff --git a/t/t4018/typescript-class-member-function b/t/t4018/typescript-class-member-function\nnew file mode 100644\nindex 0000000000..f34b0a2bac\n--- /dev/null\n+++ b/t/t4018/typescript-class-member-function\n@@ -0,0 +1,7 @@\n+class Test {\n+\tvar one;\n+\tfunction RIGHT(two: string) {\n+\t\tsomeMethodCall();\n+\t\treturn ChangeMe;\n+\t}\n+}\ndiff --git a/t/t4018/typescript-enum b/t/t4018/typescript-enum\nnew file mode 100644\nindex 0000000000..8c045a45ec\n--- /dev/null\n+++ b/t/t4018/typescript-enum\n@@ -0,0 +1,6 @@\n+enum RIGHT {\n+    ONE = 1,\n+    TWO,\n+    THREE,\n+    ChangeMe\n+}\ndiff --git a/t/t4018/typescript-function b/t/t4018/typescript-function\nnew file mode 100644\nindex 0000000000..62cf63f669\n--- /dev/null\n+++ b/t/t4018/typescript-function\n@@ -0,0 +1,4 @@\n+function RIGHT<Type implements AnotherType>(one: number): Type {\n+    someMethodCall();\n+    return ChangeMe;\n+}\ndiff --git a/t/t4018/typescript-function-assignment b/t/t4018/typescript-function-assignment\nnew file mode 100644\nindex 0000000000..49c528713e\n--- /dev/null\n+++ b/t/t4018/typescript-function-assignment\n@@ -0,0 +1,4 @@\n+const RIGHT = function(one: number): Type {\n+    someMethodCall();\n+    return ChangeMe;\n+}\ndiff --git a/t/t4018/typescript-interface b/t/t4018/typescript-interface\nnew file mode 100644\nindex 0000000000..6f3665c2af\n--- /dev/null\n+++ b/t/t4018/typescript-interface\n@@ -0,0 +1,4 @@\n+interface RIGHT {\n+  one?: string;\n+  [propName: ChangeMe]: any;\n+}\n\\ No newline at end of file\ndiff --git a/t/t4018/typescript-type b/t/t4018/typescript-type\nnew file mode 100644\nindex 0000000000..e1bb2d8371\n--- /dev/null\n+++ b/t/t4018/typescript-type\n@@ -0,0 +1,4 @@\n+type RIGHT = {\n+  one: number,\n+  ChangeMe: CustomType\n+}\n\\ No newline at end of file\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex 74586f3813..4e3cf415c2 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -338,6 +338,7 @@ test_language_driver python\n test_language_driver ruby\n test_language_driver scheme\n test_language_driver tex\n+test_language_driver typescript\n \n test_expect_success 'word-diff with diff.sbe' '\n \tcat >pre <<-\\EOF &&\ndiff --git a/t/t4034/typescript/expect b/t/t4034/typescript/expect\nnew file mode 100644\nindex 0000000000..19605fec4d\n--- /dev/null\n+++ b/t/t4034/typescript/expect\n@@ -0,0 +1,33 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index e4a51a2..9c56465 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,16 +1,16 @@<RESET>\n+log(\"Hello World<RED>!\\n<RESET><GREEN>?<RESET>\")\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>) u<RESET>'<RED>x<RESET><GREEN>y<RESET>'\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<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\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>&<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>^<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>|<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>&&<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>||<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\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 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\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/typescript/post b/t/t4034/typescript/post\nnew file mode 100644\nindex 0000000000..b1b03a7666\n--- /dev/null\n+++ b/t/t4034/typescript/post\n@@ -0,0 +1,16 @@\n+log(\"Hello World?\")\n+(1) (-1e10) (0xabcdef) u'y'\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/typescript/pre b/t/t4034/typescript/pre\nnew file mode 100644\nindex 0000000000..13a0b2138c\n--- /dev/null\n+++ b/t/t4034/typescript/pre\n@@ -0,0 +1,16 @@\n+log(\"Hello World!\\n\")\n+1 -1e10 0xabcdef 'x'\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\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,y\ndiff --git a/userdiff.c b/userdiff.c\nindex 92ef649c99..dbb5d7c072 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -297,6 +297,22 @@ PATTERNS(\"scheme\",\n \t \"|([^][)(}{[ \\t])+\"),\n PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n \t \"\\\\\\\\[a-zA-Z@]+|\\\\\\\\.|([a-zA-Z0-9]|[^\\x01-\\x7f])+\"),\n+PATTERNS(\"typescript\",\n+         \"^[ \\t]*((enum|interface|type)[ \\t]+([a-zA-Z][a-zA-Z0-9]*)+.*)$\\n\"\n+         /* Method definitions */\n+         \"^[ \\t]*[a-z]+[ \\t]+([A-Za-z_][A-Za-z_0-9]*)+([ \\t]*=[ \\t]*(function)?)?([ \\t]*[A-Za-z_<>&][?&<>|.,A-Za-z_]*[ \\t]*)*[ \\t]*\\\\([^;]*$\",\n+         /* -- */\n+         \"[a-zA-Z_][a-zA-Z0-9_]*\"\n+         /* Integers and floats */\n+         \"|[-+]?[0-9]*\\\\.?[0-9]+([eE][-+]?[0-9]+)?\"\n+         /* Binary */\n+         \"|0[bB][01]+\"\n+         /* Hexadecimals */\n+         \"|0[xX][0-9a-fA-F]+\"\n+         /* Floats starting with a decimal point */\n+         \"|[-+]?([0-9]*\\\\.?[0-9]+|[0-9]+\\\\.?[0-9]*)([eE][-+]?[0-9]+)?\"\n+         /* Operators */\n+         \"[-+*/%&|^!=<>]=?|===|!==|<<=?|>>=?|&&|\\\\|\\\\||\\\\?\\\\?|\\\\+\\\\+|--|~\"),\n { \"default\", NULL, NULL, -1, { NULL, 0 } },\n };\n #undef PATTERNS\n-- \n2.34.1\n\n"},{"id":"491397","messageId":"ZgEouMZvJQdU8VVx@tanuki","threadId":"61155","inReplyTo":"CAD6u1kiaFDcyRX7-iZBb9LtoQ1F+M18UkyJuTXsQPE0YQGafmw@mail.gmail.com","subject":"Re: [GSoC][PATCH] userdiff: add funcname regex and wordregex for typescript language","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-03-25T07:33:12Z","receivedAt":"2024-03-25T07:33:16Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Sat, Mar 23, 2024 at 08:18:57PM +0530, Utsav Parmar wrote:\n[snip]\n> > We don't usually provide such bulleted-list-style changes for each of the\n> > files. In this case, it shoul be fine to say something \"Add tests and\n> > documentation for the new driver\".\n> \n> These are the original commit messages ':|. I apologize, I'm still new with\n> using a command line mailer, so please bare with me. I'm learning how to\n> use this well. On a side note, is there a mailer that you'd recommend?\n\nThis is of course very much a matter of taste, but I myself any many\nother folks use mutt or NeoMutt to access mails from the command line.\nOthers may use for example Emacs or Alpine. If I were you I'd have a\nlook at the alternatives that exist and then decide for yourself which\none is most likely to be a good fit for you.\n\nPatrick\n"},{"id":"491398","messageId":"ZgEpnmdKtSvMH8SQ@tanuki","threadId":"61155","inReplyTo":"20240324174423.55508-1-utsavp0213@gmail.com","subject":"Re: [PATCH] userdiff: add builtin driver for typescript language","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-03-25T07:37:02Z","receivedAt":"2024-03-25T07:37:07Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Sun, Mar 24, 2024 at 11:14:23PM +0530, Utsav Parmar wrote:\n> There are no implementation or test changes in this patch. It simply relies on the git formatting rather than the IDE git UI formatting that I believe messed up in the parent email.\n\nCommit messages are supposed to be at most 72 characters wide, so please\nreflow the commit message to match that limit. Furthermore, when you\nsend an updated patch, please make sure to increment the patch version\nso that folks have an easier time to follow the evolution of your patch.\nThis can be done by passing e.g. `-v2` to git-format-patch(1) or\ngit-send-email(1).\n\nOther than that I don't have a lot to say about this patch and will hope\nfor somebody else to review the TypeScript-related things.\n\nThanks!\n\nPatrick\n\n> Signed-off-by: Utsav Parmar <utsavp0213@gmail.com>\n> ---\n>  Documentation/gitattributes.txt          |  2 ++\n>  t/t4018/typescript-arrow-function        |  4 +++\n>  t/t4018/typescript-class-member-function |  7 +++++\n>  t/t4018/typescript-enum                  |  6 +++++\n>  t/t4018/typescript-function              |  4 +++\n>  t/t4018/typescript-function-assignment   |  4 +++\n>  t/t4018/typescript-interface             |  4 +++\n>  t/t4018/typescript-type                  |  4 +++\n>  t/t4034-diff-words.sh                    |  1 +\n>  t/t4034/typescript/expect                | 33 ++++++++++++++++++++++++\n>  t/t4034/typescript/post                  | 16 ++++++++++++\n>  t/t4034/typescript/pre                   | 16 ++++++++++++\n>  userdiff.c                               | 16 ++++++++++++\n>  13 files changed, 117 insertions(+)\n>  create mode 100644 t/t4018/typescript-arrow-function\n>  create mode 100644 t/t4018/typescript-class-member-function\n>  create mode 100644 t/t4018/typescript-enum\n>  create mode 100644 t/t4018/typescript-function\n>  create mode 100644 t/t4018/typescript-function-assignment\n>  create mode 100644 t/t4018/typescript-interface\n>  create mode 100644 t/t4018/typescript-type\n>  create mode 100644 t/t4034/typescript/expect\n>  create mode 100644 t/t4034/typescript/post\n>  create mode 100644 t/t4034/typescript/pre\n> \n> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> index 4338d023d9..4461c41054 100644\n> --- a/Documentation/gitattributes.txt\n> +++ b/Documentation/gitattributes.txt\n> @@ -902,6 +902,8 @@ patterns are available:\n>  \n>  - `tex` suitable for source code for LaTeX documents.\n>  \n> +- `typescript` suitable for source code for TypeScript language.\n> +\n>  \n>  Customizing word diff\n>  ^^^^^^^^^^^^^^^^^^^^^\n> diff --git a/t/t4018/typescript-arrow-function b/t/t4018/typescript-arrow-function\n> new file mode 100644\n> index 0000000000..85a3d9cd6b\n> --- /dev/null\n> +++ b/t/t4018/typescript-arrow-function\n> @@ -0,0 +1,4 @@\n> +const RIGHT = (one) => {\n> +    someMethodCall();\n> +    return ChangeMe;\n> +}\n> diff --git a/t/t4018/typescript-class-member-function b/t/t4018/typescript-class-member-function\n> new file mode 100644\n> index 0000000000..f34b0a2bac\n> --- /dev/null\n> +++ b/t/t4018/typescript-class-member-function\n> @@ -0,0 +1,7 @@\n> +class Test {\n> +\tvar one;\n> +\tfunction RIGHT(two: string) {\n> +\t\tsomeMethodCall();\n> +\t\treturn ChangeMe;\n> +\t}\n> +}\n> diff --git a/t/t4018/typescript-enum b/t/t4018/typescript-enum\n> new file mode 100644\n> index 0000000000..8c045a45ec\n> --- /dev/null\n> +++ b/t/t4018/typescript-enum\n> @@ -0,0 +1,6 @@\n> +enum RIGHT {\n> +    ONE = 1,\n> +    TWO,\n> +    THREE,\n> +    ChangeMe\n> +}\n> diff --git a/t/t4018/typescript-function b/t/t4018/typescript-function\n> new file mode 100644\n> index 0000000000..62cf63f669\n> --- /dev/null\n> +++ b/t/t4018/typescript-function\n> @@ -0,0 +1,4 @@\n> +function RIGHT<Type implements AnotherType>(one: number): Type {\n> +    someMethodCall();\n> +    return ChangeMe;\n> +}\n> diff --git a/t/t4018/typescript-function-assignment b/t/t4018/typescript-function-assignment\n> new file mode 100644\n> index 0000000000..49c528713e\n> --- /dev/null\n> +++ b/t/t4018/typescript-function-assignment\n> @@ -0,0 +1,4 @@\n> +const RIGHT = function(one: number): Type {\n> +    someMethodCall();\n> +    return ChangeMe;\n> +}\n> diff --git a/t/t4018/typescript-interface b/t/t4018/typescript-interface\n> new file mode 100644\n> index 0000000000..6f3665c2af\n> --- /dev/null\n> +++ b/t/t4018/typescript-interface\n> @@ -0,0 +1,4 @@\n> +interface RIGHT {\n> +  one?: string;\n> +  [propName: ChangeMe]: any;\n> +}\n> \\ No newline at end of file\n> diff --git a/t/t4018/typescript-type b/t/t4018/typescript-type\n> new file mode 100644\n> index 0000000000..e1bb2d8371\n> --- /dev/null\n> +++ b/t/t4018/typescript-type\n> @@ -0,0 +1,4 @@\n> +type RIGHT = {\n> +  one: number,\n> +  ChangeMe: CustomType\n> +}\n> \\ No newline at end of file\n> diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\n> index 74586f3813..4e3cf415c2 100755\n> --- a/t/t4034-diff-words.sh\n> +++ b/t/t4034-diff-words.sh\n> @@ -338,6 +338,7 @@ test_language_driver python\n>  test_language_driver ruby\n>  test_language_driver scheme\n>  test_language_driver tex\n> +test_language_driver typescript\n>  \n>  test_expect_success 'word-diff with diff.sbe' '\n>  \tcat >pre <<-\\EOF &&\n> diff --git a/t/t4034/typescript/expect b/t/t4034/typescript/expect\n> new file mode 100644\n> index 0000000000..19605fec4d\n> --- /dev/null\n> +++ b/t/t4034/typescript/expect\n> @@ -0,0 +1,33 @@\n> +<BOLD>diff --git a/pre b/post<RESET>\n> +<BOLD>index e4a51a2..9c56465 100644<RESET>\n> +<BOLD>--- a/pre<RESET>\n> +<BOLD>+++ b/post<RESET>\n> +<CYAN>@@ -1,16 +1,16 @@<RESET>\n> +log(\"Hello World<RED>!\\n<RESET><GREEN>?<RESET>\")\n> +<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>) u<RESET>'<RED>x<RESET><GREEN>y<RESET>'\n> +!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n> +<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n> +<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n> +<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <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\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n> +<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n> +<GREEN>x<RESET>&<RED>b\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n> +<GREEN>x<RESET>^<RED>b\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n> +<GREEN>x<RESET>|<RED>b\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n> +<GREEN>x<RESET>&&<RED>b\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n> +<GREEN>x<RESET>||<RED>b\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n> +<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\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 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\n> <RESET>\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n> +<GREEN>x<RESET>,y\n> diff --git a/t/t4034/typescript/post b/t/t4034/typescript/post\n> new file mode 100644\n> index 0000000000..b1b03a7666\n> --- /dev/null\n> +++ b/t/t4034/typescript/post\n> @@ -0,0 +1,16 @@\n> +log(\"Hello World?\")\n> +(1) (-1e10) (0xabcdef) u'y'\n> +!x ~x x++ x-- x*y x&y\n> +x*y x/y x%y\n> +x+y x-y\n> +x<<y x>>y\n> +x<y x<=y x>y x>=y\n> +x==y x!=y\n> +x&y\n> +x^y\n> +x|y\n> +x&&y\n> +x||y\n> +x?y:z\n> +x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n> +x,y\n> diff --git a/t/t4034/typescript/pre b/t/t4034/typescript/pre\n> new file mode 100644\n> index 0000000000..13a0b2138c\n> --- /dev/null\n> +++ b/t/t4034/typescript/pre\n> @@ -0,0 +1,16 @@\n> +log(\"Hello World!\\n\")\n> +1 -1e10 0xabcdef 'x'\n> +!a ~a a++ a-- a*b a&b\n> +a*b a/b a%b\n> +a+b a-b\n> +a<<b a>>b\n> +a<b a<=b a>b a>=b\n> +a==b a!=b\n> +a&b\n> +a^b\n> +a|b\n> +a&&b\n> +a||b\n> +a?b:z\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,y\n> diff --git a/userdiff.c b/userdiff.c\n> index 92ef649c99..dbb5d7c072 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -297,6 +297,22 @@ PATTERNS(\"scheme\",\n>  \t \"|([^][)(}{[ \\t])+\"),\n>  PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n>  \t \"\\\\\\\\[a-zA-Z@]+|\\\\\\\\.|([a-zA-Z0-9]|[^\\x01-\\x7f])+\"),\n> +PATTERNS(\"typescript\",\n> +         \"^[ \\t]*((enum|interface|type)[ \\t]+([a-zA-Z][a-zA-Z0-9]*)+.*)$\\n\"\n> +         /* Method definitions */\n> +         \"^[ \\t]*[a-z]+[ \\t]+([A-Za-z_][A-Za-z_0-9]*)+([ \\t]*=[ \\t]*(function)?)?([ \\t]*[A-Za-z_<>&][?&<>|.,A-Za-z_]*[ \\t]*)*[ \\t]*\\\\([^;]*$\",\n> +         /* -- */\n> +         \"[a-zA-Z_][a-zA-Z0-9_]*\"\n> +         /* Integers and floats */\n> +         \"|[-+]?[0-9]*\\\\.?[0-9]+([eE][-+]?[0-9]+)?\"\n> +         /* Binary */\n> +         \"|0[bB][01]+\"\n> +         /* Hexadecimals */\n> +         \"|0[xX][0-9a-fA-F]+\"\n> +         /* Floats starting with a decimal point */\n> +         \"|[-+]?([0-9]*\\\\.?[0-9]+|[0-9]+\\\\.?[0-9]*)([eE][-+]?[0-9]+)?\"\n> +         /* Operators */\n> +         \"[-+*/%&|^!=<>]=?|===|!==|<<=?|>>=?|&&|\\\\|\\\\||\\\\?\\\\?|\\\\+\\\\+|--|~\"),\n>  { \"default\", NULL, NULL, -1, { NULL, 0 } },\n>  };\n>  #undef PATTERNS\n> -- \n> 2.34.1\n> \n> \n"},{"id":"491468","messageId":"CAOLa=ZTSHSErXaZjwxERLgjejqws5fgs43+RoUXp2cgn0fs_Eg@mail.gmail.com","threadId":"61155","inReplyTo":"20240324174423.55508-1-utsavp0213@gmail.com","subject":"Re: [PATCH] userdiff: add builtin driver for typescript language","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2024-03-25T17:23:11Z","receivedAt":"2024-03-25T17:23:13Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Utsav Parmar <utsavp0213@gmail.com> writes:\n\nHello,\n\n> There are no implementation or test changes in this patch. It simply relies on the git formatting rather than the IDE git UI formatting that I believe messed up in the parent email.\n>\n\nI think Patrick mentioned this already, but seems like the new patch\ntoo needs to be wrapped to 72 chars. Also when we send a follow up\npatch, we version it accordingly like \"[PATCH v2]\". I would suggest\nreading 'Documentation/MyFirstContribution.txt'.\n"},{"id":"492251","messageId":"20240404163827.5855-1-utsavp0213@gmail.com","threadId":"61155","inReplyTo":"20240324174423.55508-1-utsavp0213@gmail.com","subject":"[PATCH v2] userdiff: add builtin driver for typescript language","fromName":"Utsav Parmar","fromEmail":"utsavp0213@gmail.com","sentAt":"2024-04-04T16:38:27Z","receivedAt":"2024-04-04T16:38:55Z","isPatch":true,"sender":{"key":"utsavp0213@gmail.com","avatar":null},"body":"Signed-off-by: Utsav Parmar <utsavp0213@gmail.com>\n---\n Documentation/gitattributes.txt          |  2 ++\n t/t4018/typescript-arrow-function        |  4 +++\n t/t4018/typescript-class-member-function |  7 +++++\n t/t4018/typescript-enum                  |  6 +++++\n t/t4018/typescript-function              |  4 +++\n t/t4018/typescript-function-assignment   |  4 +++\n t/t4018/typescript-interface             |  4 +++\n t/t4018/typescript-type                  |  4 +++\n t/t4034-diff-words.sh                    |  1 +\n t/t4034/typescript/expect                | 33 ++++++++++++++++++++++++\n t/t4034/typescript/post                  | 16 ++++++++++++\n t/t4034/typescript/pre                   | 16 ++++++++++++\n userdiff.c                               | 16 ++++++++++++\n 13 files changed, 117 insertions(+)\n create mode 100644 t/t4018/typescript-arrow-function\n create mode 100644 t/t4018/typescript-class-member-function\n create mode 100644 t/t4018/typescript-enum\n create mode 100644 t/t4018/typescript-function\n create mode 100644 t/t4018/typescript-function-assignment\n create mode 100644 t/t4018/typescript-interface\n create mode 100644 t/t4018/typescript-type\n create mode 100644 t/t4034/typescript/expect\n create mode 100644 t/t4034/typescript/post\n create mode 100644 t/t4034/typescript/pre\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 4338d023d9..4461c41054 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -902,6 +902,8 @@ patterns are available:\n \n - `tex` suitable for source code for LaTeX documents.\n \n+- `typescript` suitable for source code for TypeScript language.\n+\n \n Customizing word diff\n ^^^^^^^^^^^^^^^^^^^^^\ndiff --git a/t/t4018/typescript-arrow-function b/t/t4018/typescript-arrow-function\nnew file mode 100644\nindex 0000000000..85a3d9cd6b\n--- /dev/null\n+++ b/t/t4018/typescript-arrow-function\n@@ -0,0 +1,4 @@\n+const RIGHT = (one) => {\n+    someMethodCall();\n+    return ChangeMe;\n+}\ndiff --git a/t/t4018/typescript-class-member-function b/t/t4018/typescript-class-member-function\nnew file mode 100644\nindex 0000000000..f34b0a2bac\n--- /dev/null\n+++ b/t/t4018/typescript-class-member-function\n@@ -0,0 +1,7 @@\n+class Test {\n+\tvar one;\n+\tfunction RIGHT(two: string) {\n+\t\tsomeMethodCall();\n+\t\treturn ChangeMe;\n+\t}\n+}\ndiff --git a/t/t4018/typescript-enum b/t/t4018/typescript-enum\nnew file mode 100644\nindex 0000000000..8c045a45ec\n--- /dev/null\n+++ b/t/t4018/typescript-enum\n@@ -0,0 +1,6 @@\n+enum RIGHT {\n+    ONE = 1,\n+    TWO,\n+    THREE,\n+    ChangeMe\n+}\ndiff --git a/t/t4018/typescript-function b/t/t4018/typescript-function\nnew file mode 100644\nindex 0000000000..62cf63f669\n--- /dev/null\n+++ b/t/t4018/typescript-function\n@@ -0,0 +1,4 @@\n+function RIGHT<Type implements AnotherType>(one: number): Type {\n+    someMethodCall();\n+    return ChangeMe;\n+}\ndiff --git a/t/t4018/typescript-function-assignment b/t/t4018/typescript-function-assignment\nnew file mode 100644\nindex 0000000000..49c528713e\n--- /dev/null\n+++ b/t/t4018/typescript-function-assignment\n@@ -0,0 +1,4 @@\n+const RIGHT = function(one: number): Type {\n+    someMethodCall();\n+    return ChangeMe;\n+}\ndiff --git a/t/t4018/typescript-interface b/t/t4018/typescript-interface\nnew file mode 100644\nindex 0000000000..6f3665c2af\n--- /dev/null\n+++ b/t/t4018/typescript-interface\n@@ -0,0 +1,4 @@\n+interface RIGHT {\n+  one?: string;\n+  [propName: ChangeMe]: any;\n+}\n\\ No newline at end of file\ndiff --git a/t/t4018/typescript-type b/t/t4018/typescript-type\nnew file mode 100644\nindex 0000000000..e1bb2d8371\n--- /dev/null\n+++ b/t/t4018/typescript-type\n@@ -0,0 +1,4 @@\n+type RIGHT = {\n+  one: number,\n+  ChangeMe: CustomType\n+}\n\\ No newline at end of file\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex 74586f3813..4e3cf415c2 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -338,6 +338,7 @@ test_language_driver python\n test_language_driver ruby\n test_language_driver scheme\n test_language_driver tex\n+test_language_driver typescript\n \n test_expect_success 'word-diff with diff.sbe' '\n \tcat >pre <<-\\EOF &&\ndiff --git a/t/t4034/typescript/expect b/t/t4034/typescript/expect\nnew file mode 100644\nindex 0000000000..19605fec4d\n--- /dev/null\n+++ b/t/t4034/typescript/expect\n@@ -0,0 +1,33 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index e4a51a2..9c56465 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,16 +1,16 @@<RESET>\n+log(\"Hello World<RED>!\\n<RESET><GREEN>?<RESET>\")\n+<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>) u<RESET>'<RED>x<RESET><GREEN>y<RESET>'\n+!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b a<RESET><GREEN>y x<RESET>%<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET><<<RED>b a<RESET><GREEN>y x<RESET>>><RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<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\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>==<RED>b a<RESET><GREEN>y x<RESET>!=<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>&<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>^<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>|<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>&&<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>||<RED>b\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>?<RED>b<RESET><GREEN>y<RESET>:z\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 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\n<RESET>\n+<RED>a<RESET><GREEN>y\n<RESET>\n+<GREEN>x<RESET>,y\ndiff --git a/t/t4034/typescript/post b/t/t4034/typescript/post\nnew file mode 100644\nindex 0000000000..b1b03a7666\n--- /dev/null\n+++ b/t/t4034/typescript/post\n@@ -0,0 +1,16 @@\n+log(\"Hello World?\")\n+(1) (-1e10) (0xabcdef) u'y'\n+!x ~x x++ x-- x*y x&y\n+x*y x/y x%y\n+x+y x-y\n+x<<y x>>y\n+x<y x<=y x>y x>=y\n+x==y x!=y\n+x&y\n+x^y\n+x|y\n+x&&y\n+x||y\n+x?y:z\n+x=y x+=y x-=y x*=y x/=y x%=y x<<=y x>>=y x&=y x^=y x|=y\n+x,y\ndiff --git a/t/t4034/typescript/pre b/t/t4034/typescript/pre\nnew file mode 100644\nindex 0000000000..13a0b2138c\n--- /dev/null\n+++ b/t/t4034/typescript/pre\n@@ -0,0 +1,16 @@\n+log(\"Hello World!\\n\")\n+1 -1e10 0xabcdef 'x'\n+!a ~a a++ a-- a*b a&b\n+a*b a/b a%b\n+a+b a-b\n+a<<b a>>b\n+a<b a<=b a>b a>=b\n+a==b a!=b\n+a&b\n+a^b\n+a|b\n+a&&b\n+a||b\n+a?b:z\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,y\ndiff --git a/userdiff.c b/userdiff.c\nindex 92ef649c99..dbb5d7c072 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -297,6 +297,22 @@ PATTERNS(\"scheme\",\n \t \"|([^][)(}{[ \\t])+\"),\n PATTERNS(\"tex\", \"^(\\\\\\\\((sub)*section|chapter|part)\\\\*{0,1}\\\\{.*)$\",\n \t \"\\\\\\\\[a-zA-Z@]+|\\\\\\\\.|([a-zA-Z0-9]|[^\\x01-\\x7f])+\"),\n+PATTERNS(\"typescript\",\n+         \"^[ \\t]*((enum|interface|type)[ \\t]+([a-zA-Z][a-zA-Z0-9]*)+.*)$\\n\"\n+         /* Method definitions */\n+         \"^[ \\t]*[a-z]+[ \\t]+([A-Za-z_][A-Za-z_0-9]*)+([ \\t]*=[ \\t]*(function)?)?([ \\t]*[A-Za-z_<>&][?&<>|.,A-Za-z_]*[ \\t]*)*[ \\t]*\\\\([^;]*$\",\n+         /* -- */\n+         \"[a-zA-Z_][a-zA-Z0-9_]*\"\n+         /* Integers and floats */\n+         \"|[-+]?[0-9]*\\\\.?[0-9]+([eE][-+]?[0-9]+)?\"\n+         /* Binary */\n+         \"|0[bB][01]+\"\n+         /* Hexadecimals */\n+         \"|0[xX][0-9a-fA-F]+\"\n+         /* Floats starting with a decimal point */\n+         \"|[-+]?([0-9]*\\\\.?[0-9]+|[0-9]+\\\\.?[0-9]*)([eE][-+]?[0-9]+)?\"\n+         /* Operators */\n+         \"[-+*/%&|^!=<>]=?|===|!==|<<=?|>>=?|&&|\\\\|\\\\||\\\\?\\\\?|\\\\+\\\\+|--|~\"),\n { \"default\", NULL, NULL, -1, { NULL, 0 } },\n };\n #undef PATTERNS\n-- \n2.34.1\n\n"},{"id":"492309","messageId":"xmqqedbjvh7e.fsf@gitster.g","threadId":"61155","inReplyTo":"20240404163827.5855-1-utsavp0213@gmail.com","subject":"Re: [PATCH v2] userdiff: add builtin driver for typescript language","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-04-05T17:43:01Z","receivedAt":"2024-04-05T17:43:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Utsav Parmar <utsavp0213@gmail.com> writes:\n\n> Subject: Re: [PATCH v2] userdiff: add builtin driver for typescript language\n\n\"builtin driver\" -> \"patterns\", probably, as the \"userdiff\"\ncustomization does not allow adding any new code.\n\n> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> index 4338d023d9..4461c41054 100644\n> --- a/Documentation/gitattributes.txt\n> +++ b/Documentation/gitattributes.txt\n> @@ -902,6 +902,8 @@ patterns are available:\n>  \n>  - `tex` suitable for source code for LaTeX documents.\n>  \n> +- `typescript` suitable for source code for TypeScript language.\n> +\n\nGood that you did not forget to add an entry to this list (and to\nthe right place).\n\n> diff --git a/t/t4018/typescript-function-assignment b/t/t4018/typescript-function-assignment\n> new file mode 100644\n> index 0000000000..49c528713e\n> --- /dev/null\n> +++ b/t/t4018/typescript-function-assignment\n> @@ -0,0 +1,4 @@\n> +const RIGHT = function(one: number): Type {\n> +    someMethodCall();\n> +    return ChangeMe;\n> +}\n> diff --git a/t/t4018/typescript-interface b/t/t4018/typescript-interface\n> new file mode 100644\n> index 0000000000..6f3665c2af\n> --- /dev/null\n> +++ b/t/t4018/typescript-interface\n> @@ -0,0 +1,4 @@\n> +interface RIGHT {\n> +  one?: string;\n> +  [propName: ChangeMe]: any;\n> +}\n> \\ No newline at end of file\n\nI do not speak typescript, but is it important for the language that\nthe sources can be stored with an incomplete line at the end of the\nfile?  IOW, I am wondering if it is deliberate *and* matters to the\ntests that some sample files end with an incomplete line while\nothers do not.\n\nIf that is not the case, please fix this and the next file; we do\nnot generally want a file with an incomplete line at the end unless\nthere is a compelling reason to (i.e., we do test that our tools\nwork with such files, and it may be convenient to ship sample input\nwith incomplete lines to run such tests).\n\nAs to the actual pattern and the words the patterns catch, I have no\nidea if they are sensible for typescript language---folks with more\nexperience than myself should lend their eyeballs to review.\n\nThanks.\n"},{"id":"492312","messageId":"xmqqa5m7vh0q.fsf@gitster.g","threadId":"61155","inReplyTo":"20240404163827.5855-1-utsavp0213@gmail.com","subject":"Re: [PATCH v2] userdiff: add builtin driver for typescript language","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-04-05T17:47:01Z","receivedAt":"2024-04-05T17:47:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Utsav Parmar <utsavp0213@gmail.com> writes:\n\n>...\n> diff --git a/t/t4034/typescript/expect b/t/t4034/typescript/expect\n> new file mode 100644\n> index 0000000000..19605fec4d\n> --- /dev/null\n> +++ b/t/t4034/typescript/expect\n> @@ -0,0 +1,33 @@\n> +<BOLD>diff --git a/pre b/post<RESET>\n> +<BOLD>index e4a51a2..9c56465 100644<RESET>\n> +<BOLD>--- a/pre<RESET>\n> +<BOLD>+++ b/post<RESET>\n> +<CYAN>@@ -1,16 +1,16 @@<RESET>\n> +log(\"Hello World<RED>!\\n<RESET><GREEN>?<RESET>\")\n> +<GREEN>(<RESET>1<GREEN>) (<RESET>-1e10<GREEN>) (<RESET>0xabcdef<GREEN>) u<RESET>'<RED>x<RESET><GREEN>y<RESET>'\n> +!<RED>a<RESET><GREEN>x<RESET> ~<RED>a a<RESET><GREEN>x x<RESET>++ <RED>a<RESET><GREEN>x<RESET>-- <RED>a<RESET><GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>&<RED>b\n> <RESET>\n\nThere is a funny line-wrapping around here that corrupts the patch.\n\n> +<RED>a<RESET><GREEN>y\n> <RESET>\n"}]}