elm / parser

A parsing library, focused on simplicity and great error messages
https://package.elm-lang.org/packages/elm/parser/latest
BSD 3-Clause "New" or "Revised" License
230 stars 46 forks source link

float parser consumes decimal separator without fractional part #15

Open aforemny opened 6 years ago

aforemny commented 6 years ago

Hi, I have found that the float parser consumes all of the input "42.". I would have expected that it would only consume "42" since there is no fractional part. In my personal opinion, "42." is not a floating point representation, while "42" is.

Here is an Ellie demonstrating this problem: https://ellie-app.com/3gJXCLHPGqJa1

If this is not a bug, I would propose to document that behavior and how to work around it.

dvberkel commented 6 years ago

I am no expert, or involved in the project, just interested and motivated.

My expectation for the float parser would be that it consumes the point (.), even when no digits follow it. So I don't think this is a bug.