projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2002-10-17 14:49:52 by simonmar]
[ghc-hetmet.git]
/
ghc
/
compiler
/
basicTypes
/
Literal.lhs
diff --git
a/ghc/compiler/basicTypes/Literal.lhs
b/ghc/compiler/basicTypes/Literal.lhs
index
45a3dc5
..
1b794a6
100644
(file)
--- a/
ghc/compiler/basicTypes/Literal.lhs
+++ b/
ghc/compiler/basicTypes/Literal.lhs
@@
-42,8
+42,8
@@
import Util ( thenCmp )
import Ratio ( numerator )
import FastString ( uniqueOfFS, lengthFS )
import Ratio ( numerator )
import FastString ( uniqueOfFS, lengthFS )
-import Int ( Int8, Int16, Int32 )
-import Word ( Word8, Word16, Word32 )
+import DATA_INT ( Int8, Int16, Int32 )
+import DATA_WORD ( Word8, Word16, Word32 )
import Char ( ord, chr )
\end{code}
import Char ( ord, chr )
\end{code}
@@
-392,10
+392,11
@@
pprLit lit
MachWord64 w | code_style -> pprHexVal w
| otherwise -> ptext SLIT("__word64") <+> integer w
MachWord64 w | code_style -> pprHexVal w
| otherwise -> ptext SLIT("__word64") <+> integer w
- MachFloat f | code_style -> ptext SLIT("(StgFloat)") <> rational f
+ MachFloat f | code_style -> ptext SLIT("(StgFloat)") <> code_rational f
| otherwise -> ptext SLIT("__float") <+> rational f
| otherwise -> ptext SLIT("__float") <+> rational f
- MachDouble d -> rational d
+ MachDouble d | code_style -> code_rational d
+ | otherwise -> rational d
MachAddr p | code_style -> ptext SLIT("(void*)") <> integer p
| otherwise -> ptext SLIT("__addr") <+> integer p
MachAddr p | code_style -> ptext SLIT("(void*)") <> integer p
| otherwise -> ptext SLIT("__addr") <+> integer p
@@
-408,6
+409,11
@@
pprLit lit
pprHsString s,
pprParendType ty])
pprHsString s,
pprParendType ty])
+-- negative floating literals in code style need parentheses to avoid
+-- interacting with surrounding syntax.
+code_rational d | d < 0 = parens (rational d)
+ | otherwise = rational d
+
pprIntVal :: Integer -> SDoc
-- Print negative integers with parens to be sure it's unambiguous
pprIntVal i | i < 0 = parens (integer i)
pprIntVal :: Integer -> SDoc
-- Print negative integers with parens to be sure it's unambiguous
pprIntVal i | i < 0 = parens (integer i)