Example #1
0
        /// <summary>
        /// Get the BindResult created from playing this text to the function
        /// </summary>
        public Tuple <FSharpOption <int>, KeyInput> GetComplete(string text)
        {
            var first  = KeyInputUtil.CharToKeyInput(text[0]);
            var result = CountCapture.GetCount(KeyRemapMode.None, first);

            if (text.Length > 1)
            {
                return(result.Run(text.Substring(1)).AsComplete().Result);
            }

            return(result.AsComplete().Result);
        }
Example #2
0
        private CountResult.Complete Process(string input)
        {
            var res = CountCapture.Process(KeyInputUtil.CharToKeyInput(input[0]));

            foreach (var cur in input.Skip(1))
            {
                Assert.IsTrue(res.IsNeedMore);
                var i = KeyInputUtil.CharToKeyInput(cur);
                res = res.AsNeedMore().item.Invoke(i);
            }

            Assert.IsTrue(res.IsComplete);
            return((CountResult.Complete)res);
        }