Files
Nim/lib/pure
Vindaar e80be6173d Add parse bin int, fixes #8018 (#8020)
* clarify `parseHexInt`, `parseOctInt` docstring and exception msgs

* add `parseBinInt` based on `parseutil.parseBin` implementation

Adds a `parseBinInt`, which parses a binary integer string and returns
it as an integer. This is based on the implementation of
`parseutil.parseBin`, removing the unnecessary parts.

* add tests for all `parse(Hex|Oct|Bin)Int` procs

* replace `parse*Int` proc impls by call to parseutil procs

Replaces the `parse(Hex|Oct|Bin)Int` procedure implementation by calls
to the `parseutil` procs, which receive a mutable argument.

Has the main advantage that the empty string as well as a "prefix
only" string, e.g. "0x" counts as an invalid integer.

Also moves the `parseOctInt` proc further up in the file so that all
`parse` procs are below one another.

* replace `var L` by `let L` in `parse` procs

There's no reason for the usage of `var` here.

* add `maxLen` optional arg for `parseutil.parse(Oct|Bin)`

Plus small change to test cases.

* update changelog about `parse*Int` procs

* fix `rejectParse` template in `tstrutils`

* make sure only `s.len` chars are parsed, if `maxLen+start` > s.len

Fixes a previous bug in `parseHex` (and now affected `parseOct` and
`parseBin`), which allowed to set `start + maxLen` to be larger than
the strings length. This resulted in an out of bounds access.

* move `parse*Int` proc change to breaking changes, add double `
2018-06-13 13:32:12 -04:00
..
2018-05-29 07:28:15 +03:00
2018-04-30 02:52:58 +02:00
2018-06-01 11:20:28 -04:00
2018-04-30 02:52:58 +02:00
2017-03-02 14:53:50 +01:00
2015-10-01 12:05:45 -07:00
2018-04-15 23:38:43 +02:00
2017-07-07 08:10:39 +02:00
2018-04-25 02:41:16 +02:00
2018-04-06 11:59:49 +02:00
2018-04-30 02:52:58 +02:00
2018-06-05 11:15:04 -04:00
2018-05-06 10:55:19 +02:00
2018-06-11 01:25:48 +02:00
2018-05-18 20:53:41 +02:00
2016-07-21 08:53:10 +01:00
2018-05-23 10:23:19 +03:00
2016-07-21 08:52:39 +01:00
2017-03-26 09:30:59 +02:00
2015-02-03 09:04:24 +01:00
2018-06-05 00:09:07 -04:00
2018-05-30 23:49:56 +03:00
2018-04-13 17:45:58 +02:00
2017-01-25 20:02:19 +01:00
2018-05-23 16:28:53 +02:00