[project @ 2005-01-01 23:59:58 by krasimir]
[ghc-base.git] / Text / Read / Lex.hs
index ff63aa1..dda2859 100644 (file)
@@ -35,7 +35,9 @@ import Text.ParserCombinators.ReadP
 import GHC.Base
 import GHC.Num( Num(..), Integer )
 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
@@ -186,7 +188,7 @@ lexCharE =
          _    -> pfail
   
   lexNumeric =
-    do base <- lexBaseChar
+    do base <- lexBaseChar <++ return 10
        n    <- lexInteger base
        guard (n <= toInteger (ord maxBound))
        return (chr (fromInteger n))
@@ -317,12 +319,9 @@ lexHexOct
        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