Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stringify produces invalid floating point number #47

Open
martykube opened this issue Mar 15, 2022 · 0 comments
Open

Stringify produces invalid floating point number #47

martykube opened this issue Mar 15, 2022 · 0 comments

Comments

@martykube
Copy link

martykube commented Mar 15, 2022

This example is for iarna-toml 2.2.5 and node v16.13.1.

const TOML = require('@iarna/toml')
undefined
> config = TOML.parse('[config]\nvalue=1e-11')
{ config: { value: 1e-11 } }
> TOML.stringify(config)
'[config]\nvalue = 1e-11.0\n'
> TOML.parse(TOML.stringify(config))
Uncaught:
TomlError: Unexpected character, expected only whitespace or comments till end of line at row 2, col 14, pos 23:
1: [config]
2> value = 1e-11.0
                ^
3: 


    at TOMLParser.parseWhitespaceToEOL (/root/mnt/fds-core-workflow/node_modules/@iarna/toml/lib/toml-parser.js:311:26)
    at TOMLParser.runOne (/root/mnt/fds-core-workflow/node_modules/@iarna/toml/lib/parser.js:64:30)
    at TOMLParser.goto (/root/mnt/fds-core-workflow/node_modules/@iarna/toml/lib/parser.js:87:17)
    at TOMLParser.recordAssignStatement (/root/mnt/fds-core-workflow/node_modules/@iarna/toml/lib/toml-parser.js:337:19)
    at TOMLParser.runOne (/root/mnt/fds-core-workflow/node_modules/@iarna/toml/lib/parser.js:64:30)
    at TOMLParser.returnNow (/root/mnt/fds-core-workflow/node_modules/@iarna/toml/lib/parser.js:107:17)
    at TOMLParser.recordAssignValue (/root/mnt/fds-core-workflow/node_modules/@iarna/toml/lib/toml-parser.js:380:19)
    at TOMLParser.runOne (/root/mnt/fds-core-workflow/node_modules/@iarna/toml/lib/parser.js:64:30)
    at TOMLParser.returnNow (/root/mnt/fds-core-workflow/node_modules/@iarna/toml/lib/parser.js:107:17)
    at TOMLParser.parseNumberExponent (/root/mnt/fds-core-workflow/node_modules/@iarna/toml/lib/toml-parser.js:903:21) {
  fromTOML: true,
  wrapped: null,
  line: 1,
  col: 13,
  pos: 23
}
> quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant