diff options
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/LexCore.hs | 38 | ||||
-rw-r--r-- | compiler/parser/Lexer.x | 5 | ||||
-rw-r--r-- | compiler/parser/cutils.c | 14 | ||||
-rw-r--r-- | compiler/parser/hschooks.c | 14 |
4 files changed, 1 insertions, 70 deletions
diff --git a/compiler/parser/LexCore.hs b/compiler/parser/LexCore.hs index 7be074a25d..936786d949 100644 --- a/compiler/parser/LexCore.hs +++ b/compiler/parser/LexCore.hs @@ -3,7 +3,7 @@ module LexCore where import ParserCoreUtils import Ratio import Char -import qualified Numeric( readFloat, readDec ) +import Numeric isNameChar c = isAlpha c || isDigit c || (c == '_') || (c == '\'') || (c == ':') || (c == '$') @@ -97,39 +97,3 @@ lexKeyword cont cs = ("_",rest) -> cont TKwild rest _ -> failP "invalid keyword" ('%':cs) - -#if __GLASGOW_HASKELL__ >= 504 --- The readFloat in the Numeric library will do the job - -readFloat :: (RealFrac a) => ReadS a -readFloat = Numeric.readFloat - -#else --- Haskell 98's Numeric.readFloat used to have a bogusly restricted signature --- so it was incapable of reading a rational. --- So for GHCs that have that old bogus library, here is the code, written out longhand. - -readFloat r = [(fromRational ((n%1)*10^^(k-d)),t) | (n,d,s) <- readFix r, - (k,t) <- readExp s] ++ - [ (0/0, t) | ("NaN",t) <- lex r] ++ - [ (1/0, t) | ("Infinity",t) <- lex r] - where - readFix r = [(read (ds++ds'), length ds', t) - | (ds,d) <- lexDigits r, - (ds',t) <- lexFrac d ] - - lexFrac ('.':ds) = lexDigits ds - lexFrac s = [("",s)] - - readExp (e:s) | e `elem` "eE" = readExp' s - readExp s = [(0,s)] - - readExp' ('-':s) = [(-k,t) | (k,t) <- Numeric.readDec s] - readExp' ('+':s) = Numeric.readDec s - readExp' s = Numeric.readDec s - -lexDigits :: ReadS String -lexDigits s = case span isDigit s of - (cs,s') | not (null cs) -> [(cs,s')] - otherwise -> [] -#endif diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 0526b1ec90..d9a0fb08b0 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -379,11 +379,6 @@ $tab+ { warn Opt_WarnTabs (text "Tab character") } } { --- work around bug in Alex 2.0 -#if __GLASGOW_HASKELL__ < 503 -unsafeAt arr i = arr ! i -#endif - -- ----------------------------------------------------------------------------- -- The token type diff --git a/compiler/parser/cutils.c b/compiler/parser/cutils.c index 08832f298d..4a7b7b3c68 100644 --- a/compiler/parser/cutils.c +++ b/compiler/parser/cutils.c @@ -3,19 +3,8 @@ These utility routines are used various places in the GHC library. */ -/* For GHC 4.08, we are relying on the fact that RtsFlags has - * compatible layout with the current version, because we're - * #including the current version of RtsFlags.h below. 4.08 didn't - * ship with its own RtsFlags.h, unfortunately. For later GHC - * versions, we #include the correct RtsFlags.h. - */ -#if __GLASGOW_HASKELL__ < 502 -#include "../includes/Rts.h" -#include "../includes/RtsFlags.h" -#else #include "Rts.h" #include "RtsFlags.h" -#endif #include "HsFFI.h" @@ -51,10 +40,7 @@ ghc_memcmp_off( HsAddr a1, HsInt i, HsAddr a2, HsInt len ) void enableTimingStats( void ) /* called from the driver */ { -#if __GLASGOW_HASKELL__ >= 411 RtsFlags.GcFlags.giveStats = ONELINE_GC_STATS; -#endif - /* ignored when bootstrapping with an older GHC */ } void diff --git a/compiler/parser/hschooks.c b/compiler/parser/hschooks.c index 5c87b3189d..9ccb345db4 100644 --- a/compiler/parser/hschooks.c +++ b/compiler/parser/hschooks.c @@ -4,19 +4,8 @@ for various bits of the RTS. They are linked in instead of the defaults. */ -/* For GHC 4.08, we are relying on the fact that RtsFlags has - * compatible layout with the current version, because we're - * #including the current version of RtsFlags.h below. 4.08 didn't - * ship with its own RtsFlags.h, unfortunately. For later GHC - * versions, we #include the correct RtsFlags.h. - */ -#if __GLASGOW_HASKELL__ < 502 -#include "../includes/Rts.h" -#include "../includes/RtsFlags.h" -#else #include "Rts.h" #include "RtsFlags.h" -#endif #include "HsFFI.h" @@ -31,11 +20,8 @@ defaultsHook (void) { RtsFlags.GcFlags.heapSizeSuggestion = 6*1024*1024 / BLOCK_SIZE; RtsFlags.GcFlags.maxStkSize = 8*1024*1024 / sizeof(W_); -#if __GLASGOW_HASKELL__ >= 411 - /* GHC < 4.11 didn't have these */ RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS; RtsFlags.GcFlags.statsFile = stderr; -#endif } void |