summaryrefslogtreecommitdiff
path: root/compiler/utils/StringBuffer.lhs
diff options
context:
space:
mode:
authorIsaac Dupree <id@isaac.cedarswampstudios.org>2007-05-26 18:08:00 +0000
committerIsaac Dupree <id@isaac.cedarswampstudios.org>2007-05-26 18:08:00 +0000
commit8226f00b071ea156753324dc9f2967dabc3cc571 (patch)
treed47c6aa51d31eace43714be97594e59f776645cf /compiler/utils/StringBuffer.lhs
parent230aa72733b1f328e5a5c619688f9c71bb8b2f14 (diff)
downloadhaskell-8226f00b071ea156753324dc9f2967dabc3cc571.tar.gz
only comments, spacing, alpha-renaming
Diffstat (limited to 'compiler/utils/StringBuffer.lhs')
-rw-r--r--compiler/utils/StringBuffer.lhs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/utils/StringBuffer.lhs b/compiler/utils/StringBuffer.lhs
index 8eb6fc2bc4..a1eddb0280 100644
--- a/compiler/utils/StringBuffer.lhs
+++ b/compiler/utils/StringBuffer.lhs
@@ -207,12 +207,14 @@ byteOff (StringBuffer buf _ cur) i =
w <- peek (ptr `plusPtr` (cur+i))
return (unsafeChr (fromIntegral (w::Word8)))
--- | XXX assumes ASCII digits only
+-- | XXX assumes ASCII digits only (by using byteOff)
parseInteger :: StringBuffer -> Int -> Integer -> (Char->Int) -> Integer
-parseInteger buf len radix to_int
+parseInteger buf len radix char_to_int
= go 0 0
- where go i x | i == len = x
- | otherwise = go (i+1) (x * radix + toInteger (to_int (byteOff buf i)))
+ where
+ go i x | i == len = x
+ | otherwise = go (i+1)
+ (x * radix + toInteger (char_to_int (byteOff buf i)))
-- -----------------------------------------------------------------------------
-- under the carpet