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

fix(char)!: Generalize textual number parsing #129

Merged
merged 6 commits into from
Feb 6, 2023
Merged

Conversation

epage
Copy link
Collaborator

@epage epage commented Feb 6, 2023

In binary number parsing, the exact data type is critical to parsing, so we want to keep that front and center. However, when parsing text, the data type is an implementation detail except for overflow constraints, so let's consolidate to generalized parsers for decimal integers, hexadecimal integers, and float numbers where the type will be inferred. The json examples are a great example of this.

This did involve a bug fix to hex_uint to be more consistent with the others: we will give an overflow error if there are extra hex characters.

Fixes #121

We infer the type as it is not critical to the grammar, so it can be
implicit.

BREAKING CHANGE: `nom8`s `number::hex_u32` is removed.
We can just use type inference for which to use as its a question of
overflow and not the grammar.
Looks like these were exposed as implementation details and not user
requests

BREAKING CHANGE: `nom8`'s `character::recognize_float*` functions are
removed
The exact type only has overflow properties and does not otherwise
affect the parsing of the grammar.

BREAKING CHANGE: Compared to `nom8`, `character::u8` and friends are
replaced by `character::dec_uint` and `character::dec_int`.
@coveralls
Copy link

coveralls commented Feb 6, 2023

Pull Request Test Coverage Report for Build 4108372374

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 97 of 163 (59.51%) changed or added relevant lines in 3 files are covered.
  • 61 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.2%) to 57.138%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/character/mod.rs 77 143 53.85%
Files with Coverage Reduction New Missed Lines %
src/character/complete.rs 1 81.45%
src/character/streaming.rs 1 74.24%
src/combinator/mod.rs 59 56.16%
Totals Coverage Status
Change from base Build 4088487314: -0.2%
Covered Lines: 1737
Relevant Lines: 3040

💛 - Coveralls

@epage epage merged commit b21c772 into winnow-rs:main Feb 6, 2023
@epage epage deleted the int branch February 6, 2023 22:23
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

Successfully merging this pull request may close these issues.

More hex_u* combinators
2 participants