Re: [PATCH] userdiff: add builtin driver for kotlin language
- From
Jaydeep Das <jaydeepjd.8914@gmail.com>
- Date
- Mar 4, 2022, 12:28 UTC
- Message-ID
- <90596af6-0158-beb9-7fa7-9237e7cff4fb@gmail.com>
- In-Reply-To
- <c1298c9d-0f4a-40b8-b337-896f4d4777f3@kdbg.org>
On 3/4/22 01:34, Johannes Sixt wrote:
Show 7 quoted lines
> 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.
Show 16 quoted lines
>> 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.