Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "\r" to the valid line terminators. ... #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Data/Attoparsec/ByteString/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,14 @@ peekWord8' = T.Parser $ \t pos more lose succ ->
in ensureSuspended 1 t pos more lose succ'
{-# INLINE peekWord8' #-}

-- | Match either a single newline character @\'\\n\'@, or a carriage
-- return followed by a newline character @\"\\r\\n\"@.
-- | Match a carriage return followed by a newline character @\"\\r\\n\"@,
-- a single newline character @\'\\n\'@, or a single carriage return
-- @\'\\r\'@.
endOfLine :: Parser ()
endOfLine = (word8 10 >> return ()) <|> (string "\r\n" >> return ())
endOfLine =
(string "\r\n" >> return ())
<|> (word8 10 >> return ())
<|> (word8 13 >> return ())

-- | Terminal failure continuation.
failK :: Failure a
Expand Down
10 changes: 7 additions & 3 deletions Data/Attoparsec/Text/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,14 @@ peekChar' = do
return $! T.unsafeHead s
{-# INLINE peekChar' #-}

-- | Match either a single newline character @\'\\n\'@, or a carriage
-- return followed by a newline character @\"\\r\\n\"@.
-- | Match a carriage return followed by a newline character @\"\\r\\n\"@,
-- a single newline character @\'\\n\'@, or a single carriage return
-- @\'\\r\'@.
endOfLine :: Parser ()
endOfLine = (char '\n' >> return ()) <|> (string "\r\n" >> return ())
endOfLine =
(string "\r\n" >> return ())
<|> (char '\n' >> return ())
<|> (char '\r' >> return ())

-- | Terminal failure continuation.
failK :: Failure a
Expand Down