Commits

Bryan O'Sullivan committed e97677a Merge

Merge.

  • Participants
  • Parent commits 16ecbe9, e12e762

Comments (0)

Files changed (4)

 *.o
 *~
 .*.swp
+*.orig
 187e68710ea1903fdb2fcc78964574982830adc0 0.2
+9c2929e868fdfe4cb267f1cc9d41bdab31d97640 0.2.1
 1f5944a3920322fa8e2bb2fbc9382223968a77d7 0.2.2
+d4934c7fdf544d4e5b2925cada4b91d92a8948c2 0.3
+91a8667f027294bdf9df7bbe3fe1083a8d09f26c 0.4
 7ad5cecf582ce41410159040c6a47002ad61613f 0.5
-91a8667f027294bdf9df7bbe3fe1083a8d09f26c 0.4
-9c2929e868fdfe4cb267f1cc9d41bdab31d97640 0.2.1
-d4934c7fdf544d4e5b2925cada4b91d92a8948c2 0.3
 d5f93303fb5169d856291fa6cde834b89866a1ed 0.5.1
+ace3afe105f50a5c90ee135dc72ad306fc3b296c 0.6
 name:            attoparsec
-version:         0.5
+version:         0.6
 license:         BSD3
 license-file:    LICENSE
 category:        Text, Parsing

src/Data/ParserCombinators/Attoparsec/Internal.hs

 endOfLine :: Parser ()
 endOfLine = Parser $ \(S sb lb n) ->
             let bs = sb +: lb
-            in case I.w2c (U.unsafeHead sb) of
-                 '\n' -> Right ((), mkState (LB.tail bs) (n + 1))
-                 '\r' -> let (h,t) = LB.splitAt 2 bs
-                             rn = L8.pack "\r\n"
-                         in if h == rn
-                            then Right ((), mkState t (n + 2))
-                            else Right ((), mkState (LB.tail bs) (n + 1))
-                 _ -> Left (bs, ["EOL"])
+            in if SB.null sb
+               then Left (bs, ["EOL"])
+               else case I.w2c (U.unsafeHead sb) of
+                     '\n' -> Right ((), mkState (LB.tail bs) (n + 1))
+                     '\r' -> let (h,t) = LB.splitAt 2 bs
+                                 rn = L8.pack "\r\n"
+                             in if h == rn
+                                then Right ((), mkState t (n + 2))
+                                else Right ((), mkState (LB.tail bs) (n + 1))
+                     _ -> Left (bs, ["EOL"])
 
 -- | Satisfy a literal string, after applying a transformation to both
 -- it and the matching text.