git.iko.soy/typeable/attoparsec
on master help sign in
I forgot to document incremental parsing
commitc25b54d3021900e6e6419775e275f1ed2e729aac authorBryan O'Sullivan <bos@serpentine.com> dateThu 15 Jan 2009, 23:53 (18 years ago) parent379cb98
3 files changed+17−4
Data/Attoparsec/Char8.hs+1−3 Data/Attoparsec/Incremental.hs+15 attoparsec.cabal+1−1
Data/Attoparsec/Char8.hs+1−3
@@ -79,12 +79,10 @@ module Data.Attoparsec.Char8
7979 , module Data.Attoparsec.Combinator
8080 ) where
8181
82−import qualified Data.ByteString.Char8 as SB
8382import qualified Data.ByteString.Lazy.Char8 as LB
8483import Data.ByteString.Internal (w2c)
8584import Data.Char (isDigit, isLetter, isSpace, toLower)
86−import Data.Attoparsec.FastSet
87− (FastSet, charClass, memberChar, set)
85+import Data.Attoparsec.FastSet (charClass, memberChar)
8886import qualified Data.Attoparsec.Internal as I
8987import Data.Attoparsec.Combinator
9088import Data.Attoparsec.Internal
Data/Attoparsec/Incremental.hs+15
@@ -18,6 +18,9 @@
1818-----------------------------------------------------------------------------
1919module Data.Attoparsec.Incremental
2020 (
21+ -- * Incremental parsing
22+ -- $incremental
23+
2124 -- * Parser types
2225 Parser
2326 , Result(..)
@@ -62,6 +65,18 @@ import qualified Data.ByteString.Lazy as L
6265import qualified Data.ByteString.Lazy.Internal as L
6366import Prelude hiding (takeWhile)
6467
68+-- $incremental
69+-- Incremental parsing makes it possible to supply a parser with only
70+-- a limited amount of input. If the parser cannot complete due to
71+-- lack of data, it will return a 'Partial' result with a continuation
72+-- to which more input can be supplied, as follows:
73+--
74+-- > case parse myParser someInput of
75+-- > Partial k -> k moreInput
76+--
77+-- To signal that no more input is available, pass an empty
78+-- string to this continuation.
79+
6580data S = S {-# UNPACK #-} !S.ByteString -- first chunk of input
6681 L.ByteString -- rest of input
6782 [L.ByteString] -- input acquired during backtracks
attoparsec.cabal+1−1
@@ -1,5 +1,5 @@
11name: attoparsec
2−version: 0.7.1
2+version: 0.7.2
33license: BSD3
44license-file: LICENSE
55category: Text, Parsing