-{-# OPTIONS -fno-implicit-prelude #-}
+{-# OPTIONS_GHC -fno-implicit-prelude #-}
-----------------------------------------------------------------------------
-- |
-- Module : Text.Read.Lex
#ifdef __GLASGOW_HASKELL__
import GHC.Base
import GHC.Num( Num(..), Integer )
-import GHC.Show( Show(.. ), isSpace, isAlpha, isAlphaNum )
+import GHC.Show( Show(..) )
+#ifndef __HADDOCK__
+import {-# SOURCE #-} GHC.Unicode ( isSpace, isAlpha, isAlphaNum )
+#endif
import GHC.Real( Ratio(..), Integral, Rational, (%), fromIntegral,
toInteger, (^), (^^), infinity, notANumber )
import GHC.List
_ -> pfail
lexNumeric =
- do base <- lexBaseChar
+ do base <- lexBaseChar <++ return 10
n <- lexInteger base
guard (n <= toInteger (ord maxBound))
return (chr (fromInteger n))
return (Int (val (fromIntegral base) 0 digits))
lexBaseChar :: ReadP Int
--- Lex a single character indicating the base,
--- or return 10 if there isn't one
-lexBaseChar = lex_base <++ return 10
- where
- lex_base = do { c <- get;
- case c of
+-- Lex a single character indicating the base; fail if not there
+lexBaseChar = do { c <- get;
+ case c of
'o' -> return 8
'O' -> return 8
'x' -> return 16