Remove unused FFI import GetTempPathA (getTempPath)
[ghc-hetmet.git] / compiler / parser / Ctype.lhs
index 8d0b91b..d813030 100644 (file)
@@ -20,6 +20,7 @@ module Ctype
 import Data.Int                ( Int32 )
 import Data.Bits       ( Bits((.&.)) )
 import Data.Char       ( ord, chr )
+import Panic
 \end{code}
 
 Bit masks
@@ -43,7 +44,8 @@ at the big case below.
 is_ctype :: Int -> Char -> Bool
 is_ctype mask c = (fromIntegral (charType c) .&. fromIntegral mask) /= (0::Int32)
 
-is_ident, is_symbol, is_any, is_space, is_lower, is_upper, is_digit :: Char -> Bool
+is_ident, is_symbol, is_any, is_space, is_lower, is_upper, is_digit,
+    is_alphanum :: Char -> Bool
 is_ident  = is_ctype cIdent
 is_symbol = is_ctype cSymbol
 is_any    = is_ctype cAny
@@ -64,14 +66,17 @@ hexDigit c | is_digit c = ord c - ord '0'
 octDecDigit :: Char -> Int
 octDecDigit c = ord c - ord '0'
 
+is_hexdigit :: Char -> Bool
 is_hexdigit c
        =  is_digit c 
        || (c >= 'a' && c <= 'f')
        || (c >= 'A' && c <= 'F')
 
+is_octdigit :: Char -> Bool
 is_octdigit c = c >= '0' && c <= '7'
 
-to_lower c 
+to_lower :: Char -> Char
+to_lower c
   | c >=  'A' && c <= 'Z' = chr (ord c - (ord 'A' - ord 'a'))
   | otherwise = c
 \end{code}
@@ -91,11 +96,11 @@ charType c = case c of
    '\6'   -> 0                         -- \006
    '\7'   -> 0                         -- \007
    '\8'   -> 0                         -- \010
-   '\9'   -> cAny + cSpace             -- \t
-   '\10'  -> cSpace                   -- \n (not allowed in strings, so !cAny)
-   '\11'  -> cAny + cSpace             -- \v
-   '\12'  -> cAny + cSpace             -- \f
-   '\13'  -> cAny + cSpace             --  ^M
+   '\9'   -> cSpace                    -- \t  (not allowed in strings, so !cAny)
+   '\10'  -> cSpace                   -- \n  (ditto)
+   '\11'  -> cSpace                    -- \v  (ditto)
+   '\12'  -> cSpace                    -- \f  (ditto)
+   '\13'  -> cSpace                    --  ^M (ditto)
    '\14'  -> 0                         -- \016
    '\15'  -> 0                         -- \017
    '\16'  -> 0                         -- \020
@@ -338,4 +343,5 @@ charType c = case c of
    '\253' -> cAny + cIdent  + cLower   -- ý
    '\254' -> cAny + cIdent  + cLower   -- þ
    '\255' -> cAny + cIdent  + cLower   -- ÿ
+   _ -> panic ("charType: " ++ show c)
 \end{code}