@@ -73,9 +73,11 @@ simpleWhiteSpace = satisfy isSpace *> pure ()
7373-- | Checks if a charcter is end of line
7474isEol :: Char -> Bool
7575isEol '\n' = True
76−isEol '\0' = True -- Check eof too
7776isEol _ = False
7877
78+eol :: MonadicParsing m => m ()
79+eol = (satisfy isEol *> pure ()) <|> lookAhead eof <?> "end of line"
80+
7981-- | Checks if a character is a documentation comment marker
8082isDocCommentMarker :: Char -> Bool
8183isDocCommentMarker '|' = True
@@ -88,8 +90,8 @@ isDocCommentMarker _ = False
8890 ;
8991 -}
9092singleLineComment :: MonadicParsing m => m ()
91−singleLineComment = try (string "--" *> satisfy isEol *> pure ())
92− <|> string "--" *> satisfy (not . isDocCommentMarker) *> many (satisfy (not . isEol)) *> (satisfy isEol <?> "end of line") *> pure ()
93+singleLineComment = try (string "--" *> eol *> pure ())
94+ <|> string "--" *> satisfy (not . isDocCommentMarker) *> many (satisfy (not . isEol)) *> eol *> pure ()
9395 <?> ""
9496
9597{- | Consumes a multi-line comment
@@ -129,7 +131,7 @@ docComment :: MonadicParsing m => Char -> m String
129131docComment marker | isDocCommentMarker marker = do dc <- docComment' marker; return (T.unpack $ T.strip $ T.pack dc)
130132 | otherwise = fail "internal error: tried to parse a documentation comment with invalid marker"
131133 where docComment' :: MonadicParsing m => Char -> m String
132− docComment' marker = string "--" *> char marker *> many (satisfy (not . isEol)) <* satisfy isEol
134+ docComment' marker = string "--" *> char marker *> many (satisfy (not . isEol)) <* eol
133135 <|> string "{-" *> char marker *> (manyTill anyChar (try (string "-}")) <?> "end of comment")
134136 <?> ""
135137