packages feed

language-ats 1.7.6.3 → 1.7.7.0

raw patch · 4 files changed

+27/−4 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Language.ATS: getDependenciesC :: ATS a -> ([FilePath], [String])

Files

CHANGELOG.md view
@@ -1,5 +1,10 @@ # language-ats +## 1.7.7.0++  * Improved parse errors+  * Add `getDependenciesC`+ ## 1.7.6.2    * Fix bug in handling of char literals
language-ats.cabal view
@@ -1,6 +1,6 @@ cabal-version:   1.18 name:            language-ats-version:         1.7.6.3+version:         1.7.7.0 license:         BSD3 license-file:    LICENSE copyright:       Copyright: (c) 2018-2019 Vanessa McHale
src/Language/ATS.hs view
@@ -14,6 +14,7 @@                     , defaultFixityState                     -- * Library functions                     , getDependencies+                    , getDependenciesC                     -- * Syntax Tree                     , ATS (..)                     , Declaration (..)@@ -67,7 +68,7 @@ import           Control.Monad import           Control.Monad.IO.Class import           Control.Monad.Trans.State-import           Data.Version (Version)+import           Data.Version                 (Version) import           GHC.IO.Handle.FD             (stderr) import           Language.ATS.Lexer import           Language.ATS.Parser@@ -76,7 +77,7 @@ import           Language.ATS.Types import           Language.ATS.Types.Lens import           Lens.Micro-import           Paths_language_ats (version)+import           Paths_language_ats           (version) import           Text.PrettyPrint.ANSI.Leijen hiding ((<$>))  -- | @since 1.7.4.0@@ -126,5 +127,21 @@ getDependencies (ATS ds) = g =<< ds     where g (Load _ _ _ s)   = [s]           g (Include s)      = [s]-          g (Local _ as as') = foldMap getDependencies [as, as']+          g (Local _ as as') = getDependencies =<< [as, as']           g _                = mempty++-- | Extract a list of @#include#-ed filepaths, plus all external C blocks.+--+-- @since 1.7.7.0+getDependenciesC :: ATS a -> ([FilePath], [String])+getDependenciesC (ATS ds) = go (d <$> ds)+    where+        d (Load _ _ _ s)   = ([s], [])+        d (Include s)      = ([s], [])+        d (Local _ as as') = appendBoth (getDependenciesC as) (getDependenciesC as')+        d (CBlock str)     = ([],[str])+        d _                = ([],[])+        appendBoth :: ([a], [b]) -> ([a], [b]) -> ([a], [b])+        appendBoth (x, y) (x', y') = (x ++ x', y ++ y')+        go :: [([a], [b])] -> ([a], [b])+        go xs = (concat (fst <$> xs), concat (snd <$> xs))
src/Language/ATS/Parser.y view
@@ -415,6 +415,7 @@           | minus {% left $ Expected $1 "Arrow" "-" }           | eq {% left $ Expected $1 "Arrow" "=" }           | minus {% left $ Expected $1 "Arrow" "-" }+          | customOperator {% left $ Expected (token_posn $1) "Arrow" ((\(Operator _ s) -> s) $1) }           | CaseArrow vbar {% left $ Expected $2 "Expression" "|" }  LambdaArrow :: { LambdaType AlexPosn }