-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Fast non-backtracking incremental combinator parsing for bytestrings -- -- Parser combinator library designed to be fast. It doesn't support -- backtracking. @package scanner @version 0.2 -- | Scanner implementation module Scanner.Internal -- | CPS scanner without backtracking newtype Scanner a Scanner :: (forall r. ByteString -> Next a r -> Result r) -> Scanner a [run] :: Scanner a -> forall r. ByteString -> Next a r -> Result r -- | Scanner continuation type Next a r = ByteString -> a -> Result r -- | Scanner result data Result r -- | Successful result with the rest of input Done :: ByteString -> r -> Result r -- | Scanner failed with rest of input and error message Fail :: ByteString -> String -> Result r -- | Need more input More :: (ByteString -> Result r) -> Result r -- | Run scanner with the input scan :: Scanner r -> ByteString -> Result r -- | Consume the next word -- -- It fails if end of input anyWord8 :: Scanner Word8 -- | Take input while the predicate is True takeWhile :: (Word8 -> Bool) -> Scanner ByteString -- | Take the specified number of bytes take :: Int -> Scanner ByteString -- | Returns True when there is no more input endOfInput :: Scanner Bool -- | Consume the specified string -- -- Warning: it is not optimized yet, so for for small string it is better -- to consume it byte-by-byte using word8 string :: ByteString -> Scanner () -- | Return the next byte, if any, without consuming it lookAhead :: Scanner (Maybe Word8) instance GHC.Base.Functor Scanner.Internal.Scanner instance GHC.Base.Applicative Scanner.Internal.Scanner instance GHC.Base.Monad Scanner.Internal.Scanner -- | Fast not-backtracking incremental scanner for bytestrings -- -- Unlike attoparsec or most of other parser combinator libraries, -- scanner doesn't support backtracking. But you probably don't need it -- anyway, at least if you need fast parser. -- -- Scanner processes input incrementally. When more input is needed, -- scanner returns More continuation. All the already processed -- input is discarded. module Scanner -- | CPS scanner without backtracking data Scanner a -- | Scanner result data Result r -- | Successful result with the rest of input Done :: ByteString -> r -> Result r -- | Scanner failed with rest of input and error message Fail :: ByteString -> String -> Result r -- | Need more input More :: (ByteString -> Result r) -> Result r -- | Run scanner with the input scan :: Scanner r -> ByteString -> Result r -- | Scan the complete input, without resupplying scanOnly :: Scanner a -> ByteString -> Either String a -- | Scan lazy bytestring by resupplying scanner with chunks scanLazy :: Scanner a -> ByteString -> Either String a -- | Scan with the provided resupply action scanWith :: Monad m => m ByteString -> Scanner a -> ByteString -> m (Result a) -- | Consume the next word -- -- It fails if end of input anyWord8 :: Scanner Word8 -- | Consume the next 8-bit char -- -- It fails if end of input anyChar8 :: Scanner Char -- | Consume the specified word or fail word8 :: Word8 -> Scanner () -- | Consume the specified 8-bit char or fail char8 :: Char -> Scanner () -- | Take the specified number of bytes take :: Int -> Scanner ByteString -- | Take input while the predicate is True takeWhile :: (Word8 -> Bool) -> Scanner ByteString -- | Take input while the predicate is True takeWhileChar8 :: (Char -> Bool) -> Scanner ByteString -- | Consume the specified string -- -- Warning: it is not optimized yet, so for for small string it is better -- to consume it byte-by-byte using word8 string :: ByteString -> Scanner () -- | Skip any input while the preducate is True skipWhile :: (Word8 -> Bool) -> Scanner () -- | Skip space skipSpace :: Scanner () -- | Return the next byte, if any, without consuming it lookAhead :: Scanner (Maybe Word8) -- | Return the next byte, if any, without consuming it lookAheadChar8 :: Scanner (Maybe Char)