git.iko.soy/typeable/attoparsec
on master help sign in
Fix up some internal comments
4b7b596Bryan O'Sullivan
Data/Attoparsec/ByteString/Internal.hs−1
@@ -501,7 +501,6 @@ ensure n = T.Parser $ \t pos more lose succ ->
501 then succ t pos more (substring pos (Pos n) t)
501 then succ t pos more (substring pos (Pos n) t)
502 -- The uncommon case is kept out-of-line to reduce code size:
502 -- The uncommon case is kept out-of-line to reduce code size:
503 else ensureSuspended n t pos more lose succ
503 else ensureSuspended n t pos more lose succ
504−-- Non-recursive so the bounds check can be inlined:
505{-# INLINE ensure #-}
504{-# INLINE ensure #-}
506
505
507-- | Return both the result of a parse and the portion of the input
506-- | Return both the result of a parse and the portion of the input
Data/Attoparsec/Text/Internal.hs+1−1
@@ -476,7 +476,6 @@ ensure n = T.Parser $ \t pos more lose succ ->
476 Just n' -> succ t pos more (n', substring pos n' t)
476 Just n' -> succ t pos more (n', substring pos n' t)
477 -- The uncommon case is kept out-of-line to reduce code size:
477 -- The uncommon case is kept out-of-line to reduce code size:
478 Nothing -> ensureSuspended n t pos more lose succ
478 Nothing -> ensureSuspended n t pos more lose succ
479−-- Non-recursive so the bounds check can be inlined:
480{-# INLINE ensure #-}
479{-# INLINE ensure #-}
481
480
482-- | Return both the result of a parse and the portion of the input
481-- | Return both the result of a parse and the portion of the input
@@ -487,6 +486,7 @@ match p = T.Parser $ \t pos more lose succ ->
487 (substring pos (pos'-pos) t', a)
486 (substring pos (pos'-pos) t', a)
488 in runParser p t pos more lose succ'
487 in runParser p t pos more lose succ'
489
488
489+-- | Ensure that at least @n@ code points of input are available.
490lengthAtLeast :: Pos -> Int -> Buffer -> Maybe Pos
490lengthAtLeast :: Pos -> Int -> Buffer -> Maybe Pos
491lengthAtLeast pos n t = go 0 (fromPos pos)
491lengthAtLeast pos n t = go 0 (fromPos pos)
492 where go i !p
492 where go i !p