on master help sign in
PParser.hs: filename: Explain failed parse with |fail|

This still provides misleading output from the parser about what it was expecting, but does explain what the actual problem was: *Pkg.PParser> execout <$> runparser pPkg defaultPkg "foo.ipkg" "package bar\n\nexecutable = \"invalid/filename\"" Failure foo.ipkg:3:32: error: a filename must be non-empty and have no directory component, expected: space executable = "invalid/filename"<EOF> ^

commit67ff67e4d8c149589623249b7e7c6481036cb264 authorJeremy W. Sherman <jeremyw.sherman@gmail.com> dateMon 12 Oct 2015, 23:16 (11 years ago) parent3ccdc4b
1 file changed+3−2
src/Pkg/PParser.hs+3−2
src/Pkg/PParser.hs+3−2
@@ -79,8 +79,9 @@ filename = (do
7979 -- Through at least version 0.9.19.1, IPKG executable values were
8080 -- possibly namespaced identifiers, like foo.bar.baz.
8181 show <$> fst <$> iName []
82− guard $ isValidFilename filename
83− return filename)
82+ if isValidFilename filename
83+ then return filename
84+ else fail "a filename must be non-empty and have no directory component")
8485 <?> "filename"
8586 where
8687 isValidFilename :: FilePath -> Bool