alex 2.3.2 → 2.3.3
raw patch · 10 files changed
+181/−179 lines, 10 filesdep −haskell98dep ~base
Dependencies removed: haskell98
Dependency ranges changed: base
Files
- alex.cabal +2/−2
- dist/build/alex/alex-tmp/Parser.hs +92/−91
- dist/build/alex/alex-tmp/Scan.hs +28/−31
- src/AbsSyn.hs +7/−3
- src/DFA.hs +14/−9
- src/Info.hs +25/−24
- src/Main.hs +2/−0
- src/Map.hs +2/−2
- src/NFA.hs +1/−9
- templates/GenericTemplate.hs +8/−8
alex.cabal view
@@ -1,5 +1,5 @@ name: alex-version: 2.3.2+version: 2.3.3 license: BSD3 license-file: LICENSE copyright: (c) Chis Dornan, Simon Marlow@@ -71,7 +71,7 @@ else build-depends: base >= 1.0 - build-depends: base < 5, haskell98 >= 1.0+ build-depends: base < 5 extensions: CPP ghc-options: -Wall
dist/build/alex/alex-tmp/Parser.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-} {-# OPTIONS -fglasgow-exts -cpp #-} -- ----------------------------------------------------------------------------- -- @@ -18,191 +19,191 @@ import Data.Char --import Debug.Trace #if __GLASGOW_HASKELL__ >= 503-import Data.Array+import qualified Data.Array as Happy_Data_Array #else-import Array+import qualified Array as Happy_Data_Array #endif #if __GLASGOW_HASKELL__ >= 503-import GHC.Exts+import qualified GHC.Exts as Happy_GHC_Exts #else-import GlaExts+import qualified GlaExts as Happy_GHC_Exts #endif --- parser produced by Happy Version 1.17+-- parser produced by Happy Version 1.18.4 newtype HappyAbsSyn = HappyAbsSyn HappyAny #if __GLASGOW_HASKELL__ >= 607-type HappyAny = GHC.Exts.Any+type HappyAny = Happy_GHC_Exts.Any #else type HappyAny = forall a . a #endif happyIn4 :: ((Maybe (AlexPosn,Code), [Directive], Scanner, Maybe (AlexPosn,Code))) -> (HappyAbsSyn )-happyIn4 x = unsafeCoerce# x+happyIn4 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn4 #-} happyOut4 :: (HappyAbsSyn ) -> ((Maybe (AlexPosn,Code), [Directive], Scanner, Maybe (AlexPosn,Code)))-happyOut4 x = unsafeCoerce# x+happyOut4 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut4 #-} happyIn5 :: (Maybe (AlexPosn,Code)) -> (HappyAbsSyn )-happyIn5 x = unsafeCoerce# x+happyIn5 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn5 #-} happyOut5 :: (HappyAbsSyn ) -> (Maybe (AlexPosn,Code))-happyOut5 x = unsafeCoerce# x+happyOut5 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut5 #-} happyIn6 :: ([Directive]) -> (HappyAbsSyn )-happyIn6 x = unsafeCoerce# x+happyIn6 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn6 #-} happyOut6 :: (HappyAbsSyn ) -> ([Directive])-happyOut6 x = unsafeCoerce# x+happyOut6 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut6 #-} happyIn7 :: (Directive) -> (HappyAbsSyn )-happyIn7 x = unsafeCoerce# x+happyIn7 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn7 #-} happyOut7 :: (HappyAbsSyn ) -> (Directive)-happyOut7 x = unsafeCoerce# x+happyOut7 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut7 #-} happyIn8 :: (()) -> (HappyAbsSyn )-happyIn8 x = unsafeCoerce# x+happyIn8 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn8 #-} happyOut8 :: (HappyAbsSyn ) -> (())-happyOut8 x = unsafeCoerce# x+happyOut8 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut8 #-} happyIn9 :: (()) -> (HappyAbsSyn )-happyIn9 x = unsafeCoerce# x+happyIn9 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn9 #-} happyOut9 :: (HappyAbsSyn ) -> (())-happyOut9 x = unsafeCoerce# x+happyOut9 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut9 #-} happyIn10 :: (Scanner) -> (HappyAbsSyn )-happyIn10 x = unsafeCoerce# x+happyIn10 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn10 #-} happyOut10 :: (HappyAbsSyn ) -> (Scanner)-happyOut10 x = unsafeCoerce# x+happyOut10 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut10 #-} happyIn11 :: ([RECtx]) -> (HappyAbsSyn )-happyIn11 x = unsafeCoerce# x+happyIn11 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn11 #-} happyOut11 :: (HappyAbsSyn ) -> ([RECtx])-happyOut11 x = unsafeCoerce# x+happyOut11 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut11 #-} happyIn12 :: ([RECtx]) -> (HappyAbsSyn )-happyIn12 x = unsafeCoerce# x+happyIn12 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn12 #-} happyOut12 :: (HappyAbsSyn ) -> ([RECtx])-happyOut12 x = unsafeCoerce# x+happyOut12 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut12 #-} happyIn13 :: (RECtx) -> (HappyAbsSyn )-happyIn13 x = unsafeCoerce# x+happyIn13 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn13 #-} happyOut13 :: (HappyAbsSyn ) -> (RECtx)-happyOut13 x = unsafeCoerce# x+happyOut13 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut13 #-} happyIn14 :: ([RECtx]) -> (HappyAbsSyn )-happyIn14 x = unsafeCoerce# x+happyIn14 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn14 #-} happyOut14 :: (HappyAbsSyn ) -> ([RECtx])-happyOut14 x = unsafeCoerce# x+happyOut14 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut14 #-} happyIn15 :: ([(String,StartCode)]) -> (HappyAbsSyn )-happyIn15 x = unsafeCoerce# x+happyIn15 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn15 #-} happyOut15 :: (HappyAbsSyn ) -> ([(String,StartCode)])-happyOut15 x = unsafeCoerce# x+happyOut15 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut15 #-} happyIn16 :: ([(String,StartCode)]) -> (HappyAbsSyn )-happyIn16 x = unsafeCoerce# x+happyIn16 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn16 #-} happyOut16 :: (HappyAbsSyn ) -> ([(String,StartCode)])-happyOut16 x = unsafeCoerce# x+happyOut16 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut16 #-} happyIn17 :: (String) -> (HappyAbsSyn )-happyIn17 x = unsafeCoerce# x+happyIn17 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn17 #-} happyOut17 :: (HappyAbsSyn ) -> (String)-happyOut17 x = unsafeCoerce# x+happyOut17 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut17 #-} happyIn18 :: (Maybe Code) -> (HappyAbsSyn )-happyIn18 x = unsafeCoerce# x+happyIn18 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn18 #-} happyOut18 :: (HappyAbsSyn ) -> (Maybe Code)-happyOut18 x = unsafeCoerce# x+happyOut18 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut18 #-} happyIn19 :: (Maybe CharSet, RExp, RightContext RExp) -> (HappyAbsSyn )-happyIn19 x = unsafeCoerce# x+happyIn19 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn19 #-} happyOut19 :: (HappyAbsSyn ) -> (Maybe CharSet, RExp, RightContext RExp)-happyOut19 x = unsafeCoerce# x+happyOut19 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut19 #-} happyIn20 :: (CharSet) -> (HappyAbsSyn )-happyIn20 x = unsafeCoerce# x+happyIn20 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn20 #-} happyOut20 :: (HappyAbsSyn ) -> (CharSet)-happyOut20 x = unsafeCoerce# x+happyOut20 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut20 #-} happyIn21 :: (RightContext RExp) -> (HappyAbsSyn )-happyIn21 x = unsafeCoerce# x+happyIn21 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn21 #-} happyOut21 :: (HappyAbsSyn ) -> (RightContext RExp)-happyOut21 x = unsafeCoerce# x+happyOut21 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut21 #-} happyIn22 :: (RExp) -> (HappyAbsSyn )-happyIn22 x = unsafeCoerce# x+happyIn22 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn22 #-} happyOut22 :: (HappyAbsSyn ) -> (RExp)-happyOut22 x = unsafeCoerce# x+happyOut22 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut22 #-} happyIn23 :: (RExp) -> (HappyAbsSyn )-happyIn23 x = unsafeCoerce# x+happyIn23 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn23 #-} happyOut23 :: (HappyAbsSyn ) -> (RExp)-happyOut23 x = unsafeCoerce# x+happyOut23 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut23 #-} happyIn24 :: (RExp) -> (HappyAbsSyn )-happyIn24 x = unsafeCoerce# x+happyIn24 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn24 #-} happyOut24 :: (HappyAbsSyn ) -> (RExp)-happyOut24 x = unsafeCoerce# x+happyOut24 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut24 #-} happyIn25 :: (RExp -> RExp) -> (HappyAbsSyn )-happyIn25 x = unsafeCoerce# x+happyIn25 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn25 #-} happyOut25 :: (HappyAbsSyn ) -> (RExp -> RExp)-happyOut25 x = unsafeCoerce# x+happyOut25 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut25 #-} happyIn26 :: (RExp) -> (HappyAbsSyn )-happyIn26 x = unsafeCoerce# x+happyIn26 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn26 #-} happyOut26 :: (HappyAbsSyn ) -> (RExp)-happyOut26 x = unsafeCoerce# x+happyOut26 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut26 #-} happyIn27 :: (CharSet) -> (HappyAbsSyn )-happyIn27 x = unsafeCoerce# x+happyIn27 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn27 #-} happyOut27 :: (HappyAbsSyn ) -> (CharSet)-happyOut27 x = unsafeCoerce# x+happyOut27 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut27 #-} happyIn28 :: (CharSet) -> (HappyAbsSyn )-happyIn28 x = unsafeCoerce# x+happyIn28 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn28 #-} happyOut28 :: (HappyAbsSyn ) -> (CharSet)-happyOut28 x = unsafeCoerce# x+happyOut28 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut28 #-} happyIn29 :: ([CharSet]) -> (HappyAbsSyn )-happyIn29 x = unsafeCoerce# x+happyIn29 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn29 #-} happyOut29 :: (HappyAbsSyn ) -> ([CharSet])-happyOut29 x = unsafeCoerce# x+happyOut29 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut29 #-} happyIn30 :: ((AlexPosn,String)) -> (HappyAbsSyn )-happyIn30 x = unsafeCoerce# x+happyIn30 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyIn30 #-} happyOut30 :: (HappyAbsSyn ) -> ((AlexPosn,String))-happyOut30 x = unsafeCoerce# x+happyOut30 x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOut30 #-}-happyInTok :: Token -> (HappyAbsSyn )-happyInTok x = unsafeCoerce# x+happyInTok :: (Token) -> (HappyAbsSyn )+happyInTok x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyInTok #-}-happyOutTok :: (HappyAbsSyn ) -> Token-happyOutTok x = unsafeCoerce# x+happyOutTok :: (HappyAbsSyn ) -> (Token)+happyOutTok x = Happy_GHC_Exts.unsafeCoerce# x {-# INLINE happyOutTok #-} @@ -221,7 +222,7 @@ happyTable :: HappyAddr happyTable = HappyA# "\x00\x00\x4e\x00\x16\x00\x5d\x00\x4c\x00\x55\x00\x0f\x00\x10\x00\x4a\x00\x11\x00\x12\x00\x13\x00\x51\x00\x14\x00\x17\x00\x5e\x00\x44\x00\x18\x00\x5e\x00\x19\x00\x16\x00\x2b\x00\x2a\x00\x4b\x00\x1a\x00\x4f\x00\x5b\x00\x54\x00\x1b\x00\x1c\x00\x1d\x00\x2d\x00\x17\x00\x5c\x00\x2b\x00\x18\x00\x48\x00\x19\x00\x16\x00\x2b\x00\x1d\x00\x13\x00\x1a\x00\x14\x00\x43\x00\x44\x00\x1b\x00\x1c\x00\x1d\x00\x46\x00\x17\x00\x48\x00\x47\x00\x18\x00\x1f\x00\x19\x00\x16\x00\x2b\x00\x02\x00\x42\x00\x1a\x00\x14\x00\x1e\x00\x0b\x00\x1b\x00\x1c\x00\x1d\x00\x31\x00\x17\x00\x14\x00\x34\x00\x18\x00\x62\x00\x19\x00\x16\x00\x60\x00\x09\x00\x06\x00\x1a\x00\x0a\x00\x0b\x00\x57\x00\x1b\x00\x1c\x00\x1d\x00\x58\x00\x17\x00\x34\x00\x59\x00\x18\x00\x5a\x00\x19\x00\x16\x00\x3d\x00\x05\x00\x06\x00\x1a\x00\x3e\x00\x3b\x00\x42\x00\x1b\x00\x1c\x00\x1d\x00\x04\x00\x17\x00\x04\x00\x02\x00\x18\x00\x40\x00\x19\x00\x16\x00\x0d\x00\x0e\x00\x2d\x00\x1a\x00\xff\xff\x16\x00\x2e\x00\x1b\x00\x1c\x00\x1d\x00\x2d\x00\x17\x00\x21\x00\x16\x00\x18\x00\x09\x00\x19\x00\x08\x00\x16\x00\x2d\x00\x18\x00\x1a\x00\x19\x00\x08\x00\x00\x00\x1b\x00\x1c\x00\x1d\x00\x18\x00\x04\x00\x19\x00\x1b\x00\x1c\x00\x18\x00\x00\x00\x19\x00\x00\x00\x31\x00\x00\x00\x1b\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x1b\x00\x1c\x00\x51\x00\x22\x00\x23\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x21\x00\x22\x00\x23\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x52\x00\x60\x00\x2e\x00\x13\x00\x3e\x00\x14\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x52\x00\x53\x00\x2e\x00\x13\x00\x40\x00\x14\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x4f\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x3b\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x4b\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x32\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x0e\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x39\x00\x14\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x2e\x00\x13\x00\x2f\x00\x14\x00\x36\x00\x37\x00\x38\x00\x39\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"# -happyReduceArr = array (1, 63) [+happyReduceArr = Happy_Data_Array.array (1, 63) [ (1 , happyReduce_1), (2 , happyReduce_2), (3 , happyReduce_3),@@ -847,7 +848,7 @@ happyThen1 = happyThen happyReturn1 :: () => a -> P a happyReturn1 = happyReturn-happyError' :: () => Token -> P a+happyError' :: () => (Token) -> P a happyError' tk = (\token -> happyError) tk parse = happySomeParser where@@ -883,7 +884,7 @@ {-# LINE 28 "templates/GenericTemplate.hs" #-} -data Happy_IntList = HappyCons Int# Happy_IntList+data Happy_IntList = HappyCons Happy_GHC_Exts.Int# Happy_IntList @@ -928,19 +929,19 @@ happyFail i tk st -1# -> {- nothing -} happyAccept i tk st- n | (n <# (0# :: Int#)) -> {- nothing -}+ n | (n Happy_GHC_Exts.<# (0# :: Happy_GHC_Exts.Int#)) -> {- nothing -} - (happyReduceArr ! rule) i tk st- where rule = (I# ((negateInt# ((n +# (1# :: Int#))))))+ (happyReduceArr Happy_Data_Array.! rule) i tk st+ where rule = (Happy_GHC_Exts.I# ((Happy_GHC_Exts.negateInt# ((n Happy_GHC_Exts.+# (1# :: Happy_GHC_Exts.Int#)))))) n -> {- nothing -} happyShift new_state i tk st- where new_state = (n -# (1# :: Int#))+ where new_state = (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) where off = indexShortOffAddr happyActOffsets st- off_i = (off +# i)- check = if (off_i >=# (0# :: Int#))- then (indexShortOffAddr happyCheck off_i ==# i)+ off_i = (off Happy_GHC_Exts.+# i)+ check = if (off_i Happy_GHC_Exts.>=# (0# :: Happy_GHC_Exts.Int#))+ then (indexShortOffAddr happyCheck off_i Happy_GHC_Exts.==# i) else False action | check = indexShortOffAddr happyTable off_i | otherwise = indexShortOffAddr happyDefActions st@@ -950,27 +951,27 @@ indexShortOffAddr (HappyA# arr) off = #if __GLASGOW_HASKELL__ > 500- narrow16Int# i+ Happy_GHC_Exts.narrow16Int# i #elif __GLASGOW_HASKELL__ == 500- intToInt16# i+ Happy_GHC_Exts.intToInt16# i #else- (i `iShiftL#` 16#) `iShiftRA#` 16#+ Happy_GHC_Exts.iShiftRA# (Happy_GHC_Exts.iShiftL# i 16#) 16# #endif where #if __GLASGOW_HASKELL__ >= 503- i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)+ i = Happy_GHC_Exts.word2Int# (Happy_GHC_Exts.or# (Happy_GHC_Exts.uncheckedShiftL# high 8#) low) #else- i = word2Int# ((high `shiftL#` 8#) `or#` low)+ i = Happy_GHC_Exts.word2Int# (Happy_GHC_Exts.or# (Happy_GHC_Exts.shiftL# high 8#) low) #endif- high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))- low = int2Word# (ord# (indexCharOffAddr# arr off'))- off' = off *# 2#+ high = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr (off' Happy_GHC_Exts.+# 1#)))+ low = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr off'))+ off' = off Happy_GHC_Exts.*# 2# -data HappyAddr = HappyA# Addr#+data HappyAddr = HappyA# Happy_GHC_Exts.Addr# @@ -984,7 +985,7 @@ -- Shifting a token happyShift new_state 0# tk st sts stk@(x `HappyStk` _) =- let i = (case unsafeCoerce# x of { (I# (i)) -> i }) in+ let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in -- trace "shifting the error token" $ happyDoAction i tk new_state (HappyCons (st) (sts)) (stk) @@ -1019,7 +1020,7 @@ happyReduce k i fn 0# tk st sts stk = happyFail 0# tk st sts stk happyReduce k nt fn j tk st sts stk- = case happyDrop (k -# (1# :: Int#)) sts of+ = case happyDrop (k Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) sts of sts1@((HappyCons (st1@(action)) (_))) -> let r = fn stk in -- it doesn't hurt to always seq here... happyDoSeq r (happyGoto nt j tk st1 sts1 r)@@ -1039,17 +1040,17 @@ drop_stk = happyDropStk k stk off = indexShortOffAddr happyGotoOffsets st1- off_i = (off +# nt)+ off_i = (off Happy_GHC_Exts.+# nt) new_state = indexShortOffAddr happyTable off_i happyDrop 0# l = l-happyDrop n (HappyCons (_) (t)) = happyDrop (n -# (1# :: Int#)) t+happyDrop n (HappyCons (_) (t)) = happyDrop (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) t happyDropStk 0# l = l-happyDropStk n (x `HappyStk` xs) = happyDropStk (n -# (1#::Int#)) xs+happyDropStk n (x `HappyStk` xs) = happyDropStk (n Happy_GHC_Exts.-# (1#::Happy_GHC_Exts.Int#)) xs ----------------------------------------------------------------------------- -- Moving to a new state after a reduction@@ -1059,7 +1060,7 @@ {- nothing -} happyDoAction j tk new_state where off = indexShortOffAddr happyGotoOffsets st- off_i = (off +# nt)+ off_i = (off Happy_GHC_Exts.+# nt) new_state = indexShortOffAddr happyTable off_i @@ -1088,7 +1089,7 @@ -- save the old token and carry on. happyFail i tk (action) sts stk = -- trace "entering error recovery" $- happyDoAction 0# tk action sts ( (unsafeCoerce# (I# (i))) `HappyStk` stk)+ happyDoAction 0# tk action sts ( (Happy_GHC_Exts.unsafeCoerce# (Happy_GHC_Exts.I# (i))) `HappyStk` stk) -- Internal happy errors: @@ -1098,7 +1099,7 @@ -- Hack to get the typechecker to accept our action functions -happyTcHack :: Int# -> a -> a+happyTcHack :: Happy_GHC_Exts.Int# -> a -> a happyTcHack x y = y {-# INLINE happyTcHack #-}
dist/build/alex/alex-tmp/Scan.hs view
@@ -1,6 +1,5 @@ {-# OPTIONS -fglasgow-exts -cpp #-} {-# LINE 13 "src/Scan.x" #-}- {-# OPTIONS_GHC -w #-} module Scan(lexer, AlexPosn(..), Token(..), Tkn(..), tokPosn) where@@ -11,7 +10,7 @@ #if __GLASGOW_HASKELL__ >= 603 #include "ghcconfig.h"-#elif defined(__GLASGOW_HASKELL__)+#else #include "config.h" #endif #if __GLASGOW_HASKELL__ >= 503@@ -42,7 +41,6 @@ alex_accept = listArray (0::Int,77) [[],[(AlexAcc (alex_action_21))],[],[],[(AlexAcc (alex_action_0))],[(AlexAcc (alex_action_0))],[(AlexAcc (alex_action_0))],[],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_1))],[(AlexAcc (alex_action_10))],[],[(AlexAcc (alex_action_2))],[(AlexAcc (alex_action_2))],[],[],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_10))],[],[],[],[],[],[(AlexAccPred (alex_action_3) (alexRightContext 24)),(AlexAcc (alex_action_4))],[],[(AlexAccSkip)],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_5))],[],[],[],[],[],[],[],[(AlexAcc (alex_action_6))],[(AlexAcc (alex_action_6))],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_7))],[(AlexAcc (alex_action_9))],[(AlexAcc (alex_action_8))],[(AlexAcc (alex_action_9))],[(AlexAcc (alex_action_9))],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_11))],[(AlexAcc (alex_action_11))],[(AlexAcc (alex_action_11))],[],[],[],[(AlexAcc (alex_action_12))],[(AlexAcc (alex_action_12))],[(AlexAcc (alex_action_12))],[],[],[],[(AlexAcc (alex_action_13))],[(AlexAcc (alex_action_13))],[],[],[],[],[(AlexAcc (alex_action_14))],[(AlexAcc (alex_action_14))],[],[],[],[],[(AlexAcc (alex_action_15))],[(AlexAcc (alex_action_16))],[(AlexAcc (alex_action_17))],[(AlexAcc (alex_action_17))],[(AlexAcc (alex_action_18))],[(AlexAcc (alex_action_19))],[(AlexAcc (alex_action_20))],[]] {-# LINE 75 "src/Scan.x" #-} - -- ----------------------------------------------------------------------------- -- Token type @@ -189,33 +187,32 @@ afterstartcodes,startcodes :: Int afterstartcodes = 1 startcodes = 2-alex_action_0 = skip -alex_action_1 = string -alex_action_2 = bind -alex_action_3 = code -alex_action_4 = special -alex_action_5 = wrapper -alex_action_6 = decch -alex_action_7 = hexch -alex_action_8 = octch -alex_action_9 = escape -alex_action_10 = char -alex_action_11 = smac -alex_action_12 = rmac -alex_action_13 = smacdef -alex_action_14 = rmacdef -alex_action_15 = special `andBegin` startcodes -alex_action_16 = zero -alex_action_17 = startcode -alex_action_18 = special -alex_action_19 = special `andBegin` afterstartcodes -alex_action_20 = special `andBegin` 0 -alex_action_21 = skip `andBegin` 0 -{-# LINE 1 "templates/GenericTemplate.hs" #-}-{-# LINE 1 "templates/GenericTemplate.hs" #-}+alex_action_0 = skip +alex_action_1 = string +alex_action_2 = bind +alex_action_3 = code +alex_action_4 = special +alex_action_5 = wrapper +alex_action_6 = decch +alex_action_7 = hexch +alex_action_8 = octch +alex_action_9 = escape +alex_action_10 = char +alex_action_11 = smac +alex_action_12 = rmac +alex_action_13 = smacdef +alex_action_14 = rmacdef +alex_action_15 = special `andBegin` startcodes +alex_action_16 = zero +alex_action_17 = startcode +alex_action_18 = special +alex_action_19 = special `andBegin` afterstartcodes +alex_action_20 = special `andBegin` 0 +alex_action_21 = skip `andBegin` 0 +{-# LINE 1 "GenericTemplate.hs" #-} {-# LINE 1 "<built-in>" #-}-{-# LINE 1 "<command-line>" #-}-{-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "<command line>" #-}+{-# LINE 1 "GenericTemplate.hs" #-} -- ----------------------------------------------------------------------------- -- ALEX TEMPLATE --@@ -225,9 +222,9 @@ -- ----------------------------------------------------------------------------- -- INTERNALS and main scanner engine -{-# LINE 35 "templates/GenericTemplate.hs" #-}+{-# LINE 35 "GenericTemplate.hs" #-} -{-# LINE 45 "templates/GenericTemplate.hs" #-}+{-# LINE 45 "GenericTemplate.hs" #-} data AlexAddr = AlexA# Addr#
src/AbsSyn.hs view
@@ -15,7 +15,7 @@ RECtx(..), RExp(..), DFA(..), State(..), SNum, StartCode, Accept(..),- RightContext(..),+ RightContext(..), showRCtx, encodeStartCodes, extractActions, Target(..) ) where@@ -82,7 +82,7 @@ showStarts [] = id showStarts scs = shows scs -showRCtx :: RightContext RExp -> String -> String+showRCtx :: Show r => RightContext r -> String -> String showRCtx NoRightContext = id showRCtx (RightContextRExp r) = ('\\':) . shows r showRCtx (RightContextCode code) = showString "\\ " . showCode code@@ -106,6 +106,10 @@ accRightCtx :: RightContext SNum } +-- debug stuff+instance Show (Accept a) where+ showsPrec _ (Acc p _act _lctx _rctx) = shows p --TODO+ type StartCode = Int -- -----------------------------------------------------------------------------@@ -256,7 +260,7 @@ mkDecl fun code = str fun . str " = " . str code . nl - act_names = map (\n -> "alex_action_" ++ show n) [0..]+ act_names = map (\n -> "alex_action_" ++ show (n::Int)) [0..] decl_str = foldr (.) id [ decl | Just decl <- decls ]
src/DFA.hs view
@@ -19,6 +19,7 @@ import qualified Map import NFA import Sort ( msort, nub' )+import CharSet import Data.Array ( (!) ) import Data.Maybe ( fromJust )@@ -113,17 +114,21 @@ umkd' = rctx_sss ++ map snd ss_outs ++ umkd - ss_outs = [ (ch, mk_ss nfa ss')- | ch <- dfa_alphabet,- let ss' = [ s' | (p,s') <- outs, p ch ],- not (null ss')- ]+ -- for each character, the set of states that character would take+ -- us to from the current set of states in the NFA.+ ss_outs :: [(Char, StateSet)]+ ss_outs = [ (ch, mk_ss nfa ss')+ | ch <- dfa_alphabet,+ let ss' = [ s' | (p,s') <- outs, p ch ],+ not (null ss')+ ] rctx_sss = [ mk_ss nfa [s]- | s <- ss,- Acc _ _ _ (RightContextRExp s) <- accs ]+ | Acc _ _ _ (RightContextRExp s) <- accs ] - outs = [ out | s <- ss, out <- nst_outs (nfa!s) ]+ outs :: [(CharSet,SNum)]+ outs = [ out | s <- ss, out <- nst_outs (nfa!s) ]+ accs = sort_accs [acc| s<-ss, acc<-nst_accs (nfa!s)] dfa_alphabet:: [Char]@@ -163,7 +168,7 @@ dfa_states = Map.empty } where- start_ss = [ msort (<=) (nst_cl(nfa!n)) | n <- [0..starts]]+ start_ss = [ msort (<=) (nst_cl(nfa!n)) | n <- [0..(starts-1)]] -- starts is the number of start states
src/Info.hs view
@@ -12,8 +12,11 @@ import AbsSyn import qualified Map-import Util ( str, nl, interleave_shows, char, ljustify )+import Util+import CharSet +import Data.Array+ -- ----------------------------------------------------------------------------- -- Generate a human readable dump of the state machine @@ -27,38 +30,36 @@ infoDFA' = interleave_shows nl (map infoStateN dfa_list) - infoStateN (i,s) = str "State " . shows i . nl . infoState s . nl+ infoStateN (i,s) = str "State " . shows i . nl . infoState s infoState :: State SNum Code -> ShowS- infoState (State _accs out)- = infoArr out . nl- -- . str ("\tDefault -> ") . shows df+ infoState (State accs out)+ = foldr (.) id (map infoAccept accs)+ . infoArr out . nl infoArr out = char '\t' . interleave_shows (str "\n\t") (map infoTransition (Map.toAscList out)) + infoAccept (Acc p act lctx rctx)+ = str "\tAccept" . paren (shows p) . space+ . outputLCtx lctx . space+ . showRCtx rctx+ . (case act of+ Nothing -> id+ Just code -> str " { " . str code . str " }")+ . nl+ infoTransition (char',state) = str (ljustify 8 (show char')) . str " -> " . shows state --- outputAccs :: [Accept Code] -> ShowS--- outputAccs accs--- = brack (interleave_shows (char ',') (map (paren.outputAcc) accs))--- --- outputAcc (Acc prio act scs lctx rctx)--- = str "Acc " . shows prio . space--- . paren (str act) . space--- . shows scs . space--- . outputLCtx lctx . space--- . shows rctx------ outputLCtx Nothing--- = str "Nothing"--- outputLCtx (Just set)--- = str "Just " . paren (outputArr (charSetToArray set))------ outputArr arr--- = str "Array.array " . shows (bounds arr) . space--- . shows (assocs arr)+ outputLCtx Nothing+ = id+ outputLCtx (Just set)+ = paren (outputArr (charSetToArray set)) . char '^'++ outputArr arr+ = str "Array.array " . shows (bounds arr) . space+ . shows (assocs arr)
src/Main.hs view
@@ -21,7 +21,9 @@ import Util ( hline ) import Paths_alex ( version, getDataDir ) +#if __GLASGOW_HASKELL__ < 610 import Control.Exception as Exception ( block, unblock, catch, throw )+#endif #if __GLASGOW_HASKELL__ >= 610 import Control.Exception ( bracketOnError ) #endif
src/Map.hs view
@@ -11,12 +11,12 @@ toAscList ) where -import Prelude hiding ( lookup )- #if __GLASGOW_HASKELL__ >= 603 import Data.Map+import Prelude () #else import Data.FiniteMap+import Prelude hiding ( lookup ) type Map k a = FiniteMap k a
src/NFA.hs view
@@ -46,9 +46,6 @@ } -- Debug stuff-instance Show (Accept a) where- showsPrec _ (Acc p _act _lctx _rctx) = shows p --TODO- instance Show NState where showsPrec _ (NSt accs cl outs) = str "NSt " . shows accs . space . shows cl . space .@@ -112,12 +109,7 @@ accept r_e rctxt_accept return (RightContextRExp r_b) -- let lctx' = case lctx of- Nothing -> Nothing- Just st -> Just st-- accept e (Acc prio code lctx' rctx_e)+ accept e (Acc prio code lctx rctx_e) return b tok_transitions toks_with_states start_code start_state = do
templates/GenericTemplate.hs view
@@ -128,17 +128,17 @@ #endif AlexError input' - (AlexLastSkip input len, _) ->+ (AlexLastSkip input'' len, _) -> #ifdef ALEX_DEBUG trace ("Skipping.") $ #endif- AlexSkip input len+ AlexSkip input'' len - (AlexLastAcc k input len, _) ->+ (AlexLastAcc k input''' len, _) -> #ifdef ALEX_DEBUG trace ("Accept.") $ #endif- AlexToken input len k+ AlexToken input''' len k -- Push the input through the DFA, remembering the most recent accepting@@ -177,11 +177,11 @@ check_accs [] = last_acc check_accs (AlexAcc a : _) = AlexLastAcc a input IBOX(len) check_accs (AlexAccSkip : _) = AlexLastSkip input IBOX(len)- check_accs (AlexAccPred a pred : rest)- | pred user orig_input IBOX(len) input+ check_accs (AlexAccPred a predx : rest)+ | predx user orig_input IBOX(len) input = AlexLastAcc a input IBOX(len)- check_accs (AlexAccSkipPred pred : rest)- | pred user orig_input IBOX(len) input+ check_accs (AlexAccSkipPred predx : rest)+ | predx user orig_input IBOX(len) input = AlexLastSkip input IBOX(len) check_accs (_ : rest) = check_accs rest