Files
Nim/tests/stdlib
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
..
2017-11-01 00:20:40 +01:00
2017-12-14 12:46:09 +01:00
2017-02-13 13:35:40 +01:00
2015-03-12 11:08:03 +01:00
2014-01-13 02:10:03 +01:00
2014-08-29 09:12:12 +02:00
2014-07-19 14:37:47 +02:00
2018-01-14 23:49:53 +01:00
2014-01-13 02:10:03 +01:00
2015-06-20 11:37:29 +01:00
2017-11-15 17:25:48 +01:00
2018-03-30 13:43:01 -07:00
2017-06-20 12:11:09 +02:00
2015-08-03 12:35:57 -04:00
2015-08-03 12:35:57 -04:00
2015-08-03 12:35:57 -04:00
2015-03-31 00:32:39 +02:00
2017-07-25 09:28:23 +02:00
2017-05-04 22:25:29 +02:00
2016-07-01 07:24:30 -06:00
2017-12-14 12:46:09 +01:00
2015-09-27 15:49:40 +10:00
2014-01-13 02:10:03 +01:00
2018-06-05 00:09:07 -04:00
2014-08-29 09:12:12 +02:00
2018-04-30 11:16:56 +02:00
2014-08-29 09:12:12 +02:00
2016-11-30 10:38:22 +07:00