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

Error while parsing floating point numbers inside collection #41

Open
wpeers opened this issue Jun 5, 2018 · 1 comment
Open

Error while parsing floating point numbers inside collection #41

wpeers opened this issue Jun 5, 2018 · 1 comment

Comments

@wpeers
Copy link

wpeers commented Jun 5, 2018

Works fine
0>** EDN.read("1.0M")
=> 1.0
Works fine
0>** EDN.read("[ 1M ]")
=> [1]
Error: M parsed as separate element
0> EDN.read("[ 1.0M ]")
=> [1.0, M]
Error: M parsed as separate element
0> EDN.read("{10.0M}")
=> {10.0=>M}
Error: M parsed as separate element
0> EDN.read("{:value 10.0M}")
=> Need an even number of items for a map`

@edporras
Copy link

edporras commented Jun 5, 2018

Output of edn vs. edn + edn_turbo using ruby 2.4.1:

[1] pry(main)> require 'edn'
=> true
[2] pry(main)> EDN.read("1.0M") 
=> 1.0
[3] pry(main)> EDN.read("[ 1M ]")
=> [1]
[4] pry(main)> EDN.read("[ 1.0M ]")
=> [1.0, #<EDN::Type::Symbol:0x007fb9639c4950 @symbol=:M>]
[5] pry(main)> EDN.read("{10.0M}")
=> {10.0=>#<EDN::Type::Symbol:0x007fb96396f7c0 @symbol=:M>}
[6] pry(main)> EDN.read("{:value 10.0M}")
RuntimeError: Need an even number of items for a map
[7] pry(main)> require 'edn_turbo'
=> true
[8] pry(main)> EDN.read("1.0M")
=> 0.1e1
[9] pry(main)> EDN.read("[ 1M ]")
=> [1]
[10] pry(main)> EDN.read("[ 1.0M ]")
=> [0.1e1]
[11] pry(main)> EDN.read("{10.0M}")
Parse error (odd number of elements in map) on line 1
[12] pry(main)> EDN.read("{:value 10.0M}")
=> {:value=>0.1e2}```

Not sure if [9] is correct or if it should match the output of [10], however.

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

2 participants