tools/protocolParser.hs
branchqmlfrontend
changeset 10898 f373838129c2
child 10900 6a805e822074
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/protocolParser.hs	Wed Apr 22 23:33:16 2015 +0300
@@ -0,0 +1,29 @@
+module Main where
+
+import Text.PrettyPrint.HughesPJ
+
+data HWProtocol = Command String [CmdParam]
+data CmdParam = Skip
+              | SS
+              | LS
+              | IntP
+              | Many [CmdParam]
+data ClientStates = NotConnected
+                  | JustConnected
+                  | ServerAuth
+                  | Lobby
+
+cmd = Command
+cmd1 s p = Command s [p]
+cmd2 s p1 p2 = Command s [p1, p2]
+
+commands = [
+        cmd "CONNECTED" [Skip, IntP]
+        , cmd1 "NICK" SS
+        , cmd1 "PROTO" IntP
+        , cmd1 "ASKPASSWORD" SS
+        , cmd1 "SERVER_AUTH" SS
+        , cmd1 "LOBBY:JOINED" $ Many [SS]
+    ]
+
+main = undefined