@@ -11,6 +11,7 @@ module Graphics.Vty.Input.Mouse
12import Graphics.Vty.Input.Events
12import Graphics.Vty.Input.Events
13import Graphics.Vty.Input.Classify.Types
13import Graphics.Vty.Input.Classify.Types
14+import Graphics.Vty.Input.Classify.Parse
15import Control.Monad.Trans.Maybe
16import Control.Monad.Trans.Maybe
16import Control.Monad.State
17import Control.Monad.State
@@ -110,36 +111,6 @@ getModifiers mods =
110 , if mods `hasBitSet` ctrlBit then Just MCtrl else Nothing
111 , if mods `hasBitSet` ctrlBit then Just MCtrl else Nothing
113−type Parser a = MaybeT (State String) a
115−runParser :: String -> Parser Event -> KClass
117− case runState (runMaybeT parser) s of
118− (Nothing, _) -> Invalid
119− (Just e, remaining) -> Valid e remaining
121−failParse :: Parser a
122−failParse = fail "invalid parse"
124−readInt :: Parser Int
127− case (reads :: ReadS Int) s of
128− [(i, rest)] -> put rest >> return i
131−readChar :: Parser Char
135− c:rest -> put rest >> return c
138−expectChar :: Char -> Parser ()
141− if c' == c then return () else failParse
143-- Attempt to classify a control sequence as a "normal" mouse event. To
114-- Attempt to classify a control sequence as a "normal" mouse event. To
144-- get here we should have already read "\ESC[M" so that will not be
115-- get here we should have already read "\ESC[M" so that will not be
145-- included in the string to be parsed.
116-- included in the string to be parsed.