X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FParser%2FHttp.hs;h=78e48181c9f251023b4c11f88630e8b26b85e1d1;hp=f6c80dc8072f65abb76deec29c6fc0f6addc476f;hb=9ac730212cb361eb10e5fe4ad0eec6758e2b200a;hpb=105aec5e11818a08bdc964cf93856e0ff95768ac diff --git a/Network/HTTP/Lucu/Parser/Http.hs b/Network/HTTP/Lucu/Parser/Http.hs index f6c80dc..78e4818 100644 --- a/Network/HTTP/Lucu/Parser/Http.hs +++ b/Network/HTTP/Lucu/Parser/Http.hs @@ -17,7 +17,6 @@ module Network.HTTP.Lucu.Parser.Http ) where -import Data.List import Network.HTTP.Lucu.Parser -- |@'isCtl' c@ is 'Prelude.False' iff @0x20 <= @c@ < 0x7F@. @@ -67,11 +66,10 @@ isToken c = c `seq` -- ('Network.HTTP.Lucu.Parser.char' \',\')@ but it allows any -- occurrences of LWS before and after each tokens. listOf :: Parser a -> Parser [a] -listOf p = p `seq` - do many lws - sepBy p $! do many lws - char ',' - many lws +listOf !p = do _ <- many lws + sepBy p $! do _ <- many lws + _ <- char ',' + many lws -- |'token' is equivalent to @'Network.HTTP.Lucu.Parser.many1' $ -- 'Network.HTTP.Lucu.Parser.satisfy' 'isToken'@ @@ -96,15 +94,15 @@ separator = satisfy isSeparator -- |'quotedStr' accepts a string surrounded by double quotation -- marks. Quotes can be escaped by backslashes. quotedStr :: Parser String -quotedStr = do char '"' +quotedStr = do _ <- char '"' xs <- many (qdtext <|> quotedPair) - char '"' + _ <- char '"' return $ foldr (++) "" xs where qdtext = do c <- satisfy (/= '"') return [c] - quotedPair = do char '\\' + quotedPair = do _ <- char '\\' c <- satisfy isChar return [c]