summaryrefslogtreecommitdiff
path: root/compiler/parser
diff options
context:
space:
mode:
authorJose Pedro Magalhaes <jpm@cs.uu.nl>2011-05-17 08:51:09 +0200
committerJose Pedro Magalhaes <jpm@cs.uu.nl>2011-05-17 08:51:09 +0200
commit2d4d636af091b8da27466b5cf90011395a9c2f66 (patch)
tree2736ea0c2cb58a223617308785a7250d1d8586bc /compiler/parser
parentd872133bb986dbd15959cbb14504bf9a863e3e4a (diff)
parent52cba3c47b25a78402e542ff63dc905fc5b26b62 (diff)
downloadhaskell-2d4d636af091b8da27466b5cf90011395a9c2f66.tar.gz
Merge branch 'master' of http://darcs.haskell.org/ghc into ghc-generics
Diffstat (limited to 'compiler/parser')
-rw-r--r--compiler/parser/Lexer.x17
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index bf34ee7fcd..a55a6310c9 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -68,7 +68,7 @@ import UniqFM
import DynFlags
import Module
import Ctype
-import BasicTypes ( InlineSpec(..), RuleMatchInfo(..) )
+import BasicTypes ( InlineSpec(..), RuleMatchInfo(..), FractionalLit(..) )
import Util ( readRational )
import Control.Monad
@@ -536,14 +536,14 @@ data Token
| ITchar Char
| ITstring FastString
| ITinteger Integer
- | ITrational Rational
+ | ITrational FractionalLit
| ITprimchar Char
| ITprimstring FastString
| ITprimint Integer
| ITprimword Integer
- | ITprimfloat Rational
- | ITprimdouble Rational
+ | ITprimfloat FractionalLit
+ | ITprimdouble FractionalLit
-- Template Haskell extension tokens
| ITopenExpQuote -- [| or [e|
@@ -1056,9 +1056,12 @@ hexadecimal = (16,hexDigit)
-- readRational can understand negative rationals, exponents, everything.
tok_float, tok_primfloat, tok_primdouble :: String -> Token
-tok_float str = ITrational $! readRational str
-tok_primfloat str = ITprimfloat $! readRational str
-tok_primdouble str = ITprimdouble $! readRational str
+tok_float str = ITrational $! readFractionalLit str
+tok_primfloat str = ITprimfloat $! readFractionalLit str
+tok_primdouble str = ITprimdouble $! readFractionalLit str
+
+readFractionalLit :: String -> FractionalLit
+readFractionalLit str = (FL $! str) $! readRational str
-- -----------------------------------------------------------------------------
-- Layout processing