{-# OPTIONS_GHC -w #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE NoStrictData #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE PartialTypeSignatures #-}
#if __GLASGOW_HASKELL__ >= 710
{-# LANGUAGE PartialTypeSignatures #-}
#endif
module Advent.Format.Parser (parseFormat, ParseError(..)) where

import Advent.Format.Types
import Advent.Format.Lexer (AlexPosn(..))
import qualified Data.Function as Happy_Prelude
import qualified Data.Bool as Happy_Prelude
import qualified Data.Function as Happy_Prelude
import qualified Data.Maybe as Happy_Prelude
import qualified Data.Int as Happy_Prelude
import qualified Data.String as Happy_Prelude
import qualified Data.List as Happy_Prelude
import qualified Control.Monad as Happy_Prelude
import qualified Text.Show as Happy_Prelude
import qualified GHC.Num as Happy_Prelude
import qualified GHC.Err as Happy_Prelude
import qualified Data.Array as Happy_Data_Array
import qualified Data.Bits as Bits
import qualified GHC.Exts as Happy_GHC_Exts
import Control.Applicative(Applicative(..))
import Control.Monad (ap)

-- parser produced by Happy Version 2.1.3

newtype HappyAbsSyn  = HappyAbsSyn HappyAny
#if __GLASGOW_HASKELL__ >= 607
type HappyAny = Happy_GHC_Exts.Any
#else
type HappyAny = forall a . a
#endif
newtype HappyWrap5 = HappyWrap5 (Format)
happyIn5 :: (Format) -> (HappyAbsSyn )
happyIn5 :: Format -> HappyAbsSyn
happyIn5 Format
x = HappyWrap5 -> HappyAbsSyn
forall a b. a -> b
Happy_GHC_Exts.unsafeCoerce# (Format -> HappyWrap5
HappyWrap5 Format
x)
{-# INLINE happyIn5 #-}
happyOut5 :: (HappyAbsSyn ) -> HappyWrap5
happyOut5 :: HappyAbsSyn -> HappyWrap5
happyOut5 HappyAbsSyn
x = HappyAbsSyn -> HappyWrap5
forall a b. a -> b
Happy_GHC_Exts.unsafeCoerce# HappyAbsSyn
x
{-# INLINE happyOut5 #-}
newtype HappyWrap6 = HappyWrap6 (Format)
happyIn6 :: (Format) -> (HappyAbsSyn )
happyIn6 :: Format -> HappyAbsSyn
happyIn6 Format
x = HappyWrap6 -> HappyAbsSyn
forall a b. a -> b
Happy_GHC_Exts.unsafeCoerce# (Format -> HappyWrap6
HappyWrap6 Format
x)
{-# INLINE happyIn6 #-}
happyOut6 :: (HappyAbsSyn ) -> HappyWrap6
happyOut6 :: HappyAbsSyn -> HappyWrap6
happyOut6 HappyAbsSyn
x = HappyAbsSyn -> HappyWrap6
forall a b. a -> b
Happy_GHC_Exts.unsafeCoerce# HappyAbsSyn
x
{-# INLINE happyOut6 #-}
newtype HappyWrap7 = HappyWrap7 (Format)
happyIn7 :: (Format) -> (HappyAbsSyn )
happyIn7 :: Format -> HappyAbsSyn
happyIn7 Format
x = HappyWrap7 -> HappyAbsSyn
forall a b. a -> b
Happy_GHC_Exts.unsafeCoerce# (Format -> HappyWrap7
HappyWrap7 Format
x)
{-# INLINE happyIn7 #-}
happyOut7 :: (HappyAbsSyn ) -> HappyWrap7
happyOut7 :: HappyAbsSyn -> HappyWrap7
happyOut7 HappyAbsSyn
x = HappyAbsSyn -> HappyWrap7
forall a b. a -> b
Happy_GHC_Exts.unsafeCoerce# HappyAbsSyn
x
{-# INLINE happyOut7 #-}
happyInTok :: ((AlexPosn, Token)) -> (HappyAbsSyn )
happyInTok :: (AlexPosn, Token) -> HappyAbsSyn
happyInTok (AlexPosn, Token)
x = (AlexPosn, Token) -> HappyAbsSyn
forall a b. a -> b
Happy_GHC_Exts.unsafeCoerce# (AlexPosn, Token)
x
{-# INLINE happyInTok #-}
happyOutTok :: (HappyAbsSyn ) -> ((AlexPosn, Token))
happyOutTok :: HappyAbsSyn -> (AlexPosn, Token)
happyOutTok HappyAbsSyn
x = HappyAbsSyn -> (AlexPosn, Token)
forall a b. a -> b
Happy_GHC_Exts.unsafeCoerce# HappyAbsSyn
x
{-# INLINE happyOutTok #-}


{-# NOINLINE happyTokenStrings #-}
happyTokenStrings :: [String]
happyTokenStrings = [String
"'('",String
"')'",String
"'*'",String
"'+'",String
"'&'",String
"'|'",String
"'!'",String
"'%a'",String
"'%c'",String
"'%s'",String
"'%u'",String
"'%d'",String
"'%x'",String
"'%lu'",String
"'%ld'",String
"'%lx'",String
"LIT",String
"NAME",String
"%eof"]

happyActOffsets :: HappyAddr
happyActOffsets :: HappyAddr
happyActOffsets = Addr# -> HappyAddr
HappyA# Addr#
"\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x0c\x00\x00\x00\x00\x00\x00\x00\xfe\xff\xff\xff\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\x00\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#

happyGotoOffsets :: HappyAddr
happyGotoOffsets :: HappyAddr
happyGotoOffsets = Addr# -> HappyAddr
HappyA# Addr#
"\x15\x00\x00\x00\x04\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x19\x00\x00\x00\x00\x00\x00\x00\x18\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\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x00\x00\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#

happyDefActions :: HappyAddr
happyDefActions :: HappyAddr
happyDefActions = Addr# -> HappyAddr
HappyA# Addr#
"\xfc\xff\xff\xff\x00\x00\x00\x00\xfe\xff\xff\xff\x00\x00\x00\x00\xfc\xff\xff\xff\xfb\xff\xff\xff\xfc\xff\xff\xff\xf0\xff\xff\xff\xf1\xff\xff\xff\xf2\xff\xff\xff\xf8\xff\xff\xff\xf7\xff\xff\xff\xf6\xff\xff\xff\xf5\xff\xff\xff\xf4\xff\xff\xff\xf3\xff\xff\xff\xef\xff\xff\xff\xea\xff\xff\xff\x00\x00\x00\x00\xee\xff\xff\xff\xed\xff\xff\xff\x00\x00\x00\x00\xec\xff\xff\xff\xfd\xff\xff\xff\xeb\xff\xff\xff\xf9\xff\xff\xff\xfa\xff\xff\xff"#

happyCheck :: HappyAddr
happyCheck :: HappyAddr
happyCheck = Addr# -> HappyAddr
HappyA# Addr#
"\xff\xff\xff\xff\x02\x00\x00\x00\x04\x00\x00\x00\x05\x00\x00\x00\x06\x00\x00\x00\x01\x00\x00\x00\x08\x00\x00\x00\x02\x00\x00\x00\x09\x00\x00\x00\x0a\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\x0e\x00\x00\x00\x0f\x00\x00\x00\x10\x00\x00\x00\x11\x00\x00\x00\x12\x00\x00\x00\x13\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x07\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x14\x00\x00\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\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#

happyTable :: HappyAddr
happyTable :: HappyAddr
happyTable = Addr# -> HappyAddr
HappyA# Addr#
"\x00\x00\x00\x00\x07\x00\x00\x00\x14\x00\x00\x00\x15\x00\x00\x00\x16\x00\x00\x00\x02\x00\x00\x00\x17\x00\x00\x00\x05\x00\x00\x00\x08\x00\x00\x00\x09\x00\x00\x00\x0a\x00\x00\x00\x0b\x00\x00\x00\x0c\x00\x00\x00\x0d\x00\x00\x00\x0e\x00\x00\x00\x0f\x00\x00\x00\x10\x00\x00\x00\x11\x00\x00\x00\x12\x00\x00\x00\x05\x00\x00\x00\x1a\x00\x00\x00\x03\x00\x00\x00\x02\x00\x00\x00\x1b\x00\x00\x00\x12\x00\x00\x00\x02\x00\x00\x00\x17\x00\x00\x00\x05\x00\x00\x00\x18\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\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\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#

happyReduceArr :: Array
  Int
  (Int#
   -> (AlexPosn, Token)
   -> Int#
   -> Happy_IntList
   -> HappyStk HappyAbsSyn
   -> [(AlexPosn, Token)]
   -> Either ParseError HappyAbsSyn)
happyReduceArr = (Int, Int)
-> [(Int,
     Int#
     -> (AlexPosn, Token)
     -> Int#
     -> Happy_IntList
     -> HappyStk HappyAbsSyn
     -> [(AlexPosn, Token)]
     -> Either ParseError HappyAbsSyn)]
-> Array
     Int
     (Int#
      -> (AlexPosn, Token)
      -> Int#
      -> Happy_IntList
      -> HappyStk HappyAbsSyn
      -> [(AlexPosn, Token)]
      -> Either ParseError HappyAbsSyn)
forall i e. Ix i => (i, i) -> [(i, e)] -> Array i e
Happy_Data_Array.array (Int
1, Int
21) [
        (Int
1 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_1),
        (Int
2 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_2),
        (Int
3 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_3),
        (Int
4 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_4),
        (Int
5 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_5),
        (Int
6 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_6),
        (Int
7 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_7),
        (Int
8 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_8),
        (Int
9 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_9),
        (Int
10 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_10),
        (Int
11 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_11),
        (Int
12 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_12),
        (Int
13 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_13),
        (Int
14 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_14),
        (Int
15 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_15),
        (Int
16 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_16),
        (Int
17 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_17),
        (Int
18 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_18),
        (Int
19 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_19),
        (Int
20 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_20),
        (Int
21 , Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_21)
        ]

happyRuleArr :: HappyAddr
happyRuleArr :: HappyAddr
happyRuleArr = Addr# -> HappyAddr
HappyA# Addr#
"\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00"#

happyCatchStates :: [Happy_Prelude.Int]
happyCatchStates :: [Int]
happyCatchStates = []

happy_n_terms :: Int
happy_n_terms = Int
21 :: Happy_Prelude.Int
happy_n_nonterms :: Int
happy_n_nonterms = Int
3 :: Happy_Prelude.Int

happy_n_starts :: Int
happy_n_starts = Int
1 :: Happy_Prelude.Int

happyReduce_1 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_1 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
0# HappyAbsSyn -> HappyAbsSyn
happyReduction_1
happyReduction_1 :: HappyAbsSyn -> HappyAbsSyn
happyReduction_1 HappyAbsSyn
happy_x_1
         =  case HappyAbsSyn -> HappyWrap6
happyOut6 HappyAbsSyn
happy_x_1 of { (HappyWrap6 Format
happy_var_1) -> 
        Format -> HappyAbsSyn
happyIn5
                 (Format
happy_var_1
        )}

happyReduce_2 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_2 = Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_3  Int#
0# HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
forall {p}. HappyAbsSyn -> p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_2
happyReduction_2 :: HappyAbsSyn -> p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_2 HappyAbsSyn
happy_x_3
        p
happy_x_2
        HappyAbsSyn
happy_x_1
         =  case HappyAbsSyn -> HappyWrap5
happyOut5 HappyAbsSyn
happy_x_1 of { (HappyWrap5 Format
happy_var_1) -> 
        case HappyAbsSyn -> HappyWrap6
happyOut6 HappyAbsSyn
happy_x_3 of { (HappyWrap6 Format
happy_var_3) -> 
        Format -> HappyAbsSyn
happyIn5
                 (Format -> Format -> Format
Alt Format
happy_var_1 Format
happy_var_3
        )}}

happyReduce_3 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_3 = Int#
-> HappyAbsSyn
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_0  Int#
1# HappyAbsSyn
happyReduction_3
happyReduction_3 :: HappyAbsSyn
happyReduction_3  =  Format -> HappyAbsSyn
happyIn6
                 ([Format] -> Format
Follow []
        )

happyReduce_4 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_4 = Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_2  Int#
1# HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
happyReduction_4
happyReduction_4 :: HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
happyReduction_4 HappyAbsSyn
happy_x_2
        HappyAbsSyn
happy_x_1
         =  case HappyAbsSyn -> HappyWrap6
happyOut6 HappyAbsSyn
happy_x_1 of { (HappyWrap6 Format
happy_var_1) -> 
        case HappyAbsSyn -> HappyWrap7
happyOut7 HappyAbsSyn
happy_x_2 of { (HappyWrap7 Format
happy_var_2) -> 
        Format -> HappyAbsSyn
happyIn6
                 ([Format] -> Format
Follow [Format
happy_var_1, Format
happy_var_2]
        )}}

happyReduce_5 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_5 = Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_3  Int#
2# HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
forall {p} {p}. p -> HappyAbsSyn -> p -> HappyAbsSyn
happyReduction_5
happyReduction_5 :: p -> HappyAbsSyn -> p -> HappyAbsSyn
happyReduction_5 p
happy_x_3
        HappyAbsSyn
happy_x_2
        p
happy_x_1
         =  case HappyAbsSyn -> HappyWrap5
happyOut5 HappyAbsSyn
happy_x_2 of { (HappyWrap5 Format
happy_var_2) -> 
        Format -> HappyAbsSyn
happyIn7
                 (Format -> Format
Group Format
happy_var_2
        )}

happyReduce_6 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_6 = Int#
-> Int#
-> (HappyStk HappyAbsSyn
    -> (AlexPosn, Token) -> Either ParseError HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyMonadReduce Int#
3# Int#
2# HappyStk HappyAbsSyn
-> (AlexPosn, Token) -> Either ParseError HappyAbsSyn
forall {p}.
HappyStk HappyAbsSyn -> p -> Either ParseError HappyAbsSyn
happyReduction_6
happyReduction_6 :: HappyStk HappyAbsSyn -> p -> Either ParseError HappyAbsSyn
happyReduction_6 (HappyAbsSyn
happy_x_3 `HappyStk`
        HappyAbsSyn
happy_x_2 `HappyStk`
        HappyAbsSyn
happy_x_1 `HappyStk`
        HappyStk HappyAbsSyn
happyRest) p
tk
         = Either ParseError Format
-> (Format -> Either ParseError HappyAbsSyn)
-> Either ParseError HappyAbsSyn
forall a b.
Either ParseError a
-> (a -> Either ParseError b) -> Either ParseError b
happyThen ((case HappyAbsSyn -> (AlexPosn, Token)
happyOutTok HappyAbsSyn
happy_x_1 of { ((AlexPosn
happy_var_1, Token
TOpenGroup)) -> 
        ( ParseError -> Either ParseError Format
forall a b. a -> Either a b
Left (AlexPosn -> ParseError
Unclosed AlexPosn
happy_var_1))})
        ) (\Format
r -> HappyAbsSyn -> Either ParseError HappyAbsSyn
forall a. a -> Either ParseError a
happyReturn (Format -> HappyAbsSyn
happyIn7 Format
r))

happyReduce_7 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_7 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn
happyReduction_7
happyReduction_7 :: p -> HappyAbsSyn
happyReduction_7 p
happy_x_1
         =  Format -> HappyAbsSyn
happyIn7
                 (Format
UnsignedInt
        )

happyReduce_8 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_8 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn
happyReduction_8
happyReduction_8 :: p -> HappyAbsSyn
happyReduction_8 p
happy_x_1
         =  Format -> HappyAbsSyn
happyIn7
                 (Format
SignedInt
        )

happyReduce_9 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_9 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn
happyReduction_9
happyReduction_9 :: p -> HappyAbsSyn
happyReduction_9 p
happy_x_1
         =  Format -> HappyAbsSyn
happyIn7
                 (Format
HexInt
        )

happyReduce_10 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_10 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn
happyReduction_10
happyReduction_10 :: p -> HappyAbsSyn
happyReduction_10 p
happy_x_1
         =  Format -> HappyAbsSyn
happyIn7
                 (Format
UnsignedInteger
        )

happyReduce_11 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_11 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn
happyReduction_11
happyReduction_11 :: p -> HappyAbsSyn
happyReduction_11 p
happy_x_1
         =  Format -> HappyAbsSyn
happyIn7
                 (Format
SignedInteger
        )

happyReduce_12 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_12 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn
happyReduction_12
happyReduction_12 :: p -> HappyAbsSyn
happyReduction_12 p
happy_x_1
         =  Format -> HappyAbsSyn
happyIn7
                 (Format
HexInteger
        )

happyReduce_13 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_13 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn
happyReduction_13
happyReduction_13 :: p -> HappyAbsSyn
happyReduction_13 p
happy_x_1
         =  Format -> HappyAbsSyn
happyIn7
                 (Format
Word
        )

happyReduce_14 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_14 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn
happyReduction_14
happyReduction_14 :: p -> HappyAbsSyn
happyReduction_14 p
happy_x_1
         =  Format -> HappyAbsSyn
happyIn7
                 (Format
Char
        )

happyReduce_15 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_15 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn
happyReduction_15
happyReduction_15 :: p -> HappyAbsSyn
happyReduction_15 p
happy_x_1
         =  Format -> HappyAbsSyn
happyIn7
                 (Format
Letter
        )

happyReduce_16 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_16 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
happyReduction_16
happyReduction_16 :: HappyAbsSyn -> HappyAbsSyn
happyReduction_16 HappyAbsSyn
happy_x_1
         =  case HappyAbsSyn -> (AlexPosn, Token)
happyOutTok HappyAbsSyn
happy_x_1 of { ((AlexPosn
_, TLiteral Char
happy_var_1)) -> 
        Format -> HappyAbsSyn
happyIn7
                 (String -> Format
Literal [Char
happy_var_1]
        )}

happyReduce_17 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_17 = Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_2  Int#
2# HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_17
happyReduction_17 :: p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_17 p
happy_x_2
        HappyAbsSyn
happy_x_1
         =  case HappyAbsSyn -> HappyWrap7
happyOut7 HappyAbsSyn
happy_x_1 of { (HappyWrap7 Format
happy_var_1) -> 
        Format -> HappyAbsSyn
happyIn7
                 (Format -> Format
Many Format
happy_var_1
        )}

happyReduce_18 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_18 = Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_2  Int#
2# HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_18
happyReduction_18 :: p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_18 p
happy_x_2
        HappyAbsSyn
happy_x_1
         =  case HappyAbsSyn -> HappyWrap7
happyOut7 HappyAbsSyn
happy_x_1 of { (HappyWrap7 Format
happy_var_1) -> 
        Format -> HappyAbsSyn
happyIn7
                 (Format -> Format
Some Format
happy_var_1
        )}

happyReduce_19 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_19 = Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_2  Int#
2# HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
forall {p}. p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_19
happyReduction_19 :: p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_19 p
happy_x_2
        HappyAbsSyn
happy_x_1
         =  case HappyAbsSyn -> HappyWrap7
happyOut7 HappyAbsSyn
happy_x_1 of { (HappyWrap7 Format
happy_var_1) -> 
        Format -> HappyAbsSyn
happyIn7
                 (Format -> Format
Gather Format
happy_var_1
        )}

happyReduce_20 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_20 = Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_3  Int#
2# HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
forall {p}. HappyAbsSyn -> p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_20
happyReduction_20 :: HappyAbsSyn -> p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_20 HappyAbsSyn
happy_x_3
        p
happy_x_2
        HappyAbsSyn
happy_x_1
         =  case HappyAbsSyn -> HappyWrap7
happyOut7 HappyAbsSyn
happy_x_1 of { (HappyWrap7 Format
happy_var_1) -> 
        case HappyAbsSyn -> HappyWrap7
happyOut7 HappyAbsSyn
happy_x_3 of { (HappyWrap7 Format
happy_var_3) -> 
        Format -> HappyAbsSyn
happyIn7
                 (Format -> Format -> Format
SepBy Format
happy_var_1 Format
happy_var_3
        )}}

happyReduce_21 :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce_21 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
happyReduction_21
happyReduction_21 :: HappyAbsSyn -> HappyAbsSyn
happyReduction_21 HappyAbsSyn
happy_x_1
         =  case HappyAbsSyn -> (AlexPosn, Token)
happyOutTok HappyAbsSyn
happy_x_1 of { ((AlexPosn
_, TAt String
happy_var_1)) -> 
        Format -> HappyAbsSyn
happyIn7
                 (String -> Format
Named String
happy_var_1
        )}

happyTerminalToTok :: (a, Token) -> Int#
happyTerminalToTok (a, Token)
term = case (a, Token)
term of {
        (a
happy_dollar_dollar, Token
TOpenGroup) -> Int#
2#;
        (a
_, Token
TCloseGroup) -> Int#
3#;
        (a
_, Token
TMany) -> Int#
4#;
        (a
_, Token
TSome) -> Int#
5#;
        (a
_, Token
TSepBy) -> Int#
6#;
        (a
_, Token
TAlt) -> Int#
7#;
        (a
_, Token
TBang) -> Int#
8#;
        (a
_, Token
TAnyLetter) -> Int#
9#;
        (a
_, Token
TAnyChar) -> Int#
10#;
        (a
_, Token
TAnyWord) -> Int#
11#;
        (a
_, Token
TUnsignedInt) -> Int#
12#;
        (a
_, Token
TSignedInt) -> Int#
13#;
        (a
_, Token
THexInt) -> Int#
14#;
        (a
_, Token
TUnsignedInteger) -> Int#
15#;
        (a
_, Token
TSignedInteger) -> Int#
16#;
        (a
_, Token
THexInteger) -> Int#
17#;
        (a
_, TLiteral Char
happy_dollar_dollar) -> Int#
18#;
        (a
_, TAt String
happy_dollar_dollar) -> Int#
19#;
        (a, Token)
_ -> Int#
-1#;
        }
{-# NOINLINE happyTerminalToTok #-}

happyLex :: (t -> [a] -> t)
-> (Int# -> (a, Token) -> [(a, Token)] -> t) -> [(a, Token)] -> t
happyLex t -> [a] -> t
kend  Int# -> (a, Token) -> [(a, Token)] -> t
_kmore []       = t -> [a] -> t
kend t
forall a. a
notHappyAtAll []
happyLex t -> [a] -> t
_kend Int# -> (a, Token) -> [(a, Token)] -> t
kmore  ((a, Token)
tk:[(a, Token)]
tks) = Int# -> (a, Token) -> [(a, Token)] -> t
kmore ((a, Token) -> Int#
forall {a}. (a, Token) -> Int#
happyTerminalToTok (a, Token)
tk) (a, Token)
tk [(a, Token)]
tks
{-# INLINE happyLex #-}

happyNewToken :: Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyNewToken Int#
action Happy_IntList
sts HappyStk HappyAbsSyn
stk = (Any -> [(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> (Int#
    -> (AlexPosn, Token)
    -> [(AlexPosn, Token)]
    -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall {t} {a} {t} {a}.
(t -> [a] -> t)
-> (Int# -> (a, Token) -> [(a, Token)] -> t) -> [(a, Token)] -> t
happyLex (\Any
tk -> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyDoAction Int#
20# (AlexPosn, Token)
forall a. a
notHappyAtAll Int#
action Happy_IntList
sts HappyStk HappyAbsSyn
stk) (\Int#
i (AlexPosn, Token)
tk -> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyDoAction Int#
i (AlexPosn, Token)
tk Int#
action Happy_IntList
sts HappyStk HappyAbsSyn
stk)

happyReport :: Int#
-> (AlexPosn, Token)
-> [String]
-> ([(AlexPosn, Token)] -> Either ParseError a)
-> [(AlexPosn, Token)]
-> Either ParseError a
happyReport Int#
20# (AlexPosn, Token)
tk [String]
explist [(AlexPosn, Token)] -> Either ParseError a
resume [(AlexPosn, Token)]
tks = [(AlexPosn, Token)]
-> [String]
-> ([(AlexPosn, Token)] -> Either ParseError a)
-> Either ParseError a
forall a.
[(AlexPosn, Token)]
-> [String]
-> ([(AlexPosn, Token)] -> Either ParseError a)
-> Either ParseError a
happyReport' [(AlexPosn, Token)]
tks [String]
explist [(AlexPosn, Token)] -> Either ParseError a
resume
happyReport Int#
_ (AlexPosn, Token)
tk [String]
explist [(AlexPosn, Token)] -> Either ParseError a
resume [(AlexPosn, Token)]
tks = [(AlexPosn, Token)]
-> [String]
-> ([(AlexPosn, Token)] -> Either ParseError a)
-> Either ParseError a
forall a.
[(AlexPosn, Token)]
-> [String]
-> ([(AlexPosn, Token)] -> Either ParseError a)
-> Either ParseError a
happyReport' ((AlexPosn, Token)
tk(AlexPosn, Token) -> [(AlexPosn, Token)] -> [(AlexPosn, Token)]
forall a. a -> [a] -> [a]
:[(AlexPosn, Token)]
tks) [String]
explist (\[(AlexPosn, Token)]
tks -> [(AlexPosn, Token)] -> Either ParseError a
resume ([(AlexPosn, Token)] -> [(AlexPosn, Token)]
forall a. HasCallStack => [a] -> [a]
Happy_Prelude.tail [(AlexPosn, Token)]
tks))


happyThen :: () => (Either ParseError a) -> (a -> (Either ParseError b)) -> (Either ParseError b)
happyThen :: forall a b.
Either ParseError a
-> (a -> Either ParseError b) -> Either ParseError b
happyThen = Either ParseError a
-> (a -> Either ParseError b) -> Either ParseError b
forall a b.
Either ParseError a
-> (a -> Either ParseError b) -> Either ParseError b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
(Happy_Prelude.>>=)
happyReturn :: () => a -> (Either ParseError a)
happyReturn :: forall a. a -> Either ParseError a
happyReturn = (a -> Either ParseError a
forall a. a -> Either ParseError a
forall (m :: * -> *) a. Monad m => a -> m a
Happy_Prelude.return)
happyThen1 :: m t -> (t -> t -> m b) -> t -> m b
happyThen1 m t
m t -> t -> m b
k t
tks = m t -> (t -> m b) -> m b
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
(Happy_Prelude.>>=) m t
m (\t
a -> t -> t -> m b
k t
a t
tks)
happyFmap1 :: (t -> b) -> (t -> Either ParseError t) -> t -> Either ParseError b
happyFmap1 t -> b
f t -> Either ParseError t
m t
tks = Either ParseError t
-> (t -> Either ParseError b) -> Either ParseError b
forall a b.
Either ParseError a
-> (a -> Either ParseError b) -> Either ParseError b
happyThen (t -> Either ParseError t
m t
tks) (\t
a -> b -> Either ParseError b
forall a. a -> Either ParseError a
happyReturn (t -> b
f t
a))
happyReturn1 :: () => a -> b -> (Either ParseError a)
happyReturn1 :: forall a b. a -> b -> Either ParseError a
happyReturn1 = \a
a b
tks -> (forall (m :: * -> *) a. Monad m => a -> m a
Happy_Prelude.return) a
a
happyReport' :: () => [((AlexPosn, Token))] -> [Happy_Prelude.String] -> ([((AlexPosn, Token))] -> (Either ParseError a)) -> (Either ParseError a)
happyReport' :: forall a.
[(AlexPosn, Token)]
-> [String]
-> ([(AlexPosn, Token)] -> Either ParseError a)
-> Either ParseError a
happyReport' = (\[(AlexPosn, Token)]
tokens [String]
expected [(AlexPosn, Token)] -> Either ParseError a
resume -> (forall a. [(AlexPosn, Token)] -> Either ParseError a
parseError) [(AlexPosn, Token)]
tokens)

happyAbort :: () => [((AlexPosn, Token))] -> (Either ParseError a)
happyAbort :: forall a. [(AlexPosn, Token)] -> Either ParseError a
happyAbort = String -> [(AlexPosn, Token)] -> Either ParseError a
forall a. HasCallStack => String -> a
Happy_Prelude.error String
"Called abort handler in non-resumptive parser"

parseFormat :: [(AlexPosn, Token)] -> Either ParseError Format
parseFormat [(AlexPosn, Token)]
tks = Either ParseError Format
happySomeParser where
 happySomeParser :: Either ParseError Format
happySomeParser = Either ParseError HappyAbsSyn
-> (HappyAbsSyn -> Either ParseError Format)
-> Either ParseError Format
forall a b.
Either ParseError a
-> (a -> Either ParseError b) -> Either ParseError b
happyThen (Int# -> [(AlexPosn, Token)] -> Either ParseError HappyAbsSyn
happyParse Int#
0# [(AlexPosn, Token)]
tks) (\HappyAbsSyn
x -> Format -> Either ParseError Format
forall a. a -> Either ParseError a
happyReturn (let {(HappyWrap5 Format
x') = HappyAbsSyn -> HappyWrap5
happyOut5 HappyAbsSyn
x} in Format
x'))

happySeq :: a -> b -> b
happySeq = a -> b -> b
forall a b. a -> b -> b
happyDontSeq


data ParseError
  = Unclosed AlexPosn
  | UnexpectedEOF
  | UnexpectedToken AlexPosn Token
  deriving Int -> ParseError -> ShowS
[ParseError] -> ShowS
ParseError -> String
(Int -> ParseError -> ShowS)
-> (ParseError -> String)
-> ([ParseError] -> ShowS)
-> Show ParseError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ParseError -> ShowS
showsPrec :: Int -> ParseError -> ShowS
$cshow :: ParseError -> String
show :: ParseError -> String
$cshowList :: [ParseError] -> ShowS
showList :: [ParseError] -> ShowS
Show

parseError :: [(AlexPosn, Token)] -> Either ParseError a
parseError :: forall a. [(AlexPosn, Token)] -> Either ParseError a
parseError ((AlexPosn
p,Token
t):[(AlexPosn, Token)]
_) = ParseError -> Either ParseError a
forall a b. a -> Either a b
Left (AlexPosn -> Token -> ParseError
UnexpectedToken AlexPosn
p Token
t)
parseError [] = ParseError -> Either ParseError a
forall a b. a -> Either a b
Left ParseError
UnexpectedEOF
#define HAPPY_COERCE 1
-- $Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp $

#if !defined(__GLASGOW_HASKELL__)
#  error This code isn't being built with GHC.
#endif

-- Get WORDS_BIGENDIAN (if defined)
#include "MachDeps.h"

-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.
#define LT(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.<# m)) :: Happy_Prelude.Bool)
#define GTE(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.>=# m)) :: Happy_Prelude.Bool)
#define EQ(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.==# m)) :: Happy_Prelude.Bool)
#define PLUS(n,m) (n Happy_GHC_Exts.+# m)
#define MINUS(n,m) (n Happy_GHC_Exts.-# m)
#define TIMES(n,m) (n Happy_GHC_Exts.*# m)
#define NEGATE(n) (Happy_GHC_Exts.negateInt# (n))

type Happy_Int = Happy_GHC_Exts.Int#
data Happy_IntList = HappyCons Happy_Int Happy_IntList

#define INVALID_TOK -1#
#define ERROR_TOK 0#
#define CATCH_TOK 1#

#if defined(HAPPY_COERCE)
#  define GET_ERROR_TOKEN(x)  (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# i) -> i })
#  define MK_ERROR_TOKEN(i)   (Happy_GHC_Exts.unsafeCoerce# (Happy_GHC_Exts.I# i))
#  define MK_TOKEN(x)         (happyInTok (x))
#else
#  define GET_ERROR_TOKEN(x)  (case x of { HappyErrorToken (Happy_GHC_Exts.I# i) -> i })
#  define MK_ERROR_TOKEN(i)   (HappyErrorToken (Happy_GHC_Exts.I# i))
#  define MK_TOKEN(x)         (HappyTerminal (x))
#endif

#if defined(HAPPY_DEBUG)
#  define DEBUG_TRACE(s)    (happyTrace (s)) Happy_Prelude.$
happyTrace string expr = Happy_System_IO_Unsafe.unsafePerformIO Happy_Prelude.$ do
    Happy_System_IO.hPutStr Happy_System_IO.stderr string
    Happy_Prelude.return expr
#else
#  define DEBUG_TRACE(s)    {- nothing -}
#endif

infixr 9 `HappyStk`
data HappyStk a = HappyStk a (HappyStk a)

-----------------------------------------------------------------------------
-- starting the parse

happyParse :: Int# -> [(AlexPosn, Token)] -> Either ParseError HappyAbsSyn
happyParse Int#
start_state = Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyNewToken Int#
start_state Happy_IntList
forall a. a
notHappyAtAll HappyStk HappyAbsSyn
forall a. a
notHappyAtAll

-----------------------------------------------------------------------------
-- Accepting the parse

-- If the current token is ERROR_TOK, it means we've just accepted a partial
-- parse (a %partial parser).  We must ignore the saved token on the top of
-- the stack in this case.
happyAccept :: Int# -> p -> Int# -> p -> HappyStk a -> b -> Either ParseError a
happyAccept ERROR_TOK tk st sts (_ `HappyStk` ans `HappyStk` _) =
        happyReturn1 ans
happyAccept Int#
j p
tk Int#
st p
sts (HappyStk a
ans HappyStk a
_) =
        (Int#
-> ((b -> Either ParseError a) -> b -> Either ParseError a)
-> (b -> Either ParseError a)
-> b
-> Either ParseError a
forall a. Int# -> a -> a
happyTcHack Int#
j (Int# -> (b -> Either ParseError a) -> b -> Either ParseError a
forall a. Int# -> a -> a
happyTcHack Int#
st)) (a -> b -> Either ParseError a
forall a b. a -> b -> Either ParseError a
happyReturn1 a
ans)

-----------------------------------------------------------------------------
-- Arrays only: do the next action

happyDoAction :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyDoAction Int#
i (AlexPosn, Token)
tk Int#
st =
  DEBUG_TRACE("state: " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# st) Happy_Prelude.++
              ",\ttoken: " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# i) Happy_Prelude.++
              ",\taction: ")
  case Int# -> HappyAction
happyDecodeAction (Int# -> Int# -> Int#
happyNextAction Int#
i Int#
st) of
    HappyAction
HappyFail             -> DEBUG_TRACE("failing.\n")
                             Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyFail Int#
i (AlexPosn, Token)
tk Int#
st
    HappyAction
HappyAccept           -> DEBUG_TRACE("accept.\n")
                             Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall {p} {p} {a} {b}.
Int# -> p -> Int# -> p -> HappyStk a -> b -> Either ParseError a
happyAccept Int#
i (AlexPosn, Token)
tk Int#
st
    HappyReduce Int#
rule      -> DEBUG_TRACE("reduce (rule " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# rule) Happy_Prelude.++ ")")
                             (Array
  Int
  (Int#
   -> (AlexPosn, Token)
   -> Int#
   -> Happy_IntList
   -> HappyStk HappyAbsSyn
   -> [(AlexPosn, Token)]
   -> Either ParseError HappyAbsSyn)
happyReduceArr Array
  Int
  (Int#
   -> (AlexPosn, Token)
   -> Int#
   -> Happy_IntList
   -> HappyStk HappyAbsSyn
   -> [(AlexPosn, Token)]
   -> Either ParseError HappyAbsSyn)
-> Int
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall i e. Ix i => Array i e -> i -> e
Happy_Data_Array.! (Int# -> Int
Happy_GHC_Exts.I# Int#
rule)) Int#
i (AlexPosn, Token)
tk Int#
st
    HappyShift  Int#
new_state -> DEBUG_TRACE("shift, enter state " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# new_state) Happy_Prelude.++ "\n")
                             Int#
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyShift Int#
new_state Int#
i (AlexPosn, Token)
tk Int#
st

{-# INLINE happyNextAction #-}
happyNextAction :: Int# -> Int# -> Int#
happyNextAction Int#
i Int#
st = case Int# -> Int# -> Maybe Int
happyIndexActionTable Int#
i Int#
st of
  Happy_Prelude.Just (Happy_GHC_Exts.I# Int#
act) -> Int#
act
  Maybe Int
Happy_Prelude.Nothing                      -> HappyAddr -> Int# -> Int#
happyIndexOffAddr HappyAddr
happyDefActions Int#
st

{-# INLINE happyIndexActionTable #-}
happyIndexActionTable :: Int# -> Int# -> Maybe Int
happyIndexActionTable Int#
i Int#
st
  | GTE(i, 0#), GTE(off, 0#), EQ(happyIndexOffAddr happyCheck off, i)
  -- i >= 0:   Guard against INVALID_TOK (do the default action, which ultimately errors)
  -- off >= 0: Otherwise it's a default action
  -- equality check: Ensure that the entry in the compressed array is owned by st
  = Int -> Maybe Int
forall a. a -> Maybe a
Happy_Prelude.Just (Int# -> Int
Happy_GHC_Exts.I# (HappyAddr -> Int# -> Int#
happyIndexOffAddr HappyAddr
happyTable Int#
off))
  | Bool
Happy_Prelude.otherwise
  = Maybe Int
forall a. Maybe a
Happy_Prelude.Nothing
  where
    off :: Int#
off = PLUS(happyIndexOffAddr happyActOffsets st, i)

data HappyAction
  = HappyFail
  | HappyAccept
  | HappyReduce Happy_Int -- rule number
  | HappyShift Happy_Int  -- new state
  deriving Int -> HappyAction -> ShowS
[HappyAction] -> ShowS
HappyAction -> String
(Int -> HappyAction -> ShowS)
-> (HappyAction -> String)
-> ([HappyAction] -> ShowS)
-> Show HappyAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HappyAction -> ShowS
showsPrec :: Int -> HappyAction -> ShowS
$cshow :: HappyAction -> String
show :: HappyAction -> String
$cshowList :: [HappyAction] -> ShowS
showList :: [HappyAction] -> ShowS
Happy_Prelude.Show

{-# INLINE happyDecodeAction #-}
happyDecodeAction :: Happy_Int -> HappyAction
happyDecodeAction :: Int# -> HappyAction
happyDecodeAction  Int#
0#                        = HappyAction
HappyFail
happyDecodeAction Int#
-1#                        = HappyAction
HappyAccept
happyDecodeAction Int#
action | LT(action, 0#)    = HappyReduce NEGATE(PLUS(action, 1#))
                         | Bool
Happy_Prelude.otherwise = Int# -> HappyAction
HappyShift MINUS(action, 1#)

{-# INLINE happyIndexGotoTable #-}
happyIndexGotoTable :: Int# -> Int# -> Int#
happyIndexGotoTable Int#
nt Int#
st = HappyAddr -> Int# -> Int#
happyIndexOffAddr HappyAddr
happyTable Int#
off
  where
    off :: Int#
off = PLUS(happyIndexOffAddr happyGotoOffsets st, nt)

{-# INLINE happyIndexOffAddr #-}
happyIndexOffAddr :: HappyAddr -> Happy_Int -> Happy_Int
happyIndexOffAddr :: HappyAddr -> Int# -> Int#
happyIndexOffAddr (HappyA# Addr#
arr) Int#
off =
#if __GLASGOW_HASKELL__ >= 901
  Int32# -> Int#
Happy_GHC_Exts.int32ToInt# -- qualified import because it doesn't exist on older GHC's
#endif
#ifdef WORDS_BIGENDIAN
  -- The CI of `alex` tests this code path
  (Happy_GHC_Exts.word32ToInt32# (Happy_GHC_Exts.wordToWord32# (Happy_GHC_Exts.byteSwap32# (Happy_GHC_Exts.word32ToWord# (Happy_GHC_Exts.int32ToWord32#
#endif
  (Addr# -> Int# -> Int32#
Happy_GHC_Exts.indexInt32OffAddr# Addr#
arr Int#
off)
#ifdef WORDS_BIGENDIAN
  )))))
#endif

happyIndexRuleArr :: Happy_Int -> (# Happy_Int, Happy_Int #)
happyIndexRuleArr :: Int# -> (# Int#, Int# #)
happyIndexRuleArr Int#
r = (# Int#
nt, Int#
len #)
  where
    !(Happy_GHC_Exts.I# Int#
n_starts) = Int
happy_n_starts
    offs :: Int#
offs = TIMES(MINUS(r,n_starts),2#)
    nt :: Int#
nt = HappyAddr -> Int# -> Int#
happyIndexOffAddr HappyAddr
happyRuleArr Int#
offs
    len :: Int#
len = HappyAddr -> Int# -> Int#
happyIndexOffAddr HappyAddr
happyRuleArr PLUS(offs,1#)

data HappyAddr = HappyA# Happy_GHC_Exts.Addr#

-----------------------------------------------------------------------------
-- Shifting a token

happyShift :: Int#
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyShift Int#
new_state ERROR_TOK tk st sts stk@(x `HappyStk` _) =
     -- See "Error Fixup" below
     let i = GET_ERROR_TOKEN(x) in
     DEBUG_TRACE("shifting the error token")
     happyDoAction i tk new_state (HappyCons st sts) stk

happyShift Int#
new_state Int#
i (AlexPosn, Token)
tk Int#
st Happy_IntList
sts HappyStk HappyAbsSyn
stk =
     Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyNewToken Int#
new_state (Int# -> Happy_IntList -> Happy_IntList
HappyCons Int#
st Happy_IntList
sts) (MK_TOKEN(tk) `HappyStk` stk)

-- happyReduce is specialised for the common cases.

happySpecReduce_0 :: Int#
-> HappyAbsSyn
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_0 Int#
nt HappyAbsSyn
fn Int#
j (AlexPosn, Token)
tk Int#
st Happy_IntList
sts HappyStk HappyAbsSyn
stk
     = HappyAbsSyn
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall a b. a -> b -> b
happySeq HappyAbsSyn
fn (Int#
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyGoto Int#
nt Int#
j (AlexPosn, Token)
tk Int#
st (Int# -> Happy_IntList -> Happy_IntList
HappyCons Int#
st Happy_IntList
sts) (HappyAbsSyn
fn HappyAbsSyn -> HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
forall a. a -> HappyStk a -> HappyStk a
`HappyStk` HappyStk HappyAbsSyn
stk))

happySpecReduce_1 :: Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_1 Int#
nt HappyAbsSyn -> HappyAbsSyn
fn Int#
j (AlexPosn, Token)
tk Int#
old_st sts :: Happy_IntList
sts@(HappyCons Int#
st Happy_IntList
_) (HappyAbsSyn
v1 `HappyStk` HappyStk HappyAbsSyn
stk')
     = let r :: HappyAbsSyn
r = HappyAbsSyn -> HappyAbsSyn
fn HappyAbsSyn
v1 in
       Int#
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall a. Int# -> a -> a
happyTcHack Int#
old_st (HappyAbsSyn
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall a b. a -> b -> b
happySeq HappyAbsSyn
r (Int#
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyGoto Int#
nt Int#
j (AlexPosn, Token)
tk Int#
st Happy_IntList
sts (HappyAbsSyn
r HappyAbsSyn -> HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
forall a. a -> HappyStk a -> HappyStk a
`HappyStk` HappyStk HappyAbsSyn
stk')))

happySpecReduce_2 :: Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_2 Int#
nt HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
fn Int#
j (AlexPosn, Token)
tk Int#
old_st
  (HappyCons Int#
_ sts :: Happy_IntList
sts@(HappyCons Int#
st Happy_IntList
_))
  (HappyAbsSyn
v1 `HappyStk` HappyAbsSyn
v2 `HappyStk` HappyStk HappyAbsSyn
stk')
     = let r :: HappyAbsSyn
r = HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
fn HappyAbsSyn
v1 HappyAbsSyn
v2 in
       Int#
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall a. Int# -> a -> a
happyTcHack Int#
old_st (HappyAbsSyn
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall a b. a -> b -> b
happySeq HappyAbsSyn
r (Int#
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyGoto Int#
nt Int#
j (AlexPosn, Token)
tk Int#
st Happy_IntList
sts (HappyAbsSyn
r HappyAbsSyn -> HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
forall a. a -> HappyStk a -> HappyStk a
`HappyStk` HappyStk HappyAbsSyn
stk')))

happySpecReduce_3 :: Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happySpecReduce_3 Int#
nt HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
fn Int#
j (AlexPosn, Token)
tk Int#
old_st
  (HappyCons Int#
_ (HappyCons Int#
_ sts :: Happy_IntList
sts@(HappyCons Int#
st Happy_IntList
_)))
  (HappyAbsSyn
v1 `HappyStk` HappyAbsSyn
v2 `HappyStk` HappyAbsSyn
v3 `HappyStk` HappyStk HappyAbsSyn
stk')
     = let r :: HappyAbsSyn
r = HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
fn HappyAbsSyn
v1 HappyAbsSyn
v2 HappyAbsSyn
v3 in
       Int#
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall a. Int# -> a -> a
happyTcHack Int#
old_st (HappyAbsSyn
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall a b. a -> b -> b
happySeq HappyAbsSyn
r (Int#
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyGoto Int#
nt Int#
j (AlexPosn, Token)
tk Int#
st Happy_IntList
sts (HappyAbsSyn
r HappyAbsSyn -> HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
forall a. a -> HappyStk a -> HappyStk a
`HappyStk` HappyStk HappyAbsSyn
stk')))

happyReduce :: Int#
-> Int#
-> (p -> HappyStk HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> p
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyReduce Int#
k Int#
nt p -> HappyStk HappyAbsSyn
fn Int#
j (AlexPosn, Token)
tk Int#
st Happy_IntList
sts p
stk
     = case Int# -> Happy_IntList -> Happy_IntList
happyDrop MINUS(k,(1# :: Happy_Int)) sts of
         sts1 :: Happy_IntList
sts1@(HappyCons Int#
st1 Happy_IntList
_) ->
                let r :: HappyStk HappyAbsSyn
r = p -> HappyStk HappyAbsSyn
fn p
stk in -- it doesn't hurt to always seq here...
                Int#
st Int#
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall a. Int# -> a -> a
`happyTcHack` HappyStk HappyAbsSyn
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall a b. a -> b -> b
happyDoSeq HappyStk HappyAbsSyn
r (Int#
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyGoto Int#
nt Int#
j (AlexPosn, Token)
tk Int#
st1 Happy_IntList
sts1 HappyStk HappyAbsSyn
r)

happyMonadReduce :: Int#
-> Int#
-> (HappyStk HappyAbsSyn
    -> (AlexPosn, Token) -> Either ParseError HappyAbsSyn)
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyMonadReduce Int#
k Int#
nt HappyStk HappyAbsSyn
-> (AlexPosn, Token) -> Either ParseError HappyAbsSyn
fn Int#
j (AlexPosn, Token)
tk Int#
st Happy_IntList
sts HappyStk HappyAbsSyn
stk =
      case Int# -> Happy_IntList -> Happy_IntList
happyDrop Int#
k (Int# -> Happy_IntList -> Happy_IntList
HappyCons Int#
st Happy_IntList
sts) of
        sts1 :: Happy_IntList
sts1@(HappyCons Int#
st1 Happy_IntList
_) ->
          let drop_stk :: HappyStk HappyAbsSyn
drop_stk = Int# -> HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
forall {a}. Int# -> HappyStk a -> HappyStk a
happyDropStk Int#
k HappyStk HappyAbsSyn
stk in
          Int#
j Int#
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall a. Int# -> a -> a
`happyTcHack` Either ParseError HappyAbsSyn
-> (HappyAbsSyn
    -> [(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall {m :: * -> *} {t} {t} {b}.
Monad m =>
m t -> (t -> t -> m b) -> t -> m b
happyThen1 (HappyStk HappyAbsSyn
-> (AlexPosn, Token) -> Either ParseError HappyAbsSyn
fn HappyStk HappyAbsSyn
stk (AlexPosn, Token)
tk)
                                     (\HappyAbsSyn
r -> Int#
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyGoto Int#
nt Int#
j (AlexPosn, Token)
tk Int#
st1 Happy_IntList
sts1 (HappyAbsSyn
r HappyAbsSyn -> HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
forall a. a -> HappyStk a -> HappyStk a
`HappyStk` HappyStk HappyAbsSyn
drop_stk))

happyMonad2Reduce :: Int#
-> Int#
-> (HappyStk HappyAbsSyn -> t -> Either ParseError HappyAbsSyn)
-> Int#
-> t
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyMonad2Reduce Int#
k Int#
nt HappyStk HappyAbsSyn -> t -> Either ParseError HappyAbsSyn
fn Int#
j t
tk Int#
st Happy_IntList
sts HappyStk HappyAbsSyn
stk =
      case Int# -> Happy_IntList -> Happy_IntList
happyDrop Int#
k (Int# -> Happy_IntList -> Happy_IntList
HappyCons Int#
st Happy_IntList
sts) of
        sts1 :: Happy_IntList
sts1@(HappyCons Int#
st1 Happy_IntList
_) ->
          let drop_stk :: HappyStk HappyAbsSyn
drop_stk = Int# -> HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
forall {a}. Int# -> HappyStk a -> HappyStk a
happyDropStk Int#
k HappyStk HappyAbsSyn
stk
              off :: Int#
off = HappyAddr -> Int# -> Int#
happyIndexOffAddr HappyAddr
happyGotoOffsets Int#
st1
              off_i :: Int#
off_i = PLUS(off, nt)
              new_state :: Int#
new_state = HappyAddr -> Int# -> Int#
happyIndexOffAddr HappyAddr
happyTable Int#
off_i
          in
            Int#
j Int#
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall a. Int# -> a -> a
`happyTcHack` Either ParseError HappyAbsSyn
-> (HappyAbsSyn
    -> [(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall {m :: * -> *} {t} {t} {b}.
Monad m =>
m t -> (t -> t -> m b) -> t -> m b
happyThen1 (HappyStk HappyAbsSyn -> t -> Either ParseError HappyAbsSyn
fn HappyStk HappyAbsSyn
stk t
tk)
                                       (\HappyAbsSyn
r -> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyNewToken Int#
new_state Happy_IntList
sts1 (HappyAbsSyn
r HappyAbsSyn -> HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
forall a. a -> HappyStk a -> HappyStk a
`HappyStk` HappyStk HappyAbsSyn
drop_stk))

happyDrop :: Int# -> Happy_IntList -> Happy_IntList
happyDrop Int#
0# Happy_IntList
l               = Happy_IntList
l
happyDrop Int#
n  (HappyCons Int#
_ Happy_IntList
t) = Int# -> Happy_IntList -> Happy_IntList
happyDrop MINUS(n,(1# :: Happy_Int)) t

happyDropStk :: Int# -> HappyStk a -> HappyStk a
happyDropStk Int#
0# HappyStk a
l                 = HappyStk a
l
happyDropStk Int#
n  (a
x `HappyStk` HappyStk a
xs) = Int# -> HappyStk a -> HappyStk a
happyDropStk MINUS(n,(1#::Happy_Int)) xs

-----------------------------------------------------------------------------
-- Moving to a new state after a reduction

happyGoto :: Int#
-> Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyGoto Int#
nt Int#
j (AlexPosn, Token)
tk Int#
st =
   DEBUG_TRACE(", goto state " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# new_state) Happy_Prelude.++ "\n")
   Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyDoAction Int#
j (AlexPosn, Token)
tk Int#
new_state
  where new_state :: Int#
new_state = Int# -> Int# -> Int#
happyIndexGotoTable Int#
nt Int#
st

{- Note [Error recovery]
~~~~~~~~~~~~~~~~~~~~~~~~
When there is no applicable action for the current lookahead token `tk`,
happy enters error recovery mode. Depending on whether the grammar file
declares the two action form `%error { abort } { report }` for
    Resumptive Error Handling,
it works in one (not resumptive) or two phases (resumptive):

 1. Fixup mode:
    Try to see if there is an action for the error token ERROR_TOK. If there
    is, do *not* emit an error and pretend instead that an `error` token was
    inserted.
    When there is no ERROR_TOK action, report an error.

    In non-resumptive error handling, calling the single error handler
    (e.g. `happyError`) will throw an exception and abort the parser.
    However, in resumptive error handling we enter *error resumption mode*.

 2. Error resumption mode:
    After reporting the error (with `report`), happy will attempt to find
    a good state stack to resume parsing in.
    For each candidate stack, it discards input until one of the candidates
    resumes (i.e. shifts the current input).
    If no candidate resumes before the end of input, resumption failed and
    calls the `abort` function, to much the same effect as in non-resumptive
    error handling.

    Candidate stacks are declared by the grammar author using the special
    `catch` terminal and called "catch frames".
    This mechanism is described in detail in Note [happyResume].

The `catch` resumption mechanism (2) is what usually is associated with
`error` in `bison` or `menhir`. Since `error` is used for the Fixup mechanism
(1) above, we call the corresponding token `catch`.
Furthermore, in constrast to `bison`, our implementation of `catch`
non-deterministically considers multiple catch frames on the stack for
resumption (See Note [Multiple catch frames]).

Note [happyResume]
~~~~~~~~~~~~~~~~~~
`happyResume` implements the resumption mechanism from Note [Error recovery].
It is best understood by example. Consider

Exp :: { String }
Exp : '1'                { "1" }
    | catch              { "catch" }
    | Exp '+' Exp %shift { $1 Happy_Prelude.++ " + " Happy_Prelude.++ $3 } -- %shift: associate 1 + 1 + 1 to the right
    | '(' Exp ')'        { "(" Happy_Prelude.++ $2 Happy_Prelude.++ ")" }

The idea of the use of `catch` here is that upon encountering a parse error
during expression parsing, we can gracefully degrade using the `catch` rule,
still producing a partial syntax tree and keep on parsing to find further
syntax errors.

Let's trace the parser state for input 11+1, which will error out after shifting 1.
After shifting, we have the following item stack (growing downwards and omitting
transitive closure items):

  State 0: %start_parseExp -> . Exp
  State 5: Exp -> '1' .

(Stack as a list of state numbers: [5,0].)
As Note [Error recovery] describes, we will first try Fixup mode.
That fails because no production can shift the `error` token.
Next we try Error resumption mode. This works as follows:

  1. Pop off the item stack until we find an item that can shift the `catch`
     token. (Implemented in `pop_items`.)
       * State 5 cannot shift catch. Pop.
       * State 0 can shift catch, which would transition into
          State 4: Exp -> catch .
     So record the *stack* `[4,0]` after doing the shift transition.
     We call this a *catch frame*, where the top is a *catch state*,
     corresponding to an item in which we just shifted a `catch` token.
     There can be multiple such catch stacks, see Note [Multiple catch frames].

  2. Discard tokens from the input until the lookahead can be shifted in one
     of the catch stacks. (Implemented in `discard_input_until_exp` and
     `some_catch_state_shifts`.)
       * We cannot shift the current lookahead '1' in state 4, so we discard
       * We *can* shift the next lookahead '+' in state 4, but only after
         reducing, which pops State 4 and goes to State 3:
           State 3: %start_parseExp -> Exp .
                    Exp -> Exp . '+' Exp
         Here we can shift '+'.
     As you can see, to implement this machinery we need to simulate
     the operation of the LALR automaton, especially reduction
     (`happySimulateReduce`).

Note [Multiple catch frames]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For fewer spurious error messages, it can be beneficial to trace multiple catch
items. Consider

Exp : '1'
    | catch
    | Exp '+' Exp %shift
    | '(' Exp ')'

Let's trace the parser state for input (;+1, which will error out after shifting (.
After shifting, we have the following item stack (growing downwards):

  State 0: %start_parseExp -> . Exp
  State 6: Exp -> '(' . Exp ')'

Upon error, we want to find items in the stack which can shift a catch token.
Note that both State 0 and State 6 can shift a catch token, transitioning into
  State 4: Exp -> catch .
Hence we record the catch frames `[4,6,0]` and `[4,0]` for possible resumption.

Which catch frame do we pick for resumption?
Note that resuming catch frame `[4,0]` will parse as "catch+1", whereas
resuming the innermost frame `[4,6,0]` corresponds to parsing "(catch+1".
The latter would keep discarding input until the closing ')' is found.
So we will discard + and 1, leading to a spurious syntax error at the end of
input, aborting the parse and never producing a partial syntax tree. Bad!

It is far preferable to resume with catch frame `[4,0]`, where we can resume
successfully on input +, so that is what we do.

In general, we pick the catch frame for resumption that discards the least
amount of input for a successful shift, preferring the topmost such catch frame.
-}

-- happyFail :: Happy_Int -> Token -> Happy_Int -> _
-- This function triggers Note [Error recovery].
-- If the current token is ERROR_TOK, phase (1) has failed and we might try
-- phase (2).
happyFail :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyFail ERROR_TOK = happyFixupFailed
happyFail Int#
i         = Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyTryFixup Int#
i

-- Enter Error Fixup (see Note [Error recovery]):
-- generate an error token, save the old token and carry on.
-- When a `happyShift` accepts the error token, we will pop off the error token
-- to resume parsing with the current lookahead `i`.
happyTryFixup :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyTryFixup Int#
i (AlexPosn, Token)
tk Int#
action Happy_IntList
sts HappyStk HappyAbsSyn
stk =
  DEBUG_TRACE("entering `error` fixup.\n")
  Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyDoAction ERROR_TOK tk action sts (MK_ERROR_TOKEN(i) `HappyStk` stk)
  -- NB: `happyShift` will simply pop the error token and carry on with
  --     `tk`. Hence we don't change `tk` in the call here

-- See Note [Error recovery], phase (2).
-- Enter resumption mode after reporting the error by calling `happyResume`.
happyFixupFailed :: (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyFixupFailed (AlexPosn, Token)
tk Int#
st Happy_IntList
sts (HappyAbsSyn
x `HappyStk` HappyStk HappyAbsSyn
stk) =
  let i :: Int#
i = GET_ERROR_TOKEN(x) in
  DEBUG_TRACE("`error` fixup failed.\n")
  let resume :: [(AlexPosn, Token)] -> Either ParseError HappyAbsSyn
resume   = Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyResume Int#
i (AlexPosn, Token)
tk Int#
st Happy_IntList
sts HappyStk HappyAbsSyn
stk
      expected :: [String]
expected = Int# -> Happy_IntList -> [String]
happyExpectedTokens Int#
st Happy_IntList
sts in
  Int#
-> (AlexPosn, Token)
-> [String]
-> ([(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall {a}.
Int#
-> (AlexPosn, Token)
-> [String]
-> ([(AlexPosn, Token)] -> Either ParseError a)
-> [(AlexPosn, Token)]
-> Either ParseError a
happyReport Int#
i (AlexPosn, Token)
tk [String]
expected [(AlexPosn, Token)] -> Either ParseError HappyAbsSyn
resume

-- happyResume :: Happy_Int -> Token -> Happy_Int -> _
-- See Note [happyResume]
happyResume :: Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyResume Int#
i (AlexPosn, Token)
tk Int#
st Happy_IntList
sts HappyStk HappyAbsSyn
stk = [(Happy_IntList, HappyStk HappyAbsSyn)]
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
pop_items [] Int#
st Happy_IntList
sts HappyStk HappyAbsSyn
stk
  where
    !(Happy_GHC_Exts.I# Int#
n_starts) = Int
happy_n_starts   -- this is to test whether we have a start token
    !(Happy_GHC_Exts.I# Int#
eof_i) = Int
happy_n_terms Int -> Int -> Int
forall a. Num a => a -> a -> a
Happy_Prelude.- Int
1   -- this is the token number of the EOF token
    happy_list_to_list :: Happy_IntList -> [Happy_Prelude.Int]
    happy_list_to_list :: Happy_IntList -> [Int]
happy_list_to_list (HappyCons Int#
st Happy_IntList
sts)
      | LT(st, n_starts)
      = [(Int# -> Int
Happy_GHC_Exts.I# Int#
st)]
      | Bool
Happy_Prelude.otherwise
      = (Int# -> Int
Happy_GHC_Exts.I# Int#
st) Int -> [Int] -> [Int]
forall a. a -> [a] -> [a]
: Happy_IntList -> [Int]
happy_list_to_list Happy_IntList
sts

    -- See (1) of Note [happyResume]
    pop_items :: [(Happy_IntList, HappyStk HappyAbsSyn)]
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
pop_items [(Happy_IntList, HappyStk HappyAbsSyn)]
catch_frames Int#
st Happy_IntList
sts HappyStk HappyAbsSyn
stk
      | LT(st, n_starts)
      = DEBUG_TRACE("reached start state " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# st) Happy_Prelude.++ ", ")
        if [(Happy_IntList, HappyStk HappyAbsSyn)] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Happy_Prelude.null [(Happy_IntList, HappyStk HappyAbsSyn)]
catch_frames_new
          then DEBUG_TRACE("no resumption.\n")
               [(AlexPosn, Token)] -> Either ParseError HappyAbsSyn
forall a. [(AlexPosn, Token)] -> Either ParseError a
happyAbort
          else DEBUG_TRACE("now discard input, trying to anchor in states " Happy_Prelude.++ Happy_Prelude.show (Happy_Prelude.map (happy_list_to_list . Happy_Prelude.fst) (Happy_Prelude.reverse catch_frames_new)) Happy_Prelude.++ ".\n")
               Int#
-> (AlexPosn, Token)
-> [(Happy_IntList, HappyStk HappyAbsSyn)]
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
discard_input_until_exp Int#
i (AlexPosn, Token)
tk ([(Happy_IntList, HappyStk HappyAbsSyn)]
-> [(Happy_IntList, HappyStk HappyAbsSyn)]
forall a. [a] -> [a]
Happy_Prelude.reverse [(Happy_IntList, HappyStk HappyAbsSyn)]
catch_frames_new)
      | (HappyCons Int#
st1 Happy_IntList
sts1) <- Happy_IntList
sts, HappyAbsSyn
_ `HappyStk` HappyStk HappyAbsSyn
stk1 <- HappyStk HappyAbsSyn
stk
      = [(Happy_IntList, HappyStk HappyAbsSyn)]
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
pop_items [(Happy_IntList, HappyStk HappyAbsSyn)]
catch_frames_new Int#
st1 Happy_IntList
sts1 HappyStk HappyAbsSyn
stk1
      where
        !catch_frames_new :: [(Happy_IntList, HappyStk HappyAbsSyn)]
catch_frames_new
          | HappyShift Int#
new_state <- Int# -> HappyAction
happyDecodeAction (Int# -> Int# -> Int#
happyNextAction CATCH_TOK st)
          , DEBUG_TRACE("can shift catch token in state " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# st) Happy_Prelude.++ ", into state " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# new_state) Happy_Prelude.++ "\n")
            [(Happy_IntList, HappyStk HappyAbsSyn)] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Happy_Prelude.null (((Happy_IntList, HappyStk HappyAbsSyn) -> Bool)
-> [(Happy_IntList, HappyStk HappyAbsSyn)]
-> [(Happy_IntList, HappyStk HappyAbsSyn)]
forall a. (a -> Bool) -> [a] -> [a]
Happy_Prelude.filter (\(HappyCons Int#
_ (HappyCons Int#
h Happy_IntList
_),HappyStk HappyAbsSyn
_) -> EQ(st,h)) catch_frames)
          = (Int# -> Happy_IntList -> Happy_IntList
HappyCons Int#
new_state (Int# -> Happy_IntList -> Happy_IntList
HappyCons Int#
st Happy_IntList
sts), MK_ERROR_TOKEN(i) `HappyStk` stk):catch_frames -- MK_ERROR_TOKEN(i) is just some dummy that should not be accessed by user code
          | Bool
Happy_Prelude.otherwise
          = DEBUG_TRACE("already shifted or can't shift catch in " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# st) Happy_Prelude.++ "\n")
            [(Happy_IntList, HappyStk HappyAbsSyn)]
catch_frames

    -- See (2) of Note [happyResume]
    discard_input_until_exp :: Int#
-> (AlexPosn, Token)
-> [(Happy_IntList, HappyStk HappyAbsSyn)]
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
discard_input_until_exp Int#
i (AlexPosn, Token)
tk [(Happy_IntList, HappyStk HappyAbsSyn)]
catch_frames
      | Happy_Prelude.Just (HappyCons Int#
st (HappyCons Int#
catch_st Happy_IntList
sts), HappyStk HappyAbsSyn
catch_frame) <- Int#
-> [(Happy_IntList, HappyStk HappyAbsSyn)]
-> Maybe (Happy_IntList, HappyStk HappyAbsSyn)
forall {b}.
Int# -> [(Happy_IntList, b)] -> Maybe (Happy_IntList, b)
some_catch_state_shifts Int#
i [(Happy_IntList, HappyStk HappyAbsSyn)]
catch_frames
      = DEBUG_TRACE("found expected token in state " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# st) Happy_Prelude.++ " after shifting from " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# catch_st) Happy_Prelude.++ ": " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# i) Happy_Prelude.++ "\n")
        Int#
-> (AlexPosn, Token)
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
happyDoAction Int#
i (AlexPosn, Token)
tk Int#
st (Int# -> Happy_IntList -> Happy_IntList
HappyCons Int#
catch_st Happy_IntList
sts) HappyStk HappyAbsSyn
catch_frame
      | EQ(i,eof_i) -- is i EOF?
      = DEBUG_TRACE("reached EOF, cannot resume. abort parse :(\n")
        [(AlexPosn, Token)] -> Either ParseError HappyAbsSyn
forall a. [(AlexPosn, Token)] -> Either ParseError a
happyAbort
      | Bool
Happy_Prelude.otherwise
      = DEBUG_TRACE("discard token " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# i) Happy_Prelude.++ "\n")
        ((AlexPosn, Token)
 -> [(AlexPosn, Token)] -> Either ParseError HappyAbsSyn)
-> (Int#
    -> (AlexPosn, Token)
    -> [(AlexPosn, Token)]
    -> Either ParseError HappyAbsSyn)
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
forall {t} {a} {t} {a}.
(t -> [a] -> t)
-> (Int# -> (a, Token) -> [(a, Token)] -> t) -> [(a, Token)] -> t
happyLex (\(AlexPosn, Token)
eof_tk -> Int#
-> (AlexPosn, Token)
-> [(Happy_IntList, HappyStk HappyAbsSyn)]
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
discard_input_until_exp Int#
eof_i (AlexPosn, Token)
eof_tk [(Happy_IntList, HappyStk HappyAbsSyn)]
catch_frames) -- eof
                 (\Int#
i (AlexPosn, Token)
tk   -> Int#
-> (AlexPosn, Token)
-> [(Happy_IntList, HappyStk HappyAbsSyn)]
-> [(AlexPosn, Token)]
-> Either ParseError HappyAbsSyn
discard_input_until_exp Int#
i (AlexPosn, Token)
tk [(Happy_IntList, HappyStk HappyAbsSyn)]
catch_frames)         -- not eof

    some_catch_state_shifts :: Int# -> [(Happy_IntList, b)] -> Maybe (Happy_IntList, b)
some_catch_state_shifts Int#
_ [] = DEBUG_TRACE("no catch state could shift.\n") Happy_Prelude.Nothing
    some_catch_state_shifts Int#
i catch_frames :: [(Happy_IntList, b)]
catch_frames@(((HappyCons Int#
st Happy_IntList
sts),b
_):[(Happy_IntList, b)]
_) = Int#
-> Int#
-> Happy_IntList
-> [(Happy_IntList, b)]
-> Maybe (Happy_IntList, b)
try_head Int#
i Int#
st Happy_IntList
sts [(Happy_IntList, b)]
catch_frames
      where
        try_head :: Int#
-> Int#
-> Happy_IntList
-> [(Happy_IntList, b)]
-> Maybe (Happy_IntList, b)
try_head Int#
i Int#
st Happy_IntList
sts [(Happy_IntList, b)]
catch_frames = -- PRECONDITION: head catch_frames = (HappyCons st sts)
          DEBUG_TRACE("trying token " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# i) Happy_Prelude.++ " in state " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# st) Happy_Prelude.++ ": ")
          case Int# -> HappyAction
happyDecodeAction (Int# -> Int# -> Int#
happyNextAction Int#
i Int#
st) of
            HappyAction
HappyFail     -> DEBUG_TRACE("fail.\n")   some_catch_state_shifts i (Happy_Prelude.tail catch_frames)
            HappyAction
HappyAccept   -> DEBUG_TRACE("accept.\n") Happy_Prelude.Just (Happy_Prelude.head catch_frames)
            HappyShift Int#
_  -> DEBUG_TRACE("shift.\n")  Happy_Prelude.Just (Happy_Prelude.head catch_frames)
            HappyReduce Int#
r -> case Int# -> Int# -> Happy_IntList -> Happy_IntList
happySimulateReduce Int#
r Int#
st Happy_IntList
sts of
              (HappyCons Int#
st1 Happy_IntList
sts1) -> Int#
-> Int#
-> Happy_IntList
-> [(Happy_IntList, b)]
-> Maybe (Happy_IntList, b)
try_head Int#
i Int#
st1 Happy_IntList
sts1 [(Happy_IntList, b)]
catch_frames

happySimulateReduce :: Int# -> Int# -> Happy_IntList -> Happy_IntList
happySimulateReduce Int#
r Int#
st Happy_IntList
sts =
  DEBUG_TRACE("simulate reduction of rule " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# r) Happy_Prelude.++ ", ")
  let (# Int#
nt, Int#
len #) = Int# -> (# Int#, Int# #)
happyIndexRuleArr Int#
r in
  DEBUG_TRACE("nt " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# nt) Happy_Prelude.++ ", len: " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# len) Happy_Prelude.++ ", new_st ")
  let !(sts1 :: Happy_IntList
sts1@(HappyCons Int#
st1 Happy_IntList
_)) = Int# -> Happy_IntList -> Happy_IntList
happyDrop Int#
len (Int# -> Happy_IntList -> Happy_IntList
HappyCons Int#
st Happy_IntList
sts)
      new_st :: Int#
new_st = Int# -> Int# -> Int#
happyIndexGotoTable Int#
nt Int#
st1 in
  DEBUG_TRACE(Happy_Prelude.show (Happy_GHC_Exts.I# new_st) Happy_Prelude.++ ".\n")
  (Int# -> Happy_IntList -> Happy_IntList
HappyCons Int#
new_st Happy_IntList
sts1)

happyTokenToString :: Happy_Prelude.Int -> Happy_Prelude.String
happyTokenToString :: Int -> String
happyTokenToString Int
i = [String]
happyTokenStrings [String] -> Int -> String
forall a. HasCallStack => [a] -> Int -> a
Happy_Prelude.!! (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
Happy_Prelude.- Int
2) -- 2: errorTok, catchTok

happyExpectedTokens :: Happy_Int -> Happy_IntList -> [Happy_Prelude.String]
-- Upon a parse error, we want to suggest tokens that are expected in that
-- situation. This function computes such tokens.
-- It works by examining the top of the state stack.
-- For every token number that does a shift transition, record that token number.
-- For every token number that does a reduce transition, simulate that reduction
-- on the state state stack and repeat.
-- The recorded token numbers are then formatted with 'happyTokenToString' and
-- returned.
happyExpectedTokens :: Int# -> Happy_IntList -> [String]
happyExpectedTokens Int#
st Happy_IntList
sts =
  DEBUG_TRACE("constructing expected tokens.\n")
  (Int -> String) -> [Int] -> [String]
forall a b. (a -> b) -> [a] -> [b]
Happy_Prelude.map Int -> String
happyTokenToString (Int# -> Happy_IntList -> [Int] -> [Int]
search_shifts Int#
st Happy_IntList
sts [])
  where
    search_shifts :: Int# -> Happy_IntList -> [Int] -> [Int]
search_shifts Int#
st Happy_IntList
sts [Int]
shifts = ((Int, Int) -> [Int] -> [Int]) -> [Int] -> [(Int, Int)] -> [Int]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
Happy_Prelude.foldr (Int# -> Happy_IntList -> (Int, Int) -> [Int] -> [Int]
add_action Int#
st Happy_IntList
sts) [Int]
shifts (Int# -> [(Int, Int)]
distinct_actions Int#
st)
    add_action :: Int# -> Happy_IntList -> (Int, Int) -> [Int] -> [Int]
add_action Int#
st Happy_IntList
sts (Happy_GHC_Exts.I# Int#
i, Happy_GHC_Exts.I# Int#
act) [Int]
shifts =
      DEBUG_TRACE("found action in state " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# st) Happy_Prelude.++ ", input " Happy_Prelude.++ Happy_Prelude.show (Happy_GHC_Exts.I# i) Happy_Prelude.++ ", " Happy_Prelude.++ Happy_Prelude.show (happyDecodeAction act) Happy_Prelude.++ "\n")
      case Int# -> HappyAction
happyDecodeAction Int#
act of
        HappyAction
HappyFail     -> [Int]
shifts
        HappyAction
HappyAccept   -> [Int]
shifts -- This would always be %eof or error... Not helpful
        HappyShift Int#
_  -> Int -> [Int] -> [Int]
forall a. Ord a => a -> [a] -> [a]
Happy_Prelude.insert (Int# -> Int
Happy_GHC_Exts.I# Int#
i) [Int]
shifts
        HappyReduce Int#
r -> case Int# -> Int# -> Happy_IntList -> Happy_IntList
happySimulateReduce Int#
r Int#
st Happy_IntList
sts of
          (HappyCons Int#
st1 Happy_IntList
sts1) -> Int# -> Happy_IntList -> [Int] -> [Int]
search_shifts Int#
st1 Happy_IntList
sts1 [Int]
shifts
    distinct_actions :: Int# -> [(Int, Int)]
distinct_actions Int#
st
      -- The (token number, action) pairs of all actions in the given state
      = ((-Int
1), (Int# -> Int
Happy_GHC_Exts.I# (HappyAddr -> Int# -> Int#
happyIndexOffAddr HappyAddr
happyDefActions Int#
st)))
      (Int, Int) -> [(Int, Int)] -> [(Int, Int)]
forall a. a -> [a] -> [a]
: [ (Int
i, Int
act) | Int
i <- [Int
begin_i..Int
happy_n_terms], Int
act <- Int# -> Int -> [Int]
get_act Int#
row_off Int
i ]
      where
        row_off :: Int#
row_off = HappyAddr -> Int# -> Int#
happyIndexOffAddr HappyAddr
happyActOffsets Int#
st
        begin_i :: Int
begin_i = Int
2 -- +2: errorTok,catchTok
    get_act :: Int# -> Int -> [Int]
get_act Int#
off (Happy_GHC_Exts.I# Int#
i) -- happyIndexActionTable with cached row offset
      | let off_i :: Int#
off_i = PLUS(off,i)
      , GTE(off_i,0#)
      , EQ(happyIndexOffAddr happyCheck off_i,i)
      = [(Int# -> Int
Happy_GHC_Exts.I# (HappyAddr -> Int# -> Int#
happyIndexOffAddr HappyAddr
happyTable Int#
off_i))]
      | Bool
Happy_Prelude.otherwise
      = []

-- Internal happy errors:

notHappyAtAll :: a
notHappyAtAll :: forall a. a
notHappyAtAll = String -> a
forall a. HasCallStack => String -> a
Happy_Prelude.error String
"Internal Happy parser panic. This is not supposed to happen! Please open a bug report at https://github.com/haskell/happy/issues.\n"

-----------------------------------------------------------------------------
-- Hack to get the typechecker to accept our action functions

happyTcHack :: Happy_Int -> a -> a
happyTcHack :: forall a. Int# -> a -> a
happyTcHack Int#
x a
y = a
y
{-# INLINE happyTcHack #-}

-----------------------------------------------------------------------------
-- Seq-ing.  If the --strict flag is given, then Happy emits
--      happySeq = happyDoSeq
-- otherwise it emits
--      happySeq = happyDontSeq

happyDoSeq, happyDontSeq :: a -> b -> b
happyDoSeq :: forall a b. a -> b -> b
happyDoSeq   a
a b
b = a
a a -> b -> b
forall a b. a -> b -> b
`Happy_GHC_Exts.seq` b
b
happyDontSeq :: forall a b. a -> b -> b
happyDontSeq a
a b
b = b
b

-----------------------------------------------------------------------------
-- Don't inline any functions from the template.  GHC has a nasty habit
-- of deciding to inline happyGoto everywhere, which increases the size of
-- the generated parser quite a bit.

{-# NOINLINE happyDoAction #-}
{-# NOINLINE happyTable #-}
{-# NOINLINE happyCheck #-}
{-# NOINLINE happyActOffsets #-}
{-# NOINLINE happyGotoOffsets #-}
{-# NOINLINE happyDefActions #-}

{-# NOINLINE happyShift #-}
{-# NOINLINE happySpecReduce_0 #-}
{-# NOINLINE happySpecReduce_1 #-}
{-# NOINLINE happySpecReduce_2 #-}
{-# NOINLINE happySpecReduce_3 #-}
{-# NOINLINE happyReduce #-}
{-# NOINLINE happyMonadReduce #-}
{-# NOINLINE happyGoto #-}
{-# NOINLINE happyFail #-}

-- end of Happy Template.