Commit 5ac854ef authored by simonmar's avatar simonmar

[project @ 2002-09-05 10:25:01 by simonmar]

In code style, print negative floating point literals in parentheses
to avoid interacting with surrounding syntax.

Fixes SourceForge bug #604849

MERGE TO STABLE
parent ed6e7225
......@@ -392,10 +392,11 @@ pprLit lit
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
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
......@@ -408,6 +409,11 @@ pprLit lit
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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment