From 9696a7e28fd15705b1b1e1db14881e78852c2440 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Mon, 8 Jul 2013 00:00:25 -0400 Subject: [PATCH] Small, non-functional changes around the tree --- .gitignore | 3 +++ Setup.hs | 2 ++ docs/sphinx/conf.py | 2 +- dyna.cabal | 6 +++--- src/Dyna/Analysis/ANF.hs | 2 +- src/Dyna/Backend/Python/Selftest.hs | 1 - src/Dyna/Main/Driver.hs | 14 ++++++++++---- src/Dyna/XXX/TrifectaTests.hs | 5 +++++ 8 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 Setup.hs diff --git a/.gitignore b/.gitignore index 49f4a3e..5ab3da7 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ test/*/*.plan.py test/*/*.anf libpeerconnection.log + +tags +TAGS diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/docs/sphinx/conf.py b/docs/sphinx/conf.py index 851e399..3760468 100644 --- a/docs/sphinx/conf.py +++ b/docs/sphinx/conf.py @@ -63,7 +63,7 @@ except: try: release = version + ' git=' + subprocess.check_output(["git", "describe", "--always"]) except subprocess.CalledProcessError: - release = '?' + release = version + ' gitless' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/dyna.cabal b/dyna.cabal index 3e941c3..8a2e126 100644 --- a/dyna.cabal +++ b/dyna.cabal @@ -4,7 +4,7 @@ Version: 0.4 Cabal-Version: >=1.14 Build-Type: Simple Stability: alpha -Copyright: Copyright (c) 2007-2012, +Copyright: Copyright (c) 2007-2013, Nathaniel W. Filardo, Tim Vieira, wren ng thornton License: OtherLicense License-File: LICENSE @@ -101,7 +101,7 @@ Executable dyna -main-is Dyna.Main.Driver Build-Depends: ansi-wl-pprint >= 0.6, - base >=4, + base >=4 && <6, bytestring >=0.9, charset >=0.3, containers >=0.4, @@ -136,7 +136,7 @@ Test-suite dyna-selftests -main-is Dyna.Main.TestsDriver Build-Depends: ansi-wl-pprint >= 0.6, - base >=4, + base >=4 && <6, bytestring >=0.9, charset >=0.3, containers >=0.4, diff --git a/src/Dyna/Analysis/ANF.hs b/src/Dyna/Analysis/ANF.hs index 8a9ec42..3f4a0f9 100644 --- a/src/Dyna/Analysis/ANF.hs +++ b/src/Dyna/Analysis/ANF.hs @@ -55,7 +55,7 @@ module Dyna.Analysis.ANF ( Crux, EvalCrux(..), UnifCrux(..), cruxIsEval, cruxVars, allCruxVars, - Rule(..), ANFAnnots, ANFWarns, + Rule(..), RuleIx, ANFAnnots, ANFWarns, normTerm, normRule, runNormalize, -- * Internals diff --git a/src/Dyna/Backend/Python/Selftest.hs b/src/Dyna/Backend/Python/Selftest.hs index 67a3dc3..abd4a3f 100644 --- a/src/Dyna/Backend/Python/Selftest.hs +++ b/src/Dyna/Backend/Python/Selftest.hs @@ -17,7 +17,6 @@ import System.IO import System.IO.Error import System.Process import Test.Framework as TF -import Test.Framework.Providers.Program import Test.Framework.TH import Test.Golden diff --git a/src/Dyna/Main/Driver.hs b/src/Dyna/Main/Driver.hs index dd076cb..d92ba66 100644 --- a/src/Dyna/Main/Driver.hs +++ b/src/Dyna/Main/Driver.hs @@ -23,6 +23,7 @@ import qualified Data.IntMap as IM import qualified Data.Maybe as MA import qualified Data.Set as S import Data.String +import Data.Version (showVersion) import Dyna.Analysis.Aggregation import Dyna.Analysis.ANF import Dyna.Analysis.ANFPretty @@ -48,6 +49,14 @@ import qualified Text.PrettyPrint.ANSI.Leijen as PPA import qualified Text.Trifecta as T import qualified Text.Trifecta.Result as TR +import qualified Paths_dyna as CPD + +------------------------------------------------------------------------}}} +-- Version display {{{ + +version :: String +version = showVersion (CPD.version) + ------------------------------------------------------------------------}}} -- Dumping {{{ @@ -174,9 +183,6 @@ quickExit QEHelpDump = do quickExit QEVersion = putStrLn $ "Dyna " ++ version quickExit QEVersionNumber = putStrLn version -version :: String -version = "0.4" -- XREF:VERSION - qeBanner :: String -> IO () qeBanner s = putStrLn $ "Dyna " ++ version ++ ": " ++ s @@ -326,7 +332,7 @@ renderSpannedWarn w s = "WARNING:" <+> text (BU.toString w) <+> "AT" ------------------------------------------------------------------------}}} -- Pipeline! {{{ -processFile :: (?dcfg :: DynacConfig) => String -> IO () +processFile :: (?dcfg :: DynacConfig) => FilePath -> IO () processFile fileName = bracket openOut hClose go where openOut = maybe (return stdout) (flip openFile WriteMode) diff --git a/src/Dyna/XXX/TrifectaTests.hs b/src/Dyna/XXX/TrifectaTests.hs index f0a4c1a..1ebc850 100644 --- a/src/Dyna/XXX/TrifectaTests.hs +++ b/src/Dyna/XXX/TrifectaTests.hs @@ -10,19 +10,23 @@ import qualified Test.Framework as TF import Test.Framework.Providers.HUnit import Test.Framework.TH import Test.HUnit +import qualified Text.PrettyPrint.ANSI.Leijen as PPA import Text.Trifecta import Dyna.XXX.Trifecta import Dyna.XXX.TrifectaTest +pa :: Parser String pa = parens (many $ char 'a') +case_incrementality0 :: Assertion case_incrementality0 = unsafeFS (parseByteString pa mempty fullstr) @=? unsafeFS (starve (feed fullstr (stepParser (release mempty *> pa) mempty B8.empty))) where fullstr = B8.pack "(aa)" +case_incrementality1 :: Assertion case_incrementality1 = unsafeFS (parseByteString pa mempty fullstr) @=? unsafeFS (starve (feed tstr (feed istr (stepParser (release mempty *> pa) mempty B8.empty)))) @@ -42,6 +46,7 @@ _case_incrementality2 = tstr = B8.pack "a)" -} +interactTest :: (Show a) => Parser a -> [String] -> (Either PPA.Doc a, [String]) interactTest p (i:is) = runState (triInteract p next success failure i) is where next = do -- 2.50.1