on master help sign in
Rename someSpace back
90ae69bJason Felice
src/Idris/Package/Parser.hs+5−5
@@ -13,7 +13,7 @@ import Idris.Imports
13import Idris.Package.Common
13import Idris.Package.Common
14import Idris.Parser.Helpers (IdrisInnerParser, MonadicParsing, eol, iName, identifier, isEol,
14import Idris.Parser.Helpers (IdrisInnerParser, MonadicParsing, eol, iName, identifier, isEol,
15 lchar, packageName, parseErrorDoc, reserved,
15 lchar, packageName, parseErrorDoc, reserved,
16− runparser, someSpace', stringLiteral)
16+ runparser, someSpace, stringLiteral)
17
17
18import Control.Applicative
18import Control.Applicative
19import Control.Monad.State.Strict
19import Control.Monad.State.Strict
@@ -48,7 +48,7 @@ pPkg :: PParser PkgDesc
48pPkg = do
48pPkg = do
49 reserved "package"
49 reserved "package"
50 p <- pPkgName
50 p <- pPkgName
51− someSpace'
51+ someSpace
52 modify $ \st -> st { pkgname = p }
52 modify $ \st -> st { pkgname = p }
53 some pClause
53 some pClause
54 st <- get
54 st <- get
@@ -99,10 +99,10 @@ filename = (do
99 "filename must contain no directory component"
99 "filename must contain no directory component"
100
100
101textUntilEol :: MonadicParsing m => m String
101textUntilEol :: MonadicParsing m => m String
102−textUntilEol = many (P.satisfy (not . isEol)) <* eol <* someSpace'
102+textUntilEol = many (P.satisfy (not . isEol)) <* eol <* someSpace
103
103
104clause :: String -> PParser a -> (PkgDesc -> a -> PkgDesc) -> PParser ()
104clause :: String -> PParser a -> (PkgDesc -> a -> PkgDesc) -> PParser ()
105−clause name p f = do value <- reserved name *> lchar '=' *> p <* someSpace'
105+clause name p f = do value <- reserved name *> lchar '=' *> p <* someSpace
106 modify $ \st -> f st value
106 modify $ \st -> f st value
107
107
108commaSep :: MonadicParsing m => m a -> m [a]
108commaSep :: MonadicParsing m => m a -> m [a]
@@ -113,7 +113,7 @@ pClause = clause "executable" filename (\st v -> st { execout = Just v })
113 <|> clause "main" (fst <$> iName []) (\st v -> st { idris_main = Just v })
113 <|> clause "main" (fst <$> iName []) (\st v -> st { idris_main = Just v })
114 <|> clause "sourcedir" (fst <$> identifier) (\st v -> st { sourcedir = v })
114 <|> clause "sourcedir" (fst <$> identifier) (\st v -> st { sourcedir = v })
115 <|> clause "opts" (pureArgParser . words . fst <$> stringLiteral) (\st v -> st { idris_opts = v ++ idris_opts st })
115 <|> clause "opts" (pureArgParser . words . fst <$> stringLiteral) (\st v -> st { idris_opts = v ++ idris_opts st })
116− <|> clause "pkgs" (commaSep (pPkgName <* someSpace')) (\st ps ->
116+ <|> clause "pkgs" (commaSep (pPkgName <* someSpace)) (\st ps ->
117 let pkgs = pureArgParser $ concatMap (\x -> ["-p", show x]) ps
117 let pkgs = pureArgParser $ concatMap (\x -> ["-p", show x]) ps
118 in st { pkgdeps = ps `union` pkgdeps st
118 in st { pkgdeps = ps `union` pkgdeps st
119 , idris_opts = pkgs ++ idris_opts st })
119 , idris_opts = pkgs ++ idris_opts st })
src/Idris/Parser/Helpers.hs+6−6
@@ -52,8 +52,8 @@ parseErrorDoc = PP.string . parseErrorPretty
52-- | Generalized monadic parsing constraint type
52-- | Generalized monadic parsing constraint type
53type MonadicParsing m = (P.MonadParsec Void String m)
53type MonadicParsing m = (P.MonadParsec Void String m)
54
54
55−someSpace' :: MonadicParsing m => m ()
55+someSpace :: MonadicParsing m => m ()
56−someSpace' = many (simpleWhiteSpace <|> singleLineComment <|> multiLineComment) *> pure ()
56+someSpace = many (simpleWhiteSpace <|> singleLineComment <|> multiLineComment) *> pure ()
57
57
58tokenFC :: MonadicParsing m => m a -> m (a, FC)
58tokenFC :: MonadicParsing m => m a -> m (a, FC)
59tokenFC p = do (FC fn (sl, sc) _) <- getFC --TODO: Update after fixing getFC
59tokenFC p = do (FC fn (sl, sc) _) <- getFC --TODO: Update after fixing getFC
@@ -186,7 +186,7 @@ docComment = do dc <- pushIndent *> docCommentLine
186 contents <- P.option "" (do first <- P.satisfy (\c -> not (isEol c || c == '@'))
186 contents <- P.option "" (do first <- P.satisfy (\c -> not (isEol c || c == '@'))
187 res <- many (P.satisfy (not . isEol))
187 res <- many (P.satisfy (not . isEol))
188 return $ first:res)
188 return $ first:res)
189− eol ; someSpace'
189+ eol ; someSpace
190 return contents
190 return contents
191
191
192 argDocCommentLine :: IdrisParser (Name, String)
192 argDocCommentLine :: IdrisParser (Name, String)
@@ -197,12 +197,12 @@ docComment = do dc <- pushIndent *> docCommentLine
197 n <- fst <$> name
197 n <- fst <$> name
198 P.many (P.satisfy isSpace)
198 P.many (P.satisfy isSpace)
199 docs <- P.many (P.satisfy (not . isEol))
199 docs <- P.many (P.satisfy (not . isEol))
200− P.eol ; someSpace'
200+ P.eol ; someSpace
201 return (n, docs)
201 return (n, docs)
202
202
203-- | Parses some white space
203-- | Parses some white space
204whiteSpace :: MonadicParsing m => m ()
204whiteSpace :: MonadicParsing m => m ()
205−whiteSpace = someSpace' <|> pure ()
205+whiteSpace = someSpace <|> pure ()
206
206
207-- | Parses a string literal
207-- | Parses a string literal
208stringLiteral :: MonadicParsing m => m (String, FC)
208stringLiteral :: MonadicParsing m => m (String, FC)
@@ -258,7 +258,7 @@ lcharFC ch = do (FC file (l, c) _) <- getFC
258 return $ FC file (l, c) (l, c+1)
258 return $ FC file (l, c) (l, c+1)
259
259
260symbol :: MonadicParsing m => String -> m ()
260symbol :: MonadicParsing m => String -> m ()
261−symbol = void . P.symbol someSpace'
261+symbol = void . P.symbol someSpace
262
262
263symbolFC :: MonadicParsing m => String -> m FC
263symbolFC :: MonadicParsing m => String -> m FC
264symbolFC str = do (FC file (l, c) _) <- getFC
264symbolFC str = do (FC file (l, c) _) <- getFC