on master help sign in
Properly ignore comments in ipkg files
eb29608David Raymond Christiansen
src/Pkg/PParser.hs+6−2
@@ -1,3 +1,5 @@
1+{-# LANGUAGE OverlappingInstances #-}
2+
1module Pkg.PParser where
3module Pkg.PParser where
2
4
3import Text.Trifecta hiding (span, stringLiteral, charLiteral, natural, symbol, char, string, whiteSpace)
5import Text.Trifecta hiding (span, stringLiteral, charLiteral, natural, symbol, char, string, whiteSpace)
@@ -27,6 +29,10 @@ data PkgDesc = PkgDesc { pkgname :: String,
27 }
29 }
28 deriving Show
30 deriving Show
29
31
32+instance TokenParsing PParser where
33+ someSpace = many (simpleWhiteSpace <|> singleLineComment <|> multiLineComment) *> pure ()
34+
35+
30defaultPkg = PkgDesc "" [] [] Nothing [] "" [] (sUN "") Nothing
36defaultPkg = PkgDesc "" [] [] Nothing [] "" [] (sUN "") Nothing
31
37
32parseDesc :: FilePath -> IO PkgDesc
38parseDesc :: FilePath -> IO PkgDesc
@@ -78,6 +84,4 @@ pClause = do reserved "executable"; lchar '=';
78 mk <- iName []
84 mk <- iName []
79 st <- get
85 st <- get
80 put (st { makefile = Just (show mk) })
86 put (st { makefile = Just (show mk) })
81− <|> do string "--"; many (satisfy (not . isEol)) ; satisfy isEol
82− return ()
83
87