-
Notifications
You must be signed in to change notification settings - Fork 808
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
Fix Parsing Special Numbers #1391
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most comment are the same for float double streaming and complete version
805e5be
to
c734f41
Compare
@Stargateur Speaking of which, I'm guessing it's a good idea to not mark any internal functions public? I did this somewhat because nom does it a lot internally, but it's probably not a good idea... |
Oh, well, I think unless someone have a good reason yeah we should not introduce too many pub item. |
Ok I believe every requested change has been made. |
($input:ident, $t:ident) => {{ | ||
let (input, sign) = sign($input.clone())?; | ||
let b = input.as_bytes(); | ||
let (mut float, count) = if b.len() >= 3 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will not parse correctly in streaming: If we get Na
as partial input it will return an error instead of Incomplete (once we refill the buffer, the next character could be N
and we get NaN
).
The Compare trait already handles those cases
Closes #1384, by adding logic to specially handle special floating-point numbers. This should correctly handle both streaming and complete parsers, and the unittests seem to confirm this, but a double-check of my logic would be appreciated.