Re: [PATCH v4] userdiff: add builtin diff driver for Kotlin language.

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

 




> +	 /* method calls */
> +	 "|[.][a-zA-Z()0-9]+"

This matches both .empty() as well as .125, but only the .5e part of
.5e-3 and only the .find(x part of .find(x/2). Is that intended?

Oh. It completely missed my mind. Anyways, that method call regex is better gone.
For matching these,
Maybe we could just use cpp's regex for floating numbers starting with decimal point:

"|\\.[0-9][0-9]*([Ee][-+]?[0-9]+)?[fFlL]?"

Or maybe, we can make the current regex for floats and integers a bit more loose:

"|[0-9.][0-9_.]*([Ee][*-]?[0-9]+)?[FfLl]*"
What do you think would be better?



I find the desire to have method calls as an entire token a bit strange.
In other languages, the last expression part is actually split into many
tokens: . find ( x / 2 ).

BTW, I'm in no way saying that this must be changed (personally I do not
care at all as I'm not writing Kotlin), so if you say that is how people
want Kotlin code to be split with --word-diff, I will believe you.

Yes. The tokenisation does not make sense if its something like `X.find(2)`.
I think I should remove it.


> +	 /* unary and binary operators */
> +	 "|[-+*/<>%&^|=!]?=(=)?|--|\\+\\+|<<?=?|>>?=?|&&?|[|]?\\||\\|->\\*?|\\.\\*"),

Is the part

	 "|\\|->\\*?|"

actually meant to be something else? Does Kotlin have the tokens "|->"
and "|->*"?

Ah. yes. Kotlin does have "->" operator but not "|->". Also there are a few
more compound operators like ".." , "!!" etc which I forgot to add. I will add these in the next patch.
A final minor nit: There is "|&&?|[|]?\\||" that could just be
"|&&|\\|\\||" (remember: single character operators are matched implicitly).


Yes. Right.


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