[Top][All Lists]

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

Re: [Nano-devel] [PATCH] syntax: go: fix bugs in number literal regex

From: Tom Levy
Subject: Re: [Nano-devel] [PATCH] syntax: go: fix bugs in number literal regex
Date: Thu, 4 Jan 2018 15:22:29 +1300

> Applied and pushed


> Followed by a condensing patch.

> commit 5965e80a38ccf86178c5df9fcfc778f1595b00b1
> Date: Mon Jan 1 15:33:18 2018 +0100
> Messsage: "tweaks: fold some regexes into one another, for conciseness"
> diff syntax/go.nanorc # snipped and reordered
>  # Literals.
> -color red "\<[0-9]+\.[0-9]*([Ee][+-]?[0-9]+)?i?\>"
> -color red "\<[0-9]+[Ee][+-]?[0-9]+i?\>"
> -color red "\<[0-9]+i\>"
> +color red "\<[0-9]+(\.[0-9]*)?([Ee][+-]?[0-9]+)?i?\>"

The new regex is not equivalent to the old.

Go has an ugly inconsistency with octal literals: a leading 0 denotes
octal only in integer literals. So 010 == 8, but 010.0 == 10.0.

The old regex was careful not to match invalid octal integer literals
such as "09". The new regex isn't careful.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]