parsestar 1.4 → 1.5
raw patch · 5 files changed
+232/−94 lines, 5 filesdep ~bytestringsetup-changed
Dependency ranges changed: bytestring
Files
- Data/STAR/Tokens.hs +91/−24
- Data/STAR/Type.hs +2/−0
- Setup.hs +17/−1
- dist/build/Data/STAR/Parser.hs +117/−54
- parsestar.cabal +5/−15
Data/STAR/Tokens.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP,MagicHash,BangPatterns #-}+{-# LANGUAGE CPP,MagicHash #-} {-# LINE 1 "preSrc/Tokens.x" #-} {-# LANGUAGE OverloadedStrings, NoMonomorphismRestriction, BangPatterns #-}@@ -187,8 +187,8 @@ alex_deflt :: AlexAddr alex_deflt = AlexA# "\x7d\x00\x8f\x00\x4d\x00\x8d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x21\x00\x21\x00\x2d\x00\x2d\x00\x31\x00\x31\x00\x33\x00\x33\x00\x37\x00\x37\x00\x38\x00\x38\x00\x3a\x00\x3a\x00\x3c\x00\x3c\x00\x3e\x00\x3e\x00\x40\x00\x40\x00\x44\x00\x44\x00\x45\x00\x45\x00\x49\x00\x49\x00\x4c\x00\x4c\x00\x4d\x00\x4d\x00\x4d\x00\x51\x00\x51\x00\x54\x00\x54\x00\x58\x00\x58\x00\x5b\x00\x5b\x00\x5e\x00\x5e\x00\x5f\x00\x5f\x00\x5f\x00\x62\x00\x62\x00\x8f\x00\x8f\x00\x8f\x00\x8d\x00\x8d\x00\x8d\x00\x4d\x00\xff\xff\x7d\x00\x7d\x00\x7d\x00\x6e\x00\x6e\x00\x6e\x00\x6e\x00\x6d\x00\x6d\x00\x6d\x00\x68\x00\x68\x00\x68\x00\x67\x00\x67\x00\x67\x00\x5f\x00\x65\x00\x65\x00\x65\x00\x65\x00\xff\xff\xff\xff\xff\xff\x67\x00\x68\x00\x68\x00\x7d\x00\x7d\x00\x7d\x00\x6d\x00\x6e\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x7d\x00\x6d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"# -alex_accept = listArray (0::Int,143) [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[(AlexAccSkip)],[(AlexAccSkip)],[(AlexAccSkip)],[(AlexAccPred (alex_action_2) (alexRightContext 4))],[(AlexAcc (alex_action_3))],[(AlexAccPred (alex_action_4) (alexRightContext 4)),(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAcc (alex_action_5))],[(AlexAcc (alex_action_6))],[(AlexAcc (alex_action_7))],[(AlexAccPred (alex_action_8) (alexRightContext 4)),(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_9) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_10) (alexRightContext 4))],[(AlexAccPred (alex_action_11) (alexPrevCharMatches(\c -> c >= '\t' && c <= '\r' || c >= ' ' && c <= ' ' || False)))],[(AlexAccPred (alex_action_12) (alexPrevCharMatches(\c -> c >= '\t' && c <= '\r' || c >= ' ' && c <= ' ' || False)))],[(AlexAccPred (alex_action_13) (alexPrevCharMatches(\c -> c >= '\n' && c <= '\n' || False)))],[(AlexAccPred (alex_action_14) (alexPrevCharMatches(\c -> c >= '\n' && c <= '\n' || False)))],[(AlexAccSkipPred (alexPrevCharMatches(\c -> c >= '\n' && c <= '\n' || False)))],[(AlexAccSkipPred (alexPrevCharMatches(\c -> c >= '\n' && c <= '\n' || False)))],[(AlexAccSkipPred (alexRightContext 99)),(AlexAccPred (alex_action_19) (alexRightContext 4))],[(AlexAccSkip)],[(AlexAccSkipPred (alexRightContext 99)),(AlexAccPred (alex_action_22) (alexRightContext 4))],[(AlexAccSkip)]]-{-# LINE 83 "preSrc/Tokens.x" #-}+alex_accept = listArray (0::Int,143) [AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccSkip,AlexAccSkip,AlexAccSkip,AlexAccPred (alex_action_2) (alexRightContext 4)(AlexAccNone),AlexAcc (alex_action_3),AlexAccPred (alex_action_4) (alexRightContext 4)(AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone)),AlexAcc (alex_action_5),AlexAcc (alex_action_6),AlexAcc (alex_action_7),AlexAccPred (alex_action_8) (alexRightContext 4)(AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone)),AlexAccPred (alex_action_9) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_10) (alexRightContext 4)(AlexAccNone),AlexAccPred (alex_action_11) (alexPrevCharMatches(\c -> c >= '\t' && c <= '\r' || c >= ' ' && c <= ' ' || False))(AlexAccNone),AlexAccPred (alex_action_12) (alexPrevCharMatches(\c -> c >= '\t' && c <= '\r' || c >= ' ' && c <= ' ' || False))(AlexAccNone),AlexAccPred (alex_action_13) (alexPrevCharMatches(\c -> c >= '\n' && c <= '\n' || False))(AlexAccNone),AlexAccPred (alex_action_14) (alexPrevCharMatches(\c -> c >= '\n' && c <= '\n' || False))(AlexAccNone),AlexAccSkipPred (alexPrevCharMatches(\c -> c >= '\n' && c <= '\n' || False))(AlexAccNone),AlexAccSkipPred (alexPrevCharMatches(\c -> c >= '\n' && c <= '\n' || False))(AlexAccNone),AlexAccSkipPred (alexRightContext 99)(AlexAccPred (alex_action_19) (alexRightContext 4)(AlexAccNone)),AlexAccSkip,AlexAccSkipPred (alexRightContext 99)(AlexAccPred (alex_action_22) (alexRightContext 4)(AlexAccNone)),AlexAccSkip]+{-# LINE 84 "preSrc/Tokens.x" #-} data ParseError = ParseError Int Int Int String@@ -317,8 +317,54 @@ alex_action_22 = (\p s -> SemiEnd $ stringStep s (-1) , 0 ) {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-}-{-# LINE 1 "<built-in>" #-} {-# LINE 1 "<command-line>" #-}+{-# LINE 8 "<command-line>" #-}+# 1 "/usr/include/stdc-predef.h" 1 3 4++# 17 "/usr/include/stdc-predef.h" 3 4+++++++++++++++++++++++++++++++++++++++++++{-# LINE 8 "<command-line>" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-} -- ----------------------------------------------------------------------------- -- ALEX TEMPLATE@@ -329,13 +375,25 @@ -- ----------------------------------------------------------------------------- -- INTERNALS and main scanner engine -{-# LINE 37 "templates/GenericTemplate.hs" #-}+{-# LINE 21 "templates/GenericTemplate.hs" #-} -{-# LINE 47 "templates/GenericTemplate.hs" #-} -data AlexAddr = AlexA# Addr# ++-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.+#if __GLASGOW_HASKELL__ > 706+#define GTE(n,m) (tagToEnum# (n >=# m))+#define EQ(n,m) (tagToEnum# (n ==# m))+#else+#define GTE(n,m) (n >=# m)+#define EQ(n,m) (n ==# m)+#endif+{-# LINE 51 "templates/GenericTemplate.hs" #-}+++data AlexAddr = AlexA# Addr#+-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex. #if __GLASGOW_HASKELL__ < 503 uncheckedShiftL# = shiftL# #endif@@ -378,6 +436,7 @@ + #if __GLASGOW_HASKELL__ < 503 quickIndex arr i = arr ! i #else@@ -444,36 +503,41 @@ - let- (!(base)) = alexIndexInt32OffAddr alex_base s- (!((I# (ord_c)))) = fromIntegral c- (!(offset)) = (base +# ord_c)- (!(check)) = alexIndexInt16OffAddr alex_check offset+ case fromIntegral c of { (I# (ord_c)) ->+ let+ !base = alexIndexInt32OffAddr alex_base s+ !offset = (base +# ord_c)+ !check = alexIndexInt16OffAddr alex_check offset - (!(new_s)) = if (offset >=# 0#) && (check ==# ord_c)+ !new_s = if GTE(offset,0#) && EQ(check,ord_c) then alexIndexInt16OffAddr alex_table offset else alexIndexInt16OffAddr alex_deflt s in- case new_s of + case new_s of -1# -> (new_acc, input) -- on an error, we want to keep the input *before* the -- character that failed, not after. _ -> alex_scan_tkn user orig_input (if c < 0x80 || c >= 0xC0 then (len +# 1#) else len) -- note that the length is increased ONLY if this is the 1st byte in a char encoding) new_input new_s new_acc-+ } where- check_accs [] = last_acc- check_accs (AlexAcc a : _) = AlexLastAcc a input (I# (len))- check_accs (AlexAccSkip : _) = AlexLastSkip input (I# (len))- check_accs (AlexAccPred a predx : rest)+ check_accs (AlexAccNone) = last_acc+ check_accs (AlexAcc a ) = AlexLastAcc a input (I# (len))+ check_accs (AlexAccSkip) = AlexLastSkip input (I# (len))++ check_accs (AlexAccPred a predx rest) | predx user orig_input (I# (len)) input = AlexLastAcc a input (I# (len))- check_accs (AlexAccSkipPred predx : rest)+ | otherwise+ = check_accs rest+ check_accs (AlexAccSkipPred predx rest) | predx user orig_input (I# (len)) input = AlexLastSkip input (I# (len))- check_accs (_ : rest) = check_accs rest+ | otherwise+ = check_accs rest + data AlexLastAcc a = AlexNone | AlexLastAcc a !AlexInput !Int@@ -485,11 +549,13 @@ fmap f (AlexLastSkip x y) = AlexLastSkip x y data AlexAcc a user- = AlexAcc a+ = AlexAccNone+ | AlexAcc a | AlexAccSkip- | AlexAccPred a (AlexAccPred user)- | AlexAccSkipPred (AlexAccPred user) + | AlexAccPred a (AlexAccPred user) (AlexAcc a user)+ | AlexAccSkipPred (AlexAccPred user) (AlexAcc a user)+ type AlexAccPred user = user -> AlexInput -> Int -> AlexInput -> Bool -- -----------------------------------------------------------------------------@@ -514,6 +580,7 @@ -- TODO: there's no need to find the longest -- match when checking the right context, just -- the first match will do.+ -- used by wrappers iUnbox (I# (i)) = i
Data/STAR/Type.hs view
@@ -25,11 +25,13 @@ } deriving (Show, Eq) +{- #ifdef DEFINE_NFDATA_BYTESTRING instance NFData BSC.ByteString where rnf bs = bs `seq` () #endif+ -} {-!
Setup.hs view
@@ -1,2 +1,18 @@+#! /usr/bin/env runhaskell++module Main(main) where+ import Distribution.Simple-main = defaultMain+import System.Environment+import Control.Monad(when)+import Data.List(isPrefixOf)++-- Defaults to installing in --user package database.+isPkgDbOpts arg = ("--package-db" `isPrefixOf` arg ) || (arg `elem` ["--user", "--global"])+haveNotPkgDbOpts = not . any isPkgDbOpts++main = do args <- getArgs+ defaultMainArgs $ if (length args > 0 && (head args `elem` ["configure", "install"]) && haveNotPkgDbOpts args)+ then (head args:"--user":tail args)+ else args+
dist/build/Data/STAR/Parser.hs view
@@ -20,7 +20,7 @@ import qualified Data.Array as Happy_Data_Array import qualified GHC.Exts as Happy_GHC_Exts --- parser produced by Happy Version 1.18.9+-- parser produced by Happy Version 1.19.3 newtype HappyAbsSyn t16 t17 t18 t19 t20 t21 t22 t23 t24 t25 t26 t27 t28 t29 t30 = HappyAbsSyn HappyAny #if __GLASGOW_HASKELL__ >= 607@@ -672,25 +672,87 @@ parseFile fname = parseFileCompressed (".gz" `Data.List.isSuffixOf` fname) fname {-# LINE 1 "templates/GenericTemplate.hs" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-}-{-# LINE 1 "<built-in>" #-} {-# LINE 1 "<command-line>" #-}+{-# LINE 8 "<command-line>" #-}+# 1 "/usr/include/stdc-predef.h" 1 3 4++# 17 "/usr/include/stdc-predef.h" 3 4+++++++++++++++++++++++++++++++++++++++++++{-# LINE 8 "<command-line>" #-} {-# LINE 1 "templates/GenericTemplate.hs" #-} -- Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp -{-# LINE 30 "templates/GenericTemplate.hs" #-}+{-# LINE 13 "templates/GenericTemplate.hs" #-} ++++-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.+#if __GLASGOW_HASKELL__ > 706+#define LT(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.<# m)) :: Bool)+#define GTE(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.>=# m)) :: Bool)+#define EQ(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.==# m)) :: Bool)+#else+#define LT(n,m) (n Happy_GHC_Exts.<# m)+#define GTE(n,m) (n Happy_GHC_Exts.>=# m)+#define EQ(n,m) (n Happy_GHC_Exts.==# m)+#endif+{-# LINE 46 "templates/GenericTemplate.hs" #-}++ data Happy_IntList = HappyCons Happy_GHC_Exts.Int# Happy_IntList -{-# LINE 51 "templates/GenericTemplate.hs" #-}+{-# LINE 67 "templates/GenericTemplate.hs" #-} -{-# LINE 61 "templates/GenericTemplate.hs" #-}+{-# LINE 77 "templates/GenericTemplate.hs" #-} -{-# LINE 70 "templates/GenericTemplate.hs" #-}+{-# LINE 86 "templates/GenericTemplate.hs" #-} infixr 9 `HappyStk` data HappyStk a = HappyStk a (HappyStk a)@@ -707,9 +769,9 @@ -- parse (a %partial parser). We must ignore the saved token on the top of -- the stack in this case. happyAccept 0# tk st sts (_ `HappyStk` ans `HappyStk` _) =- happyReturn1 ans+ happyReturn1 ans happyAccept j tk st sts (HappyStk ans _) = - (happyTcHack j (happyTcHack st)) (happyReturn1 ans)+ (happyTcHack j (happyTcHack st)) (happyReturn1 ans) ----------------------------------------------------------------------------- -- Arrays only: do the next action@@ -717,37 +779,35 @@ happyDoAction i tk st- = {- nothing -}+ = {- nothing -} - case action of- 0# -> {- nothing -}- happyFail i tk st- -1# -> {- nothing -}- happyAccept i tk st- n | (n Happy_GHC_Exts.<# (0# :: Happy_GHC_Exts.Int#)) -> {- nothing -}+ case action of+ 0# -> {- nothing -}+ happyFail i tk st+ -1# -> {- nothing -}+ happyAccept i tk st+ n | LT(n,(0# :: Happy_GHC_Exts.Int#)) -> {- nothing -} - (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 -}+ (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 Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#))- where (off) = indexShortOffAddr happyActOffsets st- (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)+ happyShift new_state i tk st+ where new_state = (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#))+ where off = indexShortOffAddr happyActOffsets st+ off_i = (off Happy_GHC_Exts.+# i)+ check = if GTE(off_i,(0# :: Happy_GHC_Exts.Int#))+ then EQ(indexShortOffAddr happyCheck off_i, i)+ else False+ action | check = indexShortOffAddr happyTable off_i | otherwise = indexShortOffAddr happyDefActions st -{-# LINE 130 "templates/GenericTemplate.hs" #-} - indexShortOffAddr (HappyA# arr) off =- Happy_GHC_Exts.narrow16Int# i+ Happy_GHC_Exts.narrow16Int# i where i = Happy_GHC_Exts.word2Int# (Happy_GHC_Exts.or# (Happy_GHC_Exts.uncheckedShiftL# high 8#) low) high = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr (off' Happy_GHC_Exts.+# 1#)))@@ -766,13 +826,13 @@ ----------------------------------------------------------------------------- -- HappyState data type (not arrays) -{-# LINE 163 "templates/GenericTemplate.hs" #-}+{-# LINE 170 "templates/GenericTemplate.hs" #-} ----------------------------------------------------------------------------- -- Shifting a token happyShift new_state 0# tk st sts stk@(x `HappyStk` _) =- let (i) = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.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) @@ -808,30 +868,33 @@ = happyFail 0# tk st sts stk happyReduce k nt fn j tk st sts stk = 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)+ 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) happyMonadReduce k nt fn 0# tk st sts stk = happyFail 0# tk st sts stk happyMonadReduce k nt fn j tk st sts stk =- happyThen1 (fn stk tk) (\r -> happyGoto nt j tk st1 sts1 (r `HappyStk` drop_stk))- where (sts1@((HappyCons (st1@(action)) (_)))) = happyDrop k (HappyCons (st) (sts))- drop_stk = happyDropStk k stk+ case happyDrop k (HappyCons (st) (sts)) of+ sts1@((HappyCons (st1@(action)) (_))) ->+ let drop_stk = happyDropStk k stk in+ happyThen1 (fn stk tk) (\r -> happyGoto nt j tk st1 sts1 (r `HappyStk` drop_stk)) happyMonad2Reduce k nt fn 0# tk st sts stk = happyFail 0# tk st sts stk happyMonad2Reduce k nt fn j tk st sts stk =- happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk))- where (sts1@((HappyCons (st1@(action)) (_)))) = happyDrop k (HappyCons (st) (sts))- drop_stk = happyDropStk k stk+ case happyDrop k (HappyCons (st) (sts)) of+ sts1@((HappyCons (st1@(action)) (_))) ->+ let drop_stk = happyDropStk k stk - (off) = indexShortOffAddr happyGotoOffsets st1- (off_i) = (off Happy_GHC_Exts.+# nt)- (new_state) = indexShortOffAddr happyTable off_i+ off = indexShortOffAddr happyGotoOffsets st1+ off_i = (off Happy_GHC_Exts.+# nt)+ new_state = indexShortOffAddr happyTable off_i + in+ happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk)) happyDrop 0# l = l happyDrop n (HappyCons (_) (t)) = happyDrop (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) t@@ -846,9 +909,9 @@ happyGoto nt j tk st = {- nothing -} happyDoAction j tk new_state- where (off) = indexShortOffAddr happyGotoOffsets st- (off_i) = (off Happy_GHC_Exts.+# nt)- (new_state) = indexShortOffAddr happyTable off_i+ where off = indexShortOffAddr happyGotoOffsets st+ off_i = (off Happy_GHC_Exts.+# nt)+ new_state = indexShortOffAddr happyTable off_i @@ -858,8 +921,8 @@ -- parse error if we are in recovery and we fail again happyFail 0# tk old_st _ stk@(x `HappyStk` _) =- let (i) = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in--- trace "failing" $ + let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in+-- trace "failing" $ happyError_ i tk {- We don't need state discarding for our restricted implementation of@@ -868,16 +931,16 @@ -- discard a state happyFail 0# tk old_st (HappyCons ((action)) (sts)) - (saved_tok `HappyStk` _ `HappyStk` stk) =--- trace ("discarding state, depth " ++ show (length stk)) $- happyDoAction 0# tk action sts ((saved_tok`HappyStk`stk))+ (saved_tok `HappyStk` _ `HappyStk` stk) =+-- trace ("discarding state, depth " ++ show (length stk)) $+ happyDoAction 0# tk action sts ((saved_tok`HappyStk`stk)) -} -- Enter error recovery: generate an error token, -- save the old token and carry on. happyFail i tk (action) sts stk = -- trace "entering error recovery" $- happyDoAction 0# tk action sts ( (Happy_GHC_Exts.unsafeCoerce# (Happy_GHC_Exts.I# (i))) `HappyStk` stk)+ happyDoAction 0# tk action sts ( (Happy_GHC_Exts.unsafeCoerce# (Happy_GHC_Exts.I# (i))) `HappyStk` stk) -- Internal happy errors: @@ -895,9 +958,9 @@ ----------------------------------------------------------------------------- -- Seq-ing. If the --strict flag is given, then Happy emits --- happySeq = happyDoSeq+-- happySeq = happyDoSeq -- otherwise it emits--- happySeq = happyDontSeq+-- happySeq = happyDontSeq happyDoSeq, happyDontSeq :: a -> b -> b happyDoSeq a b = a `seq` b
parsestar.cabal view
@@ -1,5 +1,5 @@ name: parsestar-version: 1.4+version: 1.5 synopsis: NMR-STAR file format parser. description: Parser for NMR-STAR data used by BMRB databank repository of biological nuclear magnetic resonance data.@@ -7,15 +7,10 @@ license: BSD3 license-file: LICENSE author: Michal J. Gajda-maintainer: mgajda@gwdg.de+maintainer: mjgajda@gmail.com build-type: Simple cabal-version: >=1.12-tested-with: GHC==7.4.1,GHC==7.4.2,GHC==7.6.1--flag old-bytestring- description: Use old bytestring library before version 0.10 (introduced along with GHC 7.6).- Disable for GHC 7.6.1.- default: False+tested-with: GHC==7.8.3 library default-language: Haskell2010@@ -23,15 +18,10 @@ Data.STAR.Parser Data.STAR.Path Data.STAR.ResidueCodes other-modules: Data.STAR.StringUtil Data.STAR.Tokens ghc-options:- build-depends: array, base < 4.8,mtl, binary, bytestring, bytestring-mmap, bytestring-show, bytestring-nums, deepseq,+ build-depends: array, base < 4.8,mtl, binary, bytestring >= 0.10,+ bytestring-mmap, bytestring-show, bytestring-nums, deepseq, derive, zlib >= 0.5, containers >= 0.5 build-tools: happy- if flag(old-bytestring)- cpp-options: -DDEFINE_NFDATA_BYTESTRING- build-depends: bytestring < 0.10- else- build-depends: bytestring >= 0.10.0.0- --build-tools: alex, happy executable PrintCSTypes Hs-Source-Dirs: test