1 {-# OPTIONS -fglasgow-exts -cpp #-}
2 -- parser produced by Happy Version 1.11
17 happyActOffsets :: Addr
18 happyActOffsets = A# "\x0a\x00\x0a\x00\x00\x00\xff\xff\x0a\x00\x0a\x00\x08\x00\x07\x00\x00\x00"#
20 happyGotoOffsets :: Addr
21 happyGotoOffsets = A# "\x06\x00\x00\x00\x00\x00\x00\x00\x05\x00\x04\x00\x00\x00\x00\x00\x00\x00"#
23 happyDefActions :: Addr
24 happyDefActions = A# "\x00\x00\x00\x00\xfe\xff\x00\x00\x00\x00\x00\x00\xfc\xff\xfd\xff"#
27 happyCheck = A# "\xff\xff\x02\x00\x03\x00\x04\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x02\x00\x02\x00\x01\x00\xff\xff\xff\xff\xff\xff"#
30 happyTable = A# "\x00\x00\x05\x00\x06\x00\xff\xff\x06\x00\x07\x00\x03\x00\x00\x00\x00\x00\x00\x00\x05\x00\x03\x00\x00\x00\x00\x00\x00\x00"#
32 happyReduceArr = array (1, 3) [
38 happy_n_terms = 5 :: Int
39 happy_n_nonterms = 1 :: Int
41 happyReduce_1 = happySpecReduce_1 0# happyReduction_1
47 happyReduce_2 = happySpecReduce_3 0# happyReduction_2
55 happyReduce_3 = happySpecReduce_3 0# happyReduction_3
63 happyNewToken action sts stk [] =
64 happyDoAction 4# (error "reading EOF!") action sts stk []
66 happyNewToken action sts stk (tk:tks) =
67 let cont i = happyDoAction i tk action sts stk tks in
74 happyThen = \m k -> k m
76 happyThen1 = happyThen
77 happyReturn1 = \a tks -> a
79 parser tks = happyThen (happyParse 0# tks) (\x -> case x of {HappyAbsSyn4 z -> happyReturn z; _other -> notHappyAtAll })
81 data Token = Tid | Tgreater | Tand
84 happyError = error "parse error"
86 lexer :: String -> [Token]
90 l ('a':'n':'d':cs) = Tand : l cs
93 | isAlpha c = let (_,rs) = span isAlpha (c:cs)
95 l ('>':cs) = Tgreater : l cs
96 {-# LINE 1 "GenericTemplate.hs" #-}
97 {-# LINE 1 "GenericTemplate.hs" #-}
98 -- $Id: Parser.hs,v 1.1 2002/01/31 13:46:38 simonmar Exp $
112 {-# LINE 27 "GenericTemplate.hs" #-}
116 data Happy_IntList = HappyCons Int# Happy_IntList
148 happyTrace string expr = unsafePerformIO $ do
149 hPutStr stderr string
156 data HappyStk a = HappyStk a (HappyStk a)
158 -----------------------------------------------------------------------------
159 -- starting the parse
161 happyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll
163 -----------------------------------------------------------------------------
164 -- Accepting the parse
166 happyAccept j tk st sts (HappyStk ans _) = (happyTcHack j
170 -----------------------------------------------------------------------------
171 -- Arrays only: do the next action
175 happyDoAction i tk st
176 = (happyTrace ("state: " ++ show (I# (st)) ++
177 ",\ttoken: " ++ show (I# (i)) ++
180 0# -> (happyTrace ("fail.\n")) $
182 -1# -> (happyTrace ("accept.\n")) $
184 n | (n <# (0# :: Int#)) -> (happyTrace ("reduce (rule " ++ show rule
186 (happyReduceArr ! rule) i tk st
187 where rule = (I# ((negateInt# ((n +# (1# :: Int#))))))
188 n -> (happyTrace ("shift, enter state "
189 ++ show (I# (new_state))
191 happyShift new_state i tk st
192 where new_state = (n -# (1# :: Int#))
193 where off = indexShortOffAddr happyActOffsets st
195 check = if (off_i >=# (0# :: Int#))
196 then (indexShortOffAddr happyCheck off_i ==# i)
198 action | check = indexShortOffAddr happyTable off_i
199 | otherwise = indexShortOffAddr happyDefActions st
207 indexShortOffAddr (A# arr) off =
208 #if __GLASGOW_HASKELL__ > 500
210 #elif __GLASGOW_HASKELL__ == 500
213 (i `iShiftL#` 16#) `iShiftRA#` 16#
216 i = word2Int# ((high `shiftL#` 8#) `or#` low)
217 high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
218 low = int2Word# (ord# (indexCharOffAddr# arr off'))
226 -----------------------------------------------------------------------------
227 -- HappyState data type (not arrays)
229 {-# LINE 153 "GenericTemplate.hs" #-}
232 -----------------------------------------------------------------------------
235 happyShift new_state 0# tk st sts stk@(x `HappyStk` _) =
236 let i = (case x of { HappyErrorToken (I# (i)) -> i }) in
237 -- trace "shifting the error token" $
238 happyDoAction i tk new_state (HappyCons (st) (sts)) (stk)
240 happyShift new_state i tk st sts stk =
241 happyNewToken new_state (HappyCons (st) (sts)) ((HappyTerminal (tk))`HappyStk`stk)
243 -- happyReduce is specialised for the common cases.
245 happySpecReduce_0 i fn 0# tk st sts stk
246 = happyFail 0# tk st sts stk
247 happySpecReduce_0 nt fn j tk st@((action)) sts stk
248 = happyGoto nt j tk st (HappyCons (st) (sts)) (fn `HappyStk` stk)
250 happySpecReduce_1 i fn 0# tk st sts stk
251 = happyFail 0# tk st sts stk
252 happySpecReduce_1 nt fn j tk _ sts@((HappyCons (st@(action)) (_))) (v1`HappyStk`stk')
253 = happyGoto nt j tk st sts (fn v1 `HappyStk` stk')
255 happySpecReduce_2 i fn 0# tk st sts stk
256 = happyFail 0# tk st sts stk
257 happySpecReduce_2 nt fn j tk _ (HappyCons (_) (sts@((HappyCons (st@(action)) (_))))) (v1`HappyStk`v2`HappyStk`stk')
258 = happyGoto nt j tk st sts (fn v1 v2 `HappyStk` stk')
260 happySpecReduce_3 i fn 0# tk st sts stk
261 = happyFail 0# tk st sts stk
262 happySpecReduce_3 nt fn j tk _ (HappyCons (_) ((HappyCons (_) (sts@((HappyCons (st@(action)) (_))))))) (v1`HappyStk`v2`HappyStk`v3`HappyStk`stk')
263 = happyGoto nt j tk st sts (fn v1 v2 v3 `HappyStk` stk')
265 happyReduce k i fn 0# tk st sts stk
266 = happyFail 0# tk st sts stk
267 happyReduce k nt fn j tk st sts stk = happyGoto nt j tk st1 sts1 (fn stk)
268 where sts1@((HappyCons (st1@(action)) (_))) = happyDrop k (HappyCons (st) (sts))
270 happyMonadReduce k nt fn 0# tk st sts stk
271 = happyFail 0# tk st sts stk
272 happyMonadReduce k nt fn j tk st sts stk =
273 happyThen1 (fn stk) (\r -> happyGoto nt j tk st1 sts1 (r `HappyStk` drop_stk))
274 where sts1@((HappyCons (st1@(action)) (_))) = happyDrop k (HappyCons (st) (sts))
275 drop_stk = happyDropStk k stk
278 happyDrop n (HappyCons (_) (t)) = happyDrop (n -# (1# :: Int#)) t
280 happyDropStk 0# l = l
281 happyDropStk n (x `HappyStk` xs) = happyDropStk (n -# (1#::Int#)) xs
283 -----------------------------------------------------------------------------
284 -- Moving to a new state after a reduction
287 happyGoto nt j tk st =
288 (happyTrace (", goto state " ++ show (I# (new_state)) ++ "\n")) $
289 happyDoAction j tk new_state
290 where off = indexShortOffAddr happyGotoOffsets st
292 new_state = indexShortOffAddr happyTable off_i
297 -----------------------------------------------------------------------------
298 -- Error recovery (0# is the error token)
300 -- parse error if we are in recovery and we fail again
301 happyFail 0# tk old_st _ stk =
306 {- We don't need state discarding for our restricted implementation of
307 "error". In fact, it can cause some bogus parses, so I've disabled it
311 happyFail 0# tk old_st (HappyCons ((action)) (sts))
312 (saved_tok `HappyStk` _ `HappyStk` stk) =
313 -- trace ("discarding state, depth " ++ show (length stk)) $
314 happyDoAction 0# tk action sts ((saved_tok`HappyStk`stk))
317 -- Enter error recovery: generate an error token,
318 -- save the old token and carry on.
319 happyFail i tk (action) sts stk =
320 -- trace "entering error recovery" $
321 happyDoAction 0# tk action sts ( (HappyErrorToken (I# (i))) `HappyStk` stk)
323 -- Internal happy errors:
325 notHappyAtAll = error "Internal Happy error\n"
327 -----------------------------------------------------------------------------
328 -- Hack to get the typechecker to accept our action functions
331 happyTcHack :: Int# -> a -> a
333 {-# INLINE happyTcHack #-}
336 -----------------------------------------------------------------------------
337 -- Don't inline any functions from the template. GHC has a nasty habit
338 -- of deciding to inline happyGoto everywhere, which increases the size of
339 -- the generated parser quite a bit.
342 {-# NOINLINE happyDoAction #-}
343 {-# NOINLINE happyTable #-}
344 {-# NOINLINE happyCheck #-}
345 {-# NOINLINE happyActOffsets #-}
346 {-# NOINLINE happyGotoOffsets #-}
347 {-# NOINLINE happyDefActions #-}
349 {-# NOINLINE happyShift #-}
350 {-# NOINLINE happySpecReduce_0 #-}
351 {-# NOINLINE happySpecReduce_1 #-}
352 {-# NOINLINE happySpecReduce_2 #-}
353 {-# NOINLINE happySpecReduce_3 #-}
354 {-# NOINLINE happyReduce #-}
355 {-# NOINLINE happyMonadReduce #-}
356 {-# NOINLINE happyGoto #-}
357 {-# NOINLINE happyFail #-}
359 -- end of Happy Template.