module Data.Attoparsec.Char8
(
ParseError
, Parser
, parse
, parseAt
, parseTest
, (<?>)
, try
, anyChar
, char
, digit
, letter
, notChar
, space
, satisfy
, inClass
, notInClass
, string
, stringCI
, skipSpace
, skipWhile
, takeAll
, takeCount
, takeTill
, takeWhile
, takeWhile1
, match
, notEmpty
, endOfLine
, int
, integer
, double
, endOfInput
, getConsumed
, getInput
, lookAhead
, module Data.Attoparsec.Combinator
) where
import qualified Data.ByteString.Char8 as SB
import qualified Data.ByteString.Lazy.Char8 as LB
import Data.ByteString.Internal (w2c)
import Data.Char (isDigit, isLetter, isSpace, toLower)
import Data.Attoparsec.FastSet
(FastSet, charClass, memberChar, set)
import qualified Data.Attoparsec.Internal as I
import Data.Attoparsec.Combinator
import Data.Attoparsec.Internal
(Parser, ParseError, (<?>), parse, parseAt, parseTest, try, endOfInput,
lookAhead, string,
getInput, getConsumed, takeAll, takeCount, notEmpty, match,
endOfLine, setInput)
import Data.ByteString.Lex.Lazy.Double (readDouble)
import Prelude hiding (takeWhile)
stringCI :: LB.ByteString -> Parser LB.ByteString
stringCI = I.stringTransform (LB.map toLower)
takeWhile1 :: (Char -> Bool) -> Parser LB.ByteString
takeWhile1 p = I.takeWhile1 (p . w2c)
numeric :: String -> (LB.ByteString -> Maybe (a,LB.ByteString)) -> Parser a
numeric desc f = do
s <- getInput
case f s of
Nothing -> fail desc
Just (i,s') -> setInput s' >> return i
int :: Parser Int
int = numeric "Int" LB.readInt
integer :: Parser Integer
integer = numeric "Integer" LB.readInteger
double :: Parser Double
double = numeric "Double" readDouble
#define PARSER Parser
#include "Char8Boilerplate.h"