Skip to content
New issue

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

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

Already on GitHub? # to your account

Hexadecimal values or .inf fails to get parsed #222

Closed
winitzki opened this issue Apr 27, 2023 · 2 comments · Fixed by #315
Closed

Hexadecimal values or .inf fails to get parsed #222

winitzki opened this issue Apr 27, 2023 · 2 comments · Fixed by #315
Labels
bug Something isn't working has-pr

Comments

@winitzki
Copy link
Contributor

Yaml values such as 0xFFFF or -.inf are recognized as Integer and Double but parsing fails:

scala> println("0xFFFF".as[Int])
Left(ConstructError(Cannot parse 0xFFFF as Int
at 0:0, expected Int
0xFFFF
^ ))

scala> println("-.inf".as[Double])
Left(ConstructError(Cannot parse -.inf as Double
at 0:0, expected Double
-.inf
^ ))
@lbialy lbialy added the bug Something isn't working label May 10, 2024
@lbialy
Copy link
Contributor

lbialy commented May 10, 2024

We use String#toIntOption and String#toDoubleOption to parse ints and doubles and these strings are not supported by those parsers. I guess to support them would mean writing a custom parser for both. Is this a part of yaml spec? Are those valid values for Int or Double by spec?

@kpodsiad
Copy link
Contributor

@lbialy see https://yaml.org/spec/1.2.2/#core-schema and tag resolution

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working has-pr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants