~ubuntu-branches/ubuntu/trusty/happy/trusty-proposed

« back to all changes in this revision

Viewing changes to src/AttrGrammarParser.hs

  • Committer: Bazaar Package Importer
  • Author(s): Ian Lynagh (wibble)
  • Date: 2006-10-26 22:52:14 UTC
  • mfrom: (1.2.2 upstream) (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20061026225214-6jmf0n3ykkc9elyw
Tags: 1.16~rc2-1
* New upstream (release candidate) version.
* Removed happy/ prefixes from various paths in debian/rules and
  debian/docs.
* doc/configure generated by autoconf is in the Debian diff.
* Build using cabal:
  * Various debian/rules changes.
  * Create debian/get_version.hs for extracting the version from the cabal
    file.
  * Requires ghc6 >= 6.4.2.
  * No longer tries to detect platform. Closes: #340325, #332979.
  * Removed autotool-dev build-dep.
* Add 'XSLTPROC_OPTS = --nonet' to doc/config.mk.in.
* Remove src/Parser.ly and src/AttrGrammarParser.ly before cleaning so
  the generated files don't get cleaned.
* Set Standards-Version to 3.7.2 (no changes needed).
* Removed PS and DVI stanzas from debian/doc-base as we don't build
  the documentation those ways.
* Removed content-free postinst and prerm.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{-# OPTIONS -fglasgow-exts -cpp #-}
 
2
module AttrGrammarParser (agParser) where
 
3
import ParseMonad
 
4
import AttrGrammar
 
5
import Array
 
6
#if __GLASGOW_HASKELL__ >= 503
 
7
import GHC.Exts
 
8
#else
 
9
import GlaExts
 
10
#endif
 
11
 
 
12
-- parser produced by Happy Version 1.15
 
13
 
 
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 #-}
 
51
 
 
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"#
 
54
 
 
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"#
 
57
 
 
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"#
 
60
 
 
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"#
 
63
 
 
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"#
 
66
 
 
67
happyReduceArr = array (1, 23) [
 
68
        (1 , happyReduce_1),
 
69
        (2 , happyReduce_2),
 
70
        (3 , happyReduce_3),
 
71
        (4 , happyReduce_4),
 
72
        (5 , happyReduce_5),
 
73
        (6 , happyReduce_6),
 
74
        (7 , happyReduce_7),
 
75
        (8 , happyReduce_8),
 
76
        (9 , happyReduce_9),
 
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),
 
90
        (23 , happyReduce_23)
 
91
        ]
 
92
 
 
93
happy_n_terms = 11 :: Int
 
94
happy_n_nonterms = 5 :: Int
 
95
 
 
96
happyReduce_1 = happySpecReduce_1 0# happyReduction_1
 
97
happyReduction_1 happy_x_1
 
98
         =  case happyOut5 happy_x_1 of { happy_var_1 -> 
 
99
        happyIn4
 
100
                 (happy_var_1
 
101
        )}
 
102
 
 
103
happyReduce_2 = happySpecReduce_3 1# happyReduction_2
 
104
happyReduction_2 happy_x_3
 
105
        happy_x_2
 
106
        happy_x_1
 
107
         =  case happyOut6 happy_x_1 of { happy_var_1 -> 
 
108
        case happyOut5 happy_x_3 of { happy_var_3 -> 
 
109
        happyIn5
 
110
                 (happy_var_1 : happy_var_3
 
111
        )}}
 
112
 
 
113
happyReduce_3 = happySpecReduce_1 1# happyReduction_3
 
114
happyReduction_3 happy_x_1
 
115
         =  case happyOut6 happy_x_1 of { happy_var_1 -> 
 
116
        happyIn5
 
117
                 (happy_var_1 : []
 
118
        )}
 
119
 
 
120
happyReduce_4 = happySpecReduce_0 1# happyReduction_4
 
121
happyReduction_4  =  happyIn5
 
122
                 ([]
 
123
        )
 
124
 
 
125
happyReduce_5 = happySpecReduce_3 2# happyReduction_5
 
126
happyReduction_5 happy_x_3
 
127
        happy_x_2
 
128
        happy_x_1
 
129
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
130
        case happyOut7 happy_x_3 of { happy_var_3 -> 
 
131
        happyIn6
 
132
                 (SelfAssign (selfRefVal happy_var_1) happy_var_3
 
133
        )}}
 
134
 
 
135
happyReduce_6 = happySpecReduce_3 2# happyReduction_6
 
136
happyReduction_6 happy_x_3
 
137
        happy_x_2
 
138
        happy_x_1
 
139
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
140
        case happyOut7 happy_x_3 of { happy_var_3 -> 
 
141
        happyIn6
 
142
                 (SubAssign (subRefVal happy_var_1) happy_var_3
 
143
        )}}
 
144
 
 
145
happyReduce_7 = happySpecReduce_3 2# happyReduction_7
 
146
happyReduction_7 happy_x_3
 
147
        happy_x_2
 
148
        happy_x_1
 
149
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
150
        case happyOut7 happy_x_3 of { happy_var_3 -> 
 
151
        happyIn6
 
152
                 (RightmostAssign (rightRefVal happy_var_1) happy_var_3
 
153
        )}}
 
154
 
 
155
happyReduce_8 = happySpecReduce_2 2# happyReduction_8
 
156
happyReduction_8 happy_x_2
 
157
        happy_x_1
 
158
         =  case happyOut7 happy_x_2 of { happy_var_2 -> 
 
159
        happyIn6
 
160
                 (Conditional happy_var_2
 
161
        )}
 
162
 
 
163
happyReduce_9 = happyReduce 4# 3# happyReduction_9
 
164
happyReduction_9 (happy_x_4 `HappyStk`
 
165
        happy_x_3 `HappyStk`
 
166
        happy_x_2 `HappyStk`
 
167
        happy_x_1 `HappyStk`
 
168
        happyRest)
 
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 -> 
 
173
        happyIn7
 
174
                 ([happy_var_1] ++ happy_var_2 ++ [happy_var_3] ++ happy_var_4
 
175
        ) `HappyStk` happyRest}}}}
 
176
 
 
177
happyReduce_10 = happySpecReduce_2 3# happyReduction_10
 
178
happyReduction_10 happy_x_2
 
179
        happy_x_1
 
180
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
181
        case happyOut7 happy_x_2 of { happy_var_2 -> 
 
182
        happyIn7
 
183
                 (happy_var_1 : happy_var_2
 
184
        )}}
 
185
 
 
186
happyReduce_11 = happySpecReduce_2 3# happyReduction_11
 
187
happyReduction_11 happy_x_2
 
188
        happy_x_1
 
189
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
190
        case happyOut7 happy_x_2 of { happy_var_2 -> 
 
191
        happyIn7
 
192
                 (happy_var_1 : happy_var_2
 
193
        )}}
 
194
 
 
195
happyReduce_12 = happySpecReduce_2 3# happyReduction_12
 
196
happyReduction_12 happy_x_2
 
197
        happy_x_1
 
198
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
199
        case happyOut7 happy_x_2 of { happy_var_2 -> 
 
200
        happyIn7
 
201
                 (happy_var_1 : happy_var_2
 
202
        )}}
 
203
 
 
204
happyReduce_13 = happySpecReduce_2 3# happyReduction_13
 
205
happyReduction_13 happy_x_2
 
206
        happy_x_1
 
207
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
208
        case happyOut7 happy_x_2 of { happy_var_2 -> 
 
209
        happyIn7
 
210
                 (happy_var_1 : happy_var_2
 
211
        )}}
 
212
 
 
213
happyReduce_14 = happySpecReduce_2 3# happyReduction_14
 
214
happyReduction_14 happy_x_2
 
215
        happy_x_1
 
216
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
217
        case happyOut7 happy_x_2 of { happy_var_2 -> 
 
218
        happyIn7
 
219
                 (happy_var_1 : happy_var_2
 
220
        )}}
 
221
 
 
222
happyReduce_15 = happySpecReduce_0 3# happyReduction_15
 
223
happyReduction_15  =  happyIn7
 
224
                 ([]
 
225
        )
 
226
 
 
227
happyReduce_16 = happyReduce 4# 4# happyReduction_16
 
228
happyReduction_16 (happy_x_4 `HappyStk`
 
229
        happy_x_3 `HappyStk`
 
230
        happy_x_2 `HappyStk`
 
231
        happy_x_1 `HappyStk`
 
232
        happyRest)
 
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 -> 
 
237
        happyIn8
 
238
                 ([happy_var_1] ++ happy_var_2 ++ [happy_var_3] ++ happy_var_4
 
239
        ) `HappyStk` happyRest}}}}
 
240
 
 
241
happyReduce_17 = happySpecReduce_2 4# happyReduction_17
 
242
happyReduction_17 happy_x_2
 
243
        happy_x_1
 
244
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
245
        case happyOut8 happy_x_2 of { happy_var_2 -> 
 
246
        happyIn8
 
247
                 (happy_var_1 : happy_var_2
 
248
        )}}
 
249
 
 
250
happyReduce_18 = happySpecReduce_2 4# happyReduction_18
 
251
happyReduction_18 happy_x_2
 
252
        happy_x_1
 
253
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
254
        case happyOut8 happy_x_2 of { happy_var_2 -> 
 
255
        happyIn8
 
256
                 (happy_var_1 : happy_var_2
 
257
        )}}
 
258
 
 
259
happyReduce_19 = happySpecReduce_2 4# happyReduction_19
 
260
happyReduction_19 happy_x_2
 
261
        happy_x_1
 
262
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
263
        case happyOut8 happy_x_2 of { happy_var_2 -> 
 
264
        happyIn8
 
265
                 (happy_var_1 : happy_var_2
 
266
        )}}
 
267
 
 
268
happyReduce_20 = happySpecReduce_2 4# happyReduction_20
 
269
happyReduction_20 happy_x_2
 
270
        happy_x_1
 
271
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
272
        case happyOut8 happy_x_2 of { happy_var_2 -> 
 
273
        happyIn8
 
274
                 (happy_var_1 : happy_var_2
 
275
        )}}
 
276
 
 
277
happyReduce_21 = happySpecReduce_2 4# happyReduction_21
 
278
happyReduction_21 happy_x_2
 
279
        happy_x_1
 
280
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
281
        case happyOut7 happy_x_2 of { happy_var_2 -> 
 
282
        happyIn8
 
283
                 (happy_var_1 : happy_var_2
 
284
        )}}
 
285
 
 
286
happyReduce_22 = happySpecReduce_2 4# happyReduction_22
 
287
happyReduction_22 happy_x_2
 
288
        happy_x_1
 
289
         =  case happyOutTok happy_x_1 of { happy_var_1 -> 
 
290
        case happyOut8 happy_x_2 of { happy_var_2 -> 
 
291
        happyIn8
 
292
                 (happy_var_1 : happy_var_2
 
293
        )}}
 
294
 
 
295
happyReduce_23 = happySpecReduce_0 4# happyReduction_23
 
296
happyReduction_23  =  happyIn8
 
297
                 ([]
 
298
        )
 
299
 
 
300
happyNewToken action sts stk
 
301
        = agLexer(\tk -> 
 
302
        let cont i = happyDoAction i tk action sts stk in
 
303
        case tk of {
 
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#;
 
308
        AgTok_Eq -> cont 4#;
 
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#;
 
314
        _ -> happyError'
 
315
        })
 
316
 
 
317
happyError_ tk = happyError'
 
318
 
 
319
happyThen :: () => P a -> (a -> P b) -> P b
 
320
happyThen = (>>=)
 
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
 
328
 
 
329
agParser = happySomeParser where
 
330
  happySomeParser = happyThen (happyParse 0#) (\x -> happyReturn (happyOut4 x))
 
331
 
 
332
happySeq = happyDontSeq
 
333
 
 
334
happyError :: P a
 
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" #-}
 
340
-- $Id$
 
341
 
 
342
{-# LINE 28 "GenericTemplate.hs" #-}
 
343
 
 
344
 
 
345
data Happy_IntList = HappyCons Int# Happy_IntList
 
346
 
 
347
 
 
348
 
 
349
 
 
350
 
 
351
{-# LINE 49 "GenericTemplate.hs" #-}
 
352
 
 
353
{-# LINE 59 "GenericTemplate.hs" #-}
 
354
 
 
355
{-# LINE 68 "GenericTemplate.hs" #-}
 
356
 
 
357
infixr 9 `HappyStk`
 
358
data HappyStk a = HappyStk a (HappyStk a)
 
359
 
 
360
-----------------------------------------------------------------------------
 
361
-- starting the parse
 
362
 
 
363
happyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll
 
364
 
 
365
-----------------------------------------------------------------------------
 
366
-- Accepting the parse
 
367
 
 
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` _) =
 
372
        happyReturn1 ans
 
373
happyAccept j tk st sts (HappyStk ans _) = 
 
374
        (happyTcHack j (happyTcHack st)) (happyReturn1 ans)
 
375
 
 
376
-----------------------------------------------------------------------------
 
377
-- Arrays only: do the next action
 
378
 
 
379
 
 
380
 
 
381
happyDoAction i tk st
 
382
        = {- nothing -}
 
383
 
 
384
 
 
385
          case action of
 
386
                0#                -> {- nothing -}
 
387
                                     happyFail i tk st
 
388
                -1#       -> {- nothing -}
 
389
                                     happyAccept i tk st
 
390
                n | (n <# (0# :: Int#)) -> {- nothing -}
 
391
 
 
392
                                     (happyReduceArr ! rule) i tk st
 
393
                                     where rule = (I# ((negateInt# ((n +# (1# :: Int#))))))
 
394
                n                 -> {- nothing -}
 
395
 
 
396
 
 
397
                                     happyShift new_state i tk st
 
398
                                     where new_state = (n -# (1# :: Int#))
 
399
   where off    = indexShortOffAddr happyActOffsets st
 
400
         off_i  = (off +# i)
 
401
         check  = if (off_i >=# (0# :: Int#))
 
402
                        then (indexShortOffAddr happyCheck off_i ==#  i)
 
403
                        else False
 
404
         action | check     = indexShortOffAddr happyTable off_i
 
405
                | otherwise = indexShortOffAddr happyDefActions st
 
406
 
 
407
{-# LINE 127 "GenericTemplate.hs" #-}
 
408
 
 
409
 
 
410
indexShortOffAddr (HappyA# arr) off =
 
411
#if __GLASGOW_HASKELL__ > 500
 
412
        narrow16Int# i
 
413
#elif __GLASGOW_HASKELL__ == 500
 
414
        intToInt16# i
 
415
#else
 
416
        (i `iShiftL#` 16#) `iShiftRA#` 16#
 
417
#endif
 
418
  where
 
419
#if __GLASGOW_HASKELL__ >= 503
 
420
        i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)
 
421
#else
 
422
        i = word2Int# ((high `shiftL#` 8#) `or#` low)
 
423
#endif
 
424
        high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
 
425
        low  = int2Word# (ord# (indexCharOffAddr# arr off'))
 
426
        off' = off *# 2#
 
427
 
 
428
 
 
429
 
 
430
 
 
431
 
 
432
data HappyAddr = HappyA# Addr#
 
433
 
 
434
 
 
435
 
 
436
 
 
437
-----------------------------------------------------------------------------
 
438
-- HappyState data type (not arrays)
 
439
 
 
440
{-# LINE 170 "GenericTemplate.hs" #-}
 
441
 
 
442
-----------------------------------------------------------------------------
 
443
-- Shifting a token
 
444
 
 
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)
 
449
 
 
450
happyShift new_state i tk st sts stk =
 
451
     happyNewToken new_state (HappyCons (st) (sts)) ((happyInTok (tk))`HappyStk`stk)
 
452
 
 
453
-- happyReduce is specialised for the common cases.
 
454
 
 
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)
 
459
 
 
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')
 
463
     = let r = fn v1 in
 
464
       happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))
 
465
 
 
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'))
 
471
 
 
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'))
 
477
 
 
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)
 
485
 
 
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
 
492
 
 
493
happyDrop 0# l = l
 
494
happyDrop n (HappyCons (_) (t)) = happyDrop (n -# (1# :: Int#)) t
 
495
 
 
496
happyDropStk 0# l = l
 
497
happyDropStk n (x `HappyStk` xs) = happyDropStk (n -# (1#::Int#)) xs
 
498
 
 
499
-----------------------------------------------------------------------------
 
500
-- Moving to a new state after a reduction
 
501
 
 
502
 
 
503
happyGoto nt j tk st = 
 
504
   {- nothing -}
 
505
   happyDoAction j tk new_state
 
506
   where off    = indexShortOffAddr happyGotoOffsets st
 
507
         off_i  = (off +# nt)
 
508
         new_state = indexShortOffAddr happyTable off_i
 
509
 
 
510
 
 
511
 
 
512
 
 
513
-----------------------------------------------------------------------------
 
514
-- Error recovery (0# is the error token)
 
515
 
 
516
-- parse error if we are in recovery and we fail again
 
517
happyFail  0# tk old_st _ stk =
 
518
--      trace "failing" $ 
 
519
        happyError_ tk
 
520
 
 
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
 
523
    for now --SDM
 
524
 
 
525
-- discard a state
 
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))
 
530
-}
 
531
 
 
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)
 
537
 
 
538
-- Internal happy errors:
 
539
 
 
540
notHappyAtAll = error "Internal Happy error\n"
 
541
 
 
542
-----------------------------------------------------------------------------
 
543
-- Hack to get the typechecker to accept our action functions
 
544
 
 
545
 
 
546
happyTcHack :: Int# -> a -> a
 
547
happyTcHack x y = y
 
548
{-# INLINE happyTcHack #-}
 
549
 
 
550
 
 
551
-----------------------------------------------------------------------------
 
552
-- Seq-ing.  If the --strict flag is given, then Happy emits 
 
553
--      happySeq = happyDoSeq
 
554
-- otherwise it emits
 
555
--      happySeq = happyDontSeq
 
556
 
 
557
happyDoSeq, happyDontSeq :: a -> b -> b
 
558
happyDoSeq   a b = a `seq` b
 
559
happyDontSeq a b = b
 
560
 
 
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.
 
565
 
 
566
 
 
567
{-# NOINLINE happyDoAction #-}
 
568
{-# NOINLINE happyTable #-}
 
569
{-# NOINLINE happyCheck #-}
 
570
{-# NOINLINE happyActOffsets #-}
 
571
{-# NOINLINE happyGotoOffsets #-}
 
572
{-# NOINLINE happyDefActions #-}
 
573
 
 
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 #-}
 
583
 
 
584
-- end of Happy Template.