uucore: format: Collection of small parser fixes #7623
Merged
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.
Stacks on top of #7556. A bunch of fixes and additions to parsing code that brings common core parsing to parity with
seqimplementation, and will allow the customseqparser to be removed in the next PR.uucore: format: Remove TODO
Not much more that can be easily simplified now.
uucore: format: num_parser: Allow uppercase exponent
1E3 and 0x1P3 are acceptable numbers.
Sprinkle uppercase values in the tests.
uucore: format: num_parser: underflow/overflow check
When parsing floating point numbers, return errors if we end up
overflowing/underflowing BigDecimal (e.g. with large/small exponents).
uucore: format: num_parser: Add value to Overflow error
When parsing integers, we should still return the min/max value
of the type (depending on the type), and wrap that in the error.
We need to refactor the map function to handle this case better,
and add an extract function to get the value out of an error
(if any).
This fixes the integer part of #7508.
uucore: format: Fix i64::MIN printing
-i64::MIN overflows i64, so cast to i128 first.
uucore: format: num_parser: Carve out part of parse function
We'll need more logic in there.
uucore: format: num_parser: "infinity" string parsing
Not just "inf" is allowed, also "infinity".
uucore: format: extendedbigdecimal: Implement Neg trait
This is useful and will simplify some of the parsing logic later.