Archived
1
0
Fork 0

Regressed from parsec3 to parsec2 to solve a cabal install weird dependency problem.

This commit is contained in:
Julien Dessaux 2010-10-10 01:41:27 +02:00
parent a6ba40c252
commit d05aea2def
2 changed files with 7 additions and 7 deletions

View file

@ -8,7 +8,7 @@ module Hsbot.Irc.Message
) where ) where
import Control.Monad.Identity import Control.Monad.Identity
import Text.Parsec import Text.ParserCombinators.Parsec
-- | An IRC message -- | An IRC message
data IrcMsg = IrcMsg data IrcMsg = IrcMsg
@ -35,7 +35,7 @@ data IrcBotMsg = InIrcMsg IrcMsg | OutIrcMsg IrcMsg | IntIrcCmd IrcCmd deriving
parseIrcMsg :: String -> Either ParseError IrcMsg parseIrcMsg :: String -> Either ParseError IrcMsg
parseIrcMsg line = parse pMsg "" line parseIrcMsg line = parse pMsg "" line
pMsg :: ParsecT String u Identity IrcMsg --pMsg :: Parser String u Identity IrcMsg
pMsg = do pMsg = do
pfx <- optionMaybe pPrefix pfx <- optionMaybe pPrefix
cmd <- pCommand cmd <- pCommand
@ -44,20 +44,20 @@ pMsg = do
eof eof
return $ IrcMsg pfx cmd params return $ IrcMsg pfx cmd params
pPrefix :: ParsecT String u Identity [Char] --pPrefix :: Parser String u Identity [Char]
pPrefix = do pPrefix = do
_ <- char ':' _ <- char ':'
pfx <- many1 (noneOf " ") pfx <- many1 (noneOf " ")
_ <- space _ <- space
return pfx return pfx
pCommand :: ParsecT String u Identity [Char] --pCommand :: Parser String u Identity [Char]
pCommand = count 3 digit <|> many1 upper pCommand = count 3 digit <|> many1 upper
pLongParam :: ParsecT String u Identity [Char] --pLongParam :: Parser String u Identity [Char]
pLongParam = char ':' >> (many1 (noneOf "\r")) pLongParam = char ':' >> (many1 (noneOf "\r"))
pShortParam :: ParsecT String u Identity [Char] --pShortParam :: Parser String u Identity [Char]
pShortParam = many1 (noneOf " \r") pShortParam = many1 (noneOf " \r")
-- | Serialize an IRC message to a string. -- | Serialize an IRC message to a string.

View file

@ -29,7 +29,7 @@ Executable hsbot-irc
MissingH, MissingH,
mtl, mtl,
network, network,
parsec >= 3, parsec,
random, random,
text, text,
time, time,