-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathData.hs
169 lines (157 loc) · 6.56 KB
/
Data.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
module Data
( VimCommandType(..)
, VimFunctionType(..)
, VimEventType(..)
, VimEvent(..)
, VimReply(..)
, VimMessage(..)
, IdeMessage(..)
, SequenceNum(..)
, BufferID(..)
, messageTypeString
) where
newtype BufferID = BufferID Int deriving (Read, Eq)
newtype SequenceNum = SequenceNum Int deriving (Read, Eq)
instance Show BufferID where
show (BufferID i) = show i
instance Show SequenceNum where
show (SequenceNum i) = show i
data VimCommandType = ActionMenuItem
| ActionSensitivity
| AddAnno Int Int Int Int
| BalloonResult String
| Close
| Create
| DefineAnnoType Int String String String String String
| EditFile String
| EnableBalloonEval
| EndAtomic
| Guard Int Int
| InitDone
| InsertDone
| MoveAnnoToFront Int
| NetbeansBuffer Bool
| PutBufferNumber String
| Raise
| RemoveAnno Int
| Save
| SaveDone
| SetAsUser
| SetBufferNumber String
| SetContentType
| SetDot Int
| SetExitDelay Int
| SetFullName String
| SetLocAndSize
| SetMark
| SetModified Bool
| SetModTime Int
| SetReadOnly
| SetStyle
| SetTitle String
| SetVisible Bool
| ShowBalloon String
| SpecialKeys
| StartAtomic
| StartCaretListen
| StartDocumentListen
| StopCaretListen
| StopDocumentListen
| Unguard Int Int
| Version
deriving (Show, Eq)
data VimFunctionType = GetDot
| GetCursor
| GetLength
| GetMark
| GetAnno Int
| GetModified
| GetText
| Insert Int String
| Remove Int Int
| SaveAndExit
data VimEventType = BalloonEval Int Int String
| BalloonText String
| ButtonRelease Int Int Int
| Disconnect
| FileClosed
| FileModified
| FileOpened String Bool Bool
| Geometry Int Int Int Int
| InsertEvent Int String
| InvalidEvent String
| InvokeAction
| KeyCommand String
| KeyAtPos String Int Int
| Killed
| NewDotAndMark Int Int
| RemoveEvent Int Int
| Quit
| Revert
| SaveEvent
| StartupDone
| Unmodified
| VersionEvent String
deriving (Show, Eq)
data VimEvent = VimEvent BufferID SequenceNum VimEventType deriving (Eq, Show)
data VimReply = VimReply SequenceNum deriving (Eq, Show)
data VimMessage = EventMessage VimEvent | ReplyMessage VimReply deriving (Eq, Show)
data IdeMessage = CommandMessage VimCommandType | FunctionMessage VimFunctionType
commandTypeString :: VimCommandType -> String
commandTypeString (ActionMenuItem) = "actionMenuItem"
commandTypeString (ActionSensitivity) = "actionSensitivity"
commandTypeString (AddAnno {}) = "addAnno"
commandTypeString (BalloonResult _) = "balloonResult"
commandTypeString (Close) = "close"
commandTypeString (Create) = "create"
commandTypeString (DefineAnnoType {}) = "defineAnnoType"
commandTypeString (EditFile _) = "editFile"
commandTypeString (EnableBalloonEval) = "enableBalloonEval"
commandTypeString (EndAtomic) = "endAtomic"
commandTypeString (Guard _ _) = "guard"
commandTypeString (InitDone) = "initDone"
commandTypeString (InsertDone) = "insertDone"
commandTypeString (MoveAnnoToFront _) = "moveAnnoToFront"
commandTypeString (NetbeansBuffer _) = "netbeansBuffer"
commandTypeString (PutBufferNumber _) = "putBufferNumber"
commandTypeString (Raise) = "raise"
commandTypeString (RemoveAnno _) = "removeAnno"
commandTypeString (Save) = "save"
commandTypeString (SaveDone) = "saveDone"
commandTypeString (SetAsUser) = "setAsUser"
commandTypeString (SetBufferNumber _) = "setBufferNumber"
commandTypeString (SetContentType) = "setContentType"
commandTypeString (SetDot _) = "setDot"
commandTypeString (SetExitDelay _) = "setExitDelay"
commandTypeString (SetFullName _) = "setFullName"
commandTypeString (SetLocAndSize) = "setLocAndSize"
commandTypeString (SetMark) = "setMark"
commandTypeString (SetModified _) = "setModified"
commandTypeString (SetModTime _) = "setModTime"
commandTypeString (SetReadOnly) = "setReadOnly"
commandTypeString (SetStyle) = "setStyle"
commandTypeString (SetTitle _) = "setTitle"
commandTypeString (SetVisible _) = "setVisible"
commandTypeString (ShowBalloon _) = "showBalloon"
commandTypeString (SpecialKeys) = "specialKeys"
commandTypeString (StartAtomic) = "startAtomic"
commandTypeString (StartCaretListen) = "startCaretListen"
commandTypeString (StartDocumentListen) = "startDocumentListen"
commandTypeString (StopCaretListen) = "stopCaretListen"
commandTypeString (StopDocumentListen) = "stopDocumentListen"
commandTypeString (Unguard _ _) = "unguard"
commandTypeString (Version) = "version"
functionTypeString :: VimFunctionType -> String
functionTypeString (GetDot) = "getDot"
functionTypeString (GetCursor) = "getCursor"
functionTypeString (GetLength) = "getLength"
functionTypeString (GetMark) = "getMark"
functionTypeString (GetAnno _) = "getAnno"
functionTypeString (GetModified) = "getModified"
functionTypeString (GetText) = "getText"
functionTypeString (Insert _ _) = "insert"
functionTypeString (Remove _ _) = "remove"
functionTypeString (SaveAndExit) = "saveAndExit"
messageTypeString :: IdeMessage -> String
messageTypeString (CommandMessage m) = commandTypeString m
messageTypeString (FunctionMessage f) = functionTypeString f