alex-meta 0.2.0.2 → 0.3.0.2
raw patch · 26 files changed
+3547/−2077 lines, 26 filesdep +QuickCheckdep ~haskell-src-metadep ~template-haskellsetup-changed
Dependencies added: QuickCheck
Dependency ranges changed: haskell-src-meta, template-haskell
Files
- LICENSE +30/−30
- Setup.hs +2/−2
- alex-meta.cabal +53/−45
- dist/build/Parser.hs +1124/−1125
- dist/build/Scan.hs +407/−408
- src/AbsSyn.hs +7/−2
- src/CharSet.hs +128/−16
- src/DFA.hs +12/−14
- src/DFAMin.hs +150/−0
- src/Data/Ranged.hs +9/−0
- src/Data/Ranged/Boundaries.hs +229/−0
- src/Data/Ranged/RangedSet.hs +486/−0
- src/Data/Ranged/Ranges.hs +360/−0
- src/Info.hs +3/−3
- src/Map.hs +1/−0
- src/NFA.hs +64/−20
- src/Output.hs +12/−15
- src/ParseMonad.hs +21/−8
- src/Parser.y +0/−1
- src/Scan.x +4/−5
- src/Set.hs +1/−0
- src/Text/Alex.hs +12/−9
- src/Text/Alex/AlexTemplate.hs +358/−347
- src/Text/Alex/Quote.hs +32/−27
- src/Text/Alex/Verbatim.hs +6/−0
- src/UTF8.hs +36/−0
LICENSE view
@@ -1,30 +1,30 @@-Copyright (c)2010, Chis Dornan, Jonas Duregard, Simon Marlow - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of Jonas Duregard nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Copyright (c)2010, Chis Dornan, Jonas Duregard, Simon Marlow++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Jonas Duregard nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Setup.hs view
@@ -1,2 +1,2 @@-import Distribution.Simple -main = defaultMain +import Distribution.Simple+main = defaultMain
alex-meta.cabal view
@@ -1,46 +1,54 @@-Name: alex-meta -Version: 0.2.0.2 -Synopsis: Quasi-quoter for Alex lexers --- Description: -License: BSD3 -License-file: LICENSE -Author: Jonas Duregard -Maintainer: jonas.duregard@gmail.com -Category: Development -Build-type: Simple - -Cabal-version: >=1.2 - - -Library - hs-source-dirs: src . - - extensions: CPP - - Exposed-modules: - Text.Alex.Quote - - -- Packages needed in order to build this package. - Build-depends: - template-haskell >=2.4&&<2.7 - , haskell-src-meta >=0.3&&<1.0 - , base >= 4.2 && < 5 - , array, containers - - other-modules: - Text.Alex - Text.Alex.AlexTemplate - AbsSyn - CharSet - DFA - DFS - Info - Map - NFA - Output - Parser - ParseMonad - Scan - Set - Sort +Name: alex-meta+Version: 0.3.0.2+Synopsis: Quasi-quoter for Alex lexers+-- Description: +License: BSD3+License-file: LICENSE+Author: Jonas Duregard+Maintainer: jonas.duregard@gmail.com+Category: Development+Build-type: Simple++Cabal-version: >=1.2+++Library+ hs-source-dirs: src .++ extensions: CPP++ Exposed-modules: + Text.Alex.Quote+ Text.Alex.AlexTemplate+ + -- Packages needed in order to build this package.+ Build-depends:+ template-haskell >=2.5&&<2.7+ , haskell-src-meta >=0.5&&<1.0+ , base >= 4.2 && < 5+ , array, containers+ , QuickCheck >=2++ other-modules:+ Text.Alex+ Text.Alex.Verbatim+ AbsSyn+ CharSet+ DFA+ DFS+ Info+ Map+ NFA+ Output+ Parser+ ParseMonad+ Scan+ Set+ Sort Util+ UTF8+ DFAMin+ Data.Ranged+ Data.Ranged.Boundaries+ Data.Ranged.RangedSet+ Data.Ranged.Ranges
dist/build/Parser.hs view
@@ -1,1125 +1,1124 @@-{-# OPTIONS_GHC -w #-}-{-# OPTIONS -fglasgow-exts -cpp #-}--- -------------------------------------------------------------------------------- --- Parser.y, part of Alex------ (c) Simon Marlow 2003------ -------------------------------------------------------------------------------{-# OPTIONS_GHC -w #-}-{-# LANGUAGE BangPatterns #-}--module Parser ( parse, P ) where-import AbsSyn-import Scan-import CharSet-import ParseMonad hiding ( StartCode )--import Data.Char---import Debug.Trace-import qualified Data.Array as Happy_Data_Array-import qualified GHC.Exts as Happy_GHC_Exts---- parser produced by Happy Version 1.18.6--newtype HappyAbsSyn = HappyAbsSyn HappyAny-#if __GLASGOW_HASKELL__ >= 607-type HappyAny = Happy_GHC_Exts.Any-#else-type HappyAny = forall a . a-#endif-happyIn4 :: ((Maybe (AlexPosn,Code), [Directive], Scanner, Maybe (AlexPosn,Code))) -> (HappyAbsSyn )-happyIn4 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn4 #-}-happyOut4 :: (HappyAbsSyn ) -> ((Maybe (AlexPosn,Code), [Directive], Scanner, Maybe (AlexPosn,Code)))-happyOut4 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut4 #-}-happyIn5 :: (Maybe (AlexPosn,Code)) -> (HappyAbsSyn )-happyIn5 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn5 #-}-happyOut5 :: (HappyAbsSyn ) -> (Maybe (AlexPosn,Code))-happyOut5 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut5 #-}-happyIn6 :: ([Directive]) -> (HappyAbsSyn )-happyIn6 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn6 #-}-happyOut6 :: (HappyAbsSyn ) -> ([Directive])-happyOut6 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut6 #-}-happyIn7 :: (Directive) -> (HappyAbsSyn )-happyIn7 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn7 #-}-happyOut7 :: (HappyAbsSyn ) -> (Directive)-happyOut7 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut7 #-}-happyIn8 :: (()) -> (HappyAbsSyn )-happyIn8 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn8 #-}-happyOut8 :: (HappyAbsSyn ) -> (())-happyOut8 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut8 #-}-happyIn9 :: (()) -> (HappyAbsSyn )-happyIn9 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn9 #-}-happyOut9 :: (HappyAbsSyn ) -> (())-happyOut9 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut9 #-}-happyIn10 :: (Scanner) -> (HappyAbsSyn )-happyIn10 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn10 #-}-happyOut10 :: (HappyAbsSyn ) -> (Scanner)-happyOut10 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut10 #-}-happyIn11 :: ([RECtx]) -> (HappyAbsSyn )-happyIn11 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn11 #-}-happyOut11 :: (HappyAbsSyn ) -> ([RECtx])-happyOut11 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut11 #-}-happyIn12 :: ([RECtx]) -> (HappyAbsSyn )-happyIn12 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn12 #-}-happyOut12 :: (HappyAbsSyn ) -> ([RECtx])-happyOut12 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut12 #-}-happyIn13 :: (RECtx) -> (HappyAbsSyn )-happyIn13 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn13 #-}-happyOut13 :: (HappyAbsSyn ) -> (RECtx)-happyOut13 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut13 #-}-happyIn14 :: ([RECtx]) -> (HappyAbsSyn )-happyIn14 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn14 #-}-happyOut14 :: (HappyAbsSyn ) -> ([RECtx])-happyOut14 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut14 #-}-happyIn15 :: ([(String,StartCode)]) -> (HappyAbsSyn )-happyIn15 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn15 #-}-happyOut15 :: (HappyAbsSyn ) -> ([(String,StartCode)])-happyOut15 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut15 #-}-happyIn16 :: ([(String,StartCode)]) -> (HappyAbsSyn )-happyIn16 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn16 #-}-happyOut16 :: (HappyAbsSyn ) -> ([(String,StartCode)])-happyOut16 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut16 #-}-happyIn17 :: (String) -> (HappyAbsSyn )-happyIn17 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn17 #-}-happyOut17 :: (HappyAbsSyn ) -> (String)-happyOut17 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut17 #-}-happyIn18 :: (Maybe Code) -> (HappyAbsSyn )-happyIn18 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn18 #-}-happyOut18 :: (HappyAbsSyn ) -> (Maybe Code)-happyOut18 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut18 #-}-happyIn19 :: (Maybe CharSet, RExp, RightContext RExp) -> (HappyAbsSyn )-happyIn19 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn19 #-}-happyOut19 :: (HappyAbsSyn ) -> (Maybe CharSet, RExp, RightContext RExp)-happyOut19 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut19 #-}-happyIn20 :: (CharSet) -> (HappyAbsSyn )-happyIn20 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn20 #-}-happyOut20 :: (HappyAbsSyn ) -> (CharSet)-happyOut20 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut20 #-}-happyIn21 :: (RightContext RExp) -> (HappyAbsSyn )-happyIn21 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn21 #-}-happyOut21 :: (HappyAbsSyn ) -> (RightContext RExp)-happyOut21 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut21 #-}-happyIn22 :: (RExp) -> (HappyAbsSyn )-happyIn22 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn22 #-}-happyOut22 :: (HappyAbsSyn ) -> (RExp)-happyOut22 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut22 #-}-happyIn23 :: (RExp) -> (HappyAbsSyn )-happyIn23 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn23 #-}-happyOut23 :: (HappyAbsSyn ) -> (RExp)-happyOut23 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut23 #-}-happyIn24 :: (RExp) -> (HappyAbsSyn )-happyIn24 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn24 #-}-happyOut24 :: (HappyAbsSyn ) -> (RExp)-happyOut24 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut24 #-}-happyIn25 :: (RExp -> RExp) -> (HappyAbsSyn )-happyIn25 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn25 #-}-happyOut25 :: (HappyAbsSyn ) -> (RExp -> RExp)-happyOut25 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut25 #-}-happyIn26 :: (RExp) -> (HappyAbsSyn )-happyIn26 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn26 #-}-happyOut26 :: (HappyAbsSyn ) -> (RExp)-happyOut26 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut26 #-}-happyIn27 :: (CharSet) -> (HappyAbsSyn )-happyIn27 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn27 #-}-happyOut27 :: (HappyAbsSyn ) -> (CharSet)-happyOut27 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut27 #-}-happyIn28 :: (CharSet) -> (HappyAbsSyn )-happyIn28 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn28 #-}-happyOut28 :: (HappyAbsSyn ) -> (CharSet)-happyOut28 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut28 #-}-happyIn29 :: ([CharSet]) -> (HappyAbsSyn )-happyIn29 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn29 #-}-happyOut29 :: (HappyAbsSyn ) -> ([CharSet])-happyOut29 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut29 #-}-happyIn30 :: ((AlexPosn,String)) -> (HappyAbsSyn )-happyIn30 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyIn30 #-}-happyOut30 :: (HappyAbsSyn ) -> ((AlexPosn,String))-happyOut30 x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOut30 #-}-happyInTok :: (Token) -> (HappyAbsSyn )-happyInTok x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyInTok #-}-happyOutTok :: (HappyAbsSyn ) -> (Token)-happyOutTok x = Happy_GHC_Exts.unsafeCoerce# x-{-# INLINE happyOutTok #-}---happyActOffsets :: HappyAddr-happyActOffsets = HappyA# "\x72\x00\x72\x00\x66\x00\x00\x00\x52\x00\x51\x00\x60\x00\x67\x00\x00\x00\x00\x00\x63\x00\x51\x00\x7b\x00\x6d\x00\x00\x00\x5b\x00\x00\x00\x1a\x01\x6a\x00\x00\x00\x00\x00\x00\x00\x49\x00\x7b\x00\x80\x00\x00\x00\x64\x00\x00\x00\x00\x00\x62\x00\x00\x00\x4d\x00\x13\x00\x00\x00\x13\x00\x00\x00\x01\x00\xff\xff\x6d\x00\x02\x00\x10\x00\x1b\x00\x00\x00\x00\x00\x7b\x00\x48\x00\x73\x00\x59\x00\x7b\x00\x00\x00\x53\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x42\x00\x00\x00\x6d\x00\x00\x00\x15\x00\x00\x00\x47\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x50\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x25\x00\x00\x00\x25\x00\x3f\x00\x00\x00\x00\x00\x00\x00\x1b\x00\x00\x00\x00\x00\xf7\xff\x00\x00\x00\x00\x3c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#--happyGotoOffsets :: HappyAddr-happyGotoOffsets = HappyA# "\x69\x00\x39\x00\x5c\x00\x00\x00\x00\x00\x4b\x00\x4a\x00\x00\x00\x00\x00\x00\x00\x30\x00\x3a\x00\x11\x00\xfe\x00\x00\x00\x03\x01\x00\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf5\x00\x2b\x00\x07\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x21\x00\xaa\x00\x00\x00\x96\x00\x00\x00\xda\x00\xf6\xff\xec\x00\x22\x00\x00\x00\x20\x00\x00\x00\x00\x00\x23\x00\x00\x00\xc2\x00\x00\x00\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe3\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\xf3\xff\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\xce\x00\x00\x00\xbc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#--happyDefActions :: HappyAddr-happyDefActions = HappyA# "\xfc\xff\x00\x00\xfa\xff\xfd\xff\x00\x00\xf7\xff\xfa\xff\x00\x00\xf9\xff\xfb\xff\x00\x00\xf7\xff\x00\x00\x00\x00\xf5\xff\xdb\xff\xd9\xff\xd7\xff\xcd\xff\xca\xff\xc7\xff\xc1\xff\x00\x00\x00\x00\xc2\xff\xcf\xff\xc9\xff\xc0\xff\xce\xff\xf6\xff\xf8\xff\xfc\xff\xf2\xff\xf4\xff\xf2\xff\xef\xff\x00\x00\x00\x00\x00\x00\xdd\xff\xcd\xff\x00\x00\xe2\xff\xfe\xff\x00\x00\x00\x00\xc2\xff\x00\x00\xc2\xff\xc4\xff\x00\x00\xd0\xff\xd8\xff\xd6\xff\xd5\xff\xd4\xff\x00\x00\xda\xff\x00\x00\xdc\xff\x00\x00\xcc\xff\x00\x00\xc6\xff\xc3\xff\xc8\xff\xcb\xff\x00\x00\xe9\xff\xe8\xff\xe7\xff\xe1\xff\xe3\xff\xe0\xff\x00\x00\xdd\xff\xee\xff\xe5\xff\xe6\xff\xf1\xff\xec\xff\xf3\xff\xec\xff\x00\x00\xe4\xff\xdf\xff\xde\xff\x00\x00\xeb\xff\xc5\xff\x00\x00\xd3\xff\xd2\xff\x00\x00\xea\xff\xf0\xff\xed\xff\xd1\xff"#--happyCheck :: HappyAddr-happyCheck = HappyA# "\xff\xff\x02\x00\x01\x00\x0c\x00\x0e\x00\x12\x00\x13\x00\x14\x00\x06\x00\x16\x00\x17\x00\x18\x00\x0b\x00\x1a\x00\x0d\x00\x0c\x00\x0d\x00\x10\x00\x1b\x00\x12\x00\x01\x00\x14\x00\x03\x00\x15\x00\x17\x00\x1a\x00\x05\x00\x11\x00\x1b\x00\x1c\x00\x1d\x00\x0f\x00\x0d\x00\x0c\x00\x01\x00\x10\x00\x14\x00\x12\x00\x01\x00\x14\x00\x17\x00\x18\x00\x17\x00\x1a\x00\x0c\x00\x0d\x00\x1b\x00\x1c\x00\x1d\x00\x16\x00\x0d\x00\x11\x00\x19\x00\x10\x00\x06\x00\x12\x00\x01\x00\x14\x00\x01\x00\x18\x00\x17\x00\x1a\x00\x04\x00\x05\x00\x1b\x00\x1c\x00\x1d\x00\x18\x00\x0d\x00\x1a\x00\x15\x00\x10\x00\x0c\x00\x12\x00\x01\x00\x0c\x00\x02\x00\x03\x00\x17\x00\x04\x00\x05\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x05\x00\x0d\x00\x0e\x00\x04\x00\x10\x00\x13\x00\x12\x00\x01\x00\x1b\x00\x02\x00\x03\x00\x17\x00\x0e\x00\x07\x00\x1b\x00\x1b\x00\x1c\x00\x1d\x00\x1a\x00\x0d\x00\x00\x00\x01\x00\x10\x00\x13\x00\x12\x00\x01\x00\x1e\x00\x1f\x00\x0f\x00\x17\x00\x21\x00\x01\x00\x11\x00\x1b\x00\x1c\x00\x1d\x00\x0f\x00\x0d\x00\x18\x00\x01\x00\x10\x00\x17\x00\x12\x00\x20\x00\x01\x00\x0f\x00\x10\x00\x17\x00\x12\x00\x20\x00\xff\xff\x1b\x00\x1c\x00\x1d\x00\x10\x00\x1a\x00\x12\x00\x1b\x00\x1c\x00\x10\x00\xff\xff\x12\x00\xff\xff\x14\x00\xff\xff\x1b\x00\x1c\x00\xff\xff\xff\xff\xff\xff\x1b\x00\x1c\x00\x07\x00\x08\x00\x09\x00\xff\xff\x0b\x00\xff\xff\xff\xff\xff\xff\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x07\x00\x08\x00\x09\x00\xff\xff\x0b\x00\xff\xff\xff\xff\xff\xff\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x09\x00\x0a\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x09\x00\x0a\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\x09\x00\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\x14\x00\x1a\x00\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x08\x00\x09\x00\x0a\x00\x0b\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"#--happyTable :: HappyAddr-happyTable = HappyA# "\x00\x00\x4e\x00\x16\x00\x5d\x00\x4c\x00\x55\x00\x0f\x00\x10\x00\x4a\x00\x11\x00\x12\x00\x13\x00\x51\x00\x14\x00\x17\x00\x5e\x00\x44\x00\x18\x00\x5e\x00\x19\x00\x16\x00\x2b\x00\x2a\x00\x4b\x00\x1a\x00\x4f\x00\x5b\x00\x54\x00\x1b\x00\x1c\x00\x1d\x00\x2d\x00\x17\x00\x5c\x00\x2b\x00\x18\x00\x48\x00\x19\x00\x16\x00\x2b\x00\x1d\x00\x13\x00\x1a\x00\x14\x00\x43\x00\x44\x00\x1b\x00\x1c\x00\x1d\x00\x46\x00\x17\x00\x48\x00\x47\x00\x18\x00\x1f\x00\x19\x00\x16\x00\x2b\x00\x02\x00\x42\x00\x1a\x00\x14\x00\x1e\x00\x0b\x00\x1b\x00\x1c\x00\x1d\x00\x31\x00\x17\x00\x14\x00\x34\x00\x18\x00\x62\x00\x19\x00\x16\x00\x60\x00\x09\x00\x06\x00\x1a\x00\x0a\x00\x0b\x00\x57\x00\x1b\x00\x1c\x00\x1d\x00\x58\x00\x17\x00\x34\x00\x59\x00\x18\x00\x5a\x00\x19\x00\x16\x00\x3d\x00\x05\x00\x06\x00\x1a\x00\x3e\x00\x3b\x00\x42\x00\x1b\x00\x1c\x00\x1d\x00\x04\x00\x17\x00\x04\x00\x02\x00\x18\x00\x40\x00\x19\x00\x16\x00\x0d\x00\x0e\x00\x2d\x00\x1a\x00\xff\xff\x16\x00\x2e\x00\x1b\x00\x1c\x00\x1d\x00\x2d\x00\x17\x00\x21\x00\x16\x00\x18\x00\x09\x00\x19\x00\x08\x00\x16\x00\x2d\x00\x18\x00\x1a\x00\x19\x00\x08\x00\x00\x00\x1b\x00\x1c\x00\x1d\x00\x18\x00\x04\x00\x19\x00\x1b\x00\x1c\x00\x18\x00\x00\x00\x19\x00\x00\x00\x31\x00\x00\x00\x1b\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x1b\x00\x1c\x00\x51\x00\x22\x00\x23\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x21\x00\x22\x00\x23\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x52\x00\x60\x00\x2e\x00\x13\x00\x3e\x00\x14\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x52\x00\x53\x00\x2e\x00\x13\x00\x40\x00\x14\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x4f\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x3b\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x4b\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x32\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x0e\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x39\x00\x14\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x2e\x00\x13\x00\x2f\x00\x14\x00\x36\x00\x37\x00\x38\x00\x39\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 = Happy_Data_Array.array (1, 63) [- (1 , happyReduce_1),- (2 , happyReduce_2),- (3 , happyReduce_3),- (4 , happyReduce_4),- (5 , happyReduce_5),- (6 , happyReduce_6),- (7 , happyReduce_7),- (8 , happyReduce_8),- (9 , happyReduce_9),- (10 , happyReduce_10),- (11 , happyReduce_11),- (12 , happyReduce_12),- (13 , happyReduce_13),- (14 , happyReduce_14),- (15 , happyReduce_15),- (16 , happyReduce_16),- (17 , happyReduce_17),- (18 , happyReduce_18),- (19 , happyReduce_19),- (20 , happyReduce_20),- (21 , happyReduce_21),- (22 , happyReduce_22),- (23 , happyReduce_23),- (24 , happyReduce_24),- (25 , happyReduce_25),- (26 , happyReduce_26),- (27 , happyReduce_27),- (28 , happyReduce_28),- (29 , happyReduce_29),- (30 , happyReduce_30),- (31 , happyReduce_31),- (32 , happyReduce_32),- (33 , happyReduce_33),- (34 , happyReduce_34),- (35 , happyReduce_35),- (36 , happyReduce_36),- (37 , happyReduce_37),- (38 , happyReduce_38),- (39 , happyReduce_39),- (40 , happyReduce_40),- (41 , happyReduce_41),- (42 , happyReduce_42),- (43 , happyReduce_43),- (44 , happyReduce_44),- (45 , happyReduce_45),- (46 , happyReduce_46),- (47 , happyReduce_47),- (48 , happyReduce_48),- (49 , happyReduce_49),- (50 , happyReduce_50),- (51 , happyReduce_51),- (52 , happyReduce_52),- (53 , happyReduce_53),- (54 , happyReduce_54),- (55 , happyReduce_55),- (56 , happyReduce_56),- (57 , happyReduce_57),- (58 , happyReduce_58),- (59 , happyReduce_59),- (60 , happyReduce_60),- (61 , happyReduce_61),- (62 , happyReduce_62),- (63 , happyReduce_63)- ]--happy_n_terms = 34 :: Int-happy_n_nonterms = 27 :: Int--happyReduce_1 = happyReduce 5# 0# happyReduction_1-happyReduction_1 (happy_x_5 `HappyStk`- happy_x_4 `HappyStk`- happy_x_3 `HappyStk`- happy_x_2 `HappyStk`- happy_x_1 `HappyStk`- happyRest)- = case happyOut5 happy_x_1 of { happy_var_1 -> - case happyOut6 happy_x_2 of { happy_var_2 -> - case happyOut10 happy_x_4 of { happy_var_4 -> - case happyOut5 happy_x_5 of { happy_var_5 -> - happyIn4- ((happy_var_1,happy_var_2,happy_var_4,happy_var_5)- ) `HappyStk` happyRest}}}}--happyReduce_2 = happySpecReduce_1 1# happyReduction_2-happyReduction_2 happy_x_1- = case happyOutTok happy_x_1 of { happy_var_1 -> - happyIn5- (case happy_var_1 of T pos (CodeT code) -> - Just (pos,code)- )}--happyReduce_3 = happySpecReduce_0 1# happyReduction_3-happyReduction_3 = happyIn5- (Nothing- )--happyReduce_4 = happySpecReduce_2 2# happyReduction_4-happyReduction_4 happy_x_2- happy_x_1- = case happyOut7 happy_x_1 of { happy_var_1 -> - case happyOut6 happy_x_2 of { happy_var_2 -> - happyIn6- (happy_var_1 : happy_var_2- )}}--happyReduce_5 = happySpecReduce_0 2# happyReduction_5-happyReduction_5 = happyIn6- ([]- )--happyReduce_6 = happySpecReduce_2 3# happyReduction_6-happyReduction_6 happy_x_2- happy_x_1- = case happyOutTok happy_x_2 of { (T _ (StringT happy_var_2)) -> - happyIn7- (WrapperDirective happy_var_2- )}--happyReduce_7 = happySpecReduce_2 4# happyReduction_7-happyReduction_7 happy_x_2- happy_x_1- = happyIn8- (()- )--happyReduce_8 = happySpecReduce_0 4# happyReduction_8-happyReduction_8 = happyIn8- (()- )--happyReduce_9 = happyMonadReduce 2# 5# happyReduction_9-happyReduction_9 (happy_x_2 `HappyStk`- happy_x_1 `HappyStk`- happyRest) tk- = happyThen (case happyOutTok happy_x_1 of { (T _ (SMacDefT happy_var_1)) -> - case happyOut27 happy_x_2 of { happy_var_2 -> - ( newSMac happy_var_1 happy_var_2)}}- ) (\r -> happyReturn (happyIn9 r))--happyReduce_10 = happyMonadReduce 2# 5# happyReduction_10-happyReduction_10 (happy_x_2 `HappyStk`- happy_x_1 `HappyStk`- happyRest) tk- = happyThen (case happyOutTok happy_x_1 of { (T _ (RMacDefT happy_var_1)) -> - case happyOut22 happy_x_2 of { happy_var_2 -> - ( newRMac happy_var_1 happy_var_2)}}- ) (\r -> happyReturn (happyIn9 r))--happyReduce_11 = happySpecReduce_2 6# happyReduction_11-happyReduction_11 happy_x_2- happy_x_1- = case happyOutTok happy_x_1 of { (T _ (BindT happy_var_1)) -> - case happyOut11 happy_x_2 of { happy_var_2 -> - happyIn10- (Scanner happy_var_1 happy_var_2- )}}--happyReduce_12 = happySpecReduce_2 7# happyReduction_12-happyReduction_12 happy_x_2- happy_x_1- = case happyOut12 happy_x_1 of { happy_var_1 -> - case happyOut11 happy_x_2 of { happy_var_2 -> - happyIn11- (happy_var_1 ++ happy_var_2- )}}--happyReduce_13 = happySpecReduce_0 7# happyReduction_13-happyReduction_13 = happyIn11- ([]- )--happyReduce_14 = happySpecReduce_2 8# happyReduction_14-happyReduction_14 happy_x_2- happy_x_1- = case happyOut15 happy_x_1 of { happy_var_1 -> - case happyOut13 happy_x_2 of { happy_var_2 -> - happyIn12- ([ replaceCodes happy_var_1 happy_var_2 ]- )}}--happyReduce_15 = happyReduce 4# 8# happyReduction_15-happyReduction_15 (happy_x_4 `HappyStk`- happy_x_3 `HappyStk`- happy_x_2 `HappyStk`- happy_x_1 `HappyStk`- happyRest)- = case happyOut15 happy_x_1 of { happy_var_1 -> - case happyOut14 happy_x_3 of { happy_var_3 -> - happyIn12- (map (replaceCodes happy_var_1) happy_var_3- ) `HappyStk` happyRest}}--happyReduce_16 = happySpecReduce_1 8# happyReduction_16-happyReduction_16 happy_x_1- = case happyOut13 happy_x_1 of { happy_var_1 -> - happyIn12- ([ happy_var_1 ]- )}--happyReduce_17 = happySpecReduce_2 9# happyReduction_17-happyReduction_17 happy_x_2- happy_x_1- = case happyOut19 happy_x_1 of { happy_var_1 -> - case happyOut18 happy_x_2 of { happy_var_2 -> - happyIn13- (let (l,e,r) = happy_var_1 in - RECtx [] l e r happy_var_2- )}}--happyReduce_18 = happySpecReduce_2 10# happyReduction_18-happyReduction_18 happy_x_2- happy_x_1- = case happyOut13 happy_x_1 of { happy_var_1 -> - case happyOut14 happy_x_2 of { happy_var_2 -> - happyIn14- (happy_var_1 : happy_var_2- )}}--happyReduce_19 = happySpecReduce_0 10# happyReduction_19-happyReduction_19 = happyIn14- ([]- )--happyReduce_20 = happySpecReduce_3 11# happyReduction_20-happyReduction_20 happy_x_3- happy_x_2- happy_x_1- = case happyOut16 happy_x_2 of { happy_var_2 -> - happyIn15- (happy_var_2- )}--happyReduce_21 = happySpecReduce_3 12# happyReduction_21-happyReduction_21 happy_x_3- happy_x_2- happy_x_1- = case happyOut17 happy_x_1 of { happy_var_1 -> - case happyOut16 happy_x_3 of { happy_var_3 -> - happyIn16- ((happy_var_1,0) : happy_var_3- )}}--happyReduce_22 = happySpecReduce_1 12# happyReduction_22-happyReduction_22 happy_x_1- = case happyOut17 happy_x_1 of { happy_var_1 -> - happyIn16- ([(happy_var_1,0)]- )}--happyReduce_23 = happySpecReduce_1 13# happyReduction_23-happyReduction_23 happy_x_1- = happyIn17- ("0"- )--happyReduce_24 = happySpecReduce_1 13# happyReduction_24-happyReduction_24 happy_x_1- = case happyOutTok happy_x_1 of { (T _ (IdT happy_var_1)) -> - happyIn17- (happy_var_1- )}--happyReduce_25 = happySpecReduce_1 14# happyReduction_25-happyReduction_25 happy_x_1- = case happyOutTok happy_x_1 of { happy_var_1 -> - happyIn18- (case happy_var_1 of T _ (CodeT code) -> Just code- )}--happyReduce_26 = happySpecReduce_1 14# happyReduction_26-happyReduction_26 happy_x_1- = happyIn18- (Nothing- )--happyReduce_27 = happySpecReduce_3 15# happyReduction_27-happyReduction_27 happy_x_3- happy_x_2- happy_x_1- = case happyOut20 happy_x_1 of { happy_var_1 -> - case happyOut22 happy_x_2 of { happy_var_2 -> - case happyOut21 happy_x_3 of { happy_var_3 -> - happyIn19- ((Just happy_var_1,happy_var_2,happy_var_3)- )}}}--happyReduce_28 = happySpecReduce_2 15# happyReduction_28-happyReduction_28 happy_x_2- happy_x_1- = case happyOut22 happy_x_1 of { happy_var_1 -> - case happyOut21 happy_x_2 of { happy_var_2 -> - happyIn19- ((Nothing,happy_var_1,happy_var_2)- )}}--happyReduce_29 = happySpecReduce_1 16# happyReduction_29-happyReduction_29 happy_x_1- = happyIn20- (charSetSingleton '\n'- )--happyReduce_30 = happySpecReduce_2 16# happyReduction_30-happyReduction_30 happy_x_2- happy_x_1- = case happyOut27 happy_x_1 of { happy_var_1 -> - happyIn20- (happy_var_1- )}--happyReduce_31 = happySpecReduce_1 17# happyReduction_31-happyReduction_31 happy_x_1- = happyIn21- (RightContextRExp (Ch (charSetSingleton '\n'))- )--happyReduce_32 = happySpecReduce_2 17# happyReduction_32-happyReduction_32 happy_x_2- happy_x_1- = case happyOut22 happy_x_2 of { happy_var_2 -> - happyIn21- (RightContextRExp happy_var_2- )}--happyReduce_33 = happySpecReduce_2 17# happyReduction_33-happyReduction_33 happy_x_2- happy_x_1- = case happyOutTok happy_x_2 of { happy_var_2 -> - happyIn21- (RightContextCode (case happy_var_2 of - T _ (CodeT code) -> code)- )}--happyReduce_34 = happySpecReduce_0 17# happyReduction_34-happyReduction_34 = happyIn21- (NoRightContext- )--happyReduce_35 = happySpecReduce_3 18# happyReduction_35-happyReduction_35 happy_x_3- happy_x_2- happy_x_1- = case happyOut23 happy_x_1 of { happy_var_1 -> - case happyOut22 happy_x_3 of { happy_var_3 -> - happyIn22- (happy_var_1 :| happy_var_3- )}}--happyReduce_36 = happySpecReduce_1 18# happyReduction_36-happyReduction_36 happy_x_1- = case happyOut23 happy_x_1 of { happy_var_1 -> - happyIn22- (happy_var_1- )}--happyReduce_37 = happySpecReduce_2 19# happyReduction_37-happyReduction_37 happy_x_2- happy_x_1- = case happyOut23 happy_x_1 of { happy_var_1 -> - case happyOut24 happy_x_2 of { happy_var_2 -> - happyIn23- (happy_var_1 :%% happy_var_2- )}}--happyReduce_38 = happySpecReduce_1 19# happyReduction_38-happyReduction_38 happy_x_1- = case happyOut24 happy_x_1 of { happy_var_1 -> - happyIn23- (happy_var_1- )}--happyReduce_39 = happySpecReduce_2 20# happyReduction_39-happyReduction_39 happy_x_2- happy_x_1- = case happyOut26 happy_x_1 of { happy_var_1 -> - case happyOut25 happy_x_2 of { happy_var_2 -> - happyIn24- (happy_var_2 happy_var_1- )}}--happyReduce_40 = happySpecReduce_1 20# happyReduction_40-happyReduction_40 happy_x_1- = case happyOut26 happy_x_1 of { happy_var_1 -> - happyIn24- (happy_var_1- )}--happyReduce_41 = happySpecReduce_1 21# happyReduction_41-happyReduction_41 happy_x_1- = happyIn25- (Star- )--happyReduce_42 = happySpecReduce_1 21# happyReduction_42-happyReduction_42 happy_x_1- = happyIn25- (Plus- )--happyReduce_43 = happySpecReduce_1 21# happyReduction_43-happyReduction_43 happy_x_1- = happyIn25- (Ques- )--happyReduce_44 = happySpecReduce_3 21# happyReduction_44-happyReduction_44 happy_x_3- happy_x_2- happy_x_1- = case happyOutTok happy_x_2 of { (T _ (CharT happy_var_2)) -> - happyIn25- (repeat_rng (digit happy_var_2) Nothing- )}--happyReduce_45 = happyReduce 4# 21# happyReduction_45-happyReduction_45 (happy_x_4 `HappyStk`- happy_x_3 `HappyStk`- happy_x_2 `HappyStk`- happy_x_1 `HappyStk`- happyRest)- = case happyOutTok happy_x_2 of { (T _ (CharT happy_var_2)) -> - happyIn25- (repeat_rng (digit happy_var_2) (Just Nothing)- ) `HappyStk` happyRest}--happyReduce_46 = happyReduce 5# 21# happyReduction_46-happyReduction_46 (happy_x_5 `HappyStk`- happy_x_4 `HappyStk`- happy_x_3 `HappyStk`- happy_x_2 `HappyStk`- happy_x_1 `HappyStk`- happyRest)- = case happyOutTok happy_x_2 of { (T _ (CharT happy_var_2)) -> - case happyOutTok happy_x_4 of { (T _ (CharT happy_var_4)) -> - happyIn25- (repeat_rng (digit happy_var_2) (Just (Just (digit happy_var_4)))- ) `HappyStk` happyRest}}--happyReduce_47 = happySpecReduce_2 22# happyReduction_47-happyReduction_47 happy_x_2- happy_x_1- = happyIn26- (Eps- )--happyReduce_48 = happySpecReduce_1 22# happyReduction_48-happyReduction_48 happy_x_1- = case happyOutTok happy_x_1 of { (T _ (StringT happy_var_1)) -> - happyIn26- (foldr (:%%) Eps - (map (Ch . charSetSingleton) happy_var_1)- )}--happyReduce_49 = happyMonadReduce 1# 22# happyReduction_49-happyReduction_49 (happy_x_1 `HappyStk`- happyRest) tk- = happyThen (case happyOutTok happy_x_1 of { (T _ (RMacT happy_var_1)) -> - ( lookupRMac happy_var_1)}- ) (\r -> happyReturn (happyIn26 r))--happyReduce_50 = happySpecReduce_1 22# happyReduction_50-happyReduction_50 happy_x_1- = case happyOut27 happy_x_1 of { happy_var_1 -> - happyIn26- (Ch happy_var_1- )}--happyReduce_51 = happySpecReduce_3 22# happyReduction_51-happyReduction_51 happy_x_3- happy_x_2- happy_x_1- = case happyOut22 happy_x_2 of { happy_var_2 -> - happyIn26- (happy_var_2- )}--happyReduce_52 = happySpecReduce_3 23# happyReduction_52-happyReduction_52 happy_x_3- happy_x_2- happy_x_1- = case happyOut27 happy_x_1 of { happy_var_1 -> - case happyOut28 happy_x_3 of { happy_var_3 -> - happyIn27- (happy_var_1 `charSetMinus` happy_var_3- )}}--happyReduce_53 = happySpecReduce_1 23# happyReduction_53-happyReduction_53 happy_x_1- = case happyOut28 happy_x_1 of { happy_var_1 -> - happyIn27- (happy_var_1- )}--happyReduce_54 = happySpecReduce_1 24# happyReduction_54-happyReduction_54 happy_x_1- = case happyOutTok happy_x_1 of { (T _ (CharT happy_var_1)) -> - happyIn28- (charSetSingleton happy_var_1- )}--happyReduce_55 = happySpecReduce_3 24# happyReduction_55-happyReduction_55 happy_x_3- happy_x_2- happy_x_1- = case happyOutTok happy_x_1 of { (T _ (CharT happy_var_1)) -> - case happyOutTok happy_x_3 of { (T _ (CharT happy_var_3)) -> - happyIn28- (charSetRange happy_var_1 happy_var_3- )}}--happyReduce_56 = happyMonadReduce 1# 24# happyReduction_56-happyReduction_56 (happy_x_1 `HappyStk`- happyRest) tk- = happyThen (case happyOut30 happy_x_1 of { happy_var_1 -> - ( lookupSMac happy_var_1)}- ) (\r -> happyReturn (happyIn28 r))--happyReduce_57 = happySpecReduce_3 24# happyReduction_57-happyReduction_57 happy_x_3- happy_x_2- happy_x_1- = case happyOut29 happy_x_2 of { happy_var_2 -> - happyIn28- (foldr charSetUnion emptyCharSet happy_var_2- )}--happyReduce_58 = happyMonadReduce 4# 24# happyReduction_58-happyReduction_58 (happy_x_4 `HappyStk`- happy_x_3 `HappyStk`- happy_x_2 `HappyStk`- happy_x_1 `HappyStk`- happyRest) tk- = happyThen (case happyOutTok happy_x_1 of { happy_var_1 -> - case happyOut29 happy_x_3 of { happy_var_3 -> - ( do { dot <- lookupSMac (tokPosn happy_var_1, ".");- return (dot `charSetMinus`- foldr charSetUnion emptyCharSet happy_var_3) })}}- ) (\r -> happyReturn (happyIn28 r))--happyReduce_59 = happyMonadReduce 2# 24# happyReduction_59-happyReduction_59 (happy_x_2 `HappyStk`- happy_x_1 `HappyStk`- happyRest) tk- = happyThen (case happyOutTok happy_x_1 of { happy_var_1 -> - case happyOut28 happy_x_2 of { happy_var_2 -> - ( do { dot <- lookupSMac (tokPosn happy_var_1, ".");- return (dot `charSetMinus` happy_var_2) })}}- ) (\r -> happyReturn (happyIn28 r))--happyReduce_60 = happySpecReduce_2 25# happyReduction_60-happyReduction_60 happy_x_2- happy_x_1- = case happyOut27 happy_x_1 of { happy_var_1 -> - case happyOut29 happy_x_2 of { happy_var_2 -> - happyIn29- (happy_var_1 : happy_var_2- )}}--happyReduce_61 = happySpecReduce_0 25# happyReduction_61-happyReduction_61 = happyIn29- ([]- )--happyReduce_62 = happySpecReduce_1 26# happyReduction_62-happyReduction_62 happy_x_1- = case happyOutTok happy_x_1 of { happy_var_1 -> - happyIn30- ((tokPosn happy_var_1, ".")- )}--happyReduce_63 = happySpecReduce_1 26# happyReduction_63-happyReduction_63 happy_x_1- = case happyOutTok happy_x_1 of { happy_var_1 -> - happyIn30- (case happy_var_1 of T p (SMacT s) -> (p, s)- )}--happyNewToken action sts stk- = lexer(\tk -> - let cont i = happyDoAction i tk action sts stk in- case tk of {- T _ EOFT -> happyDoAction 33# tk action sts stk;- T _ (SpecialT '.') -> cont 1#;- T _ (SpecialT ';') -> cont 2#;- T _ (SpecialT '<') -> cont 3#;- T _ (SpecialT '>') -> cont 4#;- T _ (SpecialT ',') -> cont 5#;- T _ (SpecialT '$') -> cont 6#;- T _ (SpecialT '|') -> cont 7#;- T _ (SpecialT '*') -> cont 8#;- T _ (SpecialT '+') -> cont 9#;- T _ (SpecialT '?') -> cont 10#;- T _ (SpecialT '{') -> cont 11#;- T _ (SpecialT '}') -> cont 12#;- T _ (SpecialT '(') -> cont 13#;- T _ (SpecialT ')') -> cont 14#;- T _ (SpecialT '#') -> cont 15#;- T _ (SpecialT '~') -> cont 16#;- T _ (SpecialT '-') -> cont 17#;- T _ (SpecialT '[') -> cont 18#;- T _ (SpecialT ']') -> cont 19#;- T _ (SpecialT '^') -> cont 20#;- T _ (SpecialT '/') -> cont 21#;- T _ ZeroT -> cont 22#;- T _ (StringT happy_dollar_dollar) -> cont 23#;- T _ (BindT happy_dollar_dollar) -> cont 24#;- T _ (IdT happy_dollar_dollar) -> cont 25#;- T _ (CodeT _) -> cont 26#;- T _ (CharT happy_dollar_dollar) -> cont 27#;- T _ (SMacT _) -> cont 28#;- T _ (RMacT happy_dollar_dollar) -> cont 29#;- T _ (SMacDefT happy_dollar_dollar) -> cont 30#;- T _ (RMacDefT happy_dollar_dollar) -> cont 31#;- T _ WrapperT -> cont 32#;- _ -> happyError' tk- })--happyError_ tk = happyError' tk--happyThen :: () => P a -> (a -> P b) -> P b-happyThen = ((>>=))-happyReturn :: () => a -> P a-happyReturn = (return)-happyThen1 = happyThen-happyReturn1 :: () => a -> P a-happyReturn1 = happyReturn-happyError' :: () => (Token) -> P a-happyError' tk = (\token -> happyError) tk--parse = happySomeParser where- happySomeParser = happyThen (happyParse 0#) (\x -> happyReturn (happyOut4 x))--happySeq = happyDontSeq---happyError :: P a-happyError = failP "parse error"---- -------------------------------------------------------------------------------- Utils--digit c = ord c - ord '0'--repeat_rng :: Int -> Maybe (Maybe Int) -> (RExp->RExp)-repeat_rng n (Nothing) re = foldr (:%%) Eps (replicate n re)-repeat_rng n (Just Nothing) re = foldr (:%%) (Star re) (replicate n re)-repeat_rng n (Just (Just m)) re = intl :%% rst- where- intl = repeat_rng n Nothing re- rst = foldr (\re re'->Ques(re :%% re')) Eps (replicate (m-n) re)--replaceCodes codes rectx = rectx{ reCtxStartCodes = codes }-{-# LINE 1 "templates/GenericTemplate.hs" #-}-{-# LINE 1 "templates/GenericTemplate.hs" #-}-{-# LINE 1 "<built-in>" #-}-{-# LINE 1 "<command-line>" #-}-{-# LINE 1 "templates/GenericTemplate.hs" #-}--- Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp --{-# LINE 30 "templates/GenericTemplate.hs" #-}---data Happy_IntList = HappyCons Happy_GHC_Exts.Int# Happy_IntList------{-# LINE 51 "templates/GenericTemplate.hs" #-}--{-# LINE 61 "templates/GenericTemplate.hs" #-}--{-# LINE 70 "templates/GenericTemplate.hs" #-}--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 0#, 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 i tk st- -1# -> {- nothing -}- happyAccept i tk st- n | (n Happy_GHC_Exts.<# (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) = indexShortOffAddr happyActOffsets st- (off_i) = (off Happy_GHC_Exts.+# i)- check = if (off_i Happy_GHC_Exts.>=# (0# :: Happy_GHC_Exts.Int#))- then (indexShortOffAddr happyCheck off_i Happy_GHC_Exts.==# i)- else False- (action)- | check = indexShortOffAddr happyTable off_i- | otherwise = indexShortOffAddr happyDefActions st--{-# LINE 130 "templates/GenericTemplate.hs" #-}---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#------data HappyAddr = HappyA# Happy_GHC_Exts.Addr#------------------------------------------------------------------------------------- HappyState data type (not arrays)--{-# LINE 163 "templates/GenericTemplate.hs" #-}---------------------------------------------------------------------------------- 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 =- happyThen1 (fn stk tk) (\r -> happyGoto nt j tk st1 sts1 (r `HappyStk` drop_stk))- where (sts1@((HappyCons (st1@(action)) (_)))) = happyDrop k (HappyCons (st) (sts))- drop_stk = happyDropStk k 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 =- happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk))- where (sts1@((HappyCons (st1@(action)) (_)))) = happyDrop k (HappyCons (st) (sts))- drop_stk = happyDropStk k stk-- (off) = indexShortOffAddr happyGotoOffsets st1- (off_i) = (off Happy_GHC_Exts.+# nt)- (new_state) = indexShortOffAddr happyTable off_i-----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) = indexShortOffAddr happyGotoOffsets st- (off_i) = (off Happy_GHC_Exts.+# nt)- (new_state) = indexShortOffAddr happyTable off_i------------------------------------------------------------------------------------- Error recovery (0# is the error token)---- parse error if we are in recovery and we fail again-happyFail 0# tk old_st _ stk =--- trace "failing" $ - happyError_ 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 0# tk old_st (HappyCons ((action)) (sts)) - (saved_tok `HappyStk` _ `HappyStk` stk) =--- trace ("discarding state, depth " ++ show (length stk)) $- happyDoAction 0# tk action sts ((saved_tok`HappyStk`stk))--}---- Enter error recovery: generate an error token,--- save the old token and carry on.-happyFail 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.+{-# OPTIONS_GHC -w #-} +{-# OPTIONS -fglasgow-exts -cpp #-} +-- ----------------------------------------------------------------------------- +-- +-- Parser.y, part of Alex +-- +-- (c) Simon Marlow 2003 +-- +-- ----------------------------------------------------------------------------- + +{-# OPTIONS_GHC -w #-} + +module Parser ( parse, P ) where +import AbsSyn +import Scan +import CharSet +import ParseMonad hiding ( StartCode ) + +import Data.Char +--import Debug.Trace +import qualified Data.Array as Happy_Data_Array +import qualified GHC.Exts as Happy_GHC_Exts + +-- parser produced by Happy Version 1.18.6 + +newtype HappyAbsSyn = HappyAbsSyn HappyAny +#if __GLASGOW_HASKELL__ >= 607 +type HappyAny = Happy_GHC_Exts.Any +#else +type HappyAny = forall a . a +#endif +happyIn4 :: ((Maybe (AlexPosn,Code), [Directive], Scanner, Maybe (AlexPosn,Code))) -> (HappyAbsSyn ) +happyIn4 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn4 #-} +happyOut4 :: (HappyAbsSyn ) -> ((Maybe (AlexPosn,Code), [Directive], Scanner, Maybe (AlexPosn,Code))) +happyOut4 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut4 #-} +happyIn5 :: (Maybe (AlexPosn,Code)) -> (HappyAbsSyn ) +happyIn5 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn5 #-} +happyOut5 :: (HappyAbsSyn ) -> (Maybe (AlexPosn,Code)) +happyOut5 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut5 #-} +happyIn6 :: ([Directive]) -> (HappyAbsSyn ) +happyIn6 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn6 #-} +happyOut6 :: (HappyAbsSyn ) -> ([Directive]) +happyOut6 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut6 #-} +happyIn7 :: (Directive) -> (HappyAbsSyn ) +happyIn7 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn7 #-} +happyOut7 :: (HappyAbsSyn ) -> (Directive) +happyOut7 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut7 #-} +happyIn8 :: (()) -> (HappyAbsSyn ) +happyIn8 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn8 #-} +happyOut8 :: (HappyAbsSyn ) -> (()) +happyOut8 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut8 #-} +happyIn9 :: (()) -> (HappyAbsSyn ) +happyIn9 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn9 #-} +happyOut9 :: (HappyAbsSyn ) -> (()) +happyOut9 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut9 #-} +happyIn10 :: (Scanner) -> (HappyAbsSyn ) +happyIn10 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn10 #-} +happyOut10 :: (HappyAbsSyn ) -> (Scanner) +happyOut10 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut10 #-} +happyIn11 :: ([RECtx]) -> (HappyAbsSyn ) +happyIn11 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn11 #-} +happyOut11 :: (HappyAbsSyn ) -> ([RECtx]) +happyOut11 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut11 #-} +happyIn12 :: ([RECtx]) -> (HappyAbsSyn ) +happyIn12 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn12 #-} +happyOut12 :: (HappyAbsSyn ) -> ([RECtx]) +happyOut12 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut12 #-} +happyIn13 :: (RECtx) -> (HappyAbsSyn ) +happyIn13 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn13 #-} +happyOut13 :: (HappyAbsSyn ) -> (RECtx) +happyOut13 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut13 #-} +happyIn14 :: ([RECtx]) -> (HappyAbsSyn ) +happyIn14 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn14 #-} +happyOut14 :: (HappyAbsSyn ) -> ([RECtx]) +happyOut14 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut14 #-} +happyIn15 :: ([(String,StartCode)]) -> (HappyAbsSyn ) +happyIn15 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn15 #-} +happyOut15 :: (HappyAbsSyn ) -> ([(String,StartCode)]) +happyOut15 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut15 #-} +happyIn16 :: ([(String,StartCode)]) -> (HappyAbsSyn ) +happyIn16 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn16 #-} +happyOut16 :: (HappyAbsSyn ) -> ([(String,StartCode)]) +happyOut16 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut16 #-} +happyIn17 :: (String) -> (HappyAbsSyn ) +happyIn17 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn17 #-} +happyOut17 :: (HappyAbsSyn ) -> (String) +happyOut17 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut17 #-} +happyIn18 :: (Maybe Code) -> (HappyAbsSyn ) +happyIn18 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn18 #-} +happyOut18 :: (HappyAbsSyn ) -> (Maybe Code) +happyOut18 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut18 #-} +happyIn19 :: (Maybe CharSet, RExp, RightContext RExp) -> (HappyAbsSyn ) +happyIn19 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn19 #-} +happyOut19 :: (HappyAbsSyn ) -> (Maybe CharSet, RExp, RightContext RExp) +happyOut19 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut19 #-} +happyIn20 :: (CharSet) -> (HappyAbsSyn ) +happyIn20 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn20 #-} +happyOut20 :: (HappyAbsSyn ) -> (CharSet) +happyOut20 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut20 #-} +happyIn21 :: (RightContext RExp) -> (HappyAbsSyn ) +happyIn21 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn21 #-} +happyOut21 :: (HappyAbsSyn ) -> (RightContext RExp) +happyOut21 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut21 #-} +happyIn22 :: (RExp) -> (HappyAbsSyn ) +happyIn22 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn22 #-} +happyOut22 :: (HappyAbsSyn ) -> (RExp) +happyOut22 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut22 #-} +happyIn23 :: (RExp) -> (HappyAbsSyn ) +happyIn23 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn23 #-} +happyOut23 :: (HappyAbsSyn ) -> (RExp) +happyOut23 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut23 #-} +happyIn24 :: (RExp) -> (HappyAbsSyn ) +happyIn24 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn24 #-} +happyOut24 :: (HappyAbsSyn ) -> (RExp) +happyOut24 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut24 #-} +happyIn25 :: (RExp -> RExp) -> (HappyAbsSyn ) +happyIn25 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn25 #-} +happyOut25 :: (HappyAbsSyn ) -> (RExp -> RExp) +happyOut25 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut25 #-} +happyIn26 :: (RExp) -> (HappyAbsSyn ) +happyIn26 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn26 #-} +happyOut26 :: (HappyAbsSyn ) -> (RExp) +happyOut26 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut26 #-} +happyIn27 :: (CharSet) -> (HappyAbsSyn ) +happyIn27 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn27 #-} +happyOut27 :: (HappyAbsSyn ) -> (CharSet) +happyOut27 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut27 #-} +happyIn28 :: (CharSet) -> (HappyAbsSyn ) +happyIn28 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn28 #-} +happyOut28 :: (HappyAbsSyn ) -> (CharSet) +happyOut28 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut28 #-} +happyIn29 :: ([CharSet]) -> (HappyAbsSyn ) +happyIn29 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn29 #-} +happyOut29 :: (HappyAbsSyn ) -> ([CharSet]) +happyOut29 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut29 #-} +happyIn30 :: ((AlexPosn,String)) -> (HappyAbsSyn ) +happyIn30 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyIn30 #-} +happyOut30 :: (HappyAbsSyn ) -> ((AlexPosn,String)) +happyOut30 x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOut30 #-} +happyInTok :: (Token) -> (HappyAbsSyn ) +happyInTok x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyInTok #-} +happyOutTok :: (HappyAbsSyn ) -> (Token) +happyOutTok x = Happy_GHC_Exts.unsafeCoerce# x +{-# INLINE happyOutTok #-} + + +happyActOffsets :: HappyAddr +happyActOffsets = HappyA# "\x72\x00\x72\x00\x66\x00\x00\x00\x52\x00\x51\x00\x60\x00\x67\x00\x00\x00\x00\x00\x63\x00\x51\x00\x7b\x00\x6d\x00\x00\x00\x5b\x00\x00\x00\x1a\x01\x6a\x00\x00\x00\x00\x00\x00\x00\x49\x00\x7b\x00\x80\x00\x00\x00\x64\x00\x00\x00\x00\x00\x62\x00\x00\x00\x4d\x00\x13\x00\x00\x00\x13\x00\x00\x00\x01\x00\xff\xff\x6d\x00\x02\x00\x10\x00\x1b\x00\x00\x00\x00\x00\x7b\x00\x48\x00\x73\x00\x59\x00\x7b\x00\x00\x00\x53\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x42\x00\x00\x00\x6d\x00\x00\x00\x15\x00\x00\x00\x47\x00\x00\x00\x00\x00\x00\x00\x00\x00\x54\x00\x50\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x25\x00\x00\x00\x25\x00\x3f\x00\x00\x00\x00\x00\x00\x00\x1b\x00\x00\x00\x00\x00\xf7\xff\x00\x00\x00\x00\x3c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"# + +happyGotoOffsets :: HappyAddr +happyGotoOffsets = HappyA# "\x69\x00\x39\x00\x5c\x00\x00\x00\x00\x00\x4b\x00\x4a\x00\x00\x00\x00\x00\x00\x00\x30\x00\x3a\x00\x11\x00\xfe\x00\x00\x00\x03\x01\x00\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf5\x00\x2b\x00\x07\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x21\x00\xaa\x00\x00\x00\x96\x00\x00\x00\xda\x00\xf6\xff\xec\x00\x22\x00\x00\x00\x20\x00\x00\x00\x00\x00\x23\x00\x00\x00\xc2\x00\x00\x00\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe3\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\xf3\xff\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\xce\x00\x00\x00\xbc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"# + +happyDefActions :: HappyAddr +happyDefActions = HappyA# "\xfc\xff\x00\x00\xfa\xff\xfd\xff\x00\x00\xf7\xff\xfa\xff\x00\x00\xf9\xff\xfb\xff\x00\x00\xf7\xff\x00\x00\x00\x00\xf5\xff\xdb\xff\xd9\xff\xd7\xff\xcd\xff\xca\xff\xc7\xff\xc1\xff\x00\x00\x00\x00\xc2\xff\xcf\xff\xc9\xff\xc0\xff\xce\xff\xf6\xff\xf8\xff\xfc\xff\xf2\xff\xf4\xff\xf2\xff\xef\xff\x00\x00\x00\x00\x00\x00\xdd\xff\xcd\xff\x00\x00\xe2\xff\xfe\xff\x00\x00\x00\x00\xc2\xff\x00\x00\xc2\xff\xc4\xff\x00\x00\xd0\xff\xd8\xff\xd6\xff\xd5\xff\xd4\xff\x00\x00\xda\xff\x00\x00\xdc\xff\x00\x00\xcc\xff\x00\x00\xc6\xff\xc3\xff\xc8\xff\xcb\xff\x00\x00\xe9\xff\xe8\xff\xe7\xff\xe1\xff\xe3\xff\xe0\xff\x00\x00\xdd\xff\xee\xff\xe5\xff\xe6\xff\xf1\xff\xec\xff\xf3\xff\xec\xff\x00\x00\xe4\xff\xdf\xff\xde\xff\x00\x00\xeb\xff\xc5\xff\x00\x00\xd3\xff\xd2\xff\x00\x00\xea\xff\xf0\xff\xed\xff\xd1\xff"# + +happyCheck :: HappyAddr +happyCheck = HappyA# "\xff\xff\x02\x00\x01\x00\x0c\x00\x0e\x00\x12\x00\x13\x00\x14\x00\x06\x00\x16\x00\x17\x00\x18\x00\x0b\x00\x1a\x00\x0d\x00\x0c\x00\x0d\x00\x10\x00\x1b\x00\x12\x00\x01\x00\x14\x00\x03\x00\x15\x00\x17\x00\x1a\x00\x05\x00\x11\x00\x1b\x00\x1c\x00\x1d\x00\x0f\x00\x0d\x00\x0c\x00\x01\x00\x10\x00\x14\x00\x12\x00\x01\x00\x14\x00\x17\x00\x18\x00\x17\x00\x1a\x00\x0c\x00\x0d\x00\x1b\x00\x1c\x00\x1d\x00\x16\x00\x0d\x00\x11\x00\x19\x00\x10\x00\x06\x00\x12\x00\x01\x00\x14\x00\x01\x00\x18\x00\x17\x00\x1a\x00\x04\x00\x05\x00\x1b\x00\x1c\x00\x1d\x00\x18\x00\x0d\x00\x1a\x00\x15\x00\x10\x00\x0c\x00\x12\x00\x01\x00\x0c\x00\x02\x00\x03\x00\x17\x00\x04\x00\x05\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x05\x00\x0d\x00\x0e\x00\x04\x00\x10\x00\x13\x00\x12\x00\x01\x00\x1b\x00\x02\x00\x03\x00\x17\x00\x0e\x00\x07\x00\x1b\x00\x1b\x00\x1c\x00\x1d\x00\x1a\x00\x0d\x00\x00\x00\x01\x00\x10\x00\x13\x00\x12\x00\x01\x00\x1e\x00\x1f\x00\x0f\x00\x17\x00\x21\x00\x01\x00\x11\x00\x1b\x00\x1c\x00\x1d\x00\x0f\x00\x0d\x00\x18\x00\x01\x00\x10\x00\x17\x00\x12\x00\x20\x00\x01\x00\x0f\x00\x10\x00\x17\x00\x12\x00\x20\x00\xff\xff\x1b\x00\x1c\x00\x1d\x00\x10\x00\x1a\x00\x12\x00\x1b\x00\x1c\x00\x10\x00\xff\xff\x12\x00\xff\xff\x14\x00\xff\xff\x1b\x00\x1c\x00\xff\xff\xff\xff\xff\xff\x1b\x00\x1c\x00\x07\x00\x08\x00\x09\x00\xff\xff\x0b\x00\xff\xff\xff\xff\xff\xff\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x07\x00\x08\x00\x09\x00\xff\xff\x0b\x00\xff\xff\xff\xff\xff\xff\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x09\x00\x0a\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x09\x00\x0a\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\x09\x00\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x12\x00\x13\x00\x14\x00\xff\xff\x16\x00\x17\x00\x18\x00\x14\x00\x1a\x00\x16\x00\x17\x00\x18\x00\xff\xff\x1a\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x08\x00\x09\x00\x0a\x00\x0b\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"# + +happyTable :: HappyAddr +happyTable = HappyA# "\x00\x00\x4e\x00\x16\x00\x5d\x00\x4c\x00\x55\x00\x0f\x00\x10\x00\x4a\x00\x11\x00\x12\x00\x13\x00\x51\x00\x14\x00\x17\x00\x5e\x00\x44\x00\x18\x00\x5e\x00\x19\x00\x16\x00\x2b\x00\x2a\x00\x4b\x00\x1a\x00\x4f\x00\x5b\x00\x54\x00\x1b\x00\x1c\x00\x1d\x00\x2d\x00\x17\x00\x5c\x00\x2b\x00\x18\x00\x48\x00\x19\x00\x16\x00\x2b\x00\x1d\x00\x13\x00\x1a\x00\x14\x00\x43\x00\x44\x00\x1b\x00\x1c\x00\x1d\x00\x46\x00\x17\x00\x48\x00\x47\x00\x18\x00\x1f\x00\x19\x00\x16\x00\x2b\x00\x02\x00\x42\x00\x1a\x00\x14\x00\x1e\x00\x0b\x00\x1b\x00\x1c\x00\x1d\x00\x31\x00\x17\x00\x14\x00\x34\x00\x18\x00\x62\x00\x19\x00\x16\x00\x60\x00\x09\x00\x06\x00\x1a\x00\x0a\x00\x0b\x00\x57\x00\x1b\x00\x1c\x00\x1d\x00\x58\x00\x17\x00\x34\x00\x59\x00\x18\x00\x5a\x00\x19\x00\x16\x00\x3d\x00\x05\x00\x06\x00\x1a\x00\x3e\x00\x3b\x00\x42\x00\x1b\x00\x1c\x00\x1d\x00\x04\x00\x17\x00\x04\x00\x02\x00\x18\x00\x40\x00\x19\x00\x16\x00\x0d\x00\x0e\x00\x2d\x00\x1a\x00\xff\xff\x16\x00\x2e\x00\x1b\x00\x1c\x00\x1d\x00\x2d\x00\x17\x00\x21\x00\x16\x00\x18\x00\x09\x00\x19\x00\x08\x00\x16\x00\x2d\x00\x18\x00\x1a\x00\x19\x00\x08\x00\x00\x00\x1b\x00\x1c\x00\x1d\x00\x18\x00\x04\x00\x19\x00\x1b\x00\x1c\x00\x18\x00\x00\x00\x19\x00\x00\x00\x31\x00\x00\x00\x1b\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x1b\x00\x1c\x00\x51\x00\x22\x00\x23\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x21\x00\x22\x00\x23\x00\x00\x00\x24\x00\x00\x00\x00\x00\x00\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x52\x00\x60\x00\x2e\x00\x13\x00\x3e\x00\x14\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x52\x00\x53\x00\x2e\x00\x13\x00\x40\x00\x14\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x4f\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x25\x00\x26\x00\x00\x00\x27\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x28\x00\x13\x00\x00\x00\x14\x00\x3b\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x4b\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x32\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x0e\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x39\x00\x14\x00\x11\x00\x12\x00\x13\x00\x00\x00\x14\x00\x2e\x00\x13\x00\x2f\x00\x14\x00\x36\x00\x37\x00\x38\x00\x39\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 = Happy_Data_Array.array (1, 63) [ + (1 , happyReduce_1), + (2 , happyReduce_2), + (3 , happyReduce_3), + (4 , happyReduce_4), + (5 , happyReduce_5), + (6 , happyReduce_6), + (7 , happyReduce_7), + (8 , happyReduce_8), + (9 , happyReduce_9), + (10 , happyReduce_10), + (11 , happyReduce_11), + (12 , happyReduce_12), + (13 , happyReduce_13), + (14 , happyReduce_14), + (15 , happyReduce_15), + (16 , happyReduce_16), + (17 , happyReduce_17), + (18 , happyReduce_18), + (19 , happyReduce_19), + (20 , happyReduce_20), + (21 , happyReduce_21), + (22 , happyReduce_22), + (23 , happyReduce_23), + (24 , happyReduce_24), + (25 , happyReduce_25), + (26 , happyReduce_26), + (27 , happyReduce_27), + (28 , happyReduce_28), + (29 , happyReduce_29), + (30 , happyReduce_30), + (31 , happyReduce_31), + (32 , happyReduce_32), + (33 , happyReduce_33), + (34 , happyReduce_34), + (35 , happyReduce_35), + (36 , happyReduce_36), + (37 , happyReduce_37), + (38 , happyReduce_38), + (39 , happyReduce_39), + (40 , happyReduce_40), + (41 , happyReduce_41), + (42 , happyReduce_42), + (43 , happyReduce_43), + (44 , happyReduce_44), + (45 , happyReduce_45), + (46 , happyReduce_46), + (47 , happyReduce_47), + (48 , happyReduce_48), + (49 , happyReduce_49), + (50 , happyReduce_50), + (51 , happyReduce_51), + (52 , happyReduce_52), + (53 , happyReduce_53), + (54 , happyReduce_54), + (55 , happyReduce_55), + (56 , happyReduce_56), + (57 , happyReduce_57), + (58 , happyReduce_58), + (59 , happyReduce_59), + (60 , happyReduce_60), + (61 , happyReduce_61), + (62 , happyReduce_62), + (63 , happyReduce_63) + ] + +happy_n_terms = 34 :: Int +happy_n_nonterms = 27 :: Int + +happyReduce_1 = happyReduce 5# 0# happyReduction_1 +happyReduction_1 (happy_x_5 `HappyStk` + happy_x_4 `HappyStk` + happy_x_3 `HappyStk` + happy_x_2 `HappyStk` + happy_x_1 `HappyStk` + happyRest) + = case happyOut5 happy_x_1 of { happy_var_1 -> + case happyOut6 happy_x_2 of { happy_var_2 -> + case happyOut10 happy_x_4 of { happy_var_4 -> + case happyOut5 happy_x_5 of { happy_var_5 -> + happyIn4 + ((happy_var_1,happy_var_2,happy_var_4,happy_var_5) + ) `HappyStk` happyRest}}}} + +happyReduce_2 = happySpecReduce_1 1# happyReduction_2 +happyReduction_2 happy_x_1 + = case happyOutTok happy_x_1 of { happy_var_1 -> + happyIn5 + (case happy_var_1 of T pos (CodeT code) -> + Just (pos,code) + )} + +happyReduce_3 = happySpecReduce_0 1# happyReduction_3 +happyReduction_3 = happyIn5 + (Nothing + ) + +happyReduce_4 = happySpecReduce_2 2# happyReduction_4 +happyReduction_4 happy_x_2 + happy_x_1 + = case happyOut7 happy_x_1 of { happy_var_1 -> + case happyOut6 happy_x_2 of { happy_var_2 -> + happyIn6 + (happy_var_1 : happy_var_2 + )}} + +happyReduce_5 = happySpecReduce_0 2# happyReduction_5 +happyReduction_5 = happyIn6 + ([] + ) + +happyReduce_6 = happySpecReduce_2 3# happyReduction_6 +happyReduction_6 happy_x_2 + happy_x_1 + = case happyOutTok happy_x_2 of { (T _ (StringT happy_var_2)) -> + happyIn7 + (WrapperDirective happy_var_2 + )} + +happyReduce_7 = happySpecReduce_2 4# happyReduction_7 +happyReduction_7 happy_x_2 + happy_x_1 + = happyIn8 + (() + ) + +happyReduce_8 = happySpecReduce_0 4# happyReduction_8 +happyReduction_8 = happyIn8 + (() + ) + +happyReduce_9 = happyMonadReduce 2# 5# happyReduction_9 +happyReduction_9 (happy_x_2 `HappyStk` + happy_x_1 `HappyStk` + happyRest) tk + = happyThen (case happyOutTok happy_x_1 of { (T _ (SMacDefT happy_var_1)) -> + case happyOut27 happy_x_2 of { happy_var_2 -> + ( newSMac happy_var_1 happy_var_2)}} + ) (\r -> happyReturn (happyIn9 r)) + +happyReduce_10 = happyMonadReduce 2# 5# happyReduction_10 +happyReduction_10 (happy_x_2 `HappyStk` + happy_x_1 `HappyStk` + happyRest) tk + = happyThen (case happyOutTok happy_x_1 of { (T _ (RMacDefT happy_var_1)) -> + case happyOut22 happy_x_2 of { happy_var_2 -> + ( newRMac happy_var_1 happy_var_2)}} + ) (\r -> happyReturn (happyIn9 r)) + +happyReduce_11 = happySpecReduce_2 6# happyReduction_11 +happyReduction_11 happy_x_2 + happy_x_1 + = case happyOutTok happy_x_1 of { (T _ (BindT happy_var_1)) -> + case happyOut11 happy_x_2 of { happy_var_2 -> + happyIn10 + (Scanner happy_var_1 happy_var_2 + )}} + +happyReduce_12 = happySpecReduce_2 7# happyReduction_12 +happyReduction_12 happy_x_2 + happy_x_1 + = case happyOut12 happy_x_1 of { happy_var_1 -> + case happyOut11 happy_x_2 of { happy_var_2 -> + happyIn11 + (happy_var_1 ++ happy_var_2 + )}} + +happyReduce_13 = happySpecReduce_0 7# happyReduction_13 +happyReduction_13 = happyIn11 + ([] + ) + +happyReduce_14 = happySpecReduce_2 8# happyReduction_14 +happyReduction_14 happy_x_2 + happy_x_1 + = case happyOut15 happy_x_1 of { happy_var_1 -> + case happyOut13 happy_x_2 of { happy_var_2 -> + happyIn12 + ([ replaceCodes happy_var_1 happy_var_2 ] + )}} + +happyReduce_15 = happyReduce 4# 8# happyReduction_15 +happyReduction_15 (happy_x_4 `HappyStk` + happy_x_3 `HappyStk` + happy_x_2 `HappyStk` + happy_x_1 `HappyStk` + happyRest) + = case happyOut15 happy_x_1 of { happy_var_1 -> + case happyOut14 happy_x_3 of { happy_var_3 -> + happyIn12 + (map (replaceCodes happy_var_1) happy_var_3 + ) `HappyStk` happyRest}} + +happyReduce_16 = happySpecReduce_1 8# happyReduction_16 +happyReduction_16 happy_x_1 + = case happyOut13 happy_x_1 of { happy_var_1 -> + happyIn12 + ([ happy_var_1 ] + )} + +happyReduce_17 = happySpecReduce_2 9# happyReduction_17 +happyReduction_17 happy_x_2 + happy_x_1 + = case happyOut19 happy_x_1 of { happy_var_1 -> + case happyOut18 happy_x_2 of { happy_var_2 -> + happyIn13 + (let (l,e,r) = happy_var_1 in + RECtx [] l e r happy_var_2 + )}} + +happyReduce_18 = happySpecReduce_2 10# happyReduction_18 +happyReduction_18 happy_x_2 + happy_x_1 + = case happyOut13 happy_x_1 of { happy_var_1 -> + case happyOut14 happy_x_2 of { happy_var_2 -> + happyIn14 + (happy_var_1 : happy_var_2 + )}} + +happyReduce_19 = happySpecReduce_0 10# happyReduction_19 +happyReduction_19 = happyIn14 + ([] + ) + +happyReduce_20 = happySpecReduce_3 11# happyReduction_20 +happyReduction_20 happy_x_3 + happy_x_2 + happy_x_1 + = case happyOut16 happy_x_2 of { happy_var_2 -> + happyIn15 + (happy_var_2 + )} + +happyReduce_21 = happySpecReduce_3 12# happyReduction_21 +happyReduction_21 happy_x_3 + happy_x_2 + happy_x_1 + = case happyOut17 happy_x_1 of { happy_var_1 -> + case happyOut16 happy_x_3 of { happy_var_3 -> + happyIn16 + ((happy_var_1,0) : happy_var_3 + )}} + +happyReduce_22 = happySpecReduce_1 12# happyReduction_22 +happyReduction_22 happy_x_1 + = case happyOut17 happy_x_1 of { happy_var_1 -> + happyIn16 + ([(happy_var_1,0)] + )} + +happyReduce_23 = happySpecReduce_1 13# happyReduction_23 +happyReduction_23 happy_x_1 + = happyIn17 + ("0" + ) + +happyReduce_24 = happySpecReduce_1 13# happyReduction_24 +happyReduction_24 happy_x_1 + = case happyOutTok happy_x_1 of { (T _ (IdT happy_var_1)) -> + happyIn17 + (happy_var_1 + )} + +happyReduce_25 = happySpecReduce_1 14# happyReduction_25 +happyReduction_25 happy_x_1 + = case happyOutTok happy_x_1 of { happy_var_1 -> + happyIn18 + (case happy_var_1 of T _ (CodeT code) -> Just code + )} + +happyReduce_26 = happySpecReduce_1 14# happyReduction_26 +happyReduction_26 happy_x_1 + = happyIn18 + (Nothing + ) + +happyReduce_27 = happySpecReduce_3 15# happyReduction_27 +happyReduction_27 happy_x_3 + happy_x_2 + happy_x_1 + = case happyOut20 happy_x_1 of { happy_var_1 -> + case happyOut22 happy_x_2 of { happy_var_2 -> + case happyOut21 happy_x_3 of { happy_var_3 -> + happyIn19 + ((Just happy_var_1,happy_var_2,happy_var_3) + )}}} + +happyReduce_28 = happySpecReduce_2 15# happyReduction_28 +happyReduction_28 happy_x_2 + happy_x_1 + = case happyOut22 happy_x_1 of { happy_var_1 -> + case happyOut21 happy_x_2 of { happy_var_2 -> + happyIn19 + ((Nothing,happy_var_1,happy_var_2) + )}} + +happyReduce_29 = happySpecReduce_1 16# happyReduction_29 +happyReduction_29 happy_x_1 + = happyIn20 + (charSetSingleton '\n' + ) + +happyReduce_30 = happySpecReduce_2 16# happyReduction_30 +happyReduction_30 happy_x_2 + happy_x_1 + = case happyOut27 happy_x_1 of { happy_var_1 -> + happyIn20 + (happy_var_1 + )} + +happyReduce_31 = happySpecReduce_1 17# happyReduction_31 +happyReduction_31 happy_x_1 + = happyIn21 + (RightContextRExp (Ch (charSetSingleton '\n')) + ) + +happyReduce_32 = happySpecReduce_2 17# happyReduction_32 +happyReduction_32 happy_x_2 + happy_x_1 + = case happyOut22 happy_x_2 of { happy_var_2 -> + happyIn21 + (RightContextRExp happy_var_2 + )} + +happyReduce_33 = happySpecReduce_2 17# happyReduction_33 +happyReduction_33 happy_x_2 + happy_x_1 + = case happyOutTok happy_x_2 of { happy_var_2 -> + happyIn21 + (RightContextCode (case happy_var_2 of + T _ (CodeT code) -> code) + )} + +happyReduce_34 = happySpecReduce_0 17# happyReduction_34 +happyReduction_34 = happyIn21 + (NoRightContext + ) + +happyReduce_35 = happySpecReduce_3 18# happyReduction_35 +happyReduction_35 happy_x_3 + happy_x_2 + happy_x_1 + = case happyOut23 happy_x_1 of { happy_var_1 -> + case happyOut22 happy_x_3 of { happy_var_3 -> + happyIn22 + (happy_var_1 :| happy_var_3 + )}} + +happyReduce_36 = happySpecReduce_1 18# happyReduction_36 +happyReduction_36 happy_x_1 + = case happyOut23 happy_x_1 of { happy_var_1 -> + happyIn22 + (happy_var_1 + )} + +happyReduce_37 = happySpecReduce_2 19# happyReduction_37 +happyReduction_37 happy_x_2 + happy_x_1 + = case happyOut23 happy_x_1 of { happy_var_1 -> + case happyOut24 happy_x_2 of { happy_var_2 -> + happyIn23 + (happy_var_1 :%% happy_var_2 + )}} + +happyReduce_38 = happySpecReduce_1 19# happyReduction_38 +happyReduction_38 happy_x_1 + = case happyOut24 happy_x_1 of { happy_var_1 -> + happyIn23 + (happy_var_1 + )} + +happyReduce_39 = happySpecReduce_2 20# happyReduction_39 +happyReduction_39 happy_x_2 + happy_x_1 + = case happyOut26 happy_x_1 of { happy_var_1 -> + case happyOut25 happy_x_2 of { happy_var_2 -> + happyIn24 + (happy_var_2 happy_var_1 + )}} + +happyReduce_40 = happySpecReduce_1 20# happyReduction_40 +happyReduction_40 happy_x_1 + = case happyOut26 happy_x_1 of { happy_var_1 -> + happyIn24 + (happy_var_1 + )} + +happyReduce_41 = happySpecReduce_1 21# happyReduction_41 +happyReduction_41 happy_x_1 + = happyIn25 + (Star + ) + +happyReduce_42 = happySpecReduce_1 21# happyReduction_42 +happyReduction_42 happy_x_1 + = happyIn25 + (Plus + ) + +happyReduce_43 = happySpecReduce_1 21# happyReduction_43 +happyReduction_43 happy_x_1 + = happyIn25 + (Ques + ) + +happyReduce_44 = happySpecReduce_3 21# happyReduction_44 +happyReduction_44 happy_x_3 + happy_x_2 + happy_x_1 + = case happyOutTok happy_x_2 of { (T _ (CharT happy_var_2)) -> + happyIn25 + (repeat_rng (digit happy_var_2) Nothing + )} + +happyReduce_45 = happyReduce 4# 21# happyReduction_45 +happyReduction_45 (happy_x_4 `HappyStk` + happy_x_3 `HappyStk` + happy_x_2 `HappyStk` + happy_x_1 `HappyStk` + happyRest) + = case happyOutTok happy_x_2 of { (T _ (CharT happy_var_2)) -> + happyIn25 + (repeat_rng (digit happy_var_2) (Just Nothing) + ) `HappyStk` happyRest} + +happyReduce_46 = happyReduce 5# 21# happyReduction_46 +happyReduction_46 (happy_x_5 `HappyStk` + happy_x_4 `HappyStk` + happy_x_3 `HappyStk` + happy_x_2 `HappyStk` + happy_x_1 `HappyStk` + happyRest) + = case happyOutTok happy_x_2 of { (T _ (CharT happy_var_2)) -> + case happyOutTok happy_x_4 of { (T _ (CharT happy_var_4)) -> + happyIn25 + (repeat_rng (digit happy_var_2) (Just (Just (digit happy_var_4))) + ) `HappyStk` happyRest}} + +happyReduce_47 = happySpecReduce_2 22# happyReduction_47 +happyReduction_47 happy_x_2 + happy_x_1 + = happyIn26 + (Eps + ) + +happyReduce_48 = happySpecReduce_1 22# happyReduction_48 +happyReduction_48 happy_x_1 + = case happyOutTok happy_x_1 of { (T _ (StringT happy_var_1)) -> + happyIn26 + (foldr (:%%) Eps + (map (Ch . charSetSingleton) happy_var_1) + )} + +happyReduce_49 = happyMonadReduce 1# 22# happyReduction_49 +happyReduction_49 (happy_x_1 `HappyStk` + happyRest) tk + = happyThen (case happyOutTok happy_x_1 of { (T _ (RMacT happy_var_1)) -> + ( lookupRMac happy_var_1)} + ) (\r -> happyReturn (happyIn26 r)) + +happyReduce_50 = happySpecReduce_1 22# happyReduction_50 +happyReduction_50 happy_x_1 + = case happyOut27 happy_x_1 of { happy_var_1 -> + happyIn26 + (Ch happy_var_1 + )} + +happyReduce_51 = happySpecReduce_3 22# happyReduction_51 +happyReduction_51 happy_x_3 + happy_x_2 + happy_x_1 + = case happyOut22 happy_x_2 of { happy_var_2 -> + happyIn26 + (happy_var_2 + )} + +happyReduce_52 = happySpecReduce_3 23# happyReduction_52 +happyReduction_52 happy_x_3 + happy_x_2 + happy_x_1 + = case happyOut27 happy_x_1 of { happy_var_1 -> + case happyOut28 happy_x_3 of { happy_var_3 -> + happyIn27 + (happy_var_1 `charSetMinus` happy_var_3 + )}} + +happyReduce_53 = happySpecReduce_1 23# happyReduction_53 +happyReduction_53 happy_x_1 + = case happyOut28 happy_x_1 of { happy_var_1 -> + happyIn27 + (happy_var_1 + )} + +happyReduce_54 = happySpecReduce_1 24# happyReduction_54 +happyReduction_54 happy_x_1 + = case happyOutTok happy_x_1 of { (T _ (CharT happy_var_1)) -> + happyIn28 + (charSetSingleton happy_var_1 + )} + +happyReduce_55 = happySpecReduce_3 24# happyReduction_55 +happyReduction_55 happy_x_3 + happy_x_2 + happy_x_1 + = case happyOutTok happy_x_1 of { (T _ (CharT happy_var_1)) -> + case happyOutTok happy_x_3 of { (T _ (CharT happy_var_3)) -> + happyIn28 + (charSetRange happy_var_1 happy_var_3 + )}} + +happyReduce_56 = happyMonadReduce 1# 24# happyReduction_56 +happyReduction_56 (happy_x_1 `HappyStk` + happyRest) tk + = happyThen (case happyOut30 happy_x_1 of { happy_var_1 -> + ( lookupSMac happy_var_1)} + ) (\r -> happyReturn (happyIn28 r)) + +happyReduce_57 = happySpecReduce_3 24# happyReduction_57 +happyReduction_57 happy_x_3 + happy_x_2 + happy_x_1 + = case happyOut29 happy_x_2 of { happy_var_2 -> + happyIn28 + (foldr charSetUnion emptyCharSet happy_var_2 + )} + +happyReduce_58 = happyMonadReduce 4# 24# happyReduction_58 +happyReduction_58 (happy_x_4 `HappyStk` + happy_x_3 `HappyStk` + happy_x_2 `HappyStk` + happy_x_1 `HappyStk` + happyRest) tk + = happyThen (case happyOutTok happy_x_1 of { happy_var_1 -> + case happyOut29 happy_x_3 of { happy_var_3 -> + ( do { dot <- lookupSMac (tokPosn happy_var_1, "."); + return (dot `charSetMinus` + foldr charSetUnion emptyCharSet happy_var_3) })}} + ) (\r -> happyReturn (happyIn28 r)) + +happyReduce_59 = happyMonadReduce 2# 24# happyReduction_59 +happyReduction_59 (happy_x_2 `HappyStk` + happy_x_1 `HappyStk` + happyRest) tk + = happyThen (case happyOutTok happy_x_1 of { happy_var_1 -> + case happyOut28 happy_x_2 of { happy_var_2 -> + ( do { dot <- lookupSMac (tokPosn happy_var_1, "."); + return (dot `charSetMinus` happy_var_2) })}} + ) (\r -> happyReturn (happyIn28 r)) + +happyReduce_60 = happySpecReduce_2 25# happyReduction_60 +happyReduction_60 happy_x_2 + happy_x_1 + = case happyOut27 happy_x_1 of { happy_var_1 -> + case happyOut29 happy_x_2 of { happy_var_2 -> + happyIn29 + (happy_var_1 : happy_var_2 + )}} + +happyReduce_61 = happySpecReduce_0 25# happyReduction_61 +happyReduction_61 = happyIn29 + ([] + ) + +happyReduce_62 = happySpecReduce_1 26# happyReduction_62 +happyReduction_62 happy_x_1 + = case happyOutTok happy_x_1 of { happy_var_1 -> + happyIn30 + ((tokPosn happy_var_1, ".") + )} + +happyReduce_63 = happySpecReduce_1 26# happyReduction_63 +happyReduction_63 happy_x_1 + = case happyOutTok happy_x_1 of { happy_var_1 -> + happyIn30 + (case happy_var_1 of T p (SMacT s) -> (p, s) + )} + +happyNewToken action sts stk + = lexer(\tk -> + let cont i = happyDoAction i tk action sts stk in + case tk of { + T _ EOFT -> happyDoAction 33# tk action sts stk; + T _ (SpecialT '.') -> cont 1#; + T _ (SpecialT ';') -> cont 2#; + T _ (SpecialT '<') -> cont 3#; + T _ (SpecialT '>') -> cont 4#; + T _ (SpecialT ',') -> cont 5#; + T _ (SpecialT '$') -> cont 6#; + T _ (SpecialT '|') -> cont 7#; + T _ (SpecialT '*') -> cont 8#; + T _ (SpecialT '+') -> cont 9#; + T _ (SpecialT '?') -> cont 10#; + T _ (SpecialT '{') -> cont 11#; + T _ (SpecialT '}') -> cont 12#; + T _ (SpecialT '(') -> cont 13#; + T _ (SpecialT ')') -> cont 14#; + T _ (SpecialT '#') -> cont 15#; + T _ (SpecialT '~') -> cont 16#; + T _ (SpecialT '-') -> cont 17#; + T _ (SpecialT '[') -> cont 18#; + T _ (SpecialT ']') -> cont 19#; + T _ (SpecialT '^') -> cont 20#; + T _ (SpecialT '/') -> cont 21#; + T _ ZeroT -> cont 22#; + T _ (StringT happy_dollar_dollar) -> cont 23#; + T _ (BindT happy_dollar_dollar) -> cont 24#; + T _ (IdT happy_dollar_dollar) -> cont 25#; + T _ (CodeT _) -> cont 26#; + T _ (CharT happy_dollar_dollar) -> cont 27#; + T _ (SMacT _) -> cont 28#; + T _ (RMacT happy_dollar_dollar) -> cont 29#; + T _ (SMacDefT happy_dollar_dollar) -> cont 30#; + T _ (RMacDefT happy_dollar_dollar) -> cont 31#; + T _ WrapperT -> cont 32#; + _ -> happyError' tk + }) + +happyError_ tk = happyError' tk + +happyThen :: () => P a -> (a -> P b) -> P b +happyThen = ((>>=)) +happyReturn :: () => a -> P a +happyReturn = (return) +happyThen1 = happyThen +happyReturn1 :: () => a -> P a +happyReturn1 = happyReturn +happyError' :: () => (Token) -> P a +happyError' tk = (\token -> happyError) tk + +parse = happySomeParser where + happySomeParser = happyThen (happyParse 0#) (\x -> happyReturn (happyOut4 x)) + +happySeq = happyDontSeq + + +happyError :: P a +happyError = failP "parse error" + +-- ----------------------------------------------------------------------------- +-- Utils + +digit c = ord c - ord '0' + +repeat_rng :: Int -> Maybe (Maybe Int) -> (RExp->RExp) +repeat_rng n (Nothing) re = foldr (:%%) Eps (replicate n re) +repeat_rng n (Just Nothing) re = foldr (:%%) (Star re) (replicate n re) +repeat_rng n (Just (Just m)) re = intl :%% rst + where + intl = repeat_rng n Nothing re + rst = foldr (\re re'->Ques(re :%% re')) Eps (replicate (m-n) re) + +replaceCodes codes rectx = rectx{ reCtxStartCodes = codes } +{-# LINE 1 "templates\GenericTemplate.hs" #-} +{-# LINE 1 "templates\\GenericTemplate.hs" #-} +{-# LINE 1 "<built-in>" #-} +{-# LINE 1 "<command-line>" #-} +{-# LINE 1 "templates\\GenericTemplate.hs" #-} +-- Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp + +{-# LINE 30 "templates\\GenericTemplate.hs" #-} + + +data Happy_IntList = HappyCons Happy_GHC_Exts.Int# Happy_IntList + + + + + +{-# LINE 51 "templates\\GenericTemplate.hs" #-} + +{-# LINE 61 "templates\\GenericTemplate.hs" #-} + +{-# LINE 70 "templates\\GenericTemplate.hs" #-} + +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 0#, 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 i tk st + -1# -> {- nothing -} + happyAccept i tk st + n | (n Happy_GHC_Exts.<# (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) = indexShortOffAddr happyActOffsets st + (off_i) = (off Happy_GHC_Exts.+# i) + check = if (off_i Happy_GHC_Exts.>=# (0# :: Happy_GHC_Exts.Int#)) + then (indexShortOffAddr happyCheck off_i Happy_GHC_Exts.==# i) + else False + (action) + | check = indexShortOffAddr happyTable off_i + | otherwise = indexShortOffAddr happyDefActions st + +{-# LINE 130 "templates\\GenericTemplate.hs" #-} + + +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# + + + + + +data HappyAddr = HappyA# Happy_GHC_Exts.Addr# + + + + +----------------------------------------------------------------------------- +-- HappyState data type (not arrays) + +{-# LINE 163 "templates\\GenericTemplate.hs" #-} + +----------------------------------------------------------------------------- +-- 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 = + happyThen1 (fn stk tk) (\r -> happyGoto nt j tk st1 sts1 (r `HappyStk` drop_stk)) + where (sts1@((HappyCons (st1@(action)) (_)))) = happyDrop k (HappyCons (st) (sts)) + drop_stk = happyDropStk k 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 = + happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk)) + where (sts1@((HappyCons (st1@(action)) (_)))) = happyDrop k (HappyCons (st) (sts)) + drop_stk = happyDropStk k stk + + (off) = indexShortOffAddr happyGotoOffsets st1 + (off_i) = (off Happy_GHC_Exts.+# nt) + (new_state) = indexShortOffAddr happyTable off_i + + + + +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) = indexShortOffAddr happyGotoOffsets st + (off_i) = (off Happy_GHC_Exts.+# nt) + (new_state) = indexShortOffAddr happyTable off_i + + + + +----------------------------------------------------------------------------- +-- Error recovery (0# is the error token) + +-- parse error if we are in recovery and we fail again +happyFail 0# tk old_st _ stk = +-- trace "failing" $ + happyError_ 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 0# tk old_st (HappyCons ((action)) (sts)) + (saved_tok `HappyStk` _ `HappyStk` stk) = +-- trace ("discarding state, depth " ++ show (length stk)) $ + happyDoAction 0# tk action sts ((saved_tok`HappyStk`stk)) +-} + +-- Enter error recovery: generate an error token, +-- save the old token and carry on. +happyFail 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.
dist/build/Scan.hs view
@@ -1,408 +1,407 @@-{-# LANGUAGE CPP,MagicHash #-}-{-# LINE 13 "src/Scan.x" #-}--{-# OPTIONS_GHC -w #-}-{-# LANGUAGE BangPatterns #-}--module Scan(lexer, AlexPosn(..), Token(..), Tkn(..), tokPosn) where--import Data.Char-import ParseMonad---import Debug.Trace--#if __GLASGOW_HASKELL__ >= 603-#include "ghcconfig.h"-#elif defined(__GLASGOW_HASKELL__)-#include "config.h"-#endif-#if __GLASGOW_HASKELL__ >= 503-import Data.Array-import Data.Char (ord)-import Data.Array.Base (unsafeAt)-#else-import Array-import Char (ord)-#endif-#if __GLASGOW_HASKELL__ >= 503-import GHC.Exts-#else-import GlaExts-#endif-alex_base :: AlexAddr-alex_base = AlexA# "\xf8\xff\xff\xff\x6e\x00\x00\x00\x89\x00\x00\x00\x77\x00\x00\x00\xfc\xff\xff\xff\xfd\xff\xff\xff\xdb\xff\xff\xff\xdc\xff\xff\xff\x00\x00\x00\x00\x7b\x00\x00\x00\x7c\x00\x00\x00\x00\x00\x00\x00\x72\x00\x00\x00\xdd\xff\xff\xff\x73\x00\x00\x00\xde\xff\xff\xff\xfb\x00\x00\x00\x6d\x01\x00\x00\x00\x01\x00\x00\x74\x00\x00\x00\x75\x00\x00\x00\xdf\xff\xff\xff\x00\x00\x00\x00\x8a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa7\x01\x00\x00\x00\x00\x00\x00\x96\xff\xff\xff\x9c\xff\xff\xff\xae\xff\xff\xff\xa0\xff\xff\xff\xa1\xff\xff\xff\xad\xff\xff\xff\xa2\xff\xff\xff\xde\x00\x00\x00\x4b\x01\x00\x00\x03\x02\x00\x00\x52\x02\x00\x00\x69\x02\x00\x00\x71\x00\x00\x00\x55\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8f\x02\x00\x00\x02\x03\x00\x00\x74\x03\x00\x00\x83\x02\x00\x00\xc8\x03\x00\x00\x1c\x04\x00\x00\x59\x04\x00\x00\xcb\x04\x00\x00\x3d\x05\x00\x00\xaf\x05\x00\x00\xad\x05\x00\x00\x01\x06\x00\x00\x3e\x06\x00\x00\x00\x00\x00\x00\x87\x00\x00\x00\x8c\x01\x00\x00\xa7\x00\x00\x00\xa8\x00\x00\x00\xe6\xff\xff\xff\x00\x00\x00\x00\xa9\x00\x00\x00\x21\x03\x00\x00\xaa\x00\x00\x00\x19\x01\x00\x00\xe8\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x92\x06\x00\x00\xe6\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe0\x02\x00\x00"#--alex_table :: AlexAddr-alex_table = AlexA# "\x00\x00\x03\x00\x03\x00\x03\x00\x03\x00\x03\x00\xff\xff\xff\xff\x04\x00\x04\x00\x0b\x00\x0b\x00\x13\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x3c\x00\x1b\x00\x42\x00\x00\x00\x00\x00\x03\x00\x2b\x00\x09\x00\x19\x00\x1a\x00\x1c\x00\x2b\x00\x2b\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x07\x00\x19\x00\x19\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x0f\x00\x19\x00\x45\x00\x2b\x00\x2b\x00\x19\x00\x2c\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x19\x00\x25\x00\x19\x00\x19\x00\x2b\x00\x2b\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x16\x00\x19\x00\x19\x00\x19\x00\x03\x00\x03\x00\x03\x00\x03\x00\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\x03\x00\x03\x00\x03\x00\x03\x00\x03\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\xff\xff\x03\x00\x03\x00\x03\x00\x03\x00\x03\x00\x03\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x08\x00\x08\x00\x00\x00\x0c\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x03\x00\x00\x00\x00\x00\x0e\x00\x0e\x00\x0e\x00\x0e\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\x06\x00\x00\x00\x00\x00\x46\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3a\x00\x00\x00\x00\x00\x4a\x00\x00\x00\x00\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x3a\x00\x3a\x00\x40\x00\x40\x00\x00\x00\x4c\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x00\x00\x00\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12\x00\x00\x00\x11\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x00\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0d\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x40\x00\x00\x00\x00\x00\x00\x00\x11\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x15\x00\x00\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3b\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x00\x00\x39\x00\x00\x00\x00\x00\x11\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x32\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x29\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x27\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x00\x00\x00\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x3b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x3e\x00\x00\x00\x00\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x39\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x38\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2e\x00\x41\x00\x41\x00\x41\x00\x41\x00\x41\x00\x3e\x00\x00\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x00\x00\x00\x00\x00\x00\x39\x00\x00\x00\x41\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x00\x00\x3f\x00\x00\x00\x00\x00\x2e\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x3b\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\x3b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3e\x00\x00\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x00\x00\x00\x00\x00\x00\x39\x00\x00\x00\x00\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2e\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x2f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x00\x00\x2f\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x41\x00\x41\x00\x41\x00\x41\x00\x41\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\x41\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x00\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x00\x00\x00\x00\x00\x00\x3f\x00\x00\x00\x00\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x34\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x41\x00\x41\x00\x41\x00\x41\x00\x41\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\x41\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x00\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x00\x00\x00\x00\x00\x00\x3f\x00\x00\x00\x00\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x34\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x41\x00\x41\x00\x41\x00\x41\x00\x41\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\x41\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3f\x00\x00\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x00\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x35\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x00\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x00\x00\x35\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\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\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\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\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\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"#--alex_check :: AlexAddr-alex_check = AlexA# "\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0a\x00\x0a\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x77\x00\x72\x00\x61\x00\x70\x00\x70\x00\x65\x00\x2d\x00\x72\x00\x2d\x00\xff\xff\xff\xff\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0a\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\x0a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x20\x00\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\x22\x00\x22\x00\xff\xff\x2d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x20\x00\xff\xff\xff\xff\x3a\x00\x3a\x00\x3a\x00\x3a\x00\xff\xff\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x2c\x00\x2d\x00\xff\xff\xff\xff\x30\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3d\x00\xff\xff\xff\xff\x3e\x00\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\xff\xff\x7b\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x27\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x3a\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x3d\x00\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\x3d\x00\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x2d\x00\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\x20\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\x3d\x00\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\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\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x27\x00\xff\xff\x7d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\xff\xff\x7d\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\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\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\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\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\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\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x27\x00\xff\xff\x7d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\xff\xff\x7d\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\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\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\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\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\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"#--alex_deflt :: AlexAddr-alex_deflt = AlexA# "\xff\xff\xff\xff\xff\xff\xff\xff\x05\x00\x05\x00\xff\xff\xff\xff\xff\xff\x0a\x00\x0a\x00\xff\xff\x14\x00\xff\xff\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\x14\x00\x14\x00\xff\xff\xff\xff\x18\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\xff\xff\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\x3d\x00\x3d\x00\xff\xff\xff\xff\x43\x00\xff\xff\x43\x00\x43\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4b\x00"#--alex_accept = listArray (0::Int,76) [[],[(AlexAcc (alex_action_21))],[],[(AlexAcc (alex_action_0))],[(AlexAcc (alex_action_0))],[(AlexAcc (alex_action_0))],[],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_1))],[(AlexAcc (alex_action_10))],[],[(AlexAcc (alex_action_2))],[(AlexAcc (alex_action_2))],[],[],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_10))],[],[],[],[],[],[(AlexAccPred (alex_action_3) (alexRightContext 23)),(AlexAcc (alex_action_4))],[],[(AlexAccSkip)],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_5))],[],[],[],[],[],[],[],[(AlexAcc (alex_action_6))],[(AlexAcc (alex_action_6))],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_7))],[(AlexAcc (alex_action_9))],[(AlexAcc (alex_action_8))],[(AlexAcc (alex_action_9))],[(AlexAcc (alex_action_9))],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_11))],[(AlexAcc (alex_action_11))],[(AlexAcc (alex_action_11))],[],[],[],[(AlexAcc (alex_action_12))],[(AlexAcc (alex_action_12))],[(AlexAcc (alex_action_12))],[],[],[],[(AlexAcc (alex_action_13))],[(AlexAcc (alex_action_13))],[],[],[],[],[(AlexAcc (alex_action_14))],[(AlexAcc (alex_action_14))],[],[],[],[],[(AlexAcc (alex_action_15))],[(AlexAcc (alex_action_16))],[(AlexAcc (alex_action_17))],[(AlexAcc (alex_action_17))],[(AlexAcc (alex_action_18))],[(AlexAcc (alex_action_19))],[(AlexAcc (alex_action_20))],[]]-{-# LINE 76 "src/Scan.x" #-}----- -------------------------------------------------------------------------------- Token type--data Token = T AlexPosn Tkn- deriving Show--tokPosn (T p _) = p--data Tkn- = SpecialT Char- | CodeT String- | ZeroT- | IdT String- | StringT String- | BindT String- | CharT Char- | SMacT String- | RMacT String - | SMacDefT String- | RMacDefT String - | NumT Int - | WrapperT- | EOFT- deriving Show---- -------------------------------------------------------------------------------- Token functions--special (p,_,str) ln = return $ T p (SpecialT (head str))-zero (p,_,str) ln = return $ T p ZeroT-string (p,_,str) ln = return $ T p (StringT (extract ln str))-bind (p,_,str) ln = return $ T p (BindT (takeWhile isIdChar str))-escape (p,_,str) ln = return $ T p (CharT (esc str))-decch (p,_,str) ln = return $ T p (CharT (do_ech 10 ln (take (ln-1) (tail str))))-hexch (p,_,str) ln = return $ T p (CharT (do_ech 16 ln (take (ln-2) (drop 2 str))))-octch (p,_,str) ln = return $ T p (CharT (do_ech 8 ln (take (ln-2) (drop 2 str))))-char (p,_,str) ln = return $ T p (CharT (head str))-smac (p,_,str) ln = return $ T p (SMacT (mac ln str))-rmac (p,_,str) ln = return $ T p (RMacT (mac ln str))-smacdef (p,_,str) ln = return $ T p (SMacDefT (macdef ln str))-rmacdef (p,_,str) ln = return $ T p (RMacDefT (macdef ln str))-startcode (p,_,str) ln = return $ T p (IdT (take ln str))-wrapper (p,_,str) ln = return $ T p WrapperT--isIdChar c = isAlphaNum c || c `elem` "_'"--extract ln str = take (ln-2) (tail str)- -do_ech radix ln str = chr (parseInt radix str)--mac ln (_ : str) = take (ln-1) str--macdef ln (_ : str) = takeWhile (not.isSpace) str--esc (_ : x : _) =- case x of- 'a' -> '\a'- 'b' -> '\b'- 'f' -> '\f'- 'n' -> '\n'- 'r' -> '\r'- 't' -> '\t'- 'v' -> '\v'- c -> c--parseInt :: Int -> String -> Int-parseInt radix ds = foldl1 (\n d -> n * radix + d) (map digitToInt ds)---- In brace-delimited code, we have to be careful to match braces--- within the code, but ignore braces inside strings and character--- literals. We do an approximate job (doing it properly requires--- implementing a large chunk of the Haskell lexical syntax).--code (p,_,inp) len = do- inp <- getInput- go inp 1 ""- where- go inp 0 cs = do- setInput inp- return (T p (CodeT (reverse (tail cs))))- go inp n cs = do- case alexGetChar inp of- Nothing -> err inp- Just (c,inp) -> - case c of- '{' -> go inp (n+1) (c:cs) - '}' -> go inp (n-1) (c:cs)- '\'' -> go_char inp n (c:cs)- '\"' -> go_str inp n (c:cs) '\"'- c -> go inp n (c:cs)-- -- try to catch occurrences of ' within an identifier- go_char inp n (c1:c2:cs) | isAlphaNum c2 = go inp n (c1:c2:cs)- go_char inp n cs = go_str inp n cs '\''-- go_str inp n cs end = do- case alexGetChar inp of- Nothing -> err inp- Just (c,inp)- | c == end -> go inp n (c:cs)- | otherwise -> - case c of- '\\' -> case alexGetChar inp of- Nothing -> err inp- Just (d,inp) -> go_str inp n (d:c:cs) end- c -> go_str inp n (c:cs) end-- err inp = do setInput inp; lexError "lexical error in code fragment"- ---lexError s = do- (p,_,input) <- getInput- failP (s ++ (if (not (null input))- then " at " ++ show (head input)- else " at end of file"))--lexer :: (Token -> P a) -> P a-lexer cont = lexToken >>= cont--lexToken :: P Token-lexToken = do- inp@(p,_,_) <- getInput- sc <- getStartCode- case alexScan inp sc of- AlexEOF -> return (T p EOFT)- AlexError _ -> lexError "lexical error"- AlexSkip inp1 len -> do- setInput inp1- lexToken- AlexToken inp1 len t -> do- setInput inp1- t inp len--type Action = AlexInput -> Int -> P Token--skip :: Action-skip _ _ = lexToken--andBegin :: Action -> StartCode -> Action-andBegin act sc inp len = setStartCode sc >> act inp len---afterstartcodes,startcodes :: Int-afterstartcodes = 1-startcodes = 2-alex_action_0 = skip -alex_action_1 = string -alex_action_2 = bind -alex_action_3 = code -alex_action_4 = special -alex_action_5 = wrapper -alex_action_6 = decch -alex_action_7 = hexch -alex_action_8 = octch -alex_action_9 = escape -alex_action_10 = char -alex_action_11 = smac -alex_action_12 = rmac -alex_action_13 = smacdef -alex_action_14 = rmacdef -alex_action_15 = special `andBegin` startcodes -alex_action_16 = zero -alex_action_17 = startcode -alex_action_18 = special -alex_action_19 = special `andBegin` afterstartcodes -alex_action_20 = special `andBegin` 0 -alex_action_21 = skip `andBegin` 0 -{-# LINE 1 "templates/GenericTemplate.hs" #-}-{-# LINE 1 "templates/GenericTemplate.hs" #-}-{-# LINE 1 "<built-in>" #-}-{-# LINE 1 "<command-line>" #-}-{-# LINE 1 "templates/GenericTemplate.hs" #-}--- -------------------------------------------------------------------------------- ALEX TEMPLATE------ This code is in the PUBLIC DOMAIN; you may copy it freely and use--- it for any purpose whatsoever.---- -------------------------------------------------------------------------------- INTERNALS and main scanner engine--{-# LINE 37 "templates/GenericTemplate.hs" #-}--{-# LINE 47 "templates/GenericTemplate.hs" #-}---data AlexAddr = AlexA# Addr#--#if __GLASGOW_HASKELL__ < 503-uncheckedShiftL# = shiftL#-#endif--{-# INLINE alexIndexInt16OffAddr #-}-alexIndexInt16OffAddr (AlexA# arr) off =-#ifdef WORDS_BIGENDIAN- narrow16Int# i- where- i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)- high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))- low = int2Word# (ord# (indexCharOffAddr# arr off'))- off' = off *# 2#-#else- indexInt16OffAddr# arr off-#endif------{-# INLINE alexIndexInt32OffAddr #-}-alexIndexInt32OffAddr (AlexA# arr) off = -#ifdef WORDS_BIGENDIAN- narrow32Int# i- where- i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#`- (b2 `uncheckedShiftL#` 16#) `or#`- (b1 `uncheckedShiftL#` 8#) `or#` b0)- b3 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#)))- b2 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#)))- b1 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))- b0 = int2Word# (ord# (indexCharOffAddr# arr off'))- off' = off *# 4#-#else- indexInt32OffAddr# arr off-#endif------#if __GLASGOW_HASKELL__ < 503-quickIndex arr i = arr ! i-#else--- GHC >= 503, unsafeAt is available from Data.Array.Base.-quickIndex = unsafeAt-#endif------- -------------------------------------------------------------------------------- Main lexing routines--data AlexReturn a- = AlexEOF- | AlexError !AlexInput- | AlexSkip !AlexInput !Int- | AlexToken !AlexInput !Int a---- alexScan :: AlexInput -> StartCode -> AlexReturn a-alexScan input (I# (sc))- = alexScanUser undefined input (I# (sc))--alexScanUser user input (I# (sc))- = case alex_scan_tkn user input 0# input sc AlexNone of- (AlexNone, input') ->- case alexGetChar input of- Nothing -> ---- AlexEOF- Just _ ->---- AlexError input'-- (AlexLastSkip input'' len, _) ->---- AlexSkip input'' len-- (AlexLastAcc k input''' len, _) ->---- AlexToken input''' len k----- Push the input through the DFA, remembering the most recent accepting--- state it encountered.--alex_scan_tkn user orig_input len input s last_acc =- input `seq` -- strict in the input- let - new_acc = check_accs (alex_accept `quickIndex` (I# (s)))- in- new_acc `seq`- case alexGetChar input of- Nothing -> (new_acc, input)- Just (c, new_input) -> ---- let- (base) = alexIndexInt32OffAddr alex_base s- ((I# (ord_c))) = ord c- (offset) = (base +# ord_c)- (check) = alexIndexInt16OffAddr alex_check offset- - (new_s) = if (offset >=# 0#) && (check ==# ord_c)- then alexIndexInt16OffAddr alex_table offset- else alexIndexInt16OffAddr alex_deflt s- in- case new_s of - -1# -> (new_acc, input)- -- on an error, we want to keep the input *before* the- -- character that failed, not after.- _ -> alex_scan_tkn user orig_input (len +# 1#) - new_input new_s new_acc-- where- check_accs [] = last_acc- check_accs (AlexAcc a : _) = AlexLastAcc a input (I# (len))- check_accs (AlexAccSkip : _) = AlexLastSkip input (I# (len))- check_accs (AlexAccPred a predx : rest)- | predx user orig_input (I# (len)) input- = AlexLastAcc a input (I# (len))- check_accs (AlexAccSkipPred predx : rest)- | predx user orig_input (I# (len)) input- = AlexLastSkip input (I# (len))- check_accs (_ : rest) = check_accs rest--data AlexLastAcc a- = AlexNone- | AlexLastAcc a !AlexInput !Int- | AlexLastSkip !AlexInput !Int--data AlexAcc a user- = AlexAcc a- | AlexAccSkip- | AlexAccPred a (AlexAccPred user)- | AlexAccSkipPred (AlexAccPred user)--type AlexAccPred user = user -> AlexInput -> Int -> AlexInput -> Bool---- -------------------------------------------------------------------------------- Predicates on a rule--alexAndPred p1 p2 user in1 len in2- = p1 user in1 len in2 && p2 user in1 len in2----alexPrevCharIsPred :: Char -> AlexAccPred _ -alexPrevCharIs c _ input _ _ = c == alexInputPrevChar input----alexPrevCharIsOneOfPred :: Array Char Bool -> AlexAccPred _ -alexPrevCharIsOneOf arr _ input _ _ = arr ! alexInputPrevChar input----alexRightContext :: Int -> AlexAccPred _-alexRightContext (I# (sc)) user _ _ input = - case alex_scan_tkn user input 0# input sc AlexNone of- (AlexNone, _) -> False- _ -> True- -- TODO: there's no need to find the longest- -- match when checking the right context, just- -- the first match will do.---- used by wrappers-iUnbox (I# (i)) = i+{-# LANGUAGE CPP,MagicHash #-} +{-# LINE 13 "src\Scan.x" #-} + +{-# OPTIONS_GHC -w #-} + +module Scan(lexer, AlexPosn(..), Token(..), Tkn(..), tokPosn) where + +import Data.Char +import ParseMonad +--import Debug.Trace + +#if __GLASGOW_HASKELL__ >= 603 +#include "ghcconfig.h" +#elif defined(__GLASGOW_HASKELL__) +#include "config.h" +#endif +#if __GLASGOW_HASKELL__ >= 503 +import Data.Array +import Data.Char (ord) +import Data.Array.Base (unsafeAt) +#else +import Array +import Char (ord) +#endif +#if __GLASGOW_HASKELL__ >= 503 +import GHC.Exts +#else +import GlaExts +#endif +alex_base :: AlexAddr +alex_base = AlexA# "\xf8\xff\xff\xff\x6e\x00\x00\x00\x89\x00\x00\x00\x77\x00\x00\x00\xfc\xff\xff\xff\xfd\xff\xff\xff\xdb\xff\xff\xff\xdc\xff\xff\xff\x00\x00\x00\x00\x7b\x00\x00\x00\x7c\x00\x00\x00\x00\x00\x00\x00\x72\x00\x00\x00\xdd\xff\xff\xff\x73\x00\x00\x00\xde\xff\xff\xff\xfb\x00\x00\x00\x6d\x01\x00\x00\x00\x01\x00\x00\x74\x00\x00\x00\x75\x00\x00\x00\xdf\xff\xff\xff\x00\x00\x00\x00\x8a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa7\x01\x00\x00\x00\x00\x00\x00\x96\xff\xff\xff\x9c\xff\xff\xff\xae\xff\xff\xff\xa0\xff\xff\xff\xa1\xff\xff\xff\xad\xff\xff\xff\xa2\xff\xff\xff\xde\x00\x00\x00\x4b\x01\x00\x00\x03\x02\x00\x00\x52\x02\x00\x00\x69\x02\x00\x00\x71\x00\x00\x00\x55\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8f\x02\x00\x00\x02\x03\x00\x00\x74\x03\x00\x00\x83\x02\x00\x00\xc8\x03\x00\x00\x1c\x04\x00\x00\x59\x04\x00\x00\xcb\x04\x00\x00\x3d\x05\x00\x00\xaf\x05\x00\x00\xad\x05\x00\x00\x01\x06\x00\x00\x3e\x06\x00\x00\x00\x00\x00\x00\x87\x00\x00\x00\x8c\x01\x00\x00\xa7\x00\x00\x00\xa8\x00\x00\x00\xe6\xff\xff\xff\x00\x00\x00\x00\xa9\x00\x00\x00\x21\x03\x00\x00\xaa\x00\x00\x00\x19\x01\x00\x00\xe8\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x92\x06\x00\x00\xe6\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe0\x02\x00\x00"# + +alex_table :: AlexAddr +alex_table = AlexA# "\x00\x00\x03\x00\x03\x00\x03\x00\x03\x00\x03\x00\xff\xff\xff\xff\x04\x00\x04\x00\x0b\x00\x0b\x00\x13\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x3c\x00\x1b\x00\x42\x00\x00\x00\x00\x00\x03\x00\x2b\x00\x09\x00\x19\x00\x1a\x00\x1c\x00\x2b\x00\x2b\x00\x19\x00\x19\x00\x19\x00\x19\x00\x19\x00\x07\x00\x19\x00\x19\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x2b\x00\x0f\x00\x19\x00\x45\x00\x2b\x00\x2b\x00\x19\x00\x2c\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x19\x00\x25\x00\x19\x00\x19\x00\x2b\x00\x2b\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x16\x00\x19\x00\x19\x00\x19\x00\x03\x00\x03\x00\x03\x00\x03\x00\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\x03\x00\x03\x00\x03\x00\x03\x00\x03\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\xff\xff\x03\x00\x03\x00\x03\x00\x03\x00\x03\x00\x03\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x08\x00\x08\x00\x00\x00\x0c\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x03\x00\x00\x00\x00\x00\x0e\x00\x0e\x00\x0e\x00\x0e\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x49\x00\x06\x00\x00\x00\x00\x00\x46\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3a\x00\x00\x00\x00\x00\x4a\x00\x00\x00\x00\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x3a\x00\x3a\x00\x40\x00\x40\x00\x00\x00\x4c\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x47\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x00\x00\x00\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12\x00\x00\x00\x11\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x00\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0d\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x40\x00\x00\x00\x00\x00\x00\x00\x11\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x12\x00\x12\x00\x12\x00\x12\x00\x12\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x23\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x28\x00\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x15\x00\x00\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3b\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x00\x00\x39\x00\x00\x00\x00\x00\x11\x00\x00\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x11\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x32\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x24\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x29\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x27\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x2a\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x00\x00\x00\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x3b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x3e\x00\x00\x00\x00\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x39\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x26\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x33\x00\x38\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2e\x00\x41\x00\x41\x00\x41\x00\x41\x00\x41\x00\x3e\x00\x00\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x00\x00\x00\x00\x00\x00\x39\x00\x00\x00\x41\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x00\x00\x3f\x00\x00\x00\x00\x00\x2e\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x3b\x00\x3b\x00\x3b\x00\x3b\x00\x3b\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\x3b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3e\x00\x00\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x00\x00\x00\x00\x00\x00\x39\x00\x00\x00\x00\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2e\x00\x00\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x2e\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x2f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x31\x00\x00\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x31\x00\x00\x00\x00\x00\x2f\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x30\x00\x41\x00\x41\x00\x41\x00\x41\x00\x41\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\x41\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x00\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x00\x00\x00\x00\x00\x00\x3f\x00\x00\x00\x00\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x34\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x41\x00\x41\x00\x41\x00\x41\x00\x41\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\x41\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x00\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x00\x00\x00\x00\x00\x00\x3f\x00\x00\x00\x00\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x34\x00\x00\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x34\x00\x41\x00\x41\x00\x41\x00\x41\x00\x41\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\x41\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3f\x00\x00\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x00\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x35\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x00\x00\x00\x00\x00\x00\x37\x00\x00\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x37\x00\x00\x00\x00\x00\x35\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x36\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x00\x00\x00\x00\x00\x00\x00\x00\x48\x00\x00\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\x00\x48\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\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\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\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\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"# + +alex_check :: AlexAddr +alex_check = AlexA# "\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0a\x00\x0a\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x2d\x00\x77\x00\x72\x00\x61\x00\x70\x00\x70\x00\x65\x00\x2d\x00\x72\x00\x2d\x00\xff\xff\xff\xff\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0a\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\x0a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x20\x00\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\x22\x00\x22\x00\xff\xff\x2d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x20\x00\xff\xff\xff\xff\x3a\x00\x3a\x00\x3a\x00\x3a\x00\xff\xff\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x2c\x00\x2d\x00\xff\xff\xff\xff\x30\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3d\x00\xff\xff\xff\xff\x3e\x00\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x3d\x00\x3d\x00\x3d\x00\x3d\x00\xff\xff\x7b\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x27\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x3a\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x3d\x00\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\x3d\x00\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x2d\x00\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\x20\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\x3d\x00\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\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\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x27\x00\xff\xff\x7d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\xff\xff\x7d\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\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\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\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\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\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\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2d\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x27\x00\xff\xff\x7d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\xff\xff\x7d\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\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\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\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\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\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"# + +alex_deflt :: AlexAddr +alex_deflt = AlexA# "\xff\xff\xff\xff\xff\xff\xff\xff\x05\x00\x05\x00\xff\xff\xff\xff\xff\xff\x0a\x00\x0a\x00\xff\xff\x14\x00\xff\xff\x14\x00\xff\xff\xff\xff\xff\xff\xff\xff\x14\x00\x14\x00\xff\xff\xff\xff\x18\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\xff\xff\xff\xff\xff\xff\xff\xff\x3d\x00\xff\xff\x3d\x00\x3d\x00\xff\xff\xff\xff\x43\x00\xff\xff\x43\x00\x43\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x4b\x00"# + +alex_accept = listArray (0::Int,76) [[],[(AlexAcc (alex_action_21))],[],[(AlexAcc (alex_action_0))],[(AlexAcc (alex_action_0))],[(AlexAcc (alex_action_0))],[],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_1))],[(AlexAcc (alex_action_10))],[],[(AlexAcc (alex_action_2))],[(AlexAcc (alex_action_2))],[],[],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_10))],[],[],[],[],[],[(AlexAccPred (alex_action_3) (alexRightContext 23)),(AlexAcc (alex_action_4))],[],[(AlexAccSkip)],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_5))],[],[],[],[],[],[],[],[(AlexAcc (alex_action_6))],[(AlexAcc (alex_action_6))],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_7))],[(AlexAcc (alex_action_9))],[(AlexAcc (alex_action_8))],[(AlexAcc (alex_action_9))],[(AlexAcc (alex_action_9))],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_10))],[(AlexAcc (alex_action_11))],[(AlexAcc (alex_action_11))],[(AlexAcc (alex_action_11))],[],[],[],[(AlexAcc (alex_action_12))],[(AlexAcc (alex_action_12))],[(AlexAcc (alex_action_12))],[],[],[],[(AlexAcc (alex_action_13))],[(AlexAcc (alex_action_13))],[],[],[],[],[(AlexAcc (alex_action_14))],[(AlexAcc (alex_action_14))],[],[],[],[],[(AlexAcc (alex_action_15))],[(AlexAcc (alex_action_16))],[(AlexAcc (alex_action_17))],[(AlexAcc (alex_action_17))],[(AlexAcc (alex_action_18))],[(AlexAcc (alex_action_19))],[(AlexAcc (alex_action_20))],[]] +{-# LINE 75 "src\Scan.x" #-} + + +-- ----------------------------------------------------------------------------- +-- Token type + +data Token = T AlexPosn Tkn + deriving Show + +tokPosn (T p _) = p + +data Tkn + = SpecialT Char + | CodeT String + | ZeroT + | IdT String + | StringT String + | BindT String + | CharT Char + | SMacT String + | RMacT String + | SMacDefT String + | RMacDefT String + | NumT Int + | WrapperT + | EOFT + deriving Show + +-- ----------------------------------------------------------------------------- +-- Token functions + +special (p,_,str) ln = return $ T p (SpecialT (head str)) +zero (p,_,str) ln = return $ T p ZeroT +string (p,_,str) ln = return $ T p (StringT (extract ln str)) +bind (p,_,str) ln = return $ T p (BindT (takeWhile isIdChar str)) +escape (p,_,str) ln = return $ T p (CharT (esc str)) +decch (p,_,str) ln = return $ T p (CharT (do_ech 10 ln (take (ln-1) (tail str)))) +hexch (p,_,str) ln = return $ T p (CharT (do_ech 16 ln (take (ln-2) (drop 2 str)))) +octch (p,_,str) ln = return $ T p (CharT (do_ech 8 ln (take (ln-2) (drop 2 str)))) +char (p,_,str) ln = return $ T p (CharT (head str)) +smac (p,_,str) ln = return $ T p (SMacT (mac ln str)) +rmac (p,_,str) ln = return $ T p (RMacT (mac ln str)) +smacdef (p,_,str) ln = return $ T p (SMacDefT (macdef ln str)) +rmacdef (p,_,str) ln = return $ T p (RMacDefT (macdef ln str)) +startcode (p,_,str) ln = return $ T p (IdT (take ln str)) +wrapper (p,_,str) ln = return $ T p WrapperT + +isIdChar c = isAlphaNum c || c `elem` "_'" + +extract ln str = take (ln-2) (tail str) + +do_ech radix ln str = chr (parseInt radix str) + +mac ln (_ : str) = take (ln-1) str + +macdef ln (_ : str) = takeWhile (not.isSpace) str + +esc (_ : x : _) = + case x of + 'a' -> '\a' + 'b' -> '\b' + 'f' -> '\f' + 'n' -> '\n' + 'r' -> '\r' + 't' -> '\t' + 'v' -> '\v' + c -> c + +parseInt :: Int -> String -> Int +parseInt radix ds = foldl1 (\n d -> n * radix + d) (map digitToInt ds) + +-- In brace-delimited code, we have to be careful to match braces +-- within the code, but ignore braces inside strings and character +-- literals. We do an approximate job (doing it properly requires +-- implementing a large chunk of the Haskell lexical syntax). + +code (p,_,inp) len = do + inp <- getInput + go inp 1 "" + where + go inp 0 cs = do + setInput inp + return (T p (CodeT (reverse (tail cs)))) + go inp n cs = do + case alexGetChar inp of + Nothing -> err inp + Just (c,inp) -> + case c of + '{' -> go inp (n+1) (c:cs) + '}' -> go inp (n-1) (c:cs) + '\'' -> go_char inp n (c:cs) + '\"' -> go_str inp n (c:cs) '\"' + c -> go inp n (c:cs) + + -- try to catch occurrences of ' within an identifier + go_char inp n (c1:c2:cs) | isAlphaNum c2 = go inp n (c1:c2:cs) + go_char inp n cs = go_str inp n cs '\'' + + go_str inp n cs end = do + case alexGetChar inp of + Nothing -> err inp + Just (c,inp) + | c == end -> go inp n (c:cs) + | otherwise -> + case c of + '\\' -> case alexGetChar inp of + Nothing -> err inp + Just (d,inp) -> go_str inp n (d:c:cs) end + c -> go_str inp n (c:cs) end + + err inp = do setInput inp; lexError "lexical error in code fragment" + + + +lexError s = do + (p,_,_,input) <- getInput + failP (s ++ (if (not (null input)) + then " at " ++ show (head input) + else " at end of file")) + +lexer :: (Token -> P a) -> P a +lexer cont = lexToken >>= cont + +lexToken :: P Token +lexToken = do + inp@(p,c,_,s) <- getInput + sc <- getStartCode + case alexScan inp sc of + AlexEOF -> return (T p EOFT) + AlexError _ -> lexError "lexical error" + AlexSkip inp1 len -> do + setInput inp1 + lexToken + AlexToken inp1 len t -> do + setInput inp1 + t (p,c,s) len + +type Action = (AlexPosn,Char,String) -> Int -> P Token + +skip :: Action +skip _ _ = lexToken + +andBegin :: Action -> StartCode -> Action +andBegin act sc inp len = setStartCode sc >> act inp len + + +afterstartcodes,startcodes :: Int +afterstartcodes = 1 +startcodes = 2 +alex_action_0 = skip +alex_action_1 = string +alex_action_2 = bind +alex_action_3 = code +alex_action_4 = special +alex_action_5 = wrapper +alex_action_6 = decch +alex_action_7 = hexch +alex_action_8 = octch +alex_action_9 = escape +alex_action_10 = char +alex_action_11 = smac +alex_action_12 = rmac +alex_action_13 = smacdef +alex_action_14 = rmacdef +alex_action_15 = special `andBegin` startcodes +alex_action_16 = zero +alex_action_17 = startcode +alex_action_18 = special +alex_action_19 = special `andBegin` afterstartcodes +alex_action_20 = special `andBegin` 0 +alex_action_21 = skip `andBegin` 0 +{-# LINE 1 "templates\GenericTemplate.hs" #-} +{-# LINE 1 "templates\\GenericTemplate.hs" #-} +{-# LINE 1 "<built-in>" #-} +{-# LINE 1 "<command-line>" #-} +{-# LINE 1 "templates\\GenericTemplate.hs" #-} +-- ----------------------------------------------------------------------------- +-- ALEX TEMPLATE +-- +-- This code is in the PUBLIC DOMAIN; you may copy it freely and use +-- it for any purpose whatsoever. + +-- ----------------------------------------------------------------------------- +-- INTERNALS and main scanner engine + +{-# LINE 37 "templates\\GenericTemplate.hs" #-} + +{-# LINE 47 "templates\\GenericTemplate.hs" #-} + + +data AlexAddr = AlexA# Addr# + +#if __GLASGOW_HASKELL__ < 503 +uncheckedShiftL# = shiftL# +#endif + +{-# INLINE alexIndexInt16OffAddr #-} +alexIndexInt16OffAddr (AlexA# arr) off = +#ifdef WORDS_BIGENDIAN + narrow16Int# i + where + i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low) + high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#))) + low = int2Word# (ord# (indexCharOffAddr# arr off')) + off' = off *# 2# +#else + indexInt16OffAddr# arr off +#endif + + + + + +{-# INLINE alexIndexInt32OffAddr #-} +alexIndexInt32OffAddr (AlexA# arr) off = +#ifdef WORDS_BIGENDIAN + narrow32Int# i + where + i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#` + (b2 `uncheckedShiftL#` 16#) `or#` + (b1 `uncheckedShiftL#` 8#) `or#` b0) + b3 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#))) + b2 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#))) + b1 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#))) + b0 = int2Word# (ord# (indexCharOffAddr# arr off')) + off' = off *# 4# +#else + indexInt32OffAddr# arr off +#endif + + + + + +#if __GLASGOW_HASKELL__ < 503 +quickIndex arr i = arr ! i +#else +-- GHC >= 503, unsafeAt is available from Data.Array.Base. +quickIndex = unsafeAt +#endif + + + + +-- ----------------------------------------------------------------------------- +-- Main lexing routines + +data AlexReturn a + = AlexEOF + | AlexError !AlexInput + | AlexSkip !AlexInput !Int + | AlexToken !AlexInput !Int a + +-- alexScan :: AlexInput -> StartCode -> AlexReturn a +alexScan input (I# (sc)) + = alexScanUser undefined input (I# (sc)) + +alexScanUser user input (I# (sc)) + = case alex_scan_tkn user input 0# input sc AlexNone of + (AlexNone, input') -> + case alexGetChar input of + Nothing -> + + + + AlexEOF + Just _ -> + + + + AlexError input' + + (AlexLastSkip input'' len, _) -> + + + + AlexSkip input'' len + + (AlexLastAcc k input''' len, _) -> + + + + AlexToken input''' len k + + +-- Push the input through the DFA, remembering the most recent accepting +-- state it encountered. + +alex_scan_tkn user orig_input len input s last_acc = + input `seq` -- strict in the input + let + new_acc = check_accs (alex_accept `quickIndex` (I# (s))) + in + new_acc `seq` + case alexGetChar input of + Nothing -> (new_acc, input) + Just (c, new_input) -> + + + + let + (base) = alexIndexInt32OffAddr alex_base s + ((I# (ord_c))) = ord c + (offset) = (base +# ord_c) + (check) = alexIndexInt16OffAddr alex_check offset + + (new_s) = if (offset >=# 0#) && (check ==# ord_c) + then alexIndexInt16OffAddr alex_table offset + else alexIndexInt16OffAddr alex_deflt s + in + case new_s of + -1# -> (new_acc, input) + -- on an error, we want to keep the input *before* the + -- character that failed, not after. + _ -> alex_scan_tkn user orig_input (len +# 1#) + new_input new_s new_acc + + where + check_accs [] = last_acc + check_accs (AlexAcc a : _) = AlexLastAcc a input (I# (len)) + check_accs (AlexAccSkip : _) = AlexLastSkip input (I# (len)) + check_accs (AlexAccPred a predx : rest) + | predx user orig_input (I# (len)) input + = AlexLastAcc a input (I# (len)) + check_accs (AlexAccSkipPred predx : rest) + | predx user orig_input (I# (len)) input + = AlexLastSkip input (I# (len)) + check_accs (_ : rest) = check_accs rest + +data AlexLastAcc a + = AlexNone + | AlexLastAcc a !AlexInput !Int + | AlexLastSkip !AlexInput !Int + +data AlexAcc a user + = AlexAcc a + | AlexAccSkip + | AlexAccPred a (AlexAccPred user) + | AlexAccSkipPred (AlexAccPred user) + +type AlexAccPred user = user -> AlexInput -> Int -> AlexInput -> Bool + +-- ----------------------------------------------------------------------------- +-- Predicates on a rule + +alexAndPred p1 p2 user in1 len in2 + = p1 user in1 len in2 && p2 user in1 len in2 + +--alexPrevCharIsPred :: Char -> AlexAccPred _ +alexPrevCharIs c _ input _ _ = c == alexInputPrevChar input + +--alexPrevCharIsOneOfPred :: Array Char Bool -> AlexAccPred _ +alexPrevCharIsOneOf arr _ input _ _ = arr ! alexInputPrevChar input + +--alexRightContext :: Int -> AlexAccPred _ +alexRightContext (I# (sc)) user _ _ input = + case alex_scan_tkn user input 0# input sc AlexNone of + (AlexNone, _) -> False + _ -> True + -- TODO: there's no need to find the longest + -- match when checking the right context, just + -- the first match will do. + +-- used by wrappers +iUnbox (I# (i)) = i
src/AbsSyn.hs view
@@ -23,6 +23,7 @@ import CharSet ( CharSet ) import Map ( Map ) import qualified Map hiding ( Map )+import Data.IntMap (IntMap) import Sort ( nub' ) import Util ( str, nl ) @@ -66,6 +67,7 @@ = NoRightContext | RightContextRExp r | RightContextCode Code+ deriving (Eq,Ord) instance Show RECtx where showsPrec _ (RECtx scs _ r rctx code) = @@ -95,16 +97,19 @@ dfa_states :: Map s (State s a) } -data State s a = State [Accept a] (Map Char s)+data State s a = State { state_acc :: [Accept a],+ state_out :: IntMap s -- 0..255 only+ } type SNum = Int data Accept a = Acc { accPrio :: Int, accAction :: Maybe a,- accLeftCtx :: Maybe CharSet,+ accLeftCtx :: Maybe CharSet, -- cannot be converted to byteset at this point. accRightCtx :: RightContext SNum }+ deriving (Eq,Ord) -- debug stuff instance Show (Accept a) where
src/CharSet.hs view
@@ -11,6 +11,16 @@ -- ----------------------------------------------------------------------------} module CharSet (+ setSingleton,++ Encoding(..),++ Byte,+ ByteSet,+ byteSetSingleton,+ byteRanges,+ byteSetRange,+ CharSet, -- abstract emptyCharSet, charSetSingleton,@@ -19,39 +29,141 @@ charSetComplement, charSetRange, charSetUnion,- charSetToArray,- charSetElems+ charSetQuote,+ setUnions,+ byteSetToArray,+ byteSetElems,+ byteSetElem ) where -import Data.Array ( Array, array )+import Data.Array+import Data.Ranged+import Data.Word+import Data.Maybe (catMaybes)+import Data.Char (chr,ord)+import UTF8 +type Byte = Word8 -- Implementation as functions-type CharSet = Char -> Bool+type CharSet = RSet Char+type ByteSet = RSet Byte+-- type Utf8Set = RSet [Byte]+type Utf8Range = Span [Byte] +data Encoding = Latin1 | UTF8+ emptyCharSet :: CharSet-emptyCharSet = const False+emptyCharSet = rSetEmpty +byteSetElem :: ByteSet -> Byte -> Bool+byteSetElem = rSetHas+ charSetSingleton :: Char -> CharSet-charSetSingleton c = \x -> x == c+charSetSingleton = rSingleton +setSingleton :: DiscreteOrdered a => a -> RSet a+setSingleton = rSingleton+ charSet :: [Char] -> CharSet-charSet s x = x `elem` s+charSet = setUnions . fmap charSetSingleton charSetMinus :: CharSet -> CharSet -> CharSet-charSetMinus s1 s2 x = s1 x && not (s2 x)+charSetMinus = rSetDifference charSetUnion :: CharSet -> CharSet -> CharSet-charSetUnion s1 s2 x = s1 x || s2 x+charSetUnion = rSetUnion +setUnions :: DiscreteOrdered a => [RSet a] -> RSet a+setUnions = foldr rSetUnion rSetEmpty+ charSetComplement :: CharSet -> CharSet-charSetComplement s1 = not . s1+charSetComplement = rSetNegation charSetRange :: Char -> Char -> CharSet-charSetRange c1 c2 x = x >= c1 && x <= c2+charSetRange c1 c2 = makeRangedSet [Range (BoundaryBelow c1) (BoundaryAbove c2)] -charSetToArray :: CharSet -> Array Char Bool-charSetToArray set = array (fst (head ass), fst (last ass)) ass- where ass = [(c,set c) | c <- ['\0'..'\xff']]+byteSetToArray :: ByteSet -> Array Byte Bool+byteSetToArray set = array (fst (head ass), fst (last ass)) ass+ where ass = [(c,rSetHas set c) | c <- [0..0xff]] -charSetElems :: CharSet -> [Char]-charSetElems set = [c | c <- ['\0'..'\xff'], set c]+byteSetElems :: ByteSet -> [Byte]+byteSetElems set = [c | c <- [0 .. 0xff], rSetHas set c]++charToRanges :: Encoding -> CharSet -> [Utf8Range]+charToRanges Latin1 =+ map (fmap ((: []).fromIntegral.ord)) -- Span [Byte]+ . catMaybes+ . fmap (charRangeToCharSpan False)+ . rSetRanges+charToRanges UTF8 =+ concat -- Span [Byte]+ . fmap toUtfRange -- [Span [Byte]]+ . fmap (fmap UTF8.encode) -- Span [Byte]+ . catMaybes+ . fmap (charRangeToCharSpan True)+ . rSetRanges++-- | Turns a range of characters expressed as a pair of UTF-8 byte sequences into a set of ranges, in which each range of the resulting set is between pairs of sequences of the same length+toUtfRange :: Span [Byte] -> [Span [Byte]]+toUtfRange (Span x y) = fix x y++fix :: [Byte] -> [Byte] -> [Span [Byte]]+fix x y + | length x == length y = [Span x y]+ | length x == 1 = Span x [0x7F] : fix [0xC2,0x80] y + | length x == 2 = Span x [0xDF,0xBF] : fix [0xE0,0x80,0x80] y+ | length x == 3 = Span x [0xEF,0xBF,0xBF] : fix [0xF0,0x80,0x80,0x80] y+ | otherwise = error "fix: incorrect input given"+++byteRangeToBytePair :: Span [Byte] -> ([Byte],[Byte])+byteRangeToBytePair (Span x y) = (x,y)++data Span a = Span a a -- lower bound inclusive, higher bound exclusive+ -- (SDM: upper bound inclusive, surely??)+instance Functor Span where+ fmap f (Span x y) = Span (f x) (f y)++charRangeToCharSpan :: Bool -> Range Char -> Maybe (Span Char)+charRangeToCharSpan _ (Range BoundaryAboveAll _) = Nothing+charRangeToCharSpan _ (Range _ BoundaryBelowAll) = Nothing+charRangeToCharSpan uni (Range x y) = Just (Span (l x) (h y))+ where l b = case b of+ BoundaryBelowAll -> '\0'+ BoundaryBelow a -> a+ BoundaryAbove a -> succ a+ BoundaryAboveAll -> error "panic: charRangeToCharSpan"+ h b = case b of+ BoundaryBelowAll -> error "panic: charRangeToCharSpan"+ BoundaryBelow a -> pred a+ BoundaryAbove a -> a+ BoundaryAboveAll | uni -> chr 0x10ffff+ | otherwise -> chr 0xff++byteRanges :: Encoding -> CharSet -> [([Byte],[Byte])]+byteRanges enc = fmap byteRangeToBytePair . charToRanges enc++byteSetRange :: Byte -> Byte -> ByteSet+byteSetRange c1 c2 = makeRangedSet [Range (BoundaryBelow c1) (BoundaryAbove c2)]++byteSetSingleton :: Byte -> ByteSet+byteSetSingleton = rSingleton++instance DiscreteOrdered Word8 where+ adjacent x y = x + 1 == y+ adjacentBelow 0 = Nothing+ adjacentBelow x = Just (x-1)++-- TODO: More efficient generated code!+charSetQuote :: CharSet -> String+charSetQuote s = "(\\c -> " ++ foldr (\x y -> x ++ " || " ++ y) "False" (map quoteRange (rSetRanges s)) ++ ")" + where quoteRange (Range l h) = quoteL l ++ " && " ++ quoteH h+ quoteL (BoundaryAbove a) = "c > " ++ show a+ quoteL (BoundaryBelow a) = "c >= " ++ show a+ quoteL (BoundaryAboveAll) = "False"+ quoteL (BoundaryBelowAll) = "True"+ quoteH (BoundaryAbove a) = "c <= " ++ show a+ quoteH (BoundaryBelow a) = "c < " ++ show a+ quoteH (BoundaryAboveAll) = "True"+ quoteH (BoundaryBelowAll) = "False"+
src/DFA.hs view
@@ -17,6 +17,7 @@ import AbsSyn import qualified Map+import qualified Data.IntMap as IntMap import NFA import Sort ( msort, nub' ) import CharSet@@ -88,8 +89,8 @@ -- state of the partial DFA, until all possible state sets have been considered -- The final DFA is then constructed with a `mk_dfa'. -scanner2dfa:: Scanner -> [StartCode] -> DFA SNum Code-scanner2dfa scanner scs = nfa2dfa scs (scanner2nfa scanner scs)+scanner2dfa:: Encoding -> Scanner -> [StartCode] -> DFA SNum Code+scanner2dfa enc scanner scs = nfa2dfa scs (scanner2nfa enc scanner scs) nfa2dfa:: [StartCode] -> NFA -> DFA SNum Code nfa2dfa scs nfa = mk_int_dfa nfa (nfa2pdfa nfa pdfa (dfa_start_states pdfa))@@ -110,30 +111,27 @@ | ss `in_pdfa` pdfa = nfa2pdfa nfa pdfa umkd | otherwise = nfa2pdfa nfa pdfa' umkd' where- pdfa' = add_pdfa ss (State accs (Map.fromList ss_outs)) pdfa+ pdfa' = add_pdfa ss (State accs (IntMap.fromList ss_outs)) pdfa umkd' = rctx_sss ++ map snd ss_outs ++ umkd -- for each character, the set of states that character would take -- us to from the current set of states in the NFA.- ss_outs :: [(Char, StateSet)]- ss_outs = [ (ch, mk_ss nfa ss')- | ch <- dfa_alphabet,- let ss' = [ s' | (p,s') <- outs, p ch ],- not (null ss')- ]+ ss_outs :: [(Int, StateSet)]+ ss_outs = [ (fromIntegral ch, mk_ss nfa ss')+ | ch <- byteSetElems $ setUnions [p | (p,_) <- outs],+ let ss' = [ s' | (p,s') <- outs, byteSetElem p ch ],+ not (null ss')+ ] rctx_sss = [ mk_ss nfa [s] | Acc _ _ _ (RightContextRExp s) <- accs ] - outs :: [(CharSet,SNum)]+ outs :: [(ByteSet,SNum)] outs = [ out | s <- ss, out <- nst_outs (nfa!s) ] accs = sort_accs [acc| s<-ss, acc<-nst_accs (nfa!s)] -dfa_alphabet:: [Char]-dfa_alphabet = ['\0'..'\255']- -- `sort_accs' sorts a list of accept values into decending order of priority, -- eliminating any elements that follow an unconditional accept value. @@ -198,7 +196,7 @@ cnv :: State StateSet a -> State SNum a cnv (State accs as) = State accs' as' where- as' = Map.mapWithKey (\_ch s -> lookup' s) as+ as' = IntMap.mapWithKey (\_ch s -> lookup' s) as accs' = map cnv_acc accs cnv_acc (Acc p a lctx rctx) = Acc p a lctx rctx'
+ src/DFAMin.hs view
@@ -0,0 +1,150 @@+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}+{-# LANGUAGE PatternGuards #-}+module DFAMin (minimizeDFA) where++import AbsSyn++import Data.Map (Map)+import qualified Data.Map as Map+import Data.IntSet (IntSet)+import qualified Data.IntSet as IS+import Data.IntMap (IntMap)+import qualified Data.IntMap as IM+import Data.List as List+++-- Hopcroft's Algorithm for DFA minimization (cut/pasted from Wikipedia):++-- P := {{all accepting states}, {all nonaccepting states}};+-- Q := {{all accepting states}};+-- while (Q is not empty) do+-- choose and remove a set A from Q+-- for each c in ∑ do+-- let X be the set of states for which a transition on c leads to a state in A+-- for each set Y in P for which X ∩ Y is nonempty do+-- replace Y in P by the two sets X ∩ Y and Y \ X+-- if Y is in Q+-- replace Y in Q by the same two sets+-- else+-- add the smaller of the two sets to Q+-- end;+-- end;+-- end;++minimizeDFA :: Ord a => DFA Int a -> DFA Int a+minimizeDFA dfa@ DFA { dfa_start_states = starts,+ dfa_states = statemap+ }+ = DFA { dfa_start_states = starts,+ dfa_states = Map.fromList states }+ where+ equiv_classes = groupEquivStates dfa++ numbered_states = number (length starts) equiv_classes++ -- assign each state in the minimized DFA a number, making+ -- sure that we assign the numbers [0..] to the start states.+ number _ [] = []+ number n (ss:sss) =+ case filter (`IS.member` ss) starts of+ [] -> (n,ss) : number (n+1) sss+ starts' -> zip starts' (repeat ss) ++ number n sss+ -- if one of the states of the minimized DFA corresponds+ -- to multiple starts states, we just have to duplicate+ -- that state.++ states = [+ let old_states = map (lookup statemap) (IS.toList equiv)+ accs = map fix_acc (state_acc (head old_states))+ -- accepts should all be the same+ out = IM.fromList [ (b, get_new old)+ | State _ out <- old_states,+ (b,old) <- IM.toList out ]+ in (n, State accs out)+ | (n, equiv) <- numbered_states+ ]++ fix_acc acc = acc { accRightCtx = fix_rctxt (accRightCtx acc) }++ fix_rctxt (RightContextRExp s) = RightContextRExp (get_new s)+ fix_rctxt other = other++ lookup m k = Map.findWithDefault (error "minimizeDFA") k m+ get_new = lookup old_to_new++ old_to_new :: Map Int Int+ old_to_new = Map.fromList [ (s,n) | (n,ss) <- numbered_states,+ s <- IS.toList ss ]+++groupEquivStates :: (Ord a) => DFA Int a -> [IntSet]+groupEquivStates DFA { dfa_states = statemap }+ = go init_p init_q+ where+ (accepting, nonaccepting) = Map.partition acc statemap+ where acc (State as _) = not (List.null as)++ nonaccepting_states = IS.fromList (Map.keys nonaccepting)++ -- group the accepting states into equivalence classes+ accept_map = {-# SCC "accept_map" #-}+ foldl' (\m (n,s) -> Map.insertWith (++) (state_acc s) [n] m)+ Map.empty+ (Map.toList accepting)++ -- accept_groups :: Ord s => [Set s]+ accept_groups = map IS.fromList (Map.elems accept_map)++ init_p = nonaccepting_states : accept_groups+ init_q = accept_groups++ -- map token T to+ -- a map from state S to the list of states that transition to+ -- S on token T+ -- This is a cache of the information needed to compute x below+ bigmap :: IntMap (IntMap [SNum])+ bigmap = IM.fromListWith (IM.unionWith (++))+ [ (i, IM.singleton to [from])+ | (from, state) <- Map.toList statemap,+ (i,to) <- IM.toList (state_out state) ]++ -- incoming I A = the set of states that transition to a state in+ -- A on token I.+ incoming :: Int -> IntSet -> IntSet+ incoming i a = IS.fromList (concat ss)+ where+ map1 = IM.findWithDefault IM.empty i bigmap+ ss = [ IM.findWithDefault [] s map1+ | s <- IS.toList a ]++ -- The outer loop: recurse on each set in Q+ go p [] = p+ go p (a:q) = go1 0 p q+ where+ -- recurse on each token (0..255)+ go1 256 p q = go p q+ go1 i p q = go1 (i+1) p' q'+ where+ (p',q') = go2 p [] q++ x = incoming i a++ -- recurse on each set in P+ go2 [] p' q = (p',q)+ go2 (y:p) p' q+ | IS.null i || IS.null d = go2 p (y:p') q+ | otherwise = go2 p (i:d:p') q1+ where+ i = IS.intersection x y+ d = IS.difference y x++ q1 = replaceyin q+ where+ replaceyin [] =+ if IS.size i < IS.size d then [i] else [d]+ replaceyin (z:zs)+ | z == y = i : d : zs+ | otherwise = z : replaceyin zs+++
+ src/Data/Ranged.hs view
@@ -0,0 +1,9 @@+module Data.Ranged (+ module Data.Ranged.Boundaries,+ module Data.Ranged.Ranges,+ module Data.Ranged.RangedSet+) where++import Data.Ranged.Boundaries+import Data.Ranged.Ranges+import Data.Ranged.RangedSet
+ src/Data/Ranged/Boundaries.hs view
@@ -0,0 +1,229 @@+-----------------------------------------------------------------------------+-- |+-- Module : Data.Ranged.Boundaries+-- Copyright : (c) Paul Johnson 2006+-- License : BSD-style+-- Maintainer : paul@cogito.org.uk+-- Stability : experimental+-- Portability : portable+--+-----------------------------------------------------------------------------++module Data.Ranged.Boundaries (+ DiscreteOrdered (..),+ enumAdjacent,+ boundedAdjacent,+ boundedBelow,+ Boundary (..),+ above,+ (/>/)+) where++import Data.Ratio+import Test.QuickCheck++infix 4 />/++{- |+Distinguish between dense and sparse ordered types. A dense type is+one in which any two values @v1 < v2@ have a third value @v3@ such that+@v1 < v3 < v2@.++In theory the floating types are dense, although in practice they can only have+finitely many values. This class treats them as dense.++Tuples up to 4 members are declared as instances. Larger tuples may be added+if necessary.++Most values of sparse types have an @adjacentBelow@, such that, for all x:++> case adjacentBelow x of+> Just x1 -> adjacent x1 x+> Nothing -> True++The exception is for bounded types when @x == lowerBound@. For dense types+@adjacentBelow@ always returns 'Nothing'.++This approach was suggested by Ben Rudiak-Gould on comp.lang.functional.+-}++class Ord a => DiscreteOrdered a where+ -- | Two values @x@ and @y@ are adjacent if @x < y@ and there does not+ -- exist a third value between them. Always @False@ for dense types.+ adjacent :: a -> a -> Bool+ -- | The value immediately below the argument, if it can be determined.+ adjacentBelow :: a -> Maybe a+++-- Implementation note: the precise rules about unbounded enumerated vs+-- bounded enumerated types are difficult to express using Haskell 98, so+-- the prelude types are listed individually here.++instance DiscreteOrdered Bool where+ adjacent = boundedAdjacent+ adjacentBelow = boundedBelow++instance DiscreteOrdered Ordering where+ adjacent = boundedAdjacent+ adjacentBelow = boundedBelow++instance DiscreteOrdered Char where+ adjacent = boundedAdjacent+ adjacentBelow = boundedBelow++instance DiscreteOrdered Int where+ adjacent = boundedAdjacent+ adjacentBelow = boundedBelow++instance DiscreteOrdered Integer where+ adjacent = enumAdjacent+ adjacentBelow = Just . pred++instance DiscreteOrdered Double where+ adjacent _ _ = False+ adjacentBelow = const Nothing++instance DiscreteOrdered Float where+ adjacent _ _ = False+ adjacentBelow = const Nothing++instance (Integral a) => DiscreteOrdered (Ratio a) where+ adjacent _ _ = False+ adjacentBelow = const Nothing++instance Ord a => DiscreteOrdered [a] where+ adjacent _ _ = False+ adjacentBelow = const Nothing++instance (Ord a, DiscreteOrdered b) => DiscreteOrdered (a, b)+ where+ adjacent (x1, x2) (y1, y2) = (x1 == y1) && adjacent x2 y2+ adjacentBelow (x1, x2) = do -- Maybe monad+ x2' <- adjacentBelow x2+ return (x1, x2')++instance (Ord a, Ord b, DiscreteOrdered c) => DiscreteOrdered (a, b, c)+ where+ adjacent (x1, x2, x3) (y1, y2, y3) =+ (x1 == y1) && (x2 == y2) && adjacent x3 y3+ adjacentBelow (x1, x2, x3) = do -- Maybe monad+ x3' <- adjacentBelow x3+ return (x1, x2, x3')++instance (Ord a, Ord b, Ord c, DiscreteOrdered d) =>+ DiscreteOrdered (a, b, c, d)+ where+ adjacent (x1, x2, x3, x4) (y1, y2, y3, y4) =+ (x1 == y1) && (x2 == y2) && (x3 == y3) && adjacent x4 y4+ adjacentBelow (x1, x2, x3, x4) = do -- Maybe monad+ x4' <- adjacentBelow x4+ return (x1, x2, x3, x4')+++-- | Check adjacency for sparse enumerated types (i.e. where there+-- is no value between @x@ and @succ x@).+enumAdjacent :: (Ord a, Enum a) => a -> a -> Bool+enumAdjacent x y = (succ x == y)++-- | Check adjacency, allowing for case where x = maxBound. Use as the+-- definition of "adjacent" for bounded enumerated types such as Int and Char.+boundedAdjacent :: (Ord a, Enum a) => a -> a -> Bool+boundedAdjacent x y = if x < y then succ x == y else False+++-- | The usual implementation of 'adjacentBelow' for bounded enumerated types.+boundedBelow :: (Eq a, Enum a, Bounded a) => a -> Maybe a+boundedBelow x = if x == minBound then Nothing else Just $ pred x++{- |+A Boundary is a division of an ordered type into values above+and below the boundary. No value can sit on a boundary.++Known bug: for Bounded types++* @BoundaryAbove maxBound < BoundaryAboveAll@++* @BoundaryBelow minBound > BoundaryBelowAll@++This is incorrect because there are no possible values in+between the left and right sides of these inequalities.+-}++data Boundary a =+ -- | The argument is the highest value below the boundary.+ BoundaryAbove a |+ -- | The argument is the lowest value above the boundary.+ BoundaryBelow a |+ -- | The boundary above all values.+ BoundaryAboveAll |+ -- | The boundary below all values.+ BoundaryBelowAll+ deriving (Show)++-- | True if the value is above the boundary, false otherwise.+above :: Ord v => Boundary v -> v -> Bool+above (BoundaryAbove b) v = v > b+above (BoundaryBelow b) v = v >= b+above BoundaryAboveAll _ = False+above BoundaryBelowAll _ = True++-- | Same as 'above', but with the arguments reversed for more intuitive infix+-- usage.+(/>/) :: Ord v => v -> Boundary v -> Bool+(/>/) = flip above++instance (DiscreteOrdered a) => Eq (Boundary a) where+ b1 == b2 = compare b1 b2 == EQ++instance (DiscreteOrdered a) => Ord (Boundary a) where+ -- Comparison alogrithm based on brute force and ignorance:+ -- enumerate all combinations.++ compare boundary1 boundary2 =+ case boundary1 of+ BoundaryAbove b1 ->+ case boundary2 of+ BoundaryAbove b2 -> compare b1 b2+ BoundaryBelow b2 ->+ if b1 < b2+ then+ if adjacent b1 b2 then EQ else LT+ else GT+ BoundaryAboveAll -> LT+ BoundaryBelowAll -> GT+ BoundaryBelow b1 ->+ case boundary2 of+ BoundaryAbove b2 ->+ if b1 > b2+ then+ if adjacent b2 b1 then EQ else GT+ else LT+ BoundaryBelow b2 -> compare b1 b2+ BoundaryAboveAll -> LT+ BoundaryBelowAll -> GT+ BoundaryAboveAll ->+ case boundary2 of+ BoundaryAboveAll -> EQ+ _ -> GT+ BoundaryBelowAll ->+ case boundary2 of+ BoundaryBelowAll -> EQ+ _ -> LT++-- QuickCheck Generator++instance Arbitrary a => Arbitrary (Boundary a) where+ arbitrary = frequency [+ (1, return BoundaryAboveAll),+ (1, return BoundaryBelowAll),+ (18, do+ v <- arbitrary+ oneof [return $ BoundaryAbove v, return $ BoundaryBelow v]+ )]++instance CoArbitrary a => CoArbitrary (Boundary a) where+ coarbitrary BoundaryBelowAll = variant (0 :: Int)+ coarbitrary BoundaryAboveAll = variant (1 :: Int)+ coarbitrary (BoundaryBelow v) = variant (2 :: Int) . coarbitrary v+ coarbitrary (BoundaryAbove v) = variant (3 :: Int) . coarbitrary v+
+ src/Data/Ranged/RangedSet.hs view
@@ -0,0 +1,486 @@+module Data.Ranged.RangedSet (+ -- ** Ranged Set Type+ RSet,+ rSetRanges,+ -- ** Ranged Set construction functions and their preconditions+ makeRangedSet,+ unsafeRangedSet,+ validRangeList,+ normaliseRangeList,+ rSingleton,+ rSetUnfold,+ -- ** Predicates+ rSetIsEmpty,+ rSetIsFull,+ (-?-), rSetHas,+ (-<=-), rSetIsSubset,+ (-<-), rSetIsSubsetStrict,+ -- ** Set Operations+ (-\/-), rSetUnion,+ (-/\-), rSetIntersection,+ (-!-), rSetDifference,+ rSetNegation,+ -- ** Useful Sets+ rSetEmpty,+ rSetFull,+ -- ** QuickCheck Properties+ -- *** Construction+ prop_validNormalised,+ prop_has,+ prop_unfold,+ -- *** Basic Operations+ prop_union,+ prop_intersection,+ prop_difference,+ prop_negation,+ prop_not_empty,+ -- *** Some Identities and Inequalities+ -- $ConstructionProperties+ -- $BasicOperationProperties+ -- $SomeIdentitiesAndInequalities+ prop_empty,+ prop_full,+ prop_empty_intersection,+ prop_full_union,+ prop_union_superset,+ prop_intersection_subset,+ prop_diff_intersect,+ prop_subset,+ prop_strict_subset,+ prop_union_strict_superset,+ prop_intersection_commutes,+ prop_union_commutes,+ prop_intersection_associates,+ prop_union_associates,+ prop_de_morgan_intersection,+ prop_de_morgan_union,+) where++import Data.Ranged.Boundaries+import Data.Ranged.Ranges+import Data.Monoid++import Data.List+import Test.QuickCheck++infixl 7 -/\-+infixl 6 -\/-, -!-+infixl 5 -<=-, -<-, -?-++-- | An RSet (for Ranged Set) is a list of ranges. The ranges must be sorted+-- and not overlap.+newtype RSet v = RSet {rSetRanges :: [Range v]}+ deriving (Eq, Show, Ord)++instance DiscreteOrdered a => Monoid (RSet a) where+ mappend = rSetUnion+ mempty = rSetEmpty++-- | Determine if the ranges in the list are both in order and non-overlapping.+-- If so then they are suitable input for the unsafeRangedSet function.+validRangeList :: DiscreteOrdered v => [Range v] -> Bool++validRangeList [] = True+validRangeList [Range lower upper] = lower <= upper+validRangeList rs = and $ zipWith okAdjacent rs (tail rs)+ where+ okAdjacent (Range lower1 upper1) (Range lower2 upper2) =+ lower1 <= upper1 && upper1 <= lower2 && lower2 <= upper2+++-- | Rearrange and merge the ranges in the list so that they are in order and+-- non-overlapping.+normaliseRangeList :: DiscreteOrdered v => [Range v] -> [Range v]+normaliseRangeList = normalise . sort . filter (not . rangeIsEmpty)+++-- Private routine: normalise a range list that is known to be already sorted.+-- This precondition is not checked.+normalise :: DiscreteOrdered v => [Range v] -> [Range v]+normalise (r1:r2:rs) =+ if overlap r1 r2+ then normalise $+ Range (rangeLower r1)+ (max (rangeUpper r1) (rangeUpper r2))+ : rs+ else r1 : (normalise $ r2 : rs)+ where+ overlap (Range _ upper1) (Range lower2 _) = upper1 >= lower2++normalise rs = rs+++-- | Create a new Ranged Set from a list of ranges. The list may contain+-- ranges that overlap or are not in ascending order.+makeRangedSet :: DiscreteOrdered v => [Range v] -> RSet v+makeRangedSet = RSet . normaliseRangeList+++-- | Create a new Ranged Set from a list of ranges. @validRangeList ranges@+-- must return @True@. This precondition is not checked.+unsafeRangedSet :: DiscreteOrdered v => [Range v] -> RSet v+unsafeRangedSet = RSet++-- | Create a Ranged Set from a single element.+rSingleton :: DiscreteOrdered v => v -> RSet v+rSingleton v = unsafeRangedSet [singletonRange v]++-- | True if the set has no members.+rSetIsEmpty :: DiscreteOrdered v => RSet v -> Bool+rSetIsEmpty = null . rSetRanges+++-- | True if the negation of the set has no members.+rSetIsFull :: DiscreteOrdered v => RSet v -> Bool+rSetIsFull = rSetIsEmpty . rSetNegation+++-- | True if the value is within the ranged set. Infix precedence is left 5.+rSetHas, (-?-) :: DiscreteOrdered v => RSet v -> v -> Bool+rSetHas (RSet ls) value = rSetHas1 ls+ where+ rSetHas1 [] = False+ rSetHas1 (r:rs)+ | value />/ rangeLower r = rangeHas r value || rSetHas1 rs+ | otherwise = False++(-?-) = rSetHas++-- | True if the first argument is a subset of the second argument, or is+-- equal.+--+-- Infix precedence is left 5.+rSetIsSubset, (-<=-) :: DiscreteOrdered v => RSet v -> RSet v -> Bool+rSetIsSubset rs1 rs2 = rSetIsEmpty (rs1 -!- rs2)+(-<=-) = rSetIsSubset+++-- | True if the first argument is a strict subset of the second argument.+--+-- Infix precedence is left 5.+rSetIsSubsetStrict, (-<-) :: DiscreteOrdered v => RSet v -> RSet v -> Bool+rSetIsSubsetStrict rs1 rs2 =+ rSetIsEmpty (rs1 -!- rs2)+ && not (rSetIsEmpty (rs2 -!- rs1))++(-<-) = rSetIsSubsetStrict++-- | Set union for ranged sets. Infix precedence is left 6.+rSetUnion, (-\/-) :: DiscreteOrdered v => RSet v -> RSet v -> RSet v+-- Implementation note: rSetUnion merges the two lists into a single+-- sorted list and then calls normalise to combine overlapping ranges.+rSetUnion (RSet ls1) (RSet ls2) = RSet $ normalise $ merge ls1 ls2+ where+ merge ms1 [] = ms1+ merge [] ms2 = ms2+ merge ms1@(h1:t1) ms2@(h2:t2) =+ if h1 < h2+ then h1 : merge t1 ms2+ else h2 : merge ms1 t2++(-\/-) = rSetUnion++-- | Set intersection for ranged sets. Infix precedence is left 7.+rSetIntersection, (-/\-) :: DiscreteOrdered v => RSet v -> RSet v -> RSet v+rSetIntersection (RSet ls1) (RSet ls2) =+ RSet $ filter (not . rangeIsEmpty) $ merge ls1 ls2+ where+ merge ms1@(h1:t1) ms2@(h2:t2) =+ rangeIntersection h1 h2+ : if rangeUpper h1 < rangeUpper h2+ then merge t1 ms2+ else merge ms1 t2+ merge _ _ = []++(-/\-) = rSetIntersection+++-- | Set difference. Infix precedence is left 6.+rSetDifference, (-!-) :: DiscreteOrdered v => RSet v -> RSet v -> RSet v+rSetDifference rs1 rs2 = rs1 -/\- (rSetNegation rs2)+(-!-) = rSetDifference+++-- | Set negation.+rSetNegation :: DiscreteOrdered a => RSet a -> RSet a+rSetNegation set = RSet $ ranges1 $ setBounds1+ where+ ranges1 (b1:b2:bs) = Range b1 b2 : ranges1 bs+ ranges1 [BoundaryAboveAll] = []+ ranges1 [b] = [Range b BoundaryAboveAll]+ ranges1 _ = []+ setBounds1 = case setBounds of+ (BoundaryBelowAll : bs) -> bs+ _ -> BoundaryBelowAll : setBounds+ setBounds = bounds $ rSetRanges set+ bounds (r:rs) = rangeLower r : rangeUpper r : bounds rs+ bounds _ = []++-- | The empty set.+rSetEmpty :: DiscreteOrdered a => RSet a+rSetEmpty = RSet []++-- | The set that contains everything.+rSetFull :: DiscreteOrdered a => RSet a+rSetFull = RSet [Range BoundaryBelowAll BoundaryAboveAll]++-- | Construct a range set.+rSetUnfold :: DiscreteOrdered a =>+ Boundary a+ -- ^ A first lower boundary.+ -> (Boundary a -> Boundary a)+ -- ^ A function from a lower boundary to an upper boundary, which must+ -- return a result greater than the argument (not checked).+ -> (Boundary a -> Maybe (Boundary a))+ -- ^ A function from a lower boundary to @Maybe@ the successor lower+ -- boundary, which must return a result greater than the argument+ -- (not checked). If ranges overlap then they will be merged.+ -> RSet a+rSetUnfold bound upperFunc succFunc = RSet $ normalise $ ranges1 bound+ where+ ranges1 b =+ Range b (upperFunc b)+ : case succFunc b of+ Just b2 -> ranges1 b2+ Nothing -> []+++-- QuickCheck Generators++instance (Arbitrary v, DiscreteOrdered v, Show v) =>+ Arbitrary (RSet v)+ where+ arbitrary = frequency [+ (1, return rSetEmpty),+ (1, return rSetFull),+ (18, do+ ls <- arbitrary+ return $ makeRangedSet $ rangeList $ sort ls+ )]+ where+ -- Arbitrary lists of ranges don't give many interesting sets after+ -- normalisation. So instead generate a sorted list of boundaries+ -- and pair them off. Odd boundaries are dropped.+ rangeList (b1:b2:bs) = Range b1 b2 : rangeList bs+ rangeList _ = []++instance (CoArbitrary v, DiscreteOrdered v, Show v) =>+ CoArbitrary (RSet v)+ where+ coarbitrary (RSet ls) = variant (0 :: Int) . coarbitrary ls++-- ==================================================================+-- QuickCheck Properties+-- ==================================================================++---------------------------------------------------------------------+-- Construction properties+---------------------------------------------------------------------++-- | A normalised range list is valid for unsafeRangedSet+--+-- > prop_validNormalised ls = validRangeList $ normaliseRangeList ls+prop_validNormalised :: (DiscreteOrdered a) => [Range a] -> Bool+prop_validNormalised ls = validRangeList $ normaliseRangeList ls+++-- | Iff a value is in a range list then it is in a ranged set+-- constructed from that list.+--+-- > prop_has ls v = (ls `rangeListHas` v) == makeRangedSet ls -?- v+prop_has :: (DiscreteOrdered a) => [Range a] -> a -> Bool+prop_has ls v = (ls `rangeListHas` v) == makeRangedSet ls -?- v+++-- | Verifies the correct membership of a set containing all integers+-- starting with the digit \"1\" up to 19999.+--+-- > prop_unfold = (v <= 99999 && head (show v) == '1') == (initial1 -?- v)+-- > where+-- > initial1 = rSetUnfold (BoundaryBelow 1) addNines times10+-- > addNines (BoundaryBelow n) = BoundaryAbove $ n * 2 - 1+-- > times10 (BoundaryBelow n) =+-- > if n <= 1000 then Just $ BoundaryBelow $ n * 10 else Nothing++prop_unfold :: Integer -> Bool+prop_unfold v = (v <= 99999 && head (show v) == '1') == (initial1 -?- v)+ where+ initial1 = rSetUnfold (BoundaryBelow 1) addNines times10+ addNines (BoundaryBelow n) = BoundaryAbove $ n * 2 - 1+ addNines _ = error "Can't happen"+ times10 (BoundaryBelow n) =+ if n <= 10000 then Just $ BoundaryBelow $ n * 10 else Nothing+ times10 _ = error "Can't happen"++---------------------------------------------------------------------+-- Basic operation properties+---------------------------------------------------------------------++-- | Iff a value is in either of two ranged sets then it is in the union of+-- those two sets.+--+-- > prop_union rs1 rs2 v =+-- > (rs1 -?- v || rs2 -?- v) == ((rs1 -\/- rs2) -?- v)+prop_union :: (DiscreteOrdered a ) => RSet a -> RSet a -> a -> Bool+prop_union rs1 rs2 v = (rs1 -?- v || rs2 -?- v) == ((rs1 -\/- rs2) -?- v)++-- | Iff a value is in both of two ranged sets then it is n the intersection+-- of those two sets.+--+-- > prop_intersection rs1 rs2 v =+-- > (rs1 -?- v && rs2 -?- v) == ((rs1 -/\- rs2) -?- v)+prop_intersection :: (DiscreteOrdered a) => RSet a -> RSet a -> a -> Bool+prop_intersection rs1 rs2 v =+ (rs1 -?- v && rs2 -?- v) == ((rs1 -/\- rs2) -?- v)++-- | Iff a value is in ranged set 1 and not in ranged set 2 then it is in the+-- difference of the two.+--+-- > prop_difference rs1 rs2 v =+-- > (rs1 -?- v && not (rs2 -?- v)) == ((rs1 -!- rs2) -?- v)+prop_difference :: (DiscreteOrdered a) => RSet a -> RSet a -> a -> Bool+prop_difference rs1 rs2 v =+ (rs1 -?- v && not (rs2 -?- v)) == ((rs1 -!- rs2) -?- v)++-- | Iff a value is not in a ranged set then it is in its negation.+--+-- > prop_negation rs v = rs -?- v == not (rSetNegation rs -?- v)+prop_negation :: (DiscreteOrdered a) => RSet a -> a -> Bool+prop_negation rs v = rs -?- v == not (rSetNegation rs -?- v)++-- | A set that contains a value is not empty+--+-- > prop_not_empty rs v = (rs -?- v) ==> not (rSetIsEmpty rs)+prop_not_empty :: (DiscreteOrdered a) => RSet a -> a -> Property+prop_not_empty rs v = (rs -?- v) ==> not (rSetIsEmpty rs)++---------------------------------------------------------------------+-- Some identities and inequalities of sets+---------------------------------------------------------------------++-- | The empty set has no members.+--+-- > prop_empty v = not (rSetEmpty -?- v)+prop_empty :: (DiscreteOrdered a) => a -> Bool+prop_empty v = not (rSetEmpty -?- v)++-- | The full set has every member.+--+-- > prop_full v = rSetFull -?- v+prop_full :: (DiscreteOrdered a) => a -> Bool+prop_full v = rSetFull -?- v++-- | The intersection of a set with its negation is empty.+--+-- > prop_empty_intersection rs =+-- > rSetIsEmpty (rs -/\- rSetNegation rs)+prop_empty_intersection :: (DiscreteOrdered a) => RSet a -> Bool+prop_empty_intersection rs =+ rSetIsEmpty (rs -/\- rSetNegation rs)++-- | The union of a set with its negation is full.+--+-- > prop_full_union rs v =+-- > rSetIsFull (rs -\/- rSetNegation rs)+prop_full_union :: (DiscreteOrdered a) => RSet a -> Bool+prop_full_union rs =+ rSetIsFull (rs -\/- rSetNegation rs)++-- | The union of two sets is the non-strict superset of both.+--+-- > prop_union_superset rs1 rs2 =+-- > rs1 -<=- u && rs2 -<=- u+-- > where+-- > u = rs1 -\/- rs2+prop_union_superset :: (DiscreteOrdered a) => RSet a -> RSet a -> Bool+prop_union_superset rs1 rs2 =+ rs1 -<=- u && rs2 -<=- u+ where+ u = rs1 -\/- rs2++-- | The intersection of two sets is the non-strict subset of both.+--+-- > prop_intersection_subset rs1 rs2 =+-- > i -<=- rs1 && i -<=- rs2+-- > where+-- > i = rs1 -/\- rs2+prop_intersection_subset :: (DiscreteOrdered a) => RSet a -> RSet a -> Bool+prop_intersection_subset rs1 rs2 = i -<=- rs1 && i -<=- rs2+ where+ i = rs1 -/\- rs2++-- | The difference of two sets intersected with the subtractand is empty.+--+-- > prop_diff_intersect rs1 rs2 =+-- > rSetIsEmpty ((rs1 -!- rs2) -/\- rs2)+prop_diff_intersect :: (DiscreteOrdered a) => RSet a -> RSet a -> Bool+prop_diff_intersect rs1 rs2 = rSetIsEmpty ((rs1 -!- rs2) -/\- rs2)++-- | A set is the non-strict subset of itself.+--+-- > prop_subset rs = rs -<=- rs+prop_subset :: (DiscreteOrdered a) => RSet a -> Bool+prop_subset rs = rs -<=- rs++-- | A set is not the strict subset of itself.+--+-- > prop_strict_subset rs = not (rs -<- rs)+prop_strict_subset :: (DiscreteOrdered a) => RSet a -> Bool+prop_strict_subset rs = not (rs -<- rs)++-- | If rs1 - rs2 is not empty then the union of rs1 and rs2 will be a strict+-- superset of rs2.+--+-- > prop_union_strict_superset rs1 rs2 =+-- > (not $ rSetIsEmpty (rs1 -!- rs2))+-- > ==> (rs2 -<- (rs1 -\/- rs2))+prop_union_strict_superset :: (DiscreteOrdered a) => RSet a -> RSet a -> Property+prop_union_strict_superset rs1 rs2 =+ (not $ rSetIsEmpty (rs1 -!- rs2)) ==> (rs2 -<- (rs1 -\/- rs2))++-- | Intersection commutes.+--+-- > prop_intersection_commutes rs1 rs2 = (rs1 -/\- rs2) == (rs2 -/\- rs1)+prop_intersection_commutes :: (DiscreteOrdered a) => RSet a -> RSet a -> Bool+prop_intersection_commutes rs1 rs2 = (rs1 -/\- rs2) == (rs2 -/\- rs1)++-- | Union commutes.+--+-- > prop_union_commutes rs1 rs2 = (rs1 -\/- rs2) == (rs2 -\/- rs1)+prop_union_commutes :: (DiscreteOrdered a) => RSet a -> RSet a -> Bool+prop_union_commutes rs1 rs2 = (rs1 -\/- rs2) == (rs2 -\/- rs1)++-- | Intersection associates.+--+-- > prop_intersection_associates rs1 rs2 rs3 =+-- > ((rs1 -/\- rs2) -/\- rs3) == (rs1 -/\- (rs2 -/\- rs3))+prop_intersection_associates :: (DiscreteOrdered a) =>+ RSet a -> RSet a -> RSet a -> Bool+prop_intersection_associates rs1 rs2 rs3 =+ ((rs1 -/\- rs2) -/\- rs3) == (rs1 -/\- (rs2 -/\- rs3))++-- | Union associates.+--+-- > prop_union_associates rs1 rs2 rs3 =+-- > ((rs1 -\/- rs2) -\/- rs3) == (rs1 -\/- (rs2 -\/- rs3))+prop_union_associates :: (DiscreteOrdered a) =>+ RSet a -> RSet a -> RSet a -> Bool+prop_union_associates rs1 rs2 rs3 =+ ((rs1 -\/- rs2) -\/- rs3) == (rs1 -\/- (rs2 -\/- rs3))++-- | De Morgan's Law for Intersection.+--+-- > prop_de_morgan_intersection rs1 rs2 =+-- > rSetNegation (rs1 -/\- rs2) == (rSetNegation rs1 -\/- rSetNegation rs2)+prop_de_morgan_intersection :: (DiscreteOrdered a) => RSet a -> RSet a -> Bool+prop_de_morgan_intersection rs1 rs2 =+ rSetNegation (rs1 -/\- rs2) == (rSetNegation rs1 -\/- rSetNegation rs2)++-- | De Morgan's Law for Union.+--+-- > prop_de_morgan_union rs1 rs2 =+-- > rSetNegation (rs1 -\/- rs2) == (rSetNegation rs1 -/\- rSetNegation rs2)++prop_de_morgan_union :: (DiscreteOrdered a) => RSet a -> RSet a -> Bool+prop_de_morgan_union rs1 rs2 =+ rSetNegation (rs1 -\/- rs2) == (rSetNegation rs1 -/\- rSetNegation rs2)
+ src/Data/Ranged/Ranges.hs view
@@ -0,0 +1,360 @@+-----------------------------------------------------------------------------+--+-- Module : Data.Ranged.Ranges+-- Copyright : (c) Paul Johnson 2006+-- License : BSD-style+-- Maintainer : paul@cogito.org.uk+-- Stability : experimental+-- Portability : portable+--+-----------------------------------------------------------------------------++-- | A range has an upper and lower boundary.+module Data.Ranged.Ranges (+ -- ** Construction+ Range (..),+ emptyRange,+ fullRange,+ -- ** Predicates+ rangeIsEmpty,+ rangeIsFull,+ rangeOverlap,+ rangeEncloses,+ rangeSingletonValue,+ -- ** Membership+ rangeHas,+ rangeListHas,+ -- ** Set Operations+ singletonRange,+ rangeIntersection,+ rangeUnion,+ rangeDifference,+ -- ** QuickCheck properties+ prop_unionRange,+ prop_unionRangeLength,+ prop_intersectionRange,+ prop_differenceRange,+ prop_intersectionOverlap,+ prop_enclosureUnion,+ prop_singletonRangeHas,+ prop_singletonRangeHasOnly,+ prop_singletonRangeConverse,+ prop_emptyNonSingleton,+ prop_fullNonSingleton,+ prop_nonSingleton,+ prop_intSingleton+) where++import Control.Monad+import Data.Ranged.Boundaries+import Data.Maybe+import Test.QuickCheck++-- | A Range has upper and lower boundaries.+data Range v = Range {rangeLower, rangeUpper :: Boundary v}++instance (DiscreteOrdered a) => Eq (Range a) where+ r1 == r2 = (rangeIsEmpty r1 && rangeIsEmpty r2) ||+ (rangeLower r1 == rangeLower r2 &&+ rangeUpper r1 == rangeUpper r2)+++instance (DiscreteOrdered a) => Ord (Range a) where+ compare r1 r2+ | r1 == r2 = EQ+ | rangeIsEmpty r1 = LT+ | rangeIsEmpty r2 = GT+ | otherwise = compare (rangeLower r1, rangeUpper r1)+ (rangeLower r2, rangeUpper r2)++instance (Show a, DiscreteOrdered a) => Show (Range a) where+ show r+ | rangeIsEmpty r = "Empty"+ | rangeIsFull r = "All x"+ | otherwise =+ case rangeSingletonValue r of+ Just v -> "x == " ++ show v+ Nothing -> lowerBound ++ "x" ++ upperBound+ where+ lowerBound = case rangeLower r of+ BoundaryBelowAll -> ""+ BoundaryBelow v -> show v ++ " <= "+ BoundaryAbove v -> show v ++ " < "+ BoundaryAboveAll -> error "show Range: lower bound is BoundaryAboveAll"+ upperBound = case rangeUpper r of+ BoundaryBelowAll -> error "show Range: upper bound is BoundaryBelowAll"+ BoundaryBelow v -> " < " ++ show v+ BoundaryAbove v -> " <= " ++ show v+ BoundaryAboveAll -> ""+++-- | True if the value is within the range.+rangeHas :: Ord v => Range v -> v -> Bool++rangeHas (Range b1 b2) v =+ (v />/ b1) && not (v />/ b2)+++-- | True if the value is within one of the ranges.+rangeListHas :: Ord v =>+ [Range v] -> v -> Bool+rangeListHas ls v = or $ map (\r -> rangeHas r v) ls+++-- | The empty range+emptyRange :: DiscreteOrdered v => Range v+emptyRange = Range BoundaryAboveAll BoundaryBelowAll+++-- | The full range. All values are within it.+fullRange :: DiscreteOrdered v => Range v+fullRange = Range BoundaryBelowAll BoundaryAboveAll+++-- | A range containing a single value+singletonRange :: DiscreteOrdered v => v -> Range v+singletonRange v = Range (BoundaryBelow v) (BoundaryAbove v)+++-- | If the range is a singleton, returns @Just@ the value. Otherwise returns+-- @Nothing@.+--+-- Known bug: This always returns @Nothing@ for ranges including+-- @BoundaryBelowAll@ or @BoundaryAboveAll@. For bounded types this can be+-- incorrect. For instance, the following range only contains one value:+--+-- > Range (BoundaryBelow maxBound) BoundaryAboveAll+rangeSingletonValue :: DiscreteOrdered v => Range v -> Maybe v+rangeSingletonValue (Range (BoundaryBelow v1) (BoundaryBelow v2))+ | adjacent v1 v2 = Just v1+ | otherwise = Nothing+rangeSingletonValue (Range (BoundaryBelow v1) (BoundaryAbove v2))+ | v1 == v2 = Just v1+ | otherwise = Nothing+rangeSingletonValue (Range (BoundaryAbove v1) (BoundaryBelow v2)) =+ do+ v2' <- adjacentBelow v2+ v2'' <- adjacentBelow v2'+ if v1 == v2'' then return v2' else Nothing+rangeSingletonValue (Range (BoundaryAbove v1) (BoundaryAbove v2))+ | adjacent v1 v2 = Just v2+ | otherwise = Nothing+rangeSingletonValue (Range _ _) = Nothing++-- | A range is empty unless its upper boundary is greater than its lower+-- boundary.+rangeIsEmpty :: DiscreteOrdered v => Range v -> Bool+rangeIsEmpty (Range lower upper) = upper <= lower+++-- | A range is full if it contains every possible value.+rangeIsFull :: DiscreteOrdered v => Range v -> Bool+rangeIsFull = (== fullRange)++-- | Two ranges overlap if their intersection is non-empty.+rangeOverlap :: DiscreteOrdered v => Range v -> Range v -> Bool+rangeOverlap r1 r2 =+ not (rangeIsEmpty r1)+ && not (rangeIsEmpty r2)+ && not (rangeUpper r1 <= rangeLower r2 || rangeUpper r2 <= rangeLower r1)+++-- | The first range encloses the second if every value in the second range is+-- also within the first range. If the second range is empty then this is+-- always true.+rangeEncloses :: DiscreteOrdered v => Range v -> Range v -> Bool+rangeEncloses r1 r2 =+ (rangeLower r1 <= rangeLower r2 && rangeUpper r2 <= rangeUpper r1)+ || rangeIsEmpty r2+++-- | Intersection of two ranges, if any.+rangeIntersection :: DiscreteOrdered v => Range v -> Range v -> Range v+rangeIntersection r1@(Range lower1 upper1) r2@(Range lower2 upper2)+ | rangeIsEmpty r1 || rangeIsEmpty r2 = emptyRange+ | otherwise = Range (max lower1 lower2) (min upper1 upper2)+++-- | Union of two ranges. Returns one or two results.+--+-- If there are two results then they are guaranteed to have a non-empty+-- gap in between, but may not be in ascending order.+rangeUnion :: DiscreteOrdered v => Range v -> Range v -> [Range v]+rangeUnion r1@(Range lower1 upper1) r2@(Range lower2 upper2)+ | rangeIsEmpty r1 = [r2]+ | rangeIsEmpty r2 = [r1]+ | otherwise =+ if touching then [Range lower upper] else [r1, r2]+ where+ touching = (max lower1 lower2) <= (min upper1 upper2)+ lower = min lower1 lower2+ upper = max upper1 upper2+++-- | @range1@ minus @range2@. Returns zero, one or two results. Multiple+-- results are guaranteed to have non-empty gaps in between, but may not be in+-- ascending order.+rangeDifference :: DiscreteOrdered v => Range v -> Range v -> [Range v]++rangeDifference r1@(Range lower1 upper1) (Range lower2 upper2) =+ -- There are six possibilities+ -- 1: r2 completely less than r1+ -- 2: r2 overlaps bottom of r1+ -- 3: r2 encloses r1+ -- 4: r1 encloses r2+ -- 5: r2 overlaps top of r1+ -- 6: r2 completely greater than r1+ if intersects+ then -- Cases 2,3,4,5+ filter (not . rangeIsEmpty) [Range lower1 lower2, Range upper2 upper1]+ else -- Cases 1, 6+ [r1]+ where+ intersects = (max lower1 lower2) < (min upper1 upper2)+++-- QuickCheck generators++instance (Arbitrary v, DiscreteOrdered v, Show v) =>+ Arbitrary (Range v) where++ arbitrary = frequency [+ (17, do -- Ordinary range+ b1 <- arbitrary+ b2 <- arbitrary+ if b1 < b2+ then return $ Range b1 b2+ else return $ Range b2 b1+ ),+ (1, do -- Singleton range+ v <- arbitrary+ return $ singletonRange v+ ),+ (1, return emptyRange),+ (1, return fullRange)+ ]++instance (CoArbitrary v, DiscreteOrdered v, Show v) =>+ CoArbitrary (Range v) where++ coarbitrary (Range lower upper) =+ variant (0 :: Int) . coarbitrary lower . coarbitrary upper++++-- QuickCheck Properties++-- | The union of two ranges has a value iff either range has it.+--+-- > prop_unionRange r1 r2 n =+-- > (r1 `rangeHas` n || r2 `rangeHas` n)+-- > == (r1 `rangeUnion` r2) `rangeListHas` n+prop_unionRange :: (DiscreteOrdered a) => Range a -> Range a -> a -> Bool+prop_unionRange r1 r2 n =+ (r1 `rangeHas` n || r2 `rangeHas` n)+ == (r1 `rangeUnion` r2) `rangeListHas` n++-- | The union of two ranges always contains one or two ranges.+--+-- > prop_unionRangeLength r1 r2 = (n == 1) || (n == 2)+-- > where n = length $ rangeUnion r1 r2+prop_unionRangeLength :: (DiscreteOrdered a) => Range a -> Range a -> Bool+prop_unionRangeLength r1 r2 = (n == 1) || (n == 2)+ where n = length $ rangeUnion r1 r2++-- | The intersection of two ranges has a value iff both ranges have it.+--+-- > prop_intersectionRange r1 r2 n =+-- > (r1 `rangeHas` n && r2 `rangeHas` n)+-- > == (r1 `rangeIntersection` r2) `rangeHas` n+prop_intersectionRange :: (DiscreteOrdered a) => Range a -> Range a -> a -> Bool+prop_intersectionRange r1 r2 n =+ (r1 `rangeHas` n && r2 `rangeHas` n)+ == (r1 `rangeIntersection` r2) `rangeHas` n++-- | The difference of two ranges has a value iff the first range has it and+-- the second does not.+--+-- > prop_differenceRange r1 r2 n =+-- > (r1 `rangeHas` n && not (r2 `rangeHas` n))+-- > == (r1 `rangeDifference` r2) `rangeListHas` n+prop_differenceRange :: (DiscreteOrdered a) => Range a -> Range a -> a -> Bool+prop_differenceRange r1 r2 n =+ (r1 `rangeHas` n && not (r2 `rangeHas` n))+ == (r1 `rangeDifference` r2) `rangeListHas` n++-- | Iff two ranges overlap then their intersection is non-empty.+--+-- > prop_intersectionOverlap r1 r2 =+-- > (rangeIsEmpty $ rangeIntersection r1 r2) == (rangeOverlap r1 r2)+prop_intersectionOverlap :: (DiscreteOrdered a) => Range a -> Range a -> Bool+prop_intersectionOverlap r1 r2 =+ (rangeIsEmpty $ rangeIntersection r1 r2) == not (rangeOverlap r1 r2)++-- | Range enclosure makes union an identity function.+--+-- > prop_enclosureUnion r1 r2 =+-- > rangeEncloses r1 r2 == (rangeUnion r1 r2 == [r1])+prop_enclosureUnion :: (DiscreteOrdered a) => Range a -> Range a -> Bool+prop_enclosureUnion r1 r2 = rangeEncloses r1 r2 == (rangeUnion r1 r2 == [r1])++-- | Range Singleton has its member.+--+-- > prop_singletonRangeHas v = singletonRange v `rangeHas` v+prop_singletonRangeHas :: (DiscreteOrdered a) => a -> Bool+prop_singletonRangeHas v = singletonRange v `rangeHas` v++-- | Range Singleton has only its member.+--+-- > prop_singletonHasOnly v1 v2 =+-- > (v1 == v2) == (singletonRange v1 `rangeHas` v2)+prop_singletonRangeHasOnly :: (DiscreteOrdered a) => a -> a -> Bool+prop_singletonRangeHasOnly v1 v2 =+ (v1 == v2) == (singletonRange v1 `rangeHas` v2)++-- | A singleton range can have its value extracted.+--+-- > prop_singletonRangeConverse v =+-- > rangeSingletonValue (singletonRange v) == Just v+prop_singletonRangeConverse:: (DiscreteOrdered a) => a -> Bool+prop_singletonRangeConverse v =+ rangeSingletonValue (singletonRange v) == Just v++-- | The empty range is not a singleton.+--+-- > prop_emptyNonSingleton = rangeSingletonValue emptyRange == Nothing+prop_emptyNonSingleton :: Bool+prop_emptyNonSingleton =+ rangeSingletonValue (emptyRange :: Range Int) == Nothing++-- | The full range is not a singleton.+--+-- > prop_fullNonSingleton = rangeSingletonValue fullRange == Nothing+prop_fullNonSingleton :: Bool+prop_fullNonSingleton =+ rangeSingletonValue (fullRange :: Range Int) == Nothing++-- | For real x and y, @x < y@ implies that any range between them is a+-- non-singleton.+prop_nonSingleton :: Double -> Double -> Property+prop_nonSingleton x y = (x < y) ==> null $ mapMaybe rangeSingletonValue rs+ where rs = [+ Range (BoundaryBelow x) (BoundaryBelow y),+ Range (BoundaryAbove x) (BoundaryBelow y),+ Range (BoundaryBelow x) (BoundaryAbove y),+ Range (BoundaryAbove x) (BoundaryAbove y)]+++-- | For all integers x and y, any range formed from boundaries on either side+-- of x and y is a singleton iff it contains exactly one integer.+prop_intSingleton :: Integer -> Integer -> Property+prop_intSingleton x y = forAll (rangeAround x y) $ \r ->+ case filter (rangeHas r) [x-1 .. y+1] of+ [v] -> rangeSingletonValue r == Just v+ _ -> rangeSingletonValue r == Nothing+ where+ rangeAround v1 v2 = return Range `ap` genBound v1 `ap` genBound v2+ genBound v = elements [BoundaryAbove v, BoundaryBelow v]+++
src/Info.hs view
@@ -12,8 +12,8 @@ import AbsSyn import qualified Map+import qualified Data.IntMap as IntMap import Util-import CharSet import Data.Array @@ -39,7 +39,7 @@ infoArr out = char '\t' . interleave_shows (str "\n\t")- (map infoTransition (Map.toAscList out))+ (map infoTransition (IntMap.toAscList out)) infoAccept (Acc p act lctx rctx) = str "\tAccept" . paren (shows p) . space@@ -58,7 +58,7 @@ outputLCtx Nothing = id outputLCtx (Just set)- = paren (outputArr (charSetToArray set)) . char '^'+ = paren (show set ++) . char '^' outputArr arr = str "Array.array " . shows (bounds arr) . space
src/Map.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Map ( Map, member, lookup, findWithDefault,
src/NFA.hs view
@@ -17,15 +17,14 @@ module NFA where import AbsSyn-import CharSet ( CharSet, charSetToArray )+import CharSet import DFS ( t_close, out ) import Map ( Map ) import qualified Map hiding ( Map ) import Util ( str, space ) -import Control.Monad ( zipWithM, zipWithM_ )+import Control.Monad ( forM_, zipWithM, zipWithM_, when ) import Data.Array ( Array, (!), array, listArray, assocs, bounds )---import Debug.Trace -- Each state of a nondeterministic automaton contains a list of `Accept' -- values, a list of epsilon transitions (an epsilon transition represents a@@ -42,14 +41,14 @@ data NState = NSt { nst_accs :: [Accept Code], nst_cl :: [SNum],- nst_outs :: [(CharSet,SNum)]+ nst_outs :: [(ByteSet,SNum)] } -- Debug stuff instance Show NState where showsPrec _ (NSt accs cl outs) = str "NSt " . shows accs . space . shows cl . space .- shows [ (charSetToArray c, s) | (c,s) <- outs ]+ shows [ (c, s) | (c,s) <- outs ] {- From the Scan Module @@ -75,9 +74,9 @@ -- as that startcode, and epsilon transitions from this state to each -- of the sub-NFAs for each of the tokens acceptable in that startcode. -scanner2nfa:: Scanner -> [StartCode] -> NFA-scanner2nfa Scanner{scannerTokens = toks} startcodes- = runNFA $+scanner2nfa:: Encoding -> Scanner -> [StartCode] -> NFA+scanner2nfa enc Scanner{scannerTokens = toks} startcodes+ = runNFA enc $ do -- make a start state for each start code (these will be -- numbered from zero).@@ -109,7 +108,11 @@ accept r_e rctxt_accept return (RightContextRExp r_b) - accept e (Acc prio code lctx rctx_e)+ let lctx' = case lctx of+ Nothing -> Nothing+ Just st -> Just st++ accept e (Acc prio code lctx' rctx_e) return b tok_transitions toks_with_states start_code start_state = do@@ -157,17 +160,17 @@ type MapNFA = Map SNum NState -newtype NFAM a = N {unN :: SNum -> MapNFA -> (SNum, MapNFA, a)}+newtype NFAM a = N {unN :: SNum -> MapNFA -> Encoding -> (SNum, MapNFA, a)} instance Monad NFAM where- return a = N $ \s n -> (s,n,a)+ return a = N $ \s n e -> (s,n,a) - m >>= k = N $ \s n -> case unN m s n of- (s', n', a) -> unN (k a) s' n'+ m >>= k = N $ \s n e -> case unN m s n e of+ (s', n', a) -> unN (k a) s' n' e -runNFA :: NFAM () -> NFA-runNFA m = case unN m 0 Map.empty of- (s, nfa_map, ()) -> -- trace (show (Map.toAscList nfa_map)) $ +runNFA :: Encoding -> NFAM () -> NFA+runNFA e m = case unN m 0 Map.empty e of+ (s, nfa_map, ()) -> -- trace ("runNfa.." ++ show (Map.toAscList nfa_map)) $ e_close (array (0,s-1) (Map.toAscList nfa_map)) e_close:: Array Int NState -> NFA@@ -178,10 +181,51 @@ bds@(_,hi) = bounds ar newState :: NFAM SNum-newState = N $ \s n -> (s+1,n,s)+newState = N $ \s n e -> (s+1,n,s) +getEncoding :: NFAM Encoding+getEncoding = N $ \s n e -> (s,n,e)++anyBytes :: SNum -> Int -> SNum -> NFAM ()+anyBytes from 0 to = epsilonEdge from to+anyBytes from n to = do+ s <- newState+ byteEdge from (byteSetRange 0 0xff) s+ anyBytes s (n-1) to++bytesEdge :: SNum -> [Byte] -> [Byte] -> SNum -> NFAM ()+bytesEdge from [] [] to = epsilonEdge from to+bytesEdge from [x] [y] to = byteEdge from (byteSetRange x y) to -- (OPTIMISATION)+bytesEdge from (x:xs) (y:ys) to + | x == y = do + s <- newState+ byteEdge from (byteSetSingleton x) s+ bytesEdge s xs ys to+ | x < y = do+ do s <- newState+ byteEdge from (byteSetSingleton x) s+ bytesEdge s xs (fmap (const 0xff) ys) to++ do t <- newState+ byteEdge from (byteSetSingleton y) t+ bytesEdge t (fmap (const 0x00) xs) ys to++ when ((x+1) <= (y-1)) $ do + u <- newState+ byteEdge from (byteSetRange (x+1) (y-1)) u+ anyBytes u (length xs) to+ charEdge :: SNum -> CharSet -> SNum -> NFAM ()-charEdge from charset to = N $ \s n -> (s, addEdge n, ())+charEdge from charset to = do+ -- trace ("charEdge: " ++ (show $ charset) ++ " => " ++ show (byteRanges charset)) $ + e <- getEncoding+ forM_ (byteRanges e charset) $ \(xs,ys) -> do+ bytesEdge from xs ys to+ +++byteEdge :: SNum -> ByteSet -> SNum -> NFAM ()+byteEdge from charset to = N $ \s n e -> (s, addEdge n, ()) where addEdge n = case Map.lookup from n of@@ -193,7 +237,7 @@ epsilonEdge :: SNum -> SNum -> NFAM () epsilonEdge from to | from == to = return ()- | otherwise = N $ \s n -> (s, addEdge n, ())+ | otherwise = N $ \s n e -> (s, addEdge n, ()) where addEdge n = case Map.lookup from n of@@ -201,7 +245,7 @@ Just (NSt acc eps trans) -> Map.insert from (NSt acc (to:eps) trans) n accept :: SNum -> Accept Code -> NFAM ()-accept state new_acc = N $ \s n -> (s, addAccept n, ())+accept state new_acc = N $ \s n e -> (s, addAccept n, ()) where addAccept n = case Map.lookup state n of
src/Output.hs view
@@ -14,6 +14,7 @@ import CharSet import Util import qualified Map+import qualified Data.IntMap as IntMap import Control.Monad.ST ( ST, runST ) import Data.Array ( Array )@@ -22,7 +23,6 @@ import Data.Array.Unboxed ( UArray, bounds, assocs, elems, (!), array, listArray ) import Data.Bits import Data.Char ( ord, chr )--- import Debug.Trace import Data.List ( maximumBy, sortBy, groupBy ) -- -----------------------------------------------------------------------------@@ -49,7 +49,8 @@ outputCheck = do_array hexChars16 check_nm table_size check outputDefault = do_array hexChars16 deflt_nm n_states deflt - do_array hex_chars nm upper_bound ints = case target of+ do_array hex_chars nm upper_bound ints = -- trace ("do_array: " ++ nm) $ + case target of GhcTarget -> str nm . str " :: AlexAddr\n" . str nm . str " = AlexA# \""@@ -94,12 +95,7 @@ . str " `alexAndPred` " . outputRCtx rctx - outputLCtx set - = case charSetElems set of- [] -> error "outputLCtx"- [c] -> str "alexPrevCharIs " . shows c- _other -> str "alexPrevCharIsOneOf " - . paren (outputArr (charSetToArray set))+ outputLCtx set = str "alexPrevCharMatches" . str (charSetQuote set) outputRCtx NoRightContext = id outputRCtx (RightContextRExp sn)@@ -149,8 +145,9 @@ [Int], -- default [[Accept Code]] -- accept )-mkTables dfa- = ( elems base_offs, +mkTables dfa = -- trace (show (defaults)) $+ -- trace (show (fmap (length . snd) dfa_no_defaults)) $+ ( elems base_offs, take max_off (elems table), take max_off (elems check), elems defaults,@@ -171,8 +168,8 @@ [ expand (dfa_arr!state) | state <- [0..top_state] ] expand (State _ out) = - [(i, lookup' out i) | i <- ['\0'..'\255']]- where lookup' out' i = case Map.lookup i out' of+ [(i, lookup' out i) | i <- [0..0xff]]+ where lookup' out' i = case IntMap.lookup i out' of Nothing -> -1 Just s -> s @@ -181,7 +178,7 @@ -- find the most common destination state in a given state, and -- make it the default.- best_default :: [(Char,SNum)] -> SNum+ best_default :: [(Int,SNum)] -> SNum best_default prod_list | null sorted = -1 | otherwise = snd (head (maximumBy lengths eq))@@ -191,13 +188,13 @@ lengths a b = length a `compare` length b -- remove all the default productions from the DFA- dfa_no_defaults =+ dfa_no_defaults = [ (s, prods_without_defaults s out) | (s, out) <- zip [0..] expand_states ] prods_without_defaults s out - = [ (ord c, dest) | (c,dest) <- out, dest /= defaults!s ]+ = [ (fromIntegral c, dest) | (c,dest) <- out, dest /= defaults!s ] (base_offs, table, check, max_off) = runST (genTables n_states 255 dfa_no_defaults)
src/ParseMonad.hs view
@@ -7,7 +7,7 @@ -- ----------------------------------------------------------------------------} module ParseMonad (- AlexInput, alexInputPrevChar, alexGetChar,+ AlexInput, alexInputPrevChar, alexGetChar, alexGetByte, AlexPosn(..), alexStartPos, P, runP, StartCode, failP, lookupSMac, lookupRMac, newSMac, newRMac,@@ -18,22 +18,35 @@ import CharSet ( CharSet ) import Map ( Map ) import qualified Map hiding ( Map )-+import UTF8+import Data.Word (Word8) -- ----------------------------------------------------------------------------- -- The input type+--import Codec.Binary.UTF8.Light as UTF8 +type Byte = Word8+ type AlexInput = (AlexPosn, -- current position, Char, -- previous char+ [Byte], String) -- current input string alexInputPrevChar :: AlexInput -> Char-alexInputPrevChar (_,c,_) = c+alexInputPrevChar (_,c,_,_) = c + alexGetChar :: AlexInput -> Maybe (Char,AlexInput)-alexGetChar (_,_,[]) = Nothing-alexGetChar (p,_,(c:s)) = let p' = alexMove p c in p' `seq`- Just (c, (p', c, s))+alexGetChar (_,_,[],[]) = Nothing+alexGetChar (p,_,[],(c:s)) = let p' = alexMove p c in p' `seq`+ Just (c, (p', c, [], s)) +alexGetByte :: AlexInput -> Maybe (Byte,AlexInput)+alexGetByte (p,c,(b:bs),s) = Just (b,(p,c,bs,s))+alexGetByte (_,_,[],[]) = Nothing+alexGetByte (p,_,[],(c:s)) = let p' = alexMove p c + (b:bs) = UTF8.encode c+ in p' `seq` Just (b, (p', c, bs, s))+ -- ----------------------------------------------------------------------------- -- Token positions @@ -84,10 +97,10 @@ Right (_,a) -> Right a where initial_state = PState{ smac_env=senv, rmac_env=renv,- startcode = 0, input=(alexStartPos,'\n',str) }+ startcode = 0, input=(alexStartPos,'\n',[],str) } failP :: String -> P a-failP str = P $ \PState{ input = (p,_,_) } -> Left (Just p,str)+failP str = P $ \PState{ input = (p,_,_,_) } -> Left (Just p,str) -- Macros are expanded during parsing, to simplify the abstract -- syntax. The parsing monad passes around two environments mapping
src/Parser.y view
@@ -8,7 +8,6 @@ -- ----------------------------------------------------------------------------- {-# OPTIONS_GHC -w #-}-{-# LANGUAGE BangPatterns #-} module Parser ( parse, P ) where import AbsSyn
src/Scan.x view
@@ -12,7 +12,6 @@ { {-# OPTIONS_GHC -w #-}-{-# LANGUAGE BangPatterns #-} module Scan(lexer, AlexPosn(..), Token(..), Tkn(..), tokPosn) where @@ -187,7 +186,7 @@ lexError s = do- (p,_,input) <- getInput+ (p,_,_,input) <- getInput failP (s ++ (if (not (null input)) then " at " ++ show (head input) else " at end of file"))@@ -197,7 +196,7 @@ lexToken :: P Token lexToken = do- inp@(p,_,_) <- getInput+ inp@(p,c,_,s) <- getInput sc <- getStartCode case alexScan inp sc of AlexEOF -> return (T p EOFT)@@ -207,9 +206,9 @@ lexToken AlexToken inp1 len t -> do setInput inp1- t inp len+ t (p,c,s) len -type Action = AlexInput -> Int -> P Token+type Action = (AlexPosn,Char,String) -> Int -> P Token skip :: Action skip _ _ = lexToken
src/Set.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Set ( Set, member, empty, insert ) where import Data.Set
src/Text/Alex.hs view
@@ -19,6 +19,8 @@ import AbsSyn import CharSet import DFA+import DFAMin+import NFA import Info import Map ( Map ) import qualified Map hiding ( Map )@@ -56,19 +58,21 @@ -> (String,String) alex cli script = let - target - | OptGhcTarget `elem` cli = GhcTarget- | otherwise = HaskellTarget+ target = if OptGhcTarget `elem` cli then GhcTarget else HaskellTarget+ encoding+ | OptLatin1 `elem` cli = Latin1 + | otherwise = UTF8 (maybe_header, directives, scanner1, maybe_footer) = script (scanner2, scs, sc_hdr) = encodeStartCodes scanner1 (scanner_final, actions) = extractActions scanner2- dfa = scanner2dfa scanner_final scs+ dfa = scanner2dfa encoding scanner_final scs+ min_dfa = minimizeDFA dfa nm = scannerName scanner_final in (maybe id ((++) . snd) (maybe_header) $ maybe id (flip (++) . snd) (maybe_footer) $ - outputDFA target 1 nm dfa "" ++ (actions "") ++ (sc_hdr "")- ,(infoDFA 1 nm dfa ""))+ outputDFA target 1 nm min_dfa "" ++ (actions "") ++ (sc_hdr "")+ ,(infoDFA 1 nm min_dfa "")) optsToInject :: Target -> [CLIFlags] -> String optsToInject GhcTarget _ = "{-# OPTIONS -fglasgow-exts -cpp #-}\n"@@ -124,7 +128,7 @@ initSetEnv :: Map String CharSet initSetEnv = Map.fromList [("white", charSet " \t\n\v\f\r"),- ("printable", charSet [chr 32 .. chr 126]),+ ("printable", charSetRange (chr 32) (chr 0x10FFFF)), -- FIXME: Look it up the unicode standard (".", charSetComplement emptyCharSet `charSetMinus` charSetSingleton '\n')] @@ -137,9 +141,8 @@ data CLIFlags = OptDebugParser | OptGhcTarget- | OptOutputFile FilePath | OptInfoFile (Maybe FilePath)- | OptTemplateDir FilePath+ | OptLatin1 | DumpHelp | DumpVersion deriving Eq
src/Text/Alex/AlexTemplate.hs view
@@ -1,352 +1,363 @@+{-#Language QuasiQuotes#-} module Text.Alex.AlexTemplate where import AbsSyn+import Text.Alex.Verbatim -alexTemplate GhcTarget =- "{-# LINE 1 \"templates\\GenericTemplate.hs\" #-}\n" ++ - "{-# LINE 1 \"templates\\\\GenericTemplate.hs\" #-}\n" ++ - "{-# LINE 1 \"<built-in>\" #-}\n" ++ - "{-# LINE 1 \"<command line>\" #-}\n" ++ - "{-# LINE 1 \"templates\\\\GenericTemplate.hs\" #-}\n" ++ - "-- -----------------------------------------------------------------------------\n" ++ - "-- ALEX TEMPLATE\n" ++ - "--\n" ++ - "-- This code is in the PUBLIC DOMAIN; you may copy it freely and use\n" ++ - "-- it for any purpose whatsoever.\n" ++ - "\n" ++ - "-- -----------------------------------------------------------------------------\n" ++ - "-- INTERNALS and main scanner engine\n" ++ - "\n" ++ - "{-# LINE 37 \"templates\\\\GenericTemplate.hs\" #-}\n" ++ - "\n" ++ - "{-# LINE 47 \"templates\\\\GenericTemplate.hs\" #-}\n" ++ - "\n" ++ - "\n" ++ - "data AlexAddr = AlexA# Addr#\n" ++ - "\n" ++ - "#if __GLASGOW_HASKELL__ < 503\n" ++ - "uncheckedShiftL# = shiftL#\n" ++ - "#endif\n" ++ - "\n" ++ - "{-# INLINE alexIndexInt16OffAddr #-}\n" ++ - "alexIndexInt16OffAddr (AlexA# arr) off =\n" ++ - "#ifdef WORDS_BIGENDIAN\n" ++ - " narrow16Int# i\n" ++ - " where\n" ++ - "\ti = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)\n" ++ - "\thigh = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))\n" ++ - "\tlow = int2Word# (ord# (indexCharOffAddr# arr off'))\n" ++ - "\toff' = off *# 2#\n" ++ - "#else\n" ++ - " indexInt16OffAddr# arr off\n" ++ - "#endif\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "{-# INLINE alexIndexInt32OffAddr #-}\n" ++ - "alexIndexInt32OffAddr (AlexA# arr) off = \n" ++ - "#ifdef WORDS_BIGENDIAN\n" ++ - " narrow32Int# i\n" ++ - " where\n" ++ - " i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#`\n" ++ - "\t\t (b2 `uncheckedShiftL#` 16#) `or#`\n" ++ - "\t\t (b1 `uncheckedShiftL#` 8#) `or#` b0)\n" ++ - " b3 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#)))\n" ++ - " b2 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#)))\n" ++ - " b1 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))\n" ++ - " b0 = int2Word# (ord# (indexCharOffAddr# arr off'))\n" ++ - " off' = off *# 4#\n" ++ - "#else\n" ++ - " indexInt32OffAddr# arr off\n" ++ - "#endif\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "#if __GLASGOW_HASKELL__ < 503\n" ++ - "quickIndex arr i = arr ! i\n" ++ - "#else\n" ++ - "-- GHC >= 503, unsafeAt is available from Data.Array.Base.\n" ++ - "quickIndex = unsafeAt\n" ++ - "#endif\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "-- -----------------------------------------------------------------------------\n" ++ - "-- Main lexing routines\n" ++ - "\n" ++ - "data AlexReturn a\n" ++ - " = AlexEOF\n" ++ - " | AlexError !AlexInput\n" ++ - " | AlexSkip !AlexInput !Int\n" ++ - " | AlexToken !AlexInput !Int a\n" ++ - "\n" ++ - "-- alexScan :: AlexInput -> StartCode -> AlexReturn a\n" ++ - "alexScan input (I# (sc))\n" ++ - " = alexScanUser undefined input (I# (sc))\n" ++ - "\n" ++ - "alexScanUser user input (I# (sc))\n" ++ - " = case alex_scan_tkn user input 0# input sc AlexNone of\n" ++ - "\t(AlexNone, input') ->\n" ++ - "\t\tcase alexGetChar input of\n" ++ - "\t\t\tNothing -> \n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\t\t\t\t AlexEOF\n" ++ - "\t\t\tJust _ ->\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\t\t\t\t AlexError input'\n" ++ - "\n" ++ - "\t(AlexLastSkip input'' len, _) ->\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\t\tAlexSkip input'' len\n" ++ - "\n" ++ - "\t(AlexLastAcc k input''' len, _) ->\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\t\tAlexToken input''' len k\n" ++ - "\n" ++ - "\n" ++ - "-- Push the input through the DFA, remembering the most recent accepting\n" ++ - "-- state it encountered.\n" ++ - "\n" ++ - "alex_scan_tkn user orig_input len input s last_acc =\n" ++ - " input `seq` -- strict in the input\n" ++ - " let \n" ++ - "\tnew_acc = check_accs (alex_accept `quickIndex` (I# (s)))\n" ++ - " in\n" ++ - " new_acc `seq`\n" ++ - " case alexGetChar input of\n" ++ - " Nothing -> (new_acc, input)\n" ++ - " Just (c, new_input) -> \n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\tlet\n" ++ - "\t\t!(base) = alexIndexInt32OffAddr alex_base s\n" ++ - "\t\t!((I# (ord_c))) = ord c\n" ++ - "\t\t!(offset) = (base +# ord_c)\n" ++ - "\t\t!(check) = alexIndexInt16OffAddr alex_check offset\n" ++ - "\t\t\n" ++ - "\t\t!(new_s) = if (offset >=# 0#) && (check ==# ord_c)\n" ++ - "\t\t\t then alexIndexInt16OffAddr alex_table offset\n" ++ - "\t\t\t else alexIndexInt16OffAddr alex_deflt s\n" ++ - "\tin\n" ++ - "\tcase new_s of \n" ++ - "\t -1# -> (new_acc, input)\n" ++ - "\t\t-- on an error, we want to keep the input *before* the\n" ++ - "\t\t-- character that failed, not after.\n" ++ - " \t _ -> alex_scan_tkn user orig_input (len +# 1#) \n" ++ - "\t\t\tnew_input new_s new_acc\n" ++ - "\n" ++ - " where\n" ++ - "\tcheck_accs [] = last_acc\n" ++ - "\tcheck_accs (AlexAcc a : _) = AlexLastAcc a input (I# (len))\n" ++ - "\tcheck_accs (AlexAccSkip : _) = AlexLastSkip input (I# (len))\n" ++ - "\tcheck_accs (AlexAccPred a predx : rest)\n" ++ - "\t | predx user orig_input (I# (len)) input\n" ++ - "\t = AlexLastAcc a input (I# (len))\n" ++ - "\tcheck_accs (AlexAccSkipPred predx : rest)\n" ++ - "\t | predx user orig_input (I# (len)) input\n" ++ - "\t = AlexLastSkip input (I# (len))\n" ++ - "\tcheck_accs (_ : rest) = check_accs rest\n" ++ - "\n" ++ - "data AlexLastAcc a\n" ++ - " = AlexNone\n" ++ - " | AlexLastAcc a !AlexInput !Int\n" ++ - " | AlexLastSkip !AlexInput !Int\n" ++ - "\n" ++ - "data AlexAcc a user\n" ++ - " = AlexAcc a\n" ++ - " | AlexAccSkip\n" ++ - " | AlexAccPred a (AlexAccPred user)\n" ++ - " | AlexAccSkipPred (AlexAccPred user)\n" ++ - "\n" ++ - "type AlexAccPred user = user -> AlexInput -> Int -> AlexInput -> Bool\n" ++ - "\n" ++ - "-- -----------------------------------------------------------------------------\n" ++ - "-- Predicates on a rule\n" ++ - "\n" ++ - "alexAndPred p1 p2 user in1 len in2\n" ++ - " = p1 user in1 len in2 && p2 user in1 len in2\n" ++ - "\n" ++ - "--alexPrevCharIsPred :: Char -> AlexAccPred _ \n" ++ - "alexPrevCharIs c _ input _ _ = c == alexInputPrevChar input\n" ++ - "\n" ++ - "--alexPrevCharIsOneOfPred :: Array Char Bool -> AlexAccPred _ \n" ++ - "alexPrevCharIsOneOf arr _ input _ _ = arr ! alexInputPrevChar input\n" ++ - "\n" ++ - "--alexRightContext :: Int -> AlexAccPred _\n" ++ - "alexRightContext (I# (sc)) user _ _ input = \n" ++ - " case alex_scan_tkn user input 0# input sc AlexNone of\n" ++ - "\t (AlexNone, _) -> False\n" ++ - "\t _ -> True\n" ++ - "\t-- TODO: there's no need to find the longest\n" ++ - "\t-- match when checking the right context, just\n" ++ - "\t-- the first match will do.\n" ++ - "\n" ++ - "-- used by wrappers\n" ++ - "iUnbox (I# (i)) = i" -alexTemplate _ =- "{-# LINE 1 \"templates\\GenericTemplate.hs\" #-}\n" ++ - "{-# LINE 1 \"templates\\\\GenericTemplate.hs\" #-}\n" ++ - "{-# LINE 1 \"<built-in>\" #-}\n" ++ - "{-# LINE 1 \"<command line>\" #-}\n" ++ - "{-# LINE 1 \"templates\\\\GenericTemplate.hs\" #-}\n" ++ - "-- -----------------------------------------------------------------------------\n" ++ - "-- ALEX TEMPLATE\n" ++ - "--\n" ++ - "-- This code is in the PUBLIC DOMAIN; you may copy it freely and use\n" ++ - "-- it for any purpose whatsoever.\n" ++ - "\n" ++ - "-- -----------------------------------------------------------------------------\n" ++ - "-- INTERNALS and main scanner engine\n" ++ - "\n" ++ - "{-# LINE 37 \"templates\\\\GenericTemplate.hs\" #-}\n" ++ - "\n" ++ - "{-# LINE 47 \"templates\\\\GenericTemplate.hs\" #-}\n" ++ - "\n" ++ - "{-# LINE 68 \"templates\\\\GenericTemplate.hs\" #-}\n" ++ - "alexIndexInt16OffAddr arr off = arr ! off\n" ++ - "\n" ++ - "\n" ++ - "{-# LINE 89 \"templates\\\\GenericTemplate.hs\" #-}\n" ++ - "alexIndexInt32OffAddr arr off = arr ! off\n" ++ - "\n" ++ - "\n" ++ - "{-# LINE 100 \"templates\\\\GenericTemplate.hs\" #-}\n" ++ - "quickIndex arr i = arr ! i\n" ++ - "\n" ++ - "\n" ++ - "-- -----------------------------------------------------------------------------\n" ++ - "-- Main lexing routines\n" ++ - "\n" ++ - "data AlexReturn a\n" ++ - " = AlexEOF\n" ++ - " | AlexError !AlexInput\n" ++ - " | AlexSkip !AlexInput !Int\n" ++ - " | AlexToken !AlexInput !Int a\n" ++ - "\n" ++ - "-- alexScan :: AlexInput -> StartCode -> AlexReturn a\n" ++ - "alexScan input (sc)\n" ++ - " = alexScanUser undefined input (sc)\n" ++ - "\n" ++ - "alexScanUser user input (sc)\n" ++ - " = case alex_scan_tkn user input (0) input sc AlexNone of\n" ++ - "\t(AlexNone, input') ->\n" ++ - "\t\tcase alexGetChar input of\n" ++ - "\t\t\tNothing -> \n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\t\t\t\t AlexEOF\n" ++ - "\t\t\tJust _ ->\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\t\t\t\t AlexError input'\n" ++ - "\n" ++ - "\t(AlexLastSkip input'' len, _) ->\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\t\tAlexSkip input'' len\n" ++ - "\n" ++ - "\t(AlexLastAcc k input''' len, _) ->\n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\t\tAlexToken input''' len k\n" ++ - "\n" ++ - "\n" ++ - "-- Push the input through the DFA, remembering the most recent accepting\n" ++ - "-- state it encountered.\n" ++ - "\n" ++ - "alex_scan_tkn user orig_input len input s last_acc =\n" ++ - " input `seq` -- strict in the input\n" ++ - " let \n" ++ - "\tnew_acc = check_accs (alex_accept `quickIndex` (s))\n" ++ - " in\n" ++ - " new_acc `seq`\n" ++ - " case alexGetChar input of\n" ++ - " Nothing -> (new_acc, input)\n" ++ - " Just (c, new_input) -> \n" ++ - "\n" ++ - "\n" ++ - "\n" ++ - "\tlet\n" ++ - "\t\t(base) = alexIndexInt32OffAddr alex_base s\n" ++ - "\t\t((ord_c)) = ord c\n" ++ - "\t\t(offset) = (base + ord_c)\n" ++ - "\t\t(check) = alexIndexInt16OffAddr alex_check offset\n" ++ - "\t\t\n" ++ - "\t\t(new_s) = if (offset >= (0)) && (check == ord_c)\n" ++ - "\t\t\t then alexIndexInt16OffAddr alex_table offset\n" ++ - "\t\t\t else alexIndexInt16OffAddr alex_deflt s\n" ++ - "\tin\n" ++ - "\tcase new_s + 1 of \n" ++ - "\t (0) -> (new_acc, input)\n" ++ - "\t\t-- on an error, we want to keep the input *before* the\n" ++ - "\t\t-- character that failed, not after.\n" ++ - " \t _ -> alex_scan_tkn user orig_input (len + (1)) \n" ++ - "\t\t\tnew_input new_s new_acc\n" ++ - "\n" ++ - " where\n" ++ - "\tcheck_accs [] = last_acc\n" ++ - "\tcheck_accs (AlexAcc a : _) = AlexLastAcc a input (len)\n" ++ - "\tcheck_accs (AlexAccSkip : _) = AlexLastSkip input (len)\n" ++ - "\tcheck_accs (AlexAccPred a predx : rest)\n" ++ - "\t | predx user orig_input (len) input\n" ++ - "\t = AlexLastAcc a input (len)\n" ++ - "\tcheck_accs (AlexAccSkipPred predx : rest)\n" ++ - "\t | predx user orig_input (len) input\n" ++ - "\t = AlexLastSkip input (len)\n" ++ - "\tcheck_accs (_ : rest) = check_accs rest\n" ++ - "\n" ++ - "data AlexLastAcc a\n" ++ - " = AlexNone\n" ++ - " | AlexLastAcc a !AlexInput !Int\n" ++ - " | AlexLastSkip !AlexInput !Int\n" ++ - "\n" ++ - "data AlexAcc a user\n" ++ - " = AlexAcc a\n" ++ - " | AlexAccSkip\n" ++ - " | AlexAccPred a (AlexAccPred user)\n" ++ - " | AlexAccSkipPred (AlexAccPred user)\n" ++ - "\n" ++ - "type AlexAccPred user = user -> AlexInput -> Int -> AlexInput -> Bool\n" ++ - "\n" ++ - "-- -----------------------------------------------------------------------------\n" ++ - "-- Predicates on a rule\n" ++ - "\n" ++ - "alexAndPred p1 p2 user in1 len in2\n" ++ - " = p1 user in1 len in2 && p2 user in1 len in2\n" ++ - "\n" ++ - "--alexPrevCharIsPred :: Char -> AlexAccPred _ \n" ++ - "alexPrevCharIs c _ input _ _ = c == alexInputPrevChar input\n" ++ - "\n" ++ - "--alexPrevCharIsOneOfPred :: Array Char Bool -> AlexAccPred _ \n" ++ - "alexPrevCharIsOneOf arr _ input _ _ = arr ! alexInputPrevChar input\n" ++ - "\n" ++ - "--alexRightContext :: Int -> AlexAccPred _\n" ++ - "alexRightContext (sc) user _ _ input = \n" ++ - " case alex_scan_tkn user input (0) input sc AlexNone of\n" ++ - "\t (AlexNone, _) -> False\n" ++ - "\t _ -> True\n" ++ - "\t-- TODO: there's no need to find the longest\n" ++ - "\t-- match when checking the right context, just\n" ++ - "\t-- the first match will do.\n" ++ - "\n" ++ - "-- used by wrappers\n" ++ - "iUnbox (i) = i" +alexTemplate GhcTarget = [verbatim|+-- -----------------------------------------------------------------------------+-- ALEX TEMPLATE+--+-- This code is in the PUBLIC DOMAIN; you may copy it freely and use+-- it for any purpose whatsoever.++-- -----------------------------------------------------------------------------+-- INTERNALS and main scanner engine++{-# LINE 37 "templates\\GenericTemplate.hs" #-}++{-# LINE 47 "templates\\GenericTemplate.hs" #-}+++data AlexAddr = AlexA# Addr#++-- Never happens+-- #if __GLASGOW_HASKELL__ < 503+-- uncheckedShiftL# = shiftL#+-- #endif++{-# INLINE alexIndexInt16OffAddr #-}+alexIndexInt16OffAddr (AlexA# arr) off = |] +++#ifdef WORDS_BIGENDIAN+ [verbatim|+ narrow16Int# i+ where+ i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)+ high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))+ low = int2Word# (ord# (indexCharOffAddr# arr off'))+ off' = off *# 2#+ |]+#else+ [verbatim|+ indexInt16OffAddr# arr off+ |]+#endif + ++ [verbatim|++++++{-# INLINE alexIndexInt32OffAddr #-}+alexIndexInt32OffAddr (AlexA# arr) off = |] +++#ifdef WORDS_BIGENDIAN+ [verbatim|+ narrow32Int# i+ where+ !i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#`+ (b2 `uncheckedShiftL#` 16#) `or#`+ (b1 `uncheckedShiftL#` 8#) `or#` b0)+ !b3 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#)))+ !b2 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#)))+ !b1 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))+ !b0 = int2Word# (ord# (indexCharOffAddr# arr off'))+ !off' = off *# 4#+ |]+#else+ [verbatim|+ indexInt32OffAddr# arr off+ |]+#endif+ ++ [verbatim|+++++-- Never happens+-- #if __GLASGOW_HASKELL__ < 503+-- quickIndex arr i = arr ! i+-- #else+-- GHC >= 503, unsafeAt is available from Data.Array.Base.+quickIndex = unsafeAt+-- #endif+++++-- -----------------------------------------------------------------------------+-- Main lexing routines++data AlexReturn a+ = AlexEOF+ | AlexError !AlexInput+ | AlexSkip !AlexInput !Int+ | AlexToken !AlexInput !Int a++-- alexScan :: AlexInput -> StartCode -> AlexReturn a+alexScan input (I# (sc))+ = alexScanUser undefined input (I# (sc))++alexScanUser user input (I# (sc))+ = case alex_scan_tkn user input 0# input sc AlexNone of+ (AlexNone, input') ->+ case alexGetByte input of+ Nothing -> ++++ AlexEOF+ Just _ ->++++ AlexError input'++ (AlexLastSkip input'' len, _) ->++++ AlexSkip input'' len++ (AlexLastAcc k input''' len, _) ->++++ AlexToken input''' len k+++-- Push the input through the DFA, remembering the most recent accepting+-- state it encountered.++alex_scan_tkn user orig_input len input s last_acc =+ input `seq` -- strict in the input+ let + new_acc = (check_accs (alex_accept `quickIndex` (I# (s))))+ in+ new_acc `seq`+ case alexGetByte input of+ Nothing -> (new_acc, input)+ Just (c, new_input) -> ++++ let+ (base) = alexIndexInt32OffAddr alex_base s+ ((I# (ord_c))) = fromIntegral c+ (offset) = (base +# ord_c)+ (check) = alexIndexInt16OffAddr alex_check offset+ + (new_s) = if (offset >=# 0#) && (check ==# ord_c)+ then alexIndexInt16OffAddr alex_table offset+ else alexIndexInt16OffAddr alex_deflt s+ in+ case new_s of + -1# -> (new_acc, input)+ -- on an error, we want to keep the input *before* the+ -- character that failed, not after.+ _ -> alex_scan_tkn user orig_input (if c < 0x80 || c >= 0xC0 then (len +# 1#) else len)+ -- note that the length is increased ONLY if this is the 1st byte in a char encoding)+ new_input new_s new_acc++ where+ check_accs [] = last_acc+ check_accs (AlexAcc a : _) = AlexLastAcc a input (I# (len))+ check_accs (AlexAccSkip : _) = AlexLastSkip input (I# (len))+ check_accs (AlexAccPred a predx : rest)+ | predx user orig_input (I# (len)) input+ = AlexLastAcc a input (I# (len))+ check_accs (AlexAccSkipPred predx : rest)+ | predx user orig_input (I# (len)) input+ = AlexLastSkip input (I# (len))+ check_accs (_ : rest) = check_accs rest++data AlexLastAcc a+ = AlexNone+ | AlexLastAcc a !AlexInput !Int+ | AlexLastSkip !AlexInput !Int++instance Functor AlexLastAcc where+ fmap f AlexNone = AlexNone+ fmap f (AlexLastAcc x y z) = AlexLastAcc (f x) y z+ fmap f (AlexLastSkip x y) = AlexLastSkip x y++data AlexAcc a user+ = AlexAcc a+ | AlexAccSkip+ | AlexAccPred a (AlexAccPred user)+ | AlexAccSkipPred (AlexAccPred user)++type AlexAccPred user = user -> AlexInput -> Int -> AlexInput -> Bool++-- -----------------------------------------------------------------------------+-- Predicates on a rule++alexAndPred p1 p2 user in1 len in2+ = p1 user in1 len in2 && p2 user in1 len in2++--alexPrevCharIsPred :: Char -> AlexAccPred _ +alexPrevCharIs c _ input _ _ = c == alexInputPrevChar input++alexPrevCharMatches f _ input _ _ = f (alexInputPrevChar input)++--alexPrevCharIsOneOfPred :: Array Char Bool -> AlexAccPred _ +alexPrevCharIsOneOf arr _ input _ _ = arr ! alexInputPrevChar input++--alexRightContext :: Int -> AlexAccPred _+alexRightContext (I# (sc)) user _ _ input = + case alex_scan_tkn user input 0# input sc AlexNone of+ (AlexNone, _) -> False+ _ -> True+ -- TODO: there's no need to find the longest+ -- match when checking the right context, just+ -- the first match will do.++-- used by wrappers+iUnbox (I# (i)) = i+|]+++++++++-- This code is in the PUBLIC DOMAIN; you may copy it freely and use+-- it for any purpose whatsoever.++alexTemplate _ = unlines[+ "alexIndexInt16OffAddr arr off = arr ! off",+ "alexIndexInt32OffAddr arr off = arr ! off",+ "quickIndex arr i = arr ! i",++ "-- -----------------------------------------------------------------------------",+ "-- Main lexing routines",+ "",+ "data AlexReturn a",+ " = AlexEOF",+ " | AlexError !AlexInput",+ " | AlexSkip !AlexInput !Int",+ " | AlexToken !AlexInput !Int a",+ "",+ "-- alexScan :: AlexInput -> StartCode -> AlexReturn a",+ "alexScan input (sc)",+ " = alexScanUser undefined input (sc)",+ "",+ "alexScanUser user input (sc)",+ " = case alex_scan_tkn user input (0) input sc AlexNone of",+ "\t(AlexNone, input') ->",+ "\t\tcase alexGetByte input of",+ "\t\t\tNothing -> ",+ "",+ "",+ "",+ "\t\t\t\t AlexEOF",+ "\t\t\tJust _ ->",+ "",+ "",+ "",+ "\t\t\t\t AlexError input'",+ "",+ "\t(AlexLastSkip input'' len, _) ->",+ "",+ "",+ "",+ "\t\tAlexSkip input'' len",+ "",+ "\t(AlexLastAcc k input''' len, _) ->",+ "",+ "",+ "",+ "\t\tAlexToken input''' len k",+ "",+ "",+ "-- Push the input through the DFA, remembering the most recent accepting",+ "-- state it encountered.",+ "",+ "alex_scan_tkn user orig_input len input s last_acc =",+ " input `seq` -- strict in the input",+ " let ",+ "\tnew_acc = (check_accs (alex_accept `quickIndex` (s)))",+ " in",+ " new_acc `seq`",+ " case alexGetByte input of",+ " Nothing -> (new_acc, input)",+ " Just (c, new_input) -> ",+ "",+ "",+ "",+ "\tlet",+ "\t\t(base) = alexIndexInt32OffAddr alex_base s",+ "\t\t((ord_c)) = fromIntegral c",+ "\t\t(offset) = (base + ord_c)",+ "\t\t(check) = alexIndexInt16OffAddr alex_check offset",+ "\t\t",+ "\t\t(new_s) = if (offset >= (0)) && (check == ord_c)",+ "\t\t\t then alexIndexInt16OffAddr alex_table offset",+ "\t\t\t else alexIndexInt16OffAddr alex_deflt s",+ "\tin",+ "\tcase new_s of ",+ "\t (-1) -> (new_acc, input)",+ "\t\t-- on an error, we want to keep the input *before* the",+ "\t\t-- character that failed, not after.",+ " \t _ -> alex_scan_tkn user orig_input (if c < 0x80 || c >= 0xC0 then (len + (1)) else len)",+ " -- note that the length is increased ONLY if this is the 1st byte in a char encoding)",+ "\t\t\tnew_input new_s new_acc",+ "",+ " where",+ "\tcheck_accs [] = last_acc",+ "\tcheck_accs (AlexAcc a : _) = AlexLastAcc a input (len)",+ "\tcheck_accs (AlexAccSkip : _) = AlexLastSkip input (len)",+ "\tcheck_accs (AlexAccPred a predx : rest)",+ "\t | predx user orig_input (len) input",+ "\t = AlexLastAcc a input (len)",+ "\tcheck_accs (AlexAccSkipPred predx : rest)",+ "\t | predx user orig_input (len) input",+ "\t = AlexLastSkip input (len)",+ "\tcheck_accs (_ : rest) = check_accs rest",+ "",+ "data AlexLastAcc a",+ " = AlexNone",+ " | AlexLastAcc a !AlexInput !Int",+ " | AlexLastSkip !AlexInput !Int",+ "",+ "instance Functor AlexLastAcc where",+ " fmap f AlexNone = AlexNone",+ " fmap f (AlexLastAcc x y z) = AlexLastAcc (f x) y z",+ " fmap f (AlexLastSkip x y) = AlexLastSkip x y",+ "",+ "data AlexAcc a user",+ " = AlexAcc a",+ " | AlexAccSkip",+ " | AlexAccPred a (AlexAccPred user)",+ " | AlexAccSkipPred (AlexAccPred user)",+ "",+ "type AlexAccPred user = user -> AlexInput -> Int -> AlexInput -> Bool",+ "",+ "-- -----------------------------------------------------------------------------",+ "-- Predicates on a rule",+ "",+ "alexAndPred p1 p2 user in1 len in2",+ " = p1 user in1 len in2 && p2 user in1 len in2",+ "",+ "--alexPrevCharIsPred :: Char -> AlexAccPred _ ",+ "alexPrevCharIs c _ input _ _ = c == alexInputPrevChar input",+ "",+ "alexPrevCharMatches f _ input _ _ = f (alexInputPrevChar input)",+ "",+ "--alexPrevCharIsOneOfPred :: Array Char Bool -> AlexAccPred _ ",+ "alexPrevCharIsOneOf arr _ input _ _ = arr ! alexInputPrevChar input",+ "",+ "--alexRightContext :: Int -> AlexAccPred _",+ "alexRightContext (sc) user _ _ input = ",+ " case alex_scan_tkn user input (0) input sc AlexNone of",+ "\t (AlexNone, _) -> False",+ "\t _ -> True",+ "\t-- TODO: there's no need to find the longest",+ "\t-- match when checking the right context, just",+ "\t-- the first match will do.",+ "",+ "-- used by wrappers",+ "iUnbox (i) = i"+ ]
src/Text/Alex/Quote.hs view
@@ -1,27 +1,32 @@-{-#OPTIONS_GHC -fno-warn-missing-fields#-} - -module Text.Alex.Quote ( - parseAlex - , compileAlex - , alex - ) where - -import Text.Alex(runAlex, Target(..)) -import Text.Alex.AlexTemplate - -import Language.Haskell.TH.Quote -import Language.Haskell.TH - -import Language.Haskell.Meta - -type Alex = String - -compileAlex :: Alex -> Q [Dec] -compileAlex = return . either error id . parseDecs - -alex :: QuasiQuoter -alex = QuasiQuoter {quoteExp = litE . StringL . parseAlex} - -parseAlex :: String -> Alex -parseAlex s = fst (runAlex [] Nothing s) ++ "\n" ++ alexTemplate HaskellTarget - +{-#OPTIONS_GHC -fno-warn-missing-fields#-}++module Text.Alex.Quote (+ parseAlex+-- , parseAlexGHC+ , compileAlex+ , alex+-- , CLIFlags(..)+ ) where++import Text.Alex(runAlex, Target(..), CLIFlags(..))+import Text.Alex.AlexTemplate++import Language.Haskell.TH.Quote+import Language.Haskell.TH++import Language.Haskell.Meta++type Alex = String++compileAlex :: Alex -> Q [Dec]+compileAlex = return . either error id . parseDecs++alex :: QuasiQuoter+alex = QuasiQuoter {quoteExp = litE . StringL . parseAlex}++parseAlex :: String -> Alex+parseAlex s = fst (runAlex [] Nothing s) ++ "\n" ++ alexTemplate HaskellTarget++-- parseAlexGHC :: String -> Alex+-- parseAlexGHC s = fst (runAlex [OptGhcTarget] Nothing s) ++ "\n" ++ alexTemplate GhcTarget+
+ src/Text/Alex/Verbatim.hs view
@@ -0,0 +1,6 @@+module Text.Alex.Verbatim where++import Language.Haskell.TH.Quote+import Language.Haskell.TH.Syntax++verbatim = QuasiQuoter{quoteExp = lift}
+ src/UTF8.hs view
@@ -0,0 +1,36 @@+module UTF8 where++import Data.Word+import Data.Bits+import Data.Char++{-+-- Could also be imported:++import Codec.Binary.UTF8.Light as UTF8+ +encode :: Char -> [Word8]+encode c = head (UTF8.encodeUTF8' [UTF8.c2w c])++-}++-- | Encode a Haskell String to a list of Word8 values, in UTF8 format.+encode :: Char -> [Word8]+encode = map fromIntegral . go . ord+ where+ go oc+ | oc <= 0x7f = [oc]++ | oc <= 0x7ff = [ 0xc0 + (oc `shiftR` 6)+ , 0x80 + oc .&. 0x3f+ ]++ | oc <= 0xffff = [ 0xe0 + (oc `shiftR` 12)+ , 0x80 + ((oc `shiftR` 6) .&. 0x3f)+ , 0x80 + oc .&. 0x3f+ ]+ | otherwise = [ 0xf0 + (oc `shiftR` 18)+ , 0x80 + ((oc `shiftR` 12) .&. 0x3f)+ , 0x80 + ((oc `shiftR` 6) .&. 0x3f)+ , 0x80 + oc .&. 0x3f+ ]