[Pkg-haskell-maintainers] Bug#639037: alex 3 patch

Clint Adams clint at debian.org
Mon Sep 5 18:54:12 UTC 2011


This seems to do the trick

--- a/c2hs/c/CLexer.x
+++ b/c2hs/c/CLexer.x
@@ -78,6 +78,8 @@
 import CTokens
 import CParserMonad
 
+import Data.Word (Word8)
+
 }
 
 $space = [ \ \t ] -- horizontal white space
@@ -390,6 +392,12 @@
 alexInputPrevChar :: AlexInput -> Char
 alexInputPrevChar _ = error "alexInputPrevChar not used"
 
+-- for alex 3
+alexGetByte :: AlexInput -> Maybe (Word8, AlexInput)
+alexGetByte (p,[]) = Nothing
+alexGetByte (p, (c:s)) = let p' = alexMove p c in p' `seq`
+                           Just ((fromIntegral $ ord c), (p', s))
+
 alexGetChar :: AlexInput -> Maybe (Char,AlexInput)
 alexGetChar (p,[]) = Nothing
 alexGetChar (p,(c:s))  = let p' = alexMove p c in p' `seq`





More information about the Pkg-haskell-maintainers mailing list