-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
parser: Fix 3 corner cases #7694
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
Conversation
GNU testsuite comparison:
|
8d84efe
to
b71229f
Compare
Resolved conflicts. |
can we have tests in test/by-util/ too ? |
GNU testsuite comparison:
|
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 seems fine although the Option<BigInt>
feels a bit convoluted? I wonder if all this might benefit from not using an iterator but just operating on the slice. I find that to be much easier to reason about usually. I won't mind this being merged though.
Will do (those end-to-end tests were very useful when doing refactoring...)
My first instinct (coming from more "classical" languages) was to carry that information in a boolean ( Happy to hear your suggestions though ,-)
This function badly needs some rethinking/splitting, overall. I can look a bit more into it after this (hopefully we're done with most of the big features/bug fixes work now...) |
This is mostly important when parsing digits like `.` and `0x.` where we should return an error. Fixes uutils#7684.
Numbers like 123.15e or 123.15e- should return PartialMatch. Numbers like `e`, `.e` are not valid. Fixes uutils#7685.
printf treats "0x" as a partial match of 0 and "x".
b71229f
to
fce9f79
Compare
Done! |
GNU testsuite comparison:
|
Thanks a lot ! |
This can wait a bit, e.g. after #7656 and #7675 so they don't have to rebase (I don't think there's any direct logical conflict but maybe some context).uucore: parser: num_parser: Parse "0x"/"0b" as PartialMatch
printf treats "0x" as a partial match of 0 and "x".
uucore: parser: num_parser: Ignore empty exponents
Numbers like 123.15e or 123.15e- should return PartialMatch.
Numbers like
e
,.e
are not valid.Fixes #7685.
uucore: parser: num_parser: Return error if no digit has been parsed
This is mostly important when parsing digits like
.
and0x.
where we should return an error.
Fixes #7684.