Commit d1b0f20f authored by Mart Lubbers's avatar Mart Lubbers

Fix mode command and hostnames ending with .

parent 80375cb5
......@@ -26,7 +26,7 @@ gIRCParse{|EITHER|} lp rp as = case lp as of
(Right a, rest) = (Right $ LEFT a, rest)
(Left e1, _) = case rp as of
(Right a, rest) = (Right $ RIGHT a, rest)
(Left e2, _) = (Left $ e1 +++ " and " +++ e2, [])
(Left e2, _) = (Left $ e2, [])
gIRCParse{|OBJECT|} p as = appFst (fmap OBJECT) $ p as
gIRCParse{|CONS of d|} p []
= (Left $ concat ["Expected a cmd constructor: ", d.gcd_name], [])
......
......@@ -41,7 +41,7 @@ where
, parseIRCMessage ":cherryh.freenode.net ISON a b c d e f :g h\r\n"
, parseIRCMessage ":wilhelm.freenode.net 001 clooglebot :Welcome to the freenode Internet Relay Chat Network clooglebot\r\n"
, parseIRCMessage "PING :orwell.freenode.net\r\n"
, parseIRCMessage ":ChanServ!ChanServ@services. MODE #cloogle +o frobnicator\r\n"
]
parseIRCMessage :: String -> Either [Error] IRCMessage
......@@ -82,7 +82,8 @@ where
>>= \cs->pure (toString [c:cs])
parseHost :: Parser Char String
parseHost = jon "." <$> pSepBy parseName (pToken '.')
parseHost = jon "." <$> (pSepBy parseName (pToken '.'))
>>= \s->optional (pToken '.') >>= pure o maybe s (\p->s+++toString s)
where
parseName :: Parser Char String
parseName = toString <$> pSome (pAlpha <|> pDigit <|> pOneOf ['-'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment