Switch from fast_double_parser to fast_float#108
Open
sirosen wants to merge 3 commits intoKijewski:mainfrom
Open
Switch from fast_double_parser to fast_float#108sirosen wants to merge 3 commits intoKijewski:mainfrom
sirosen wants to merge 3 commits intoKijewski:mainfrom
Conversation
The only oddity in here is handling around `std::errc` because `0` is not part of the named enum values. As a workaround, treat the enum type as an int, and explicitly cast it when comparing it against `0`.
This more accurately matches the supported types for the JSON5 spec.
Owner
|
Thank you very much for working on that! I'll try to have a look in the next few days. (I wonder why the CI did not run for you PR, I'll have to investigate that.) |
`fast_float` allows for exponents containing floats, which are not allowed per the JSON5 spec. Constraining `fast_float` to a format which does not allow for these exponents results in other supported usages being rejected. To handle this, explicitly check by adding a new guard. `has_invalid_exponent` is a string scan which returns true if it finds a suffix on the string which looks like an invalid exponent.
Author
|
I was able to confirm that the string I think it's now in good shape -- all tests pass -- and I hopefully have some more contributions to follow! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First off, thanks for maintaining this library!
I'm trying to pitch in a bit to help and make sure things stay healthy.
It's my first time working with Cython, so I'll be a little slow to make changes.
This PR swaps the fast_double_parser for fast_float, per the deprecation warning cited in #83.
It all works cleanly except for a small number of tests regarding scientific notation.
I could use some input on how to push this over the finish line.
None of the
fast_floatbehaviors matches what the JSON5 tests expect, and the one which is labeledjson_or_infnanseems like the best fit for the spec in spirit.Right now, I'm seeing
pyjson5.loads(1e2.3)return100, which is definitely wrong.But I haven't yet figured out where the issue is. I would guess (from the above) that somehow it's truncating the data to
1e2.