@@ -178,6 +178,7 @@ parseBreak (PRD.Parser pstep initial extract) stream@(Stream step state) = do
178178 pRes <- pstep pst x
179179 case pRes of
180180 PR.Partial 0 pst1 -> go SPEC s (List []) pst1
181+ PR.Partial 1 pst1 -> go1 SPEC s x pst1
181182 PR.Partial n pst1 -> do
182183 assert (n <= length (x:getList buf)) (return ())
183184 let src0 = Prelude.take n (x:getList buf)
@@ -201,6 +202,30 @@ parseBreak (PRD.Parser pstep initial extract) stream@(Stream step state) = do
201202 Skip s -> go SPEC s buf pst
202203 Stop -> goStop buf pst
203204
205+ go1 _ s x !pst = do
206+ pRes <- pstep pst x
207+ case pRes of
208+ PR.Partial 0 pst1 ->
209+ go SPEC s (List []) pst1
210+ PR.Partial 1 pst1 -> do
211+ go1 SPEC s x pst1
212+ PR.Partial n _ ->
213+ error $ "parseBreak: parser bug, go1: Partial n = " ++ show n
214+ PR.Continue 0 pst1 ->
215+ go SPEC s (List [x]) pst1
216+ PR.Continue 1 pst1 ->
217+ go1 SPEC s x pst1
218+ PR.Continue n _ -> do
219+ error $ "parseBreak: parser bug, go1: Continue n = " ++ show n
220+ PR.Done 0 b -> do
221+ return (b, Stream step s)
222+ PR.Done 1 b -> do
223+ return (b, StreamD.cons x (Stream step s))
224+ PR.Done n _ -> do
225+ error $ "parseBreak: parser bug, go1: Done n = " ++ show n
226+ PR.Error err ->
227+ throwM $ ParseError err
228+
204229 gobuf !_ s buf (List []) !pst = go SPEC s buf pst
205230 gobuf !_ s buf (List (x:xs)) !pst = do
206231 pRes <- pstep pst x