summaryrefslogtreecommitdiff
path: root/compiler/cmm/CmmLex.x
diff options
context:
space:
mode:
authorIsaac Dupree <id@isaac.cedarswampstudios.org>2007-05-26 21:22:04 +0000
committerIsaac Dupree <id@isaac.cedarswampstudios.org>2007-05-26 21:22:04 +0000
commit4a1aca1033549f95cbdb62cbc0aac331610c91ea (patch)
tree644e5e0872ee810f0c85c83980501c2c0a955aa5 /compiler/cmm/CmmLex.x
parenta12dcc89780ddec69beec723ac444c5fab388a9a (diff)
downloadhaskell-4a1aca1033549f95cbdb62cbc0aac331610c91ea.tar.gz
parseInteger->parseUnsignedInteger to clarify meaning
I decided against adding parseSignedInteger since octal and hex literals often have junk between the '-' and the digits, but, compare to Util.readRational which does handle signed numbers. Also since Integers - mathematically and in Haskell - can be negative, normally.
Diffstat (limited to 'compiler/cmm/CmmLex.x')
-rw-r--r--compiler/cmm/CmmLex.x10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/cmm/CmmLex.x b/compiler/cmm/CmmLex.x
index 6ae52007bd..a1aa2762a9 100644
--- a/compiler/cmm/CmmLex.x
+++ b/compiler/cmm/CmmLex.x
@@ -180,7 +180,7 @@ global_regN :: (Int -> GlobalReg) -> Action
global_regN con span buf len
= return (L span (CmmT_GlobalReg (con (fromIntegral n))))
where buf' = stepOn buf
- n = parseInteger buf' (len-1) 10 octDecDigit
+ n = parseUnsignedInteger buf' (len-1) 10 octDecDigit
global_reg :: GlobalReg -> Action
global_reg r span buf len = return (L span (CmmT_GlobalReg r))
@@ -227,13 +227,13 @@ reservedWordsFM = listToUFM $
]
tok_decimal span buf len
- = return (L span (CmmT_Int $! parseInteger buf len 10 octDecDigit))
+ = return (L span (CmmT_Int $! parseUnsignedInteger buf len 10 octDecDigit))
tok_octal span buf len
- = return (L span (CmmT_Int $! parseInteger (offsetBytes 1 buf) (len-1) 8 octDecDigit))
+ = return (L span (CmmT_Int $! parseUnsignedInteger (offsetBytes 1 buf) (len-1) 8 octDecDigit))
tok_hexadecimal span buf len
- = return (L span (CmmT_Int $! parseInteger (offsetBytes 2 buf) (len-2) 16 hexDigit))
+ = return (L span (CmmT_Int $! parseUnsignedInteger (offsetBytes 2 buf) (len-2) 16 hexDigit))
tok_float str = CmmT_Float $! readRational str
@@ -245,7 +245,7 @@ tok_string str = CmmT_String (read str)
setLine :: Int -> Action
setLine code span buf len = do
- let line = parseInteger buf len 10 octDecDigit
+ let line = parseUnsignedInteger buf len 10 octDecDigit
setSrcLoc (mkSrcLoc (srcSpanFile span) (fromIntegral line - 1) 0)
-- subtract one: the line number refers to the *following* line
-- trace ("setLine " ++ show line) $ do