Will use own tree type qmlfrontend
authorunc0rr
Tue, 28 Apr 2015 11:49:48 +0300
branchqmlfrontend
changeset 10902 29519fe63fdd
parent 10900 6a805e822074
child 10904 ce265b038220
Will use own tree type
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