nomeata / cabal-plan-bounds

Calculate Haskell dependency ranges from multiple build plans
BSD 2-Clause "Simplified" License
33 stars 3 forks source link

parser chokes on "quickjs-hs -any" #23

Open mwotton opened 3 months ago

mwotton commented 3 months ago

i'm not actually super familiar with the details of the cabal format, but apparently "quickjs-hs -any" is a valid dependency.

https://github.com/mwotton/quickjs-hs/blob/master/quickjs-hs.cabal#L80

test-suite quickjs-hs-test
  type:             exitcode-stdio-1.0
  main-is:          Spec.hs
  hs-source-dirs:   test
  other-modules:    Paths_quickjs_hs
  default-language: Haskell2010
  ghc-options:      -threaded -rtsopts -with-rtsopts=-N
  build-depends:
      base
    , quickjs-hs           -any
    , aeson
    , exceptions
    , HUnit                >=1.6.0.0
    , QuickCheck           >=2.9
    , tasty                >=1.0
    , tasty-hunit          >=0.10
    , tasty-quickcheck     >=0.9
    , text
    , unordered-containers
    , vector

cabal-plan-bounds fails on this

➜  cabal-plan-bounds --extend --also bytestring-0.12.1.0 --also containers-0.7 --also text-2.1.1 --also time-1.14  -c *.cabal
cabal-plan-bounds: Parsing field failed: "\"<eitherParsec>\" (line 2, column 24):\nunexpected '-'\nexpecting space, white space, opening paren, operator, comma or end of input"
CallStack (from HasCallStack):
  error, called at src/ReplaceDependencies.hs:79:21 in main:ReplaceDependencies

I don't think the "-any" specifier is necessary in my case but it's accepted by cabal, at least.

nomeata commented 3 months ago

Thanks for the report. I'm using the Cabal-syntax library for parsing here, I'll (or someone) have to see if the issue is with that or my code.