-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from fizruk/fix-doctests
Fix doctests
- Loading branch information
Showing
9 changed files
with
152 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
haskell/free-foil/src/Language/LambdaPi/Syntax/Abs.hs linguist-generated=true | ||
haskell/free-foil/src/Language/LambdaPi/Syntax/Doc.txt linguist-generated=true | ||
haskell/free-foil/src/Language/LambdaPi/Syntax/Layout.hs linguist-generated=true | ||
haskell/free-foil/src/Language/LambdaPi/Syntax/Layout.hs linguist-generated=true | ||
haskell/free-foil/src/Language/LambdaPi/Syntax/* linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,59 @@ | ||
{-# LANGUAGE CPP #-} | ||
{-# LANGUAGE QuasiQuotes #-} | ||
|
||
-- Source: https://github.com/haskell/cabal/issues/6726#issuecomment-918663262 | ||
|
||
-- | Custom Setup that runs bnfc to generate the language sub-libraries | ||
-- for the parsers included in Ogma. | ||
module Main (main) where | ||
|
||
import Distribution.Simple (defaultMainWithHooks, | ||
hookedPrograms, postConf, | ||
preBuild, simpleUserHooks) | ||
import Distribution.Simple.Program (Program (..), findProgramVersion, | ||
simpleProgram) | ||
import System.Process (system) | ||
import Data.List (intercalate) | ||
import Distribution.Simple (defaultMainWithHooks, hookedPrograms, postConf, preBuild, simpleUserHooks) | ||
import Distribution.Simple.Program (Program (..), findProgramVersion, simpleProgram) | ||
import PyF (fmt) | ||
import System.Exit (ExitCode (..)) | ||
import System.Process (callCommand) | ||
|
||
-- | Run BNFC on the grammar before the actual build step. | ||
-- | Run BNFC, happy, and alex on the grammar before the actual build step. | ||
-- | ||
-- All options for bnfc are hard-coded here. | ||
main :: IO () | ||
main = defaultMainWithHooks $ simpleUserHooks | ||
{ hookedPrograms = [ bnfcProgram ] | ||
, postConf = \args flags packageDesc localBuildInfo -> do | ||
#ifndef mingw32_HOST_OS | ||
_ <- system "bnfc -d -p Language.LambdaPi --generic -o src/ grammar/LambdaPi/Syntax.cf" | ||
main = | ||
defaultMainWithHooks $ | ||
simpleUserHooks | ||
{ hookedPrograms = [bnfcProgram] | ||
, postConf = \args flags packageDesc localBuildInfo -> do | ||
let | ||
isWindows = | ||
#ifdef mingw32_HOST_OS | ||
True | ||
#else | ||
False | ||
#endif | ||
postConf simpleUserHooks args flags packageDesc localBuildInfo | ||
} | ||
-- See the details on the command in https://github.com/objectionary/normalizer/issues/347#issuecomment-2117097070 | ||
command = intercalate "; " $ | ||
[ "set -ex" ] <> | ||
[ "chcp.com" | isWindows ] <> | ||
[ "chcp.com 65001" | isWindows ] <> | ||
[ "bnfc --haskell -d -p Language.LambdaPi --generic -o src/ grammar/LambdaPi/Syntax.cf" | ||
, "cd src/Language/LambdaPi/Syntax" | ||
, "alex Lex.x" | ||
, "happy Par.y" | ||
, "true" | ||
] | ||
|
||
fullCommand = [fmt|bash -c ' {command} '|] | ||
|
||
putStrLn fullCommand | ||
|
||
_ <- callCommand fullCommand | ||
|
||
postConf simpleUserHooks args flags packageDesc localBuildInfo | ||
} | ||
|
||
-- | TODO: This should be in Cabal.Distribution.Simple.Program.Builtin. | ||
-- | NOTE: This should be in Cabal.Distribution.Simple.Program.Builtin. | ||
bnfcProgram :: Program | ||
bnfcProgram = (simpleProgram "bnfc") | ||
{ programFindVersion = findProgramVersion "--version" id | ||
} | ||
bnfcProgram = | ||
(simpleProgram "bnfc") | ||
{ programFindVersion = findProgramVersion "--version" id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters