Re: [PATCH v6] userdiff: add builtin diff driver for kotlin language.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 12.03.22 um 05:36 schrieb jaydeepjd.8914@xxxxxxxxx:
> On 3/12/22 1:37 AM, Johannes Sixt <j6t@xxxxxxxx> wrote:
>> Am 11.03.22 um 08:27 schrieb Jaydeep P Das:
>> > diff --git a/userdiff.c b/userdiff.c
>> > index 8578cb0d12..c416c9b426 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]*"
>>
>> This line matches a non-empty digit sequence of any length, and I
>> thought the longest match would win. Why is that not the case here?
>> Frankly, I'm scratching my head over it. Any ideas?
> 
> Yes. The capture group ([.][0-9_]*) should occur once or zero times. So
> this `([.][0-9_]*)?` will fix it.

Oh, good catch! That's the missing piece.

-- Hannes



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux