on master help sign in
Use hidden instead of <?> ""
commitbd9ce0c7b075753994ea26c29b77710af3c57e72 authorJason Felice <jason.m.felice@gmail.com> dateWed 1 Nov 2017, 22:12 (9 years ago) parent739286e
1 file changed+11−15
src/Idris/Parser/Helpers.hs+11−15
src/Idris/Parser/Helpers.hs+11−15
@@ -130,10 +130,7 @@ eol = () <$ P.satisfy isEol <|> P.lookAhead P.eof <?> "end of line"
130130@
131131 -}
132132singleLineComment :: MonadicParsing m => m ()
133−singleLineComment = (string "--" *>
134− many (P.satisfy (not . isEol)) *>
135− eol *> pure ())
136− <?> ""
133+singleLineComment = P.hidden (() <$ string "--" *> many (P.satisfy (not . isEol)) *> eol)
137134
138135{- | Consumes a multi-line comment
139136
@@ -153,9 +150,8 @@ singleLineComment = (string "--" *>
153150@
154151-}
155152multiLineComment :: MonadicParsing m => m ()
156−multiLineComment = P.try (string "{-" *> (string "-}") *> pure ())
157− <|> string "{-" *> inCommentChars
158− <?> ""
153+multiLineComment = P.hidden $ P.try (string "{-" *> string "-}" *> pure ())
154+ <|> string "{-" *> inCommentChars
159155 where inCommentChars :: MonadicParsing m => m ()
160156 inCommentChars = string "-}" *> pure ()
161157 <|> P.try (multiLineComment) *> inCommentChars
@@ -184,14 +180,14 @@ docComment = do dc <- pushIndent *> docCommentLine
184180 map (\(n, d) -> (n, parseDocstring (T.pack d))) args)
185181
186182 where docCommentLine :: MonadicParsing m => m String
187− docCommentLine = P.try (do string "|||"
188− many (P.satisfy (==' '))
189− contents <- P.option "" (do first <- P.satisfy (\c -> not (isEol c || c == '@'))
190− res <- many (P.satisfy (not . isEol))
191− return $ first:res)
192− eol ; someSpace'
193− return contents)
194− <?> ""
183+ docCommentLine = P.hidden $ P.try $ do
184+ string "|||"
185+ many (P.satisfy (==' '))
186+ contents <- P.option "" (do first <- P.satisfy (\c -> not (isEol c || c == '@'))
187+ res <- many (P.satisfy (not . isEol))
188+ return $ first:res)
189+ eol ; someSpace'
190+ return contents
195191
196192 argDocCommentLine :: IdrisParser (Name, String)
197193 argDocCommentLine = do P.string "|||"