kowainik / tomland

🏝 Bidirectional TOML serialization
https://kowainik.github.io/posts/2019-01-14-tomland
Mozilla Public License 2.0
120 stars 39 forks source link

Numbers with leading zero #333

Closed dariodsa closed 3 years ago

dariodsa commented 4 years ago

Currently tomland interprets decimal numbers with leading zeros into zero. That is not really in the spirit of a TOML-0.5.0. According to the documentation:

Leading zeros are not allowed. Integer values -0 and +0 are valid and identical to an unprefixed zero.

For this behaviour is responsible zero parser in function decimalP. https://github.com/kowainik/tomland/blob/316c893a10d1dc652bbcc46f7f8862974941244e/src/Toml/Parser/Value.hs#L37-L38 So the type of parser should allow leading zero only if it is the only digit in the number, otherwise it shouldn't be allowed to come first.

chshersh commented 3 years ago

Resolved by #344