Re: [PATCH] userdiff: add builtin diff driver for Kotlin language.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 1, 2022, 17:17 UTC
- Message-ID
- <xmqq8rttsic1.fsf@gitster.g>
- In-Reply-To
- <20220301155431.2534136-1-jaydeepjd.8914@gmail.com>
Jaydeep P Das <jaydeepjd.8914@gmail.com> writes:
Show 13 quoted lines
> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt > index a71dad2674..4b36d51beb 100644 > --- a/Documentation/gitattributes.txt > +++ b/Documentation/gitattributes.txt > @@ -829,6 +829,8 @@ patterns are available: > > - `java` suitable for source code in the Java language. > > +- `kotlin` suitable for source code in the Kotlin language. > + > - `markdown` suitable for Markdown documents. > > - `matlab` suitable for source code in the MATLAB and Octave languages.
I do not speak the language, but hopefully those who do will find issues and help us correct them if there still are any. The patch organization looks good. Will queue.
Thanks.
Show 18 quoted lines
> diff --git a/userdiff.c b/userdiff.c
> index 8578cb0d12..f23f098f19 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -168,6 +168,13 @@ PATTERNS("java",
> "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
> "|[-+*/<>%&^|=!]="
> "|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"),
> +PATTERNS("kotlin",
> + "^[ \t]*(([a-z]+[ \t]+)*(fun|class|interface)[ \t]+.*[ \t]*)$",
> + /* -- */
> + "[a-zA-Z_][a-zA-Z0-9_]*"
> + "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
> + "|[-+*/<>%&^|=!]="
> + "|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"),
> PATTERNS("markdown",
> "^ {0,3}#{1,6}[ \t].*",
> /* -- */