1
{-# OPTIONS -fglasgow-exts -cpp #-}
2
module AttrGrammarParser (agParser) where
6
#if __GLASGOW_HASKELL__ >= 503
12
-- parser produced by Happy Version 1.15
14
newtype HappyAbsSyn = HappyAbsSyn (() -> ())
15
happyIn4 :: ([AgRule]) -> (HappyAbsSyn )
16
happyIn4 x = unsafeCoerce# x
17
{-# INLINE happyIn4 #-}
18
happyOut4 :: (HappyAbsSyn ) -> ([AgRule])
19
happyOut4 x = unsafeCoerce# x
20
{-# INLINE happyOut4 #-}
21
happyIn5 :: ([AgRule]) -> (HappyAbsSyn )
22
happyIn5 x = unsafeCoerce# x
23
{-# INLINE happyIn5 #-}
24
happyOut5 :: (HappyAbsSyn ) -> ([AgRule])
25
happyOut5 x = unsafeCoerce# x
26
{-# INLINE happyOut5 #-}
27
happyIn6 :: (AgRule) -> (HappyAbsSyn )
28
happyIn6 x = unsafeCoerce# x
29
{-# INLINE happyIn6 #-}
30
happyOut6 :: (HappyAbsSyn ) -> (AgRule)
31
happyOut6 x = unsafeCoerce# x
32
{-# INLINE happyOut6 #-}
33
happyIn7 :: ([AgToken]) -> (HappyAbsSyn )
34
happyIn7 x = unsafeCoerce# x
35
{-# INLINE happyIn7 #-}
36
happyOut7 :: (HappyAbsSyn ) -> ([AgToken])
37
happyOut7 x = unsafeCoerce# x
38
{-# INLINE happyOut7 #-}
39
happyIn8 :: ([AgToken]) -> (HappyAbsSyn )
40
happyIn8 x = unsafeCoerce# x
41
{-# INLINE happyIn8 #-}
42
happyOut8 :: (HappyAbsSyn ) -> ([AgToken])
43
happyOut8 x = unsafeCoerce# x
44
{-# INLINE happyOut8 #-}
45
happyInTok :: AgToken -> (HappyAbsSyn )
46
happyInTok x = unsafeCoerce# x
47
{-# INLINE happyInTok #-}
48
happyOutTok :: (HappyAbsSyn ) -> AgToken
49
happyOutTok x = unsafeCoerce# x
50
{-# INLINE happyOutTok #-}
52
happyActOffsets :: HappyAddr
53
happyActOffsets = HappyA# "\x0f\x00\x0f\x00\x00\x00\x30\x00\x0a\x00\x2e\x00\x2d\x00\x2b\x00\x14\x00\x0a\x00\x0a\x00\x0a\x00\x00\x00\x01\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2c\x00\x01\x00\x01\x00\x01\x00\x01\x00\x01\x00\x0a\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x26\x00\x0a\x00\x00\x00\x01\x00\x00\x00\x00\x00"#
55
happyGotoOffsets :: HappyAddr
56
happyGotoOffsets = HappyA# "\x18\x00\x1a\x00\x00\x00\x00\x00\x2a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x29\x00\x28\x00\x27\x00\x00\x00\x25\x00\x24\x00\x23\x00\x22\x00\x21\x00\x20\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1e\x00\x1d\x00\x1c\x00\x1b\x00\x19\x00\x0c\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\xfd\xff\x00\x00\x00\x00"#
58
happyDefActions :: HappyAddr
59
happyDefActions = HappyA# "\xfb\xff\x00\x00\xfe\xff\xfc\xff\xf0\xff\x00\x00\x00\x00\x00\x00\x00\x00\xf0\xff\xf0\xff\xf0\xff\xf7\xff\xe8\xff\xf0\xff\xf0\xff\xf0\xff\xf0\xff\xf0\xff\xfb\xff\xfd\xff\xf1\xff\xf2\xff\xf3\xff\xf4\xff\xf5\xff\x00\x00\xe8\xff\xe8\xff\xe8\xff\xe8\xff\xe8\xff\xf0\xff\xe8\xff\xfa\xff\xf9\xff\xf8\xff\xe9\xff\xea\xff\xeb\xff\xec\xff\xee\xff\xed\xff\x00\x00\xf0\xff\xf6\xff\xe8\xff\xef\xff"#
61
happyCheck :: HappyAddr
62
happyCheck = HappyA# "\xff\xff\x04\x00\x01\x00\x04\x00\x03\x00\x04\x00\x03\x00\x06\x00\x07\x00\x08\x00\x09\x00\x01\x00\x01\x00\x02\x00\x04\x00\x03\x00\x06\x00\x07\x00\x08\x00\x09\x00\x05\x00\x06\x00\x07\x00\x08\x00\x00\x00\x01\x00\x02\x00\x01\x00\x02\x00\x04\x00\x0a\x00\x04\x00\x04\x00\x04\x00\x04\x00\x03\x00\x03\x00\x03\x00\x03\x00\x03\x00\x02\x00\x04\x00\x03\x00\x03\x00\x03\x00\x03\x00\x02\x00\x04\x00\xff\xff\x04\x00\x04\x00\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#
64
happyTable :: HappyAddr
65
happyTable = HappyA# "\x00\x00\x2f\x00\x1c\x00\x25\x00\x1d\x00\x1e\x00\x2d\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x0e\x00\x14\x00\x03\x00\x0f\x00\x26\x00\x10\x00\x11\x00\x12\x00\x13\x00\x05\x00\x06\x00\x07\x00\x08\x00\x08\x00\x02\x00\x03\x00\x02\x00\x03\x00\x27\x00\xff\xff\x28\x00\x29\x00\x2a\x00\x2b\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x2f\x00\x1a\x00\x22\x00\x23\x00\x24\x00\x0c\x00\x2d\x00\x0a\x00\x00\x00\x0b\x00\x0c\x00\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
67
happyReduceArr = array (1, 23) [
77
(10 , happyReduce_10),
78
(11 , happyReduce_11),
79
(12 , happyReduce_12),
80
(13 , happyReduce_13),
81
(14 , happyReduce_14),
82
(15 , happyReduce_15),
83
(16 , happyReduce_16),
84
(17 , happyReduce_17),
85
(18 , happyReduce_18),
86
(19 , happyReduce_19),
87
(20 , happyReduce_20),
88
(21 , happyReduce_21),
89
(22 , happyReduce_22),
93
happy_n_terms = 11 :: Int
94
happy_n_nonterms = 5 :: Int
96
happyReduce_1 = happySpecReduce_1 0# happyReduction_1
97
happyReduction_1 happy_x_1
98
= case happyOut5 happy_x_1 of { happy_var_1 ->
103
happyReduce_2 = happySpecReduce_3 1# happyReduction_2
104
happyReduction_2 happy_x_3
107
= case happyOut6 happy_x_1 of { happy_var_1 ->
108
case happyOut5 happy_x_3 of { happy_var_3 ->
110
(happy_var_1 : happy_var_3
113
happyReduce_3 = happySpecReduce_1 1# happyReduction_3
114
happyReduction_3 happy_x_1
115
= case happyOut6 happy_x_1 of { happy_var_1 ->
120
happyReduce_4 = happySpecReduce_0 1# happyReduction_4
121
happyReduction_4 = happyIn5
125
happyReduce_5 = happySpecReduce_3 2# happyReduction_5
126
happyReduction_5 happy_x_3
129
= case happyOutTok happy_x_1 of { happy_var_1 ->
130
case happyOut7 happy_x_3 of { happy_var_3 ->
132
(SelfAssign (selfRefVal happy_var_1) happy_var_3
135
happyReduce_6 = happySpecReduce_3 2# happyReduction_6
136
happyReduction_6 happy_x_3
139
= case happyOutTok happy_x_1 of { happy_var_1 ->
140
case happyOut7 happy_x_3 of { happy_var_3 ->
142
(SubAssign (subRefVal happy_var_1) happy_var_3
145
happyReduce_7 = happySpecReduce_3 2# happyReduction_7
146
happyReduction_7 happy_x_3
149
= case happyOutTok happy_x_1 of { happy_var_1 ->
150
case happyOut7 happy_x_3 of { happy_var_3 ->
152
(RightmostAssign (rightRefVal happy_var_1) happy_var_3
155
happyReduce_8 = happySpecReduce_2 2# happyReduction_8
156
happyReduction_8 happy_x_2
158
= case happyOut7 happy_x_2 of { happy_var_2 ->
160
(Conditional happy_var_2
163
happyReduce_9 = happyReduce 4# 3# happyReduction_9
164
happyReduction_9 (happy_x_4 `HappyStk`
169
= case happyOutTok happy_x_1 of { happy_var_1 ->
170
case happyOut8 happy_x_2 of { happy_var_2 ->
171
case happyOutTok happy_x_3 of { happy_var_3 ->
172
case happyOut7 happy_x_4 of { happy_var_4 ->
174
([happy_var_1] ++ happy_var_2 ++ [happy_var_3] ++ happy_var_4
175
) `HappyStk` happyRest}}}}
177
happyReduce_10 = happySpecReduce_2 3# happyReduction_10
178
happyReduction_10 happy_x_2
180
= case happyOutTok happy_x_1 of { happy_var_1 ->
181
case happyOut7 happy_x_2 of { happy_var_2 ->
183
(happy_var_1 : happy_var_2
186
happyReduce_11 = happySpecReduce_2 3# happyReduction_11
187
happyReduction_11 happy_x_2
189
= case happyOutTok happy_x_1 of { happy_var_1 ->
190
case happyOut7 happy_x_2 of { happy_var_2 ->
192
(happy_var_1 : happy_var_2
195
happyReduce_12 = happySpecReduce_2 3# happyReduction_12
196
happyReduction_12 happy_x_2
198
= case happyOutTok happy_x_1 of { happy_var_1 ->
199
case happyOut7 happy_x_2 of { happy_var_2 ->
201
(happy_var_1 : happy_var_2
204
happyReduce_13 = happySpecReduce_2 3# happyReduction_13
205
happyReduction_13 happy_x_2
207
= case happyOutTok happy_x_1 of { happy_var_1 ->
208
case happyOut7 happy_x_2 of { happy_var_2 ->
210
(happy_var_1 : happy_var_2
213
happyReduce_14 = happySpecReduce_2 3# happyReduction_14
214
happyReduction_14 happy_x_2
216
= case happyOutTok happy_x_1 of { happy_var_1 ->
217
case happyOut7 happy_x_2 of { happy_var_2 ->
219
(happy_var_1 : happy_var_2
222
happyReduce_15 = happySpecReduce_0 3# happyReduction_15
223
happyReduction_15 = happyIn7
227
happyReduce_16 = happyReduce 4# 4# happyReduction_16
228
happyReduction_16 (happy_x_4 `HappyStk`
233
= case happyOutTok happy_x_1 of { happy_var_1 ->
234
case happyOut8 happy_x_2 of { happy_var_2 ->
235
case happyOutTok happy_x_3 of { happy_var_3 ->
236
case happyOut8 happy_x_4 of { happy_var_4 ->
238
([happy_var_1] ++ happy_var_2 ++ [happy_var_3] ++ happy_var_4
239
) `HappyStk` happyRest}}}}
241
happyReduce_17 = happySpecReduce_2 4# happyReduction_17
242
happyReduction_17 happy_x_2
244
= case happyOutTok happy_x_1 of { happy_var_1 ->
245
case happyOut8 happy_x_2 of { happy_var_2 ->
247
(happy_var_1 : happy_var_2
250
happyReduce_18 = happySpecReduce_2 4# happyReduction_18
251
happyReduction_18 happy_x_2
253
= case happyOutTok happy_x_1 of { happy_var_1 ->
254
case happyOut8 happy_x_2 of { happy_var_2 ->
256
(happy_var_1 : happy_var_2
259
happyReduce_19 = happySpecReduce_2 4# happyReduction_19
260
happyReduction_19 happy_x_2
262
= case happyOutTok happy_x_1 of { happy_var_1 ->
263
case happyOut8 happy_x_2 of { happy_var_2 ->
265
(happy_var_1 : happy_var_2
268
happyReduce_20 = happySpecReduce_2 4# happyReduction_20
269
happyReduction_20 happy_x_2
271
= case happyOutTok happy_x_1 of { happy_var_1 ->
272
case happyOut8 happy_x_2 of { happy_var_2 ->
274
(happy_var_1 : happy_var_2
277
happyReduce_21 = happySpecReduce_2 4# happyReduction_21
278
happyReduction_21 happy_x_2
280
= case happyOutTok happy_x_1 of { happy_var_1 ->
281
case happyOut7 happy_x_2 of { happy_var_2 ->
283
(happy_var_1 : happy_var_2
286
happyReduce_22 = happySpecReduce_2 4# happyReduction_22
287
happyReduction_22 happy_x_2
289
= case happyOutTok happy_x_1 of { happy_var_1 ->
290
case happyOut8 happy_x_2 of { happy_var_2 ->
292
(happy_var_1 : happy_var_2
295
happyReduce_23 = happySpecReduce_0 4# happyReduction_23
296
happyReduction_23 = happyIn8
300
happyNewToken action sts stk
302
let cont i = happyDoAction i tk action sts stk in
304
AgTok_EOF -> happyDoAction 10# (error "reading EOF!") action sts stk;
305
AgTok_LBrace -> cont 1#;
306
AgTok_RBrace -> cont 2#;
307
AgTok_Semicolon -> cont 3#;
309
AgTok_Where -> cont 5#;
310
AgTok_SelfRef _ -> cont 6#;
311
AgTok_SubRef _ -> cont 7#;
312
AgTok_RightmostRef _ -> cont 8#;
313
AgTok_Unknown _ -> cont 9#;
317
happyError_ tk = happyError'
319
happyThen :: () => P a -> (a -> P b) -> P b
321
happyReturn :: () => a -> P a
322
happyReturn = (return)
323
happyThen1 = happyThen
324
happyReturn1 :: () => a -> P a
325
happyReturn1 = happyReturn
326
happyError' :: () => P a
327
happyError' = happyError
329
agParser = happySomeParser where
330
happySomeParser = happyThen (happyParse 0#) (\x -> happyReturn (happyOut4 x))
332
happySeq = happyDontSeq
335
happyError = fail ("Parse error\n")
336
{-# LINE 1 "GenericTemplate.hs" #-}
337
{-# LINE 1 "<built-in>" #-}
338
{-# LINE 1 "<command line>" #-}
339
{-# LINE 1 "GenericTemplate.hs" #-}
342
{-# LINE 28 "GenericTemplate.hs" #-}
345
data Happy_IntList = HappyCons Int# Happy_IntList
351
{-# LINE 49 "GenericTemplate.hs" #-}
353
{-# LINE 59 "GenericTemplate.hs" #-}
355
{-# LINE 68 "GenericTemplate.hs" #-}
358
data HappyStk a = HappyStk a (HappyStk a)
360
-----------------------------------------------------------------------------
361
-- starting the parse
363
happyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll
365
-----------------------------------------------------------------------------
366
-- Accepting the parse
368
-- If the current token is 0#, it means we've just accepted a partial
369
-- parse (a %partial parser). We must ignore the saved token on the top of
370
-- the stack in this case.
371
happyAccept 0# tk st sts (_ `HappyStk` ans `HappyStk` _) =
373
happyAccept j tk st sts (HappyStk ans _) =
374
(happyTcHack j (happyTcHack st)) (happyReturn1 ans)
376
-----------------------------------------------------------------------------
377
-- Arrays only: do the next action
381
happyDoAction i tk st
390
n | (n <# (0# :: Int#)) -> {- nothing -}
392
(happyReduceArr ! rule) i tk st
393
where rule = (I# ((negateInt# ((n +# (1# :: Int#))))))
397
happyShift new_state i tk st
398
where new_state = (n -# (1# :: Int#))
399
where off = indexShortOffAddr happyActOffsets st
401
check = if (off_i >=# (0# :: Int#))
402
then (indexShortOffAddr happyCheck off_i ==# i)
404
action | check = indexShortOffAddr happyTable off_i
405
| otherwise = indexShortOffAddr happyDefActions st
407
{-# LINE 127 "GenericTemplate.hs" #-}
410
indexShortOffAddr (HappyA# arr) off =
411
#if __GLASGOW_HASKELL__ > 500
413
#elif __GLASGOW_HASKELL__ == 500
416
(i `iShiftL#` 16#) `iShiftRA#` 16#
419
#if __GLASGOW_HASKELL__ >= 503
420
i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)
422
i = word2Int# ((high `shiftL#` 8#) `or#` low)
424
high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
425
low = int2Word# (ord# (indexCharOffAddr# arr off'))
432
data HappyAddr = HappyA# Addr#
437
-----------------------------------------------------------------------------
438
-- HappyState data type (not arrays)
440
{-# LINE 170 "GenericTemplate.hs" #-}
442
-----------------------------------------------------------------------------
445
happyShift new_state 0# tk st sts stk@(x `HappyStk` _) =
446
let i = (case unsafeCoerce# x of { (I# (i)) -> i }) in
447
-- trace "shifting the error token" $
448
happyDoAction i tk new_state (HappyCons (st) (sts)) (stk)
450
happyShift new_state i tk st sts stk =
451
happyNewToken new_state (HappyCons (st) (sts)) ((happyInTok (tk))`HappyStk`stk)
453
-- happyReduce is specialised for the common cases.
455
happySpecReduce_0 i fn 0# tk st sts stk
456
= happyFail 0# tk st sts stk
457
happySpecReduce_0 nt fn j tk st@((action)) sts stk
458
= happyGoto nt j tk st (HappyCons (st) (sts)) (fn `HappyStk` stk)
460
happySpecReduce_1 i fn 0# tk st sts stk
461
= happyFail 0# tk st sts stk
462
happySpecReduce_1 nt fn j tk _ sts@((HappyCons (st@(action)) (_))) (v1`HappyStk`stk')
464
happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))
466
happySpecReduce_2 i fn 0# tk st sts stk
467
= happyFail 0# tk st sts stk
468
happySpecReduce_2 nt fn j tk _ (HappyCons (_) (sts@((HappyCons (st@(action)) (_))))) (v1`HappyStk`v2`HappyStk`stk')
469
= let r = fn v1 v2 in
470
happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))
472
happySpecReduce_3 i fn 0# tk st sts stk
473
= happyFail 0# tk st sts stk
474
happySpecReduce_3 nt fn j tk _ (HappyCons (_) ((HappyCons (_) (sts@((HappyCons (st@(action)) (_))))))) (v1`HappyStk`v2`HappyStk`v3`HappyStk`stk')
475
= let r = fn v1 v2 v3 in
476
happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))
478
happyReduce k i fn 0# tk st sts stk
479
= happyFail 0# tk st sts stk
480
happyReduce k nt fn j tk st sts stk
481
= case happyDrop (k -# (1# :: Int#)) sts of
482
sts1@((HappyCons (st1@(action)) (_))) ->
483
let r = fn stk in -- it doesn't hurt to always seq here...
484
happyDoSeq r (happyGoto nt j tk st1 sts1 r)
486
happyMonadReduce k nt fn 0# tk st sts stk
487
= happyFail 0# tk st sts stk
488
happyMonadReduce k nt fn j tk st sts stk =
489
happyThen1 (fn stk) (\r -> happyGoto nt j tk st1 sts1 (r `HappyStk` drop_stk))
490
where sts1@((HappyCons (st1@(action)) (_))) = happyDrop k (HappyCons (st) (sts))
491
drop_stk = happyDropStk k stk
494
happyDrop n (HappyCons (_) (t)) = happyDrop (n -# (1# :: Int#)) t
496
happyDropStk 0# l = l
497
happyDropStk n (x `HappyStk` xs) = happyDropStk (n -# (1#::Int#)) xs
499
-----------------------------------------------------------------------------
500
-- Moving to a new state after a reduction
503
happyGoto nt j tk st =
505
happyDoAction j tk new_state
506
where off = indexShortOffAddr happyGotoOffsets st
508
new_state = indexShortOffAddr happyTable off_i
513
-----------------------------------------------------------------------------
514
-- Error recovery (0# is the error token)
516
-- parse error if we are in recovery and we fail again
517
happyFail 0# tk old_st _ stk =
521
{- We don't need state discarding for our restricted implementation of
522
"error". In fact, it can cause some bogus parses, so I've disabled it
526
happyFail 0# tk old_st (HappyCons ((action)) (sts))
527
(saved_tok `HappyStk` _ `HappyStk` stk) =
528
-- trace ("discarding state, depth " ++ show (length stk)) $
529
happyDoAction 0# tk action sts ((saved_tok`HappyStk`stk))
532
-- Enter error recovery: generate an error token,
533
-- save the old token and carry on.
534
happyFail i tk (action) sts stk =
535
-- trace "entering error recovery" $
536
happyDoAction 0# tk action sts ( (unsafeCoerce# (I# (i))) `HappyStk` stk)
538
-- Internal happy errors:
540
notHappyAtAll = error "Internal Happy error\n"
542
-----------------------------------------------------------------------------
543
-- Hack to get the typechecker to accept our action functions
546
happyTcHack :: Int# -> a -> a
548
{-# INLINE happyTcHack #-}
551
-----------------------------------------------------------------------------
552
-- Seq-ing. If the --strict flag is given, then Happy emits
553
-- happySeq = happyDoSeq
554
-- otherwise it emits
555
-- happySeq = happyDontSeq
557
happyDoSeq, happyDontSeq :: a -> b -> b
558
happyDoSeq a b = a `seq` b
561
-----------------------------------------------------------------------------
562
-- Don't inline any functions from the template. GHC has a nasty habit
563
-- of deciding to inline happyGoto everywhere, which increases the size of
564
-- the generated parser quite a bit.
567
{-# NOINLINE happyDoAction #-}
568
{-# NOINLINE happyTable #-}
569
{-# NOINLINE happyCheck #-}
570
{-# NOINLINE happyActOffsets #-}
571
{-# NOINLINE happyGotoOffsets #-}
572
{-# NOINLINE happyDefActions #-}
574
{-# NOINLINE happyShift #-}
575
{-# NOINLINE happySpecReduce_0 #-}
576
{-# NOINLINE happySpecReduce_1 #-}
577
{-# NOINLINE happySpecReduce_2 #-}
578
{-# NOINLINE happySpecReduce_3 #-}
579
{-# NOINLINE happyReduce #-}
580
{-# NOINLINE happyMonadReduce #-}
581
{-# NOINLINE happyGoto #-}
582
{-# NOINLINE happyFail #-}
584
-- end of Happy Template.