strscans #4562

Closed
StefanSalewski opened this Issue Aug 3, 2016 · 0 comments

Projects

None yet

1 participant

@StefanSalewski

import strscans

var t = ":"
var j: int

if scanf(t, ":$i$.", j):
echo "match:", j

$ ./t
match:0

I really did not expect a successful match here.
(I cound not find a separate issue tracker for strscans.) And a related remark for parseutils:
Comment is misleading (result 0 for overflow). Signed parseInt() has correct comment.

proc parseUInt*(s: string, number: var uint, start = 0): int {.
rtl, extern: "npuParseUInt", noSideEffect.} =

parses an unsigned integer starting at start and stores the value

into number.

Result is the number of processed chars or 0 if there is no integer or

overflow detected.

var res: uint64
result = parseBiggestUInt(s, res, start)
if (sizeof(uint) <= 4) and
(res > 0xFFFF_FFFF'u64):
raise newException(OverflowError, "overflow")
elif result != 0:

@Araq Araq added a commit that closed this issue Aug 3, 2016
@Araq Araq fixes #4562 6466338
@Araq Araq closed this in 6466338 Aug 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment