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

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

 



Sorry for the late reply.
On 3/9/22 12:02 AM, Johannes Sixt <j6t@xxxxxxxx> wrote:
Am 08.03.22 um 17:54 schrieb jaydeepjd.8914@xxxxxxxxx:
> So, the final regexes are these, right?:

Not quite.

>
>       "[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_]+([Ee][-+]?[0-9]+)?[fFlLuU]*"

This would not match 12.5 because you allow only a single digit before
the decimal point. Perhaps

	"|[0-9][.0-9_]*([Ee][-+]?[0-9]+)?[fFlLuU]*"

Okay.
>       /* floating point numbers beginning with decimal point */
>       "|[.][0-9][0-9_]*([Ee][-+]?[0-9]+)?[fFlL]?"
>       /* unary and binary operators */
> > "|[-+*/<>%&^|=!]?==?|--|\\+\\+|<<=|>>=|&&|[||]|->|\\.\\*|!!|::|[?:.][.:]"),

[||] does not work as you intend. A new suggestion: do not start with an
initial optional character in order to reduce the number of
backtrackings that the regular expression evaluation has to do. I would
write this line as

	"|[-+*/<>%&^|=!]==?|--|\\+\\+|<<=|>>=|&&|\\|\\||->|\\.\\*|!!|::|[?:.][.:]"),

BTW which operators are handled by "[?:.][.:]"? I'm asking because you
list :: separatly that would also be matched by this sub-expression.

It matches the following operators: `?:`, `?.`, `..` `::`. Although matching `::` is
unnecessary since its matched before.

https://kotlinlang.org/docs/keyword-reference.html#operators-and-special-symbols







[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