From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=1.1 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,LIST_MIRROR_RECEIVED,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UPPERCASE_50_75 shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id F2C101F670 for ; Wed, 2 Mar 2022 20:18:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241242AbiCBUTL (ORCPT ); Wed, 2 Mar 2022 15:19:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231219AbiCBUTK (ORCPT ); Wed, 2 Mar 2022 15:19:10 -0500 Received: from bsmtp1.bon.at (bsmtp1.bon.at [213.33.87.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 553F63E0CE for ; Wed, 2 Mar 2022 12:18:25 -0800 (PST) Received: from [192.168.0.98] (unknown [93.83.142.38]) by bsmtp1.bon.at (Postfix) with ESMTPSA id 4K85663lDnz5tl9; Wed, 2 Mar 2022 21:18:22 +0100 (CET) Message-ID: Date: Wed, 2 Mar 2022 21:18:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH] userdiff: add builtin driver for kotlin language Content-Language: en-US To: Jaydeep P Das References: <20220301070226.2477769-1-jaydeepjd.8914@gmail.com> <20220302142608.2754709-1-jaydeepjd.8914@gmail.com> <20220302142608.2754709-2-jaydeepjd.8914@gmail.com> Cc: git@vger.kernel.org From: Johannes Sixt In-Reply-To: <20220302142608.2754709-2-jaydeepjd.8914@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Am 02.03.22 um 15:26 schrieb Jaydeep P Das: > diff --git a/t/t4034/kotlin/expect b/t/t4034/kotlin/expect > new file mode 100644 > index 0000000000..7062b67319 > --- /dev/null > +++ b/t/t4034/kotlin/expect > @@ -0,0 +1,34 @@ > +diff --git a/pre b/post > +index 3cfa271..20d26cc 100644 > +--- a/pre > ++++ b/post > +@@ -1,21 +1,21 @@ > +println("Hello World!\n?") > +(1) (-1e10) (0xabcdef) 'xy' > +[ax] ax->b ay x.by > +!a ax x.inv() ax*b ay x&b > +ay > +x*b ay x/b ay x%b > +ay > +x+b ay x-by > +a shrshl b > +ax<b ay x<=b ay x>b ay x>=b > +ay > +x==b ay x!=b ay x===b > +ay > +x and b > +ay > +x^b > +ay > +x or b > +ay > +x&&b ay x||b > +ay > +x=b ay x+=b ay x-=b ay x*=b ay x/=b ay x%=b ay x<<=b ay x>>=b ay x&=b ay x^=b ay x|=by > +a=+=b c+==d e-=<=f g*=>=h i/=/j k%=%l m<<=<<n o>>=>>p q&=&r s^=^t u|=|v > +a<<=<=b > +a|||b a&&&b > +ax,y > +--a==!=--b > +a++==!=++b > +0xFF_EC_DE_5E 0b100_000 100_0000xFF_E1_DE_5E 0b100_100 200_000 Many of the a->x, b->y changes are redundant IMHO, but they do not hurt. This looks good. > diff --git a/userdiff.c b/userdiff.c > index 8578cb0d12..bb701100c6 100644 > --- a/userdiff.c > +++ b/userdiff.c > @@ -168,6 +168,16 @@ 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._]+([Ee][-+]?[0-9]+)?[fFlLuU]*" > + /* unary and binary operators */ > + "|[-+*/<>%&^|=!]?=(=)?|--|\\+\\+|<>?=?|&&?|[|]?\\||\\|->\\*?|\\.\\*"), Some of these sub-expressions match single-character operators, but that does not hurt. How many tokens will the word-regex find in the expression X.e+200UL? .e+200UL is a single token. Also, X.Find consists of the three tokens X .F ind. It's most easily fixed by requiring a digit before the fullstop. But if floatingpoint numbers can begin with a fullstop, then we need a second expression that requires a digit after a leading fullstop. > PATTERNS("markdown", > "^ {0,3}#{1,6}[ \t].*", > /* -- */ -- Hannes