summary refs log tree commit diff stats
path: root/lib/pure/asyncmacro.nim
diff options
context:
space:
mode:
authorVindaar <basti90@gmail.com>2018-06-13 19:32:12 +0200
committerVarriount <Varriount@users.noreply.github.com>2018-06-13 13:32:12 -0400
commite80be6173d854ecb50e19ba1459529432fc5efbe (patch)
treefdab4186c07b2f686abc1b1f24c75cf05e754344 /lib/pure/asyncmacro.nim
parentcd65ef0056c48ba06922aeec49bb0bd5c9d68fb9 (diff)
downloadNim-e80be6173d854ecb50e19ba1459529432fc5efbe.tar.gz
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 `
Diffstat (limited to 'lib/pure/asyncmacro.nim')
0 files changed, 0 insertions, 0 deletions