{-# OPTIONS_GHC -w #-}
{-# OPTIONS -XMagicHash -XBangPatterns -XTypeSynonymInstances -XFlexibleInstances -cpp #-}
#if __GLASGOW_HASKELL__ >= 710
{-# OPTIONS_GHC -XPartialTypeSignatures #-}
#endif
-- -*- Mode: Haskell -*-
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}

module Camfort.Specification.DerivedDataType.Parser
  ( ddtParser
  , DDTParseError
  , DDTStatement(..)
  ) where

import Camfort.Specification.Parser (mkParser, SpecParser)
import Control.DeepSeq
import Control.Monad.Except (throwError)
import Data.Binary (Binary)
import Data.Char (isLetter, isNumber, isAlphaNum, toLower)
import Data.Data (Data)
import GHC.Generics (Generic)
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 1.19.12

newtype HappyAbsSyn  = HappyAbsSyn HappyAny
#if __GLASGOW_HASKELL__ >= 607
type HappyAny = Happy_GHC_Exts.Any
#else
type HappyAny = forall a . a
#endif
newtype HappyWrap4 = HappyWrap4 (DDTStatement)
happyIn4 :: (DDTStatement) -> (HappyAbsSyn )
happyIn4 :: DDTStatement -> HappyAbsSyn
happyIn4 DDTStatement
x = HappyWrap4 -> HappyAbsSyn
Happy_GHC_Exts.unsafeCoerce# (DDTStatement -> HappyWrap4
HappyWrap4 DDTStatement
x)
{-# INLINE happyIn4 #-}
happyOut4 :: (HappyAbsSyn ) -> HappyWrap4
happyOut4 :: HappyAbsSyn -> HappyWrap4
happyOut4 HappyAbsSyn
x = HappyAbsSyn -> HappyWrap4
Happy_GHC_Exts.unsafeCoerce# HappyAbsSyn
x
{-# INLINE happyOut4 #-}
newtype HappyWrap5 = HappyWrap5 (Bool)
happyIn5 :: (Bool) -> (HappyAbsSyn )
happyIn5 :: Bool -> HappyAbsSyn
happyIn5 Bool
x = HappyWrap5 -> HappyAbsSyn
Happy_GHC_Exts.unsafeCoerce# (Bool -> HappyWrap5
HappyWrap5 Bool
x)
{-# INLINE happyIn5 #-}
happyOut5 :: (HappyAbsSyn ) -> HappyWrap5
happyOut5 :: HappyAbsSyn -> HappyWrap5
happyOut5 HappyAbsSyn
x = HappyAbsSyn -> HappyWrap5
Happy_GHC_Exts.unsafeCoerce# HappyAbsSyn
x
{-# INLINE happyOut5 #-}
newtype HappyWrap6 = HappyWrap6 ([(String, Int)])
happyIn6 :: ([(String, Int)]) -> (HappyAbsSyn )
happyIn6 :: [(String, Int)] -> HappyAbsSyn
happyIn6 [(String, Int)]
x = HappyWrap6 -> HappyAbsSyn
Happy_GHC_Exts.unsafeCoerce# ([(String, Int)] -> HappyWrap6
HappyWrap6 [(String, Int)]
x)
{-# INLINE happyIn6 #-}
happyOut6 :: (HappyAbsSyn ) -> HappyWrap6
happyOut6 :: HappyAbsSyn -> HappyWrap6
happyOut6 HappyAbsSyn
x = HappyAbsSyn -> HappyWrap6
Happy_GHC_Exts.unsafeCoerce# HappyAbsSyn
x
{-# INLINE happyOut6 #-}
newtype HappyWrap7 = HappyWrap7 ((String, Int))
happyIn7 :: ((String, Int)) -> (HappyAbsSyn )
happyIn7 :: (String, Int) -> HappyAbsSyn
happyIn7 (String, Int)
x = HappyWrap7 -> HappyAbsSyn
Happy_GHC_Exts.unsafeCoerce# ((String, Int) -> HappyWrap7
HappyWrap7 (String, Int)
x)
{-# INLINE happyIn7 #-}
happyOut7 :: (HappyAbsSyn ) -> HappyWrap7
happyOut7 :: HappyAbsSyn -> HappyWrap7
happyOut7 HappyAbsSyn
x = HappyAbsSyn -> HappyWrap7
Happy_GHC_Exts.unsafeCoerce# HappyAbsSyn
x
{-# INLINE happyOut7 #-}
newtype HappyWrap8 = HappyWrap8 ([(String, String)])
happyIn8 :: ([(String, String)]) -> (HappyAbsSyn )
happyIn8 :: [(String, String)] -> HappyAbsSyn
happyIn8 [(String, String)]
x = HappyWrap8 -> HappyAbsSyn
Happy_GHC_Exts.unsafeCoerce# ([(String, String)] -> HappyWrap8
HappyWrap8 [(String, String)]
x)
{-# INLINE happyIn8 #-}
happyOut8 :: (HappyAbsSyn ) -> HappyWrap8
happyOut8 :: HappyAbsSyn -> HappyWrap8
happyOut8 HappyAbsSyn
x = HappyAbsSyn -> HappyWrap8
Happy_GHC_Exts.unsafeCoerce# HappyAbsSyn
x
{-# INLINE happyOut8 #-}
newtype HappyWrap9 = HappyWrap9 ((String, String))
happyIn9 :: ((String, String)) -> (HappyAbsSyn )
happyIn9 :: (String, String) -> HappyAbsSyn
happyIn9 (String, String)
x = HappyWrap9 -> HappyAbsSyn
Happy_GHC_Exts.unsafeCoerce# ((String, String) -> HappyWrap9
HappyWrap9 (String, String)
x)
{-# INLINE happyIn9 #-}
happyOut9 :: (HappyAbsSyn ) -> HappyWrap9
happyOut9 :: HappyAbsSyn -> HappyWrap9
happyOut9 HappyAbsSyn
x = HappyAbsSyn -> HappyWrap9
Happy_GHC_Exts.unsafeCoerce# HappyAbsSyn
x
{-# INLINE happyOut9 #-}
happyInTok :: (Token) -> (HappyAbsSyn )
happyInTok :: Token -> HappyAbsSyn
happyInTok Token
x = Token -> HappyAbsSyn
Happy_GHC_Exts.unsafeCoerce# Token
x
{-# INLINE happyInTok #-}
happyOutTok :: (HappyAbsSyn ) -> (Token)
happyOutTok :: HappyAbsSyn -> Token
happyOutTok HappyAbsSyn
x = HappyAbsSyn -> Token
Happy_GHC_Exts.unsafeCoerce# HappyAbsSyn
x
{-# INLINE happyOutTok #-}


happyExpList :: HappyAddr
happyExpList :: HappyAddr
happyExpList = Addr# -> HappyAddr
HappyA# Addr#
"\x00\x02\x00\x40\x00\x00\x00\x20\x00\x00\x00\x80\x00\x00\x00\x00\x00\x80\x00\x80\x00\x00\x00\x04\x00\x04\x00\x00\x04\x00\x04\x00\x00\x01\x00\x80\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x01\x40\x00\x00\x10\x00\x00\x00\x00\x00\x04\x00\x10\x00\x00\x80\x00\x00\x00\x00\x00\x00"#

{-# NOINLINE happyExpListPerState #-}
happyExpListPerState :: Int -> [String]
happyExpListPerState Int
st =
    [String]
token_strs_expected
  where token_strs :: [String]
token_strs = [String
"error",String
"%dummy",String
"%start_parseDDT",String
"DDT",String
"OPTSTAR",String
"VARDIMS",String
"VARDIM",String
"LABELS",String
"LABEL",String
"ddt",String
"dim",String
"id",String
"num",String
"','",String
"'::'",String
"'='",String
"'=>'",String
"'('",String
"')'",String
"'*'",String
"%eof"]
        bit_start :: Int
bit_start = Int
st Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
21
        bit_end :: Int
bit_end = (Int
st Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
21
        read_bit :: Int -> Bool
read_bit = HappyAddr -> Int -> Bool
readArrayBit HappyAddr
happyExpList
        bits :: [Bool]
bits = (Int -> Bool) -> [Int] -> [Bool]
forall a b. (a -> b) -> [a] -> [b]
map Int -> Bool
read_bit [Int
bit_start..Int
bit_end Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]
        bits_indexed :: [(Bool, Int)]
bits_indexed = [Bool] -> [Int] -> [(Bool, Int)]
forall a b. [a] -> [b] -> [(a, b)]
zip [Bool]
bits [Int
0..Int
20]
        token_strs_expected :: [String]
token_strs_expected = ((Bool, Int) -> [String]) -> [(Bool, Int)] -> [String]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Bool, Int) -> [String]
f [(Bool, Int)]
bits_indexed
        f :: (Bool, Int) -> [String]
f (Bool
False, Int
_) = []
        f (Bool
True, Int
nr) = [[String]
token_strs [String] -> Int -> String
forall a. [a] -> Int -> a
!! Int
nr]

happyActOffsets :: HappyAddr
happyActOffsets :: HappyAddr
happyActOffsets = Addr# -> HappyAddr
HappyA# Addr#
"\x08\x00\x08\x00\x01\x00\xfe\xff\x0a\x00\x00\x00\x02\x00\x0b\x00\x04\x00\x0c\x00\x0d\x00\x0f\x00\x10\x00\x11\x00\x13\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x07\x00\x16\x00\x17\x00\x00\x00\x12\x00\x18\x00\x14\x00\x00\x00\x00\x00"#

happyGotoOffsets :: HappyAddr
happyGotoOffsets :: HappyAddr
happyGotoOffsets = Addr# -> HappyAddr
HappyA# Addr#
"\x1b\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfd\xff\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#

happyAdjustOffset :: Happy_GHC_Exts.Int# -> Happy_GHC_Exts.Int#
happyAdjustOffset :: Int# -> Int#
happyAdjustOffset Int#
off = Int#
off

happyDefActions :: HappyAddr
happyDefActions :: HappyAddr
happyDefActions = Addr# -> HappyAddr
HappyA# Addr#
"\x00\x00\x00\x00\xfc\xff\x00\x00\x00\x00\xfd\xff\x00\x00\x00\x00\x00\x00\xf7\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\xff\xf6\xff\xfe\xff\xfa\xff\x00\x00\x00\x00\x00\x00\xfb\xff\x00\x00\x00\x00\x00\x00\xf9\xff"#

happyCheck :: HappyAddr
happyCheck :: HappyAddr
happyCheck = Addr# -> HappyAddr
HappyA# Addr#
"\xff\xff\x04\x00\x05\x00\x04\x00\x05\x00\x02\x00\x03\x00\x02\x00\x03\x00\x01\x00\x0c\x00\x09\x00\x0b\x00\x03\x00\x0a\x00\x04\x00\x09\x00\x05\x00\x03\x00\x05\x00\x04\x00\x08\x00\x03\x00\x06\x00\x02\x00\x07\x00\x03\x00\x00\x00\x04\x00\x01\x00\x0a\x00\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\x08\x00\x09\x00\x0f\x00\x09\x00\x11\x00\x12\x00\x16\x00\x12\x00\x03\x00\xff\xff\x08\x00\x06\x00\x07\x00\x0e\x00\x0b\x00\x15\x00\x0d\x00\x11\x00\x16\x00\x0b\x00\x0c\x00\x14\x00\x0f\x00\x18\x00\x19\x00\x14\x00\x03\x00\x1a\x00\x04\x00\x1b\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#
   -> Token
   -> Int#
   -> Happy_IntList
   -> HappyStk HappyAbsSyn
   -> [Token]
   -> DDTSpecParser HappyAbsSyn)
happyReduceArr = (Int, Int)
-> [(Int,
     Int#
     -> Token
     -> Int#
     -> Happy_IntList
     -> HappyStk HappyAbsSyn
     -> [Token]
     -> DDTSpecParser HappyAbsSyn)]
-> Array
     Int
     (Int#
      -> Token
      -> Int#
      -> Happy_IntList
      -> HappyStk HappyAbsSyn
      -> [Token]
      -> DDTSpecParser HappyAbsSyn)
forall i e. Ix i => (i, i) -> [(i, e)] -> Array i e
Happy_Data_Array.array (Int
1, Int
9) [
	(Int
1 , Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_1),
	(Int
2 , Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_2),
	(Int
3 , Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_3),
	(Int
4 , Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_4),
	(Int
5 , Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_5),
	(Int
6 , Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_6),
	(Int
7 , Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_7),
	(Int
8 , Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_8),
	(Int
9 , Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_9)
	]

happy_n_terms :: Int
happy_n_terms = Int
13 :: Int
happy_n_nonterms :: Int
happy_n_nonterms = Int
6 :: Int

happyReduce_1 :: Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_1 = Int#
-> Int#
-> (HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn)
-> Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce Int#
8# Int#
0# HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
happyReduction_1
happyReduction_1 :: HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
happyReduction_1 (HappyAbsSyn
happy_x_8 `HappyStk`
	HappyAbsSyn
happy_x_7 `HappyStk`
	HappyAbsSyn
happy_x_6 `HappyStk`
	HappyAbsSyn
happy_x_5 `HappyStk`
	HappyAbsSyn
happy_x_4 `HappyStk`
	HappyAbsSyn
happy_x_3 `HappyStk`
	HappyAbsSyn
happy_x_2 `HappyStk`
	HappyAbsSyn
happy_x_1 `HappyStk`
	HappyStk HappyAbsSyn
happyRest)
	 = case HappyAbsSyn -> HappyWrap5
happyOut5 HappyAbsSyn
happy_x_2 of { (HappyWrap5 Bool
happy_var_2) -> 
	case HappyAbsSyn -> Token
happyOutTok HappyAbsSyn
happy_x_3 of { (TId String
happy_var_3) -> 
	case HappyAbsSyn -> HappyWrap8
happyOut8 HappyAbsSyn
happy_x_5 of { (HappyWrap8 [(String, String)]
happy_var_5) -> 
	case HappyAbsSyn -> HappyWrap6
happyOut6 HappyAbsSyn
happy_x_8 of { (HappyWrap6 [(String, Int)]
happy_var_8) -> 
	DDTStatement -> HappyAbsSyn
happyIn4
		 (Bool
-> String -> [(String, String)] -> [(String, Int)] -> DDTStatement
DDTSt Bool
happy_var_2 String
happy_var_3 [(String, String)]
happy_var_5 [(String, Int)]
happy_var_8
	) HappyAbsSyn -> HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
forall a. a -> HappyStk a -> HappyStk a
`HappyStk` HappyStk HappyAbsSyn
happyRest}}}}

happyReduce_2 :: Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_2 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happySpecReduce_1  Int#
1# HappyAbsSyn -> HappyAbsSyn
forall p. p -> HappyAbsSyn
happyReduction_2
happyReduction_2 :: p -> HappyAbsSyn
happyReduction_2 p
happy_x_1
	 =  Bool -> HappyAbsSyn
happyIn5
		 (Bool
True
	)

happyReduce_3 :: Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_3 = Int#
-> HappyAbsSyn
-> Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happySpecReduce_0  Int#
1# HappyAbsSyn
happyReduction_3
happyReduction_3 :: HappyAbsSyn
happyReduction_3  =  Bool -> HappyAbsSyn
happyIn5
		 (Bool
False
	)

happyReduce_4 :: Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_4 = Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happySpecReduce_3  Int#
2# HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
forall p. HappyAbsSyn -> p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_4
happyReduction_4 :: HappyAbsSyn -> p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_4 HappyAbsSyn
happy_x_3
	p
happy_x_2
	HappyAbsSyn
happy_x_1
	 =  case HappyAbsSyn -> HappyWrap7
happyOut7 HappyAbsSyn
happy_x_1 of { (HappyWrap7 (String, Int)
happy_var_1) -> 
	case HappyAbsSyn -> HappyWrap6
happyOut6 HappyAbsSyn
happy_x_3 of { (HappyWrap6 [(String, Int)]
happy_var_3) -> 
	[(String, Int)] -> HappyAbsSyn
happyIn6
		 ((String, Int)
happy_var_1 (String, Int) -> [(String, Int)] -> [(String, Int)]
forall k1. k1 -> [k1] -> [k1]
: [(String, Int)]
happy_var_3
	)}}

happyReduce_5 :: Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_5 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happySpecReduce_1  Int#
2# HappyAbsSyn -> HappyAbsSyn
happyReduction_5
happyReduction_5 :: HappyAbsSyn -> HappyAbsSyn
happyReduction_5 HappyAbsSyn
happy_x_1
	 =  case HappyAbsSyn -> HappyWrap7
happyOut7 HappyAbsSyn
happy_x_1 of { (HappyWrap7 (String, Int)
happy_var_1) -> 
	[(String, Int)] -> HappyAbsSyn
happyIn6
		 ([(String, Int)
happy_var_1]
	)}

happyReduce_6 :: Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_6 = Int#
-> Int#
-> (HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn)
-> Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce Int#
6# Int#
3# HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
happyReduction_6
happyReduction_6 :: HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
happyReduction_6 (HappyAbsSyn
happy_x_6 `HappyStk`
	HappyAbsSyn
happy_x_5 `HappyStk`
	HappyAbsSyn
happy_x_4 `HappyStk`
	HappyAbsSyn
happy_x_3 `HappyStk`
	HappyAbsSyn
happy_x_2 `HappyStk`
	HappyAbsSyn
happy_x_1 `HappyStk`
	HappyStk HappyAbsSyn
happyRest)
	 = case HappyAbsSyn -> Token
happyOutTok HappyAbsSyn
happy_x_1 of { (TId String
happy_var_1) -> 
	case HappyAbsSyn -> Token
happyOutTok HappyAbsSyn
happy_x_5 of { (TNum String
happy_var_5) -> 
	(String, Int) -> HappyAbsSyn
happyIn7
		 ((String
happy_var_1, String -> Int
forall a. Read a => String -> a
read String
happy_var_5)
	) HappyAbsSyn -> HappyStk HappyAbsSyn -> HappyStk HappyAbsSyn
forall a. a -> HappyStk a -> HappyStk a
`HappyStk` HappyStk HappyAbsSyn
happyRest}}

happyReduce_7 :: Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_7 = Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happySpecReduce_3  Int#
4# HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
forall p. HappyAbsSyn -> p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_7
happyReduction_7 :: HappyAbsSyn -> p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_7 HappyAbsSyn
happy_x_3
	p
happy_x_2
	HappyAbsSyn
happy_x_1
	 =  case HappyAbsSyn -> HappyWrap9
happyOut9 HappyAbsSyn
happy_x_1 of { (HappyWrap9 (String, String)
happy_var_1) -> 
	case HappyAbsSyn -> HappyWrap8
happyOut8 HappyAbsSyn
happy_x_3 of { (HappyWrap8 [(String, String)]
happy_var_3) -> 
	[(String, String)] -> HappyAbsSyn
happyIn8
		 ((String, String)
happy_var_1 (String, String) -> [(String, String)] -> [(String, String)]
forall k1. k1 -> [k1] -> [k1]
: [(String, String)]
happy_var_3
	)}}

happyReduce_8 :: Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_8 = Int#
-> (HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happySpecReduce_1  Int#
4# HappyAbsSyn -> HappyAbsSyn
happyReduction_8
happyReduction_8 :: HappyAbsSyn -> HappyAbsSyn
happyReduction_8 HappyAbsSyn
happy_x_1
	 =  case HappyAbsSyn -> HappyWrap9
happyOut9 HappyAbsSyn
happy_x_1 of { (HappyWrap9 (String, String)
happy_var_1) -> 
	[(String, String)] -> HappyAbsSyn
happyIn8
		 ([(String, String)
happy_var_1]
	)}

happyReduce_9 :: Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyReduce_9 = Int#
-> (HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn)
-> Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happySpecReduce_3  Int#
5# HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn -> HappyAbsSyn
forall p. HappyAbsSyn -> p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_9
happyReduction_9 :: HappyAbsSyn -> p -> HappyAbsSyn -> HappyAbsSyn
happyReduction_9 HappyAbsSyn
happy_x_3
	p
happy_x_2
	HappyAbsSyn
happy_x_1
	 =  case HappyAbsSyn -> Token
happyOutTok HappyAbsSyn
happy_x_1 of { (TNum String
happy_var_1) -> 
	case HappyAbsSyn -> Token
happyOutTok HappyAbsSyn
happy_x_3 of { (TId String
happy_var_3) -> 
	(String, String) -> HappyAbsSyn
happyIn9
		 ((String
happy_var_1, String
happy_var_3)
	)}}

happyNewToken :: Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyNewToken Int#
action Happy_IntList
sts HappyStk HappyAbsSyn
stk [] =
	Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyDoAction Int#
12# Token
forall a. a
notHappyAtAll Int#
action Happy_IntList
sts HappyStk HappyAbsSyn
stk []

happyNewToken Int#
action Happy_IntList
sts HappyStk HappyAbsSyn
stk (Token
tk:[Token]
tks) =
	let cont :: Int# -> DDTSpecParser HappyAbsSyn
cont Int#
i = Int#
-> Token
-> Int#
-> Happy_IntList
-> HappyStk HappyAbsSyn
-> [Token]
-> DDTSpecParser HappyAbsSyn
happyDoAction Int#
i Token
tk Int#
action Happy_IntList
sts HappyStk HappyAbsSyn
stk [Token]
tks in
	case Token
tk of {
	TId String
"ddt" -> Int# -> DDTSpecParser HappyAbsSyn
cont Int#
1#;
	TId String
"dim" -> Int# -> DDTSpecParser HappyAbsSyn
cont Int#
2#;
	TId String
happy_dollar_dollar -> Int# -> DDTSpecParser HappyAbsSyn
cont Int#
3#;
	TNum String
happy_dollar_dollar -> Int# -> DDTSpecParser HappyAbsSyn
cont Int#
4#;
	Token
TComma -> Int# -> DDTSpecParser HappyAbsSyn
cont Int#
5#;
	Token
TDoubleColon -> Int# -> DDTSpecParser HappyAbsSyn
cont Int#
6#;
	Token
TEqual -> Int# -> DDTSpecParser HappyAbsSyn
cont Int#
7#;
	Token
TArrow -> Int# -> DDTSpecParser HappyAbsSyn
cont Int#
8#;
	Token
TLeftPar -> Int# -> DDTSpecParser HappyAbsSyn
cont Int#
9#;
	Token
TRightPar -> Int# -> DDTSpecParser HappyAbsSyn
cont Int#
10#;
	Token
TStar -> Int# -> DDTSpecParser HappyAbsSyn
cont Int#
11#;
	Token
_ -> ([Token], [String]) -> DDTSpecParser HappyAbsSyn
forall a. ([Token], [String]) -> DDTSpecParser a
happyError' ((Token
tkToken -> [Token] -> [Token]
forall k1. k1 -> [k1] -> [k1]
:[Token]
tks), [])
	}

happyError_ :: [String] -> Int# -> Token -> [Token] -> DDTSpecParser a
happyError_ [String]
explist Int#
12# Token
tk [Token]
tks = ([Token], [String]) -> DDTSpecParser a
forall a. ([Token], [String]) -> DDTSpecParser a
happyError' ([Token]
tks, [String]
explist)
happyError_ [String]
explist Int#
_ Token
tk [Token]
tks = ([Token], [String]) -> DDTSpecParser a
forall a. ([Token], [String]) -> DDTSpecParser a
happyError' ((Token
tkToken -> [Token] -> [Token]
forall k1. k1 -> [k1] -> [k1]
:[Token]
tks), [String]
explist)

happyThen :: () => DDTSpecParser a -> (a -> DDTSpecParser b) -> DDTSpecParser b
happyThen :: DDTSpecParser a -> (a -> DDTSpecParser b) -> DDTSpecParser b
happyThen = DDTSpecParser a -> (a -> DDTSpecParser b) -> DDTSpecParser b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
(>>=)
happyReturn :: () => a -> DDTSpecParser a
happyReturn :: a -> DDTSpecParser a
happyReturn = (a -> DDTSpecParser a
forall (m :: * -> *) a. Monad m => a -> m a
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 (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
(>>=) m t
m (\t
a -> t -> t -> m b
k t
a t
tks)
happyReturn1 :: () => a -> b -> DDTSpecParser a
happyReturn1 :: a -> b -> DDTSpecParser a
happyReturn1 = \a
a b
tks -> (a -> DDTSpecParser a
forall (m :: * -> *) a. Monad m => a -> m a
return) a
a
happyError' :: () => ([(Token)], [String]) -> DDTSpecParser a
happyError' :: ([Token], [String]) -> DDTSpecParser a
happyError' = (\([Token]
tokens, [String]
_) -> [Token] -> DDTSpecParser a
forall a. [Token] -> DDTSpecParser a
happyError [Token]
tokens)
parseDDT :: [Token] -> DDTSpecParser DDTStatement
parseDDT [Token]
tks = DDTSpecParser DDTStatement
happySomeParser where
 happySomeParser :: DDTSpecParser DDTStatement
happySomeParser = DDTSpecParser HappyAbsSyn
-> (HappyAbsSyn -> DDTSpecParser DDTStatement)
-> DDTSpecParser DDTStatement
forall a b.
DDTSpecParser a -> (a -> DDTSpecParser b) -> DDTSpecParser b
happyThen (Int# -> [Token] -> DDTSpecParser HappyAbsSyn
happyParse Int#
0# [Token]
tks) (\HappyAbsSyn
x -> DDTStatement -> DDTSpecParser DDTStatement
forall a. a -> DDTSpecParser a
happyReturn (let {(HappyWrap4 DDTStatement
x') = HappyAbsSyn -> HappyWrap4
happyOut4 HappyAbsSyn
x} in DDTStatement
x'))

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


data DDTStatement
  = DDTSt { DDTStatement -> Bool
ddtStStarred  :: Bool
          , DDTStatement -> String
ddtStTypeName :: String
          , DDTStatement -> [(String, String)]
ddtStLabels   :: [(String, String)]
          , DDTStatement -> [(String, Int)]
ddtStVarDims  :: [(String, Int)] }
  deriving (Typeable DDTStatement
DataType
Constr
Typeable DDTStatement
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> DDTStatement -> c DDTStatement)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c DDTStatement)
-> (DDTStatement -> Constr)
-> (DDTStatement -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c DDTStatement))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c DDTStatement))
-> ((forall b. Data b => b -> b) -> DDTStatement -> DDTStatement)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> DDTStatement -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> DDTStatement -> r)
-> (forall u. (forall d. Data d => d -> u) -> DDTStatement -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> DDTStatement -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> DDTStatement -> m DDTStatement)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DDTStatement -> m DDTStatement)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> DDTStatement -> m DDTStatement)
-> Data DDTStatement
DDTStatement -> DataType
DDTStatement -> Constr
(forall b. Data b => b -> b) -> DDTStatement -> DDTStatement
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DDTStatement -> c DDTStatement
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DDTStatement
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> DDTStatement -> u
forall u. (forall d. Data d => d -> u) -> DDTStatement -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DDTStatement -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DDTStatement -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DDTStatement -> m DDTStatement
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DDTStatement -> m DDTStatement
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DDTStatement
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DDTStatement -> c DDTStatement
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DDTStatement)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DDTStatement)
$cDDTSt :: Constr
$tDDTStatement :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> DDTStatement -> m DDTStatement
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DDTStatement -> m DDTStatement
gmapMp :: (forall d. Data d => d -> m d) -> DDTStatement -> m DDTStatement
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DDTStatement -> m DDTStatement
gmapM :: (forall d. Data d => d -> m d) -> DDTStatement -> m DDTStatement
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DDTStatement -> m DDTStatement
gmapQi :: Int -> (forall d. Data d => d -> u) -> DDTStatement -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DDTStatement -> u
gmapQ :: (forall d. Data d => d -> u) -> DDTStatement -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DDTStatement -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DDTStatement -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DDTStatement -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DDTStatement -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DDTStatement -> r
gmapT :: (forall b. Data b => b -> b) -> DDTStatement -> DDTStatement
$cgmapT :: (forall b. Data b => b -> b) -> DDTStatement -> DDTStatement
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DDTStatement)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DDTStatement)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c DDTStatement)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DDTStatement)
dataTypeOf :: DDTStatement -> DataType
$cdataTypeOf :: DDTStatement -> DataType
toConstr :: DDTStatement -> Constr
$ctoConstr :: DDTStatement -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DDTStatement
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DDTStatement
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DDTStatement -> c DDTStatement
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DDTStatement -> c DDTStatement
$cp1Data :: Typeable DDTStatement
Data, DDTStatement -> DDTStatement -> Bool
(DDTStatement -> DDTStatement -> Bool)
-> (DDTStatement -> DDTStatement -> Bool) -> Eq DDTStatement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DDTStatement -> DDTStatement -> Bool
$c/= :: DDTStatement -> DDTStatement -> Bool
== :: DDTStatement -> DDTStatement -> Bool
$c== :: DDTStatement -> DDTStatement -> Bool
Eq, Int -> DDTStatement -> ShowS
[DDTStatement] -> ShowS
DDTStatement -> String
(Int -> DDTStatement -> ShowS)
-> (DDTStatement -> String)
-> ([DDTStatement] -> ShowS)
-> Show DDTStatement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DDTStatement] -> ShowS
$cshowList :: [DDTStatement] -> ShowS
show :: DDTStatement -> String
$cshow :: DDTStatement -> String
showsPrec :: Int -> DDTStatement -> ShowS
$cshowsPrec :: Int -> DDTStatement -> ShowS
Show, (forall x. DDTStatement -> Rep DDTStatement x)
-> (forall x. Rep DDTStatement x -> DDTStatement)
-> Generic DDTStatement
forall x. Rep DDTStatement x -> DDTStatement
forall x. DDTStatement -> Rep DDTStatement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DDTStatement x -> DDTStatement
$cfrom :: forall x. DDTStatement -> Rep DDTStatement x
Generic)
instance NFData DDTStatement
instance Binary DDTStatement

data DDTParseError
  -- | Not a valid identifier character.
  = NotAnIdentifier Char
  -- | Tokens do not represent a syntactically valid specification.
  | CouldNotParseSpecification [Token]
  deriving (DDTParseError -> DDTParseError -> Bool
(DDTParseError -> DDTParseError -> Bool)
-> (DDTParseError -> DDTParseError -> Bool) -> Eq DDTParseError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DDTParseError -> DDTParseError -> Bool
$c/= :: DDTParseError -> DDTParseError -> Bool
== :: DDTParseError -> DDTParseError -> Bool
$c== :: DDTParseError -> DDTParseError -> Bool
Eq)

instance Show DDTParseError where
  show :: DDTParseError -> String
show (CouldNotParseSpecification [Token]
ts) =
    String
"Could not parse specification at: \"" String -> ShowS
forall a. [a] -> [a] -> [a]
++ [Token] -> String
forall a. Show a => a -> String
show [Token]
ts String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"\"\n"
  show (NotAnIdentifier Char
c) = String
"Invalid character in identifier: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Char -> String
forall a. Show a => a -> String
show Char
c

notAnIdentifier :: Char -> DDTParseError
notAnIdentifier :: Char -> DDTParseError
notAnIdentifier = Char -> DDTParseError
NotAnIdentifier

couldNotParseSpecification :: [Token] -> DDTParseError
couldNotParseSpecification :: [Token] -> DDTParseError
couldNotParseSpecification = [Token] -> DDTParseError
CouldNotParseSpecification

type DDTSpecParser a = Either DDTParseError a

data Token =
   TComma
 | TDoubleColon
 | TArrow
 | TEqual
 | TStar
 | TLeftPar
 | TRightPar
 | TId String
 | TNum String
 deriving (Int -> Token -> ShowS
[Token] -> ShowS
Token -> String
(Int -> Token -> ShowS)
-> (Token -> String) -> ([Token] -> ShowS) -> Show Token
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Token] -> ShowS
$cshowList :: [Token] -> ShowS
show :: Token -> String
$cshow :: Token -> String
showsPrec :: Int -> Token -> ShowS
$cshowsPrec :: Int -> Token -> ShowS
Show, Token -> Token -> Bool
(Token -> Token -> Bool) -> (Token -> Token -> Bool) -> Eq Token
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Token -> Token -> Bool
$c/= :: Token -> Token -> Bool
== :: Token -> Token -> Bool
$c== :: Token -> Token -> Bool
Eq)

addToTokens :: Token -> String -> DDTSpecParser [ Token ]
addToTokens :: Token -> String -> DDTSpecParser [Token]
addToTokens Token
tok String
rest = do
 [Token]
tokens <- String -> DDTSpecParser [Token]
lexer String
rest
 [Token] -> DDTSpecParser [Token]
forall (m :: * -> *) a. Monad m => a -> m a
return ([Token] -> DDTSpecParser [Token])
-> [Token] -> DDTSpecParser [Token]
forall a b. (a -> b) -> a -> b
$ Token
tok Token -> [Token] -> [Token]
forall k1. k1 -> [k1] -> [k1]
: [Token]
tokens

lexer :: String -> DDTSpecParser [ Token ]
lexer :: String -> DDTSpecParser [Token]
lexer [] = [Token] -> DDTSpecParser [Token]
forall a b. b -> Either a b
Right []
lexer [Char
'\n']  = [Token] -> DDTSpecParser [Token]
forall a b. b -> Either a b
Right []
lexer [Char
'\r', Char
'\n']  = [Token] -> DDTSpecParser [Token]
forall a b. b -> Either a b
Right []
lexer [Char
'\r']  = [Token] -> DDTSpecParser [Token]
forall a b. b -> Either a b
Right [] -- windows
lexer (Char
' ':String
xs) = String -> DDTSpecParser [Token]
lexer String
xs
lexer (Char
'\t':String
xs) = String -> DDTSpecParser [Token]
lexer String
xs
lexer (Char
':':Char
':':String
xs) = Token -> String -> DDTSpecParser [Token]
addToTokens Token
TDoubleColon String
xs
lexer (Char
'=':Char
'>':String
xs) = Token -> String -> DDTSpecParser [Token]
addToTokens Token
TArrow String
xs
lexer (Char
',':String
xs) = Token -> String -> DDTSpecParser [Token]
addToTokens Token
TComma String
xs
lexer (Char
'=':String
xs) = Token -> String -> DDTSpecParser [Token]
addToTokens Token
TEqual String
xs
lexer (Char
'*':String
xs) = Token -> String -> DDTSpecParser [Token]
addToTokens Token
TStar String
xs
lexer (Char
'(':String
xs) = Token -> String -> DDTSpecParser [Token]
addToTokens Token
TLeftPar String
xs
lexer (Char
')':String
xs) = Token -> String -> DDTSpecParser [Token]
addToTokens Token
TRightPar String
xs
lexer (Char
x:String
xs)
 | Char -> Bool
isLetter Char
x Bool -> Bool -> Bool
|| Char
x Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'\'' = (Char -> Bool) -> (String -> Token) -> DDTSpecParser [Token]
aux (\ Char
c -> Char -> Bool
isAlphaNum Char
c Bool -> Bool -> Bool
|| Char
c Char -> String -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Char
'\'',Char
'_',Char
'-'])
                                 String -> Token
TId
 | Char -> Bool
isNumber Char
x              = (Char -> Bool) -> (String -> Token) -> DDTSpecParser [Token]
aux Char -> Bool
isNumber String -> Token
TNum
 | Bool
otherwise
     = DDTParseError -> DDTSpecParser [Token]
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (DDTParseError -> DDTSpecParser [Token])
-> DDTParseError -> DDTSpecParser [Token]
forall a b. (a -> b) -> a -> b
$ Char -> DDTParseError
notAnIdentifier Char
x
 where
   aux :: (Char -> Bool) -> (String -> Token) -> DDTSpecParser [Token]
aux Char -> Bool
p String -> Token
cons =
     let (String
target, String
rest) = (Char -> Bool) -> String -> (String, String)
forall a. (a -> Bool) -> [a] -> ([a], [a])
span Char -> Bool
p String
xs
     in String -> DDTSpecParser [Token]
lexer String
rest DDTSpecParser [Token]
-> ([Token] -> DDTSpecParser [Token]) -> DDTSpecParser [Token]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (\[Token]
tokens -> [Token] -> DDTSpecParser [Token]
forall (m :: * -> *) a. Monad m => a -> m a
return ([Token] -> DDTSpecParser [Token])
-> [Token] -> DDTSpecParser [Token]
forall a b. (a -> b) -> a -> b
$ String -> Token
cons (Char
xChar -> ShowS
forall k1. k1 -> [k1] -> [k1]
:String
target) Token -> [Token] -> [Token]
forall k1. k1 -> [k1] -> [k1]
: [Token]
tokens)

ddtParser :: SpecParser DDTParseError DDTStatement
ddtParser :: SpecParser DDTParseError DDTStatement
ddtParser = (String -> DDTSpecParser DDTStatement)
-> [String] -> SpecParser DDTParseError DDTStatement
forall e r. (String -> Either e r) -> [String] -> SpecParser e r
mkParser (\String
src -> do
                          [Token]
tokens <- String -> DDTSpecParser [Token]
lexer (String -> DDTSpecParser [Token])
-> String -> DDTSpecParser [Token]
forall a b. (a -> b) -> a -> b
$ (Char -> Char) -> ShowS
forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
toLower String
src
                          [Token] -> DDTSpecParser DDTStatement
parseDDT [Token]
tokens) [String
"ddt"]

happyError :: [ Token ] -> DDTSpecParser a
happyError :: [Token] -> DDTSpecParser a
happyError = DDTParseError -> DDTSpecParser a
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (DDTParseError -> DDTSpecParser a)
-> ([Token] -> DDTParseError) -> [Token] -> DDTSpecParser a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Token] -> DDTParseError
couldNotParseSpecification
{-# LINE 1 "templates/GenericTemplate.hs" #-}
-- $Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp $













-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.
#if __GLASGOW_HASKELL__ > 706
#define LT(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.<# m)) :: Bool)
#define GTE(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.>=# m)) :: Bool)
#define EQ(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.==# m)) :: Bool)
#else
#define LT(n,m) (n Happy_GHC_Exts.<# m)
#define GTE(n,m) (n Happy_GHC_Exts.>=# m)
#define EQ(n,m) (n Happy_GHC_Exts.==# m)
#endif



















data Happy_IntList = HappyCons Happy_GHC_Exts.Int# Happy_IntList








































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

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

happyParse start_state = happyNewToken start_state notHappyAtAll 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 0# tk st sts (_ `HappyStk` ans `HappyStk` _) =
        happyReturn1 ans
happyAccept j tk st sts (HappyStk ans _) = 
        (happyTcHack j (happyTcHack st)) (happyReturn1 ans)

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



happyDoAction i tk st
        = {- nothing -}
          case action of
                0#           -> {- nothing -}
                                     happyFail (happyExpListPerState ((Happy_GHC_Exts.I# (st)) :: Int)) i tk st
                -1#          -> {- nothing -}
                                     happyAccept i tk st
                n | LT(n,(0# :: Happy_GHC_Exts.Int#)) -> {- nothing -}
                                                   (happyReduceArr Happy_Data_Array.! rule) i tk st
                                                   where rule = (Happy_GHC_Exts.I# ((Happy_GHC_Exts.negateInt# ((n Happy_GHC_Exts.+# (1# :: Happy_GHC_Exts.Int#))))))
                n                 -> {- nothing -}
                                     happyShift new_state i tk st
                                     where new_state = (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#))
   where off    = happyAdjustOffset (indexShortOffAddr happyActOffsets st)
         off_i  = (off Happy_GHC_Exts.+# i)
         check  = if GTE(off_i,(0# :: Happy_GHC_Exts.Int#))
                  then EQ(indexShortOffAddr happyCheck off_i, i)
                  else False
         action
          | check     = indexShortOffAddr happyTable off_i
          | otherwise = indexShortOffAddr happyDefActions st




indexShortOffAddr (HappyA# arr) off =
        Happy_GHC_Exts.narrow16Int# i
  where
        i = Happy_GHC_Exts.word2Int# (Happy_GHC_Exts.or# (Happy_GHC_Exts.uncheckedShiftL# high 8#) low)
        high = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr (off' Happy_GHC_Exts.+# 1#)))
        low  = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr off'))
        off' = off Happy_GHC_Exts.*# 2#




{-# INLINE happyLt #-}
happyLt x y = LT(x,y)


readArrayBit arr bit =
    Bits.testBit (Happy_GHC_Exts.I# (indexShortOffAddr arr ((unbox_int bit) `Happy_GHC_Exts.iShiftRA#` 4#))) (bit `mod` 16)
  where unbox_int (Happy_GHC_Exts.I# x) = x






data HappyAddr = HappyA# Happy_GHC_Exts.Addr#


-----------------------------------------------------------------------------
-- HappyState data type (not arrays)













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

happyShift new_state 0# tk st sts stk@(x `HappyStk` _) =
     let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in
--     trace "shifting the error token" $
     happyDoAction i tk new_state (HappyCons (st) (sts)) (stk)

happyShift new_state i tk st sts stk =
     happyNewToken new_state (HappyCons (st) (sts)) ((happyInTok (tk))`HappyStk`stk)

-- happyReduce is specialised for the common cases.

happySpecReduce_0 i fn 0# tk st sts stk
     = happyFail [] 0# tk st sts stk
happySpecReduce_0 nt fn j tk st@((action)) sts stk
     = happyGoto nt j tk st (HappyCons (st) (sts)) (fn `HappyStk` stk)

happySpecReduce_1 i fn 0# tk st sts stk
     = happyFail [] 0# tk st sts stk
happySpecReduce_1 nt fn j tk _ sts@((HappyCons (st@(action)) (_))) (v1`HappyStk`stk')
     = let r = fn v1 in
       happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))

happySpecReduce_2 i fn 0# tk st sts stk
     = happyFail [] 0# tk st sts stk
happySpecReduce_2 nt fn j tk _ (HappyCons (_) (sts@((HappyCons (st@(action)) (_))))) (v1`HappyStk`v2`HappyStk`stk')
     = let r = fn v1 v2 in
       happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))

happySpecReduce_3 i fn 0# tk st sts stk
     = happyFail [] 0# tk st sts stk
happySpecReduce_3 nt fn j tk _ (HappyCons (_) ((HappyCons (_) (sts@((HappyCons (st@(action)) (_))))))) (v1`HappyStk`v2`HappyStk`v3`HappyStk`stk')
     = let r = fn v1 v2 v3 in
       happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))

happyReduce k i fn 0# tk st sts stk
     = happyFail [] 0# tk st sts stk
happyReduce k nt fn j tk st sts stk
     = case happyDrop (k Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) sts of
         sts1@((HappyCons (st1@(action)) (_))) ->
                let r = fn stk in  -- it doesn't hurt to always seq here...
                happyDoSeq r (happyGoto nt j tk st1 sts1 r)

happyMonadReduce k nt fn 0# tk st sts stk
     = happyFail [] 0# tk st sts stk
happyMonadReduce k nt fn j tk st sts stk =
      case happyDrop k (HappyCons (st) (sts)) of
        sts1@((HappyCons (st1@(action)) (_))) ->
          let drop_stk = happyDropStk k stk in
          happyThen1 (fn stk tk) (\r -> happyGoto nt j tk st1 sts1 (r `HappyStk` drop_stk))

happyMonad2Reduce k nt fn 0# tk st sts stk
     = happyFail [] 0# tk st sts stk
happyMonad2Reduce k nt fn j tk st sts stk =
      case happyDrop k (HappyCons (st) (sts)) of
        sts1@((HappyCons (st1@(action)) (_))) ->
         let drop_stk = happyDropStk k stk

             off = happyAdjustOffset (indexShortOffAddr happyGotoOffsets st1)
             off_i = (off Happy_GHC_Exts.+# nt)
             new_state = indexShortOffAddr happyTable off_i




          in
          happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk))

happyDrop 0# l = l
happyDrop n (HappyCons (_) (t)) = happyDrop (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) t

happyDropStk 0# l = l
happyDropStk n (x `HappyStk` xs) = happyDropStk (n Happy_GHC_Exts.-# (1#::Happy_GHC_Exts.Int#)) xs

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


happyGoto nt j tk st = 
   {- nothing -}
   happyDoAction j tk new_state
   where off = happyAdjustOffset (indexShortOffAddr happyGotoOffsets st)
         off_i = (off Happy_GHC_Exts.+# nt)
         new_state = indexShortOffAddr happyTable off_i




-----------------------------------------------------------------------------
-- Error recovery (ERROR_TOK is the error token)

-- parse error if we are in recovery and we fail again
happyFail explist 0# tk old_st _ stk@(x `HappyStk` _) =
     let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in
--      trace "failing" $ 
        happyError_ explist i tk

{-  We don't need state discarding for our restricted implementation of
    "error".  In fact, it can cause some bogus parses, so I've disabled it
    for now --SDM

-- discard a state
happyFail  ERROR_TOK tk old_st CONS(HAPPYSTATE(action),sts) 
                                                (saved_tok `HappyStk` _ `HappyStk` stk) =
--      trace ("discarding state, depth " ++ show (length stk))  $
        DO_ACTION(action,ERROR_TOK,tk,sts,(saved_tok`HappyStk`stk))
-}

-- Enter error recovery: generate an error token,
--                       save the old token and carry on.
happyFail explist i tk (action) sts stk =
--      trace "entering error recovery" $
        happyDoAction 0# tk action sts ((Happy_GHC_Exts.unsafeCoerce# (Happy_GHC_Exts.I# (i))) `HappyStk` stk)

-- Internal happy errors:

notHappyAtAll :: a
notHappyAtAll = error "Internal Happy error\n"

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


happyTcHack :: Happy_GHC_Exts.Int# -> a -> a
happyTcHack x y = 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   a b = a `seq` b
happyDontSeq a 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.