nano-devel
[Top][All Lists]
Advanced

[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: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] syntax: go: fix bugs in number literal regex
Date: Mon, 8 Jan 2018 21:11:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0


    color red "\<0([0-7]*|[xX][0-9a-fA-F]+)\>"
    color red "(\<0+|\B)\.[0-9]+([Ee][+-]?[0-9]+)?i?\>"
    color red "\<[1-9][0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?i?\>"

Doesn't match 09.0 or 09i :(

Hm.  But does anyone _want_ to write things that way?  Wouldn't it
be more likely that those were typos for 90.0 and 90i?

I vote sticking with the old regex from commit a794c331, maybe with a
tiny bit of grouping and reordering to match the spec more closely:

color red "\<([1-9][0-9]*|0[0-7]*|0[xX][0-9A-Fa-f]+)\>"
color red "\<[0-9]+\.[0-9]*([eE][+-]?[0-9]+)?i?\>"
color red "\<[0-9]+[eE][+-]?[0-9]+i?\>"
color red "\B\.[0-9]+([eE][+-]?[0-9]+)?i?\>"
color red "\<[0-9]+i\>"

Anyone else who has an opinion on this?

Benno



reply via email to

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