cdeps 0.1.2.3 → 0.1.2.4
raw patch · 4 files changed
+47/−77 lines, 4 filesdep −semigroupsdep −transformersdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies removed: semigroups, transformers
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- cdeps.cabal +35/−46
- src/Language/C/Dependency.x +4/−29
- test/Spec.hs +4/−2
CHANGELOG.md view
@@ -1,5 +1,9 @@ # cdeps +## 0.1.2.4++ * No nested comments since C doesn't have them+ ## 0.1.2.3 * Set `cross` flag to temporarily enable cross-compilation. This will be
cdeps.cabal view
@@ -1,44 +1,43 @@-cabal-version: 1.18-name: cdeps-version: 0.1.2.3-license: BSD3-license-file: LICENSE-copyright: Copyright: (c) 2018 Vanessa McHale-maintainer: vamchale@gmail.com-author: Vanessa McHale-synopsis: Extract dependencies from C code.+cabal-version: 1.18+name: cdeps+version: 0.1.2.4+license: BSD3+license-file: LICENSE+copyright: Copyright: (c) 2018 Vanessa McHale+maintainer: vamchale@gmail.com+author: Vanessa McHale+synopsis: Extract dependencies from C code. description: This package provides the ability to extract dependencies from C code, for use with [shake](https://shakebuild.com) or otherwise. This can also be used to extract dependencies from Haskell source using the C preprocessor.-category: Development, C, Language-build-type: Simple-extra-doc-files: README.md- CHANGELOG.md +category: Development, C, Language+build-type: Simple+extra-doc-files:+ README.md+ CHANGELOG.md+ source-repository head- type: darcs+ type: darcs location: https://hub.darcs.net/vamchale/cdeps flag cross- description:- Set this flag when cross-compiling- default: False- manual: True+ description: Set this flag when cross-compiling+ default: False+ manual: True flag development- description:- Enable `-Werror`- default: False- manual: True+ description: Enable `-Werror`+ default: False+ manual: True library- exposed-modules:- Language.C.Dependency- hs-source-dirs: src+ exposed-modules: Language.C.Dependency+ hs-source-dirs: src default-language: Haskell2010 other-extensions: OverloadedStrings- ghc-options: -Wall+ ghc-options: -Wall build-depends:- base >=4.8 && <5,+ base >=4.9 && <5, text -any, bytestring -any, array -any,@@ -51,11 +50,6 @@ if (flag(development) && impl(ghc <8.4)) ghc-options: -Werror - if !impl(ghc >=8.0)- build-depends:- transformers -any,- semigroups -any- if impl(ghc >=8.0) ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates @@ -63,21 +57,16 @@ ghc-options: -Wmissing-export-lists executable cdeps- main-is: Main.hs- hs-source-dirs: app- other-modules:- Paths_cdeps+ main-is: Main.hs+ hs-source-dirs: app+ other-modules: Paths_cdeps default-language: Haskell2010- ghc-options: -Wall+ ghc-options: -Wall build-depends:- base >=4.8 && <5,+ base >=4.9 && <5, cdeps -any, optparse-applicative -any - if !impl(ghc >=8.0)- build-depends:- semigroups -any- if (flag(development) && impl(ghc <8.4)) ghc-options: -Werror @@ -88,11 +77,11 @@ ghc-options: -Wmissing-export-lists test-suite cdeps-test- type: exitcode-stdio-1.0- main-is: Spec.hs- hs-source-dirs: test+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ hs-source-dirs: test default-language: Haskell2010- ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall build-depends: base -any, cdeps -any,
src/Language/C/Dependency.x view
@@ -30,12 +30,15 @@ @include = "#include" | "#include" $white+ \\\n +@comment_inner_char = ([^\*] | \* [^\/])+ tokens :- $white+ ; "//".* ; - "/*" { \_ _ -> nested_comment }+ -- FIXME: no nested comments in C+ "/*" @comment_inner_char* "*/" ; @include { \_ _ -> alex Include } @string { tok (\_ s -> alex (StringTok (TL.unpack (decodeUtf8 s)))) }@@ -62,34 +65,6 @@ getIncludesText :: TL.Text -> Either String [FilePath] getIncludesText = getIncludes . encodeUtf8---- TODO file name??-nested_comment :: Alex Token-nested_comment = go 1 =<< alexGetInput-- where go :: Int -> AlexInput -> Alex Token- go 0 input = alexSetInput input *> alexMonadScan- go n input =- case alexGetByte input of- Nothing -> err input- Just (c, input') ->- case c of- 42 ->- case alexGetByte input' of- Nothing -> err input'- Just (47,input_) -> go (n-1) input_- Just (_,input_) -> go n input_- 47 ->- case alexGetByte input' of- Nothing -> err input'- Just (c',input_) -> go (addLevel c' $ n) input_- _ -> go n input'-- addLevel c' = if c' == 42 then (+1) else id-- err (pos,_,_,_) =- let (AlexPn _ line col) = pos in- alexError ("Error in nested comment at line " ++ show line ++ ", column " ++ show col) extractDeps :: [Token] -> [FilePath] extractDeps [] = []
test/Spec.hs view
@@ -6,7 +6,9 @@ main :: IO () main = hspec $ parallel $ describe "byteStringIncludes" $ do- it "should work (1/2)" $+ it "should work (1/3)" $ getIncludes "#include \"header.h\"" `shouldBe` Right ["header.h"]- it "should work (2/2)" $+ it "should work (2/3)" $ getIncludes "#include \\\n\"gmp.cats\"" `shouldBe` Right ["gmp.cats"]+ it "should work (3/3)" $+ getIncludes "/* block commend /* */\n#include \\\n\"gmp.cats\"" `shouldBe` Right ["gmp.cats"]