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

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

 



Am 04.03.22 um 13:28 schrieb Jaydeep Das:
> On 3/4/22 01:34, Johannes Sixt wrote:
>> Am 03.03.22 um 12:41 schrieb Jaydeep Das:
>>> How about modifying the number match regex to:
>>>
>>> `[0-9._]+([Ee][-+]?[0-9]+)?[fFlLuU]*[^a-zA-Z]` ?
>>>
>>> The `[^a-zA-Z]` in the end would make sure to not match
>>> the `.F` in `X.Find`.
>  
>> No, you cannot do that, because then in X.u+1 you have three tokens X
>> .u+ 1, which you do not want, either.
> 
> If X is an integer here, then

No, I mean X literally, i.e., an identifier.

> 
> In C/C++ 2.f is equivalent to 2.000000
> However in Kotlin 2.f is invalid syntax. 2.0f is valid.
> 
> So is implementing a proper regex for invalid syntax really
> necessary?

No, that's not necessary. It can be assumed that invalid syntax does not
occur. For this reason...

>> Have a look at the regex in the cpp driver. I think we need something
>> like this:
>>
>>    /* integers floatingpoint numbers */
>>    "|[0-9][0-9_.]*([Ee][*-]?[0-9]+)?[FfLl]*"

... I propose this loose [0-9_.]* after the first digit, even though it
would match "9.8_7._65"; we can assume that this invalid token will not
occur.

BTW, make that [FfLlUl] near the end.

>>    /* floatingpoint numbers that begin with a decimal point */
>>    "|[.][0-9][0-9_]*([Ee][*-]?[0-9]+)?[FfLl]*"
> 
> 
>> Drop the second option if numbers such as .5 are invalid syntax in
>> Kotlin.
> .5 is valid syntax in Kotlin.

OK, then we need this second branch, which ensures that there is a digit
after the fullstop.

-- 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