[MLton] Bug in LargeInt.scan
Stephen Weeks
MLton@mlton.org
Mon, 15 Aug 2005 07:47:40 -0700
> Note that strings such as "0xg" and "0x 123" are scanned as SOME(0),
> even using a hexadecimal radix.
>
> So, that patch still isn't correct.
> A better patch is attached.
Patch cleaned up and committed. Thanks.
Here's the definition of toHexR that I went with.
fun toHexR (cread: (char, 'a) reader, uread: (bigInt, 'a) reader)
s =
case Reader.reader2 cread s of
NONE => NONE
| SOME ((c1, c2), s') =>
if c1 = #"0" andalso (c2 = #"x" orelse c2 = #"X") then
case uread s' of
NONE => uread s (* ? *)
| SOME x => SOME x
else uread s
I was wondering if in the case marked (* ? *) I could simply return
SOME zero.