gurkankaymak / hocon

go implementation of lightbend's HOCON configuration library https://github.com/lightbend/config
MIT License
79 stars 17 forks source link

Unable to have String starting with the digits #32

Closed floating-cat closed 1 year ago

floating-cat commented 1 year ago

Example config1:

uuid = 123e4567-e89b-12d3-a456-426614174000

Error:

error: strconv.ParseFloat: parsing "123e4567": value out of range

Example2:

id = 123abc

Error:

error: missing comma! at: 1:9, values should have comma or ASCII newline ('\n') between them

This library recognizes the String starting with the digits as a number. But these are two valid strings "123e4567-e89b-12d3-a456-426614174000", "123e4567":

https://github.com/lightbend/config/blob/main/HOCON.md#string-value-concatenation

The value of an object field or array element may consist of multiple values which are combined. There are three kinds of value concatenation: if all the values are simple values (neither objects nor arrays), they are concatenated into a string. ..... For purposes of string value concatenation, non-string values are converted to strings as follows (strings shown as quoted strings): numbers should be kept as they were originally written in the file. For example, if you parse 1e5 then you might render it alternatively as 1E5 with capital E, or just 100000. For purposes of value concatenation, it should be rendered as it was written in the file.

In https://hocon-playground.avelier.dev/, these can be recognized correctly: image

sholsapp commented 1 year ago

Ah, this is impacting me, too.