Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix overly permissive parsing after whitespace (#59)
* Fix parsing logic after first whitespace The way the parse was implemented accepted additional numeric characters or `.` after the first valid `f64` literal but ignored them. This permitted more strings that are invalid following a strict grammar for byte sizes and silently ignores the further symbols without error. ``` 1.0 ...KB 1.0 42.0 B ``` This change makes those illegal. `1 000 B` was also subject to the bad `skip_while` ignoring the following `000`. In this version of the fix whitespace is not accepted as a digit separator. So it will raise an error if the user doesn't explicitly strip the whitespace instead of reporting a wrong value. * Add tests for invalid chars after whitespace * Add test documenting that whitespace is not a valid digit separator More following the old choices of using `f64::from_str` --------- Co-authored-by: Rob Ede <robjtede@icloud.com>
- Loading branch information