packages feed

BNFC-meta 0.5 → 0.6

raw patch · 6 files changed

+32/−21 lines, 6 filesdep ~template-haskell

Dependency ranges changed: template-haskell

Files

BNFC-meta.cabal view
@@ -1,5 +1,5 @@ Name:	        BNFC-meta-version:        0.5+version:        0.6 cabal-Version:  >= 1.6 build-type:     Simple license:        GPL-2@@ -46,7 +46,7 @@   Build-Depends:      base>=4.2&&<5     , array>=0.4&&<0.6-    , template-haskell >=2.11&&<2.12+    , template-haskell >=2.12 && < 2.13     , haskell-src-meta >= 0.5 && < 1.0     , happy-meta >= 0.2.0.4 && < 0.3     , alex-meta >= 0.3.0.5 && < 0.4
Bootstrap/Bootstrap.hs view
@@ -26,7 +26,7 @@ import System.FilePath  -- This was required for some reason but I don't recall why /Jonas-package = "BNFC-meta-0.2.1"+package = "BNFC-meta-0.6"  nfile = file ++ ".new.bak" file = ".." </> "Language" </> "LBNF" </> "Grammar.hs"
Language/LBNF/CFtoAbstract.hs view
@@ -24,40 +24,47 @@  import Language.LBNF.CF -absRules :: CF -> Q [Dec]-absRules cf0 = sequence $ -  map (prData $ map mkName $ derivations cf0) $ cf2data cf0  +absRules :: CF -> Q [Dec]+absRules cf0 = sequence $ +  map (prData $ mkDerivClause $ map mkName $ derivations cf0) $ cf2data cf0+  where+    mkDerivClause :: [Name] -> [Q DerivClause]+    mkDerivClause names = return $ return $ DerivClause Nothing (map ConT names)   absTokens :: CF -> Q [Dec] absTokens cf0 = sequence $ -  map (prSpecialData (map mkName $ derivations cf0) cf0) (specialCats cf0)-+  map (prSpecialData (mkDerivClause $ map mkName $ derivations cf0) cf0) (specialCats cf0)+  where+    mkDerivClause :: [Name] -> [DerivClause]+    mkDerivClause names = return $ DerivClause Nothing (map ConT names)   fixname :: String -> TypeQ fixname ('[':xs) = appT listT $ conT $ mkName $ init xs fixname xs = conT $ mkName xs   -prData :: [Name] -> Data -> Q Dec+prData :: [DerivClauseQ] -> Data -> Q Dec prData deriv (cat,rules) = -  dataD (return []) (mkName cat) [] Nothing (map cons rules) deriv' where+  dataD (return []) (mkName cat) [] Nothing (map cons rules) deriv where     cons (fun,cats) = normalC (mkName fun) $ either (map typ) (const str) cats     typ = strictType notStrict . fixname     str = [typ "String"]-    deriv' = mapM conT deriv - -- deriv = [''Eq,''Ord,''Show] -prSpecialData :: [Name] -> CF -> Cat -> Q Dec-prSpecialData deriv cf cat =-  newtypeD (return []) (mkName cat) [] Nothing con deriv' where-    con = normalC (mkName cat) $ [typ]-    typ = strictType notStrict $ contentSpec cf cat-    deriv' = mapM conT deriv+prSpecialData :: [DerivClause] -> CF -> Cat -> Q Dec+prSpecialData deriv cf cat = do+  let con = normalC (mkName cat) $ [typ]+      typ = strictType notStrict $ contentSpec cf cat+  ctxt1 <- (return [])+  con1  <- con+  return (NewtypeD ctxt1 (mkName cat) [] Nothing con1 deriv)  +-- got rid of newtypeD by replacing it with its definition in 2.10.0.0, and then+-- forcing the parameters of NewtypeD to match up with the new types in 2.12.0.0+  contentSpec :: CF -> Cat -> Q Type contentSpec cf cat = if isPositionCat cf cat 
Language/LBNF/CFtoLayout.hs view
@@ -67,8 +67,9 @@       (id         [''Token, 'Err,  ''Posn, 'PT,  ''Tok, 'TS,  'Pn, ''Block, 'Implicit, 'Explicit])       (map mkName ["Token", "Err", "Posn", "PT", "Tok", "TS", "Pn", "Block", "Implicit","Explicit"])  in fmap mkRename $  -     fmap (DataD [] (mkName "Block") [] Nothing [NormalC (mkName "Implicit") [(Bang NoSourceUnpackedness NoSourceStrictness,ConT ''Int)],-       NormalC (mkName "Explicit") []] [ConT ''Show]:)+     fmap (DataD [] (mkName "Block") [] Nothing [NormalC (mkName "Implicit") [(Bang NoSourceUnpackedness NoSourceStrictness ,ConT ''Int)],+       NormalC (mkName "Explicit") []]+       ([DerivClause Nothing [ConT ''Show]])  :)        (makedecs top lay stop (sort (reservedWords cf ++ symbols cf)))         -- Hack to make haddock work
examples/jll/JavaletteLight.hs view
@@ -5,7 +5,7 @@ import Language.LBNF.Compiletime  import Language.LBNF(lbnf, dumpCode, bnfc)-dumpCode [lbnf|+bnfc [lbnf|  Fun.      Prog     ::= Typ Ident "(" ")" "{" [Stm] "}" ; 
examples/jll/UseJll.hs view
@@ -24,3 +24,6 @@ print10 :: Prog print10 = printing' [expr| 5 + 5 |] +main :: IO ()+main = do+  print print10