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

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

 





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

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?


But then you can use the regex you had in the first round:

    [a-zA-Z_][a-zA-Z0-9_]*

Right. I will change that.
Numbers: `[0-9_.]+([Ee][-+]?[0-9]+)?[fFlLuU]*[^a-zA-Z]`
(It makes sure that in X.Find, .F is not matched )

Additionally, An extra regex for method calls:

`[.][a-zA-Z()0-9]+`

What do you think?

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]*"
   /* 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.

--
Thanks,
Jaydeep.






[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