Beispiel #1
0
        public void Should_Return_Empty_String()
        {
            IMatch match = new SuccessMatch("");

            Assert.True(match.Success());
            Assert.Equal("", match.RemainingText());
        }
Beispiel #2
0
        public void CheckWord_Numbers()
        {
            var    range = new Range('1', '9');
            IMatch match = new SuccessMatch("5");

            Assert.True(match.Success());
            Assert.Equal("5", match.RemainingText());
        }
Beispiel #3
0
        public IMatch Match(string text)
        {
            IMatch match = new SuccessMatch(text);

            while (match.Success())
            {
                match = pattern.Match(match.RemainingText());
            }

            return(new SuccessMatch(match.RemainingText()));
        }
Beispiel #4
0
        public IMatch Match(string text)
        {
            IMatch match = new SuccessMatch(text);

            foreach (var pattern in patterns)
            {
                match = pattern.Match(match.RemainingText());

                if (!match.Success())
                {
                    return(new FailedMatch(text));
                }
            }

            return(match);
        }
Beispiel #5
0
        public void Check__Word_HasHexadecimal_Characters_(string input)
        {
            var hex = new SuccessMatch(input);

            Assert.True(hex.Success());
        }