# HG changeset patch # User unc0rr # Date 1430210988 -10800 # Node ID 29519fe63fdd0c016bff21c2757894765b3d22c9 # Parent 6a805e82207412607f2e1c5f11081bb860ba572e Will use own tree type diff -r 6a805e822074 -r 29519fe63fdd tools/protocolParser.hs --- a/tools/protocolParser.hs Sat Apr 25 23:46:09 2015 +0300 +++ b/tools/protocolParser.hs Tue Apr 28 11:49:48 2015 +0300 @@ -1,7 +1,6 @@ module Main where import Text.PrettyPrint.HughesPJ -import Data.Tree data HWProtocol = Command String [CmdParam] data CmdParam = Skip @@ -14,10 +13,15 @@ | ServerAuth | Lobby +data ParseTree = PTChar Char [ParseTree] + | PTCommand HWProtocol + cmd = Command cmd1 s p = Command s [p] cmd2 s p1 p2 = Command s [p1, p2] +breakCmd (Command (c:cs) params) = (c, Command cs params) + commands = [ cmd "CONNECTED" [Skip, IntP] , cmd1 "NICK" SS @@ -25,8 +29,13 @@ , cmd1 "ASKPASSWORD" SS , cmd1 "SERVER_AUTH" SS , cmd1 "LOBBY:JOINED" $ Many [SS] + , cmd2 "LOBBY:LEFT" $ SS SS + , cmd2 "CLIENT_FLAGS" $ SS $ Many [SS] + , cmd1 "SERVER_MESSAGE" LS ] + + pas = main = putStrLn $ render pas