BNFC-meta 0.3 → 0.3.0.1
raw patch · 5 files changed
+17/−14 lines, 5 filesdep ~alex-metadep ~happy-meta
Dependency ranges changed: alex-meta, happy-meta
Files
- BNFC-meta.cabal +3/−3
- Bootstrap/Bootstrap.hs +3/−3
- Language/LBNF.hs +7/−5
- Language/LBNF/Compiletime.hs +1/−2
- Language/LBNF/Grammar.hs +3/−1
BNFC-meta.cabal view
@@ -1,5 +1,5 @@ Name: BNFC-meta-version: 0.3+version: 0.3.0.1 cabal-Version: >= 1.6 build-type: Simple license: GPL-2@@ -29,8 +29,8 @@ , array==0.3.0.* , template-haskell >=2.4&&<2.7 , haskell-src-meta >= 0.5 && < 1.0- , happy-meta >= 0.2.0.2- , alex-meta >= 0.3+ , happy-meta >= 0.2.0.4 && < 0.3+ , alex-meta >= 0.3.0.3 && < 0.4 , syb >= 0.2 && <1.0 Exposed-modules: Language.LBNF
Bootstrap/Bootstrap.hs view
@@ -33,7 +33,7 @@ bbfile = bfile ++ ".bak" main = do- c <- getCode (package,"Language.LBNF.Grammar") g+ c <- getCode ("Language.LBNF.Grammar") g doesFileExist bfile >>= \b -> when b $ copyFile bfile bbfile copyFile file bfile writeFile file $ c@@ -47,11 +47,11 @@ here = do- c <- getCode ("main", "Grammar") g+ c <- getCode ("Grammar") g writeFile "Grammar.hs" c -g = [$lbnf|+g = [lbnf| -- A Grammar is a sequence of definitions
Language/LBNF.hs view
@@ -90,26 +90,28 @@ dumpCode :: Grammar -> Q [Dec] dumpCode g = do- runIO $ getCode ("main","Main") g >>= writeFile "dump.hs"+ runIO $ getCode ("Main") g >>= writeFile "dump.hs" bnfc g -getCode :: (String,String) -> Grammar -> IO String-getCode (p,m) g = do+getCode :: String -> Grammar -> IO String+getCode m g = do let cf = toCF g datas <- runQ $ absRules cf tokens <- runQ $ absTokens cf pretty <- runQ $ cf2Printer cf dEp <- runQ $ cf2qq cf let header = unlines- [ "{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-}"+ [ "{-# LANGUAGE TemplateHaskell #-}"+ , "{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-}" , "module "++m++exportList (m++".") cf++" where" , "import Language.LBNF.Compiletime"+ , "import Language.Haskell.TH(lift,loc_package,location)" ] res = unlines [ header, uglyPrint $ pprint $ concat [datas , tokens, pretty, dEp], concreteAlex cf,- concreteHappy (Loc {loc_module = m, loc_package = p}) cf+ concreteHappy (Loc {loc_module = m, loc_package = " $(fmap loc_package location >>= lift) "}) cf ] return res
Language/LBNF/Compiletime.hs view
@@ -28,6 +28,7 @@ , Lift (..) , printAq , stringAq+ ) where import Language.LBNF.Runtime@@ -251,7 +252,5 @@ handle :: ParseMonad BNFC_QQType -> Q BNFC_QQType handle (Bad s) = fail s handle (Ok a) = return a--
Language/LBNF/Grammar.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-overlapping-patterns #-} module Language.LBNF.Grammar(Language.LBNF.Grammar.myLexer , Language.LBNF.Grammar.tokens@@ -99,6 +100,7 @@ , Language.LBNF.Grammar.Reg(..) , Language.LBNF.Grammar.Ident(..)) where import Language.LBNF.Compiletime+import Language.Haskell.TH (location, loc_package) data Grammar = Grammar ([Def]) deriving (Show, Eq, Ord) data Def@@ -5517,7 +5519,7 @@ myLexer = tokens -myLocation = ("BNFC-meta-0.3","Language.LBNF.Grammar")+myLocation = ($(fmap loc_package location >>= lift),"Language.LBNF.Grammar") {-# LINE 1 "templates\GenericTemplate.hs" #-} {-# LINE 1 "templates\\GenericTemplate.hs" #-}