Ejemplo n.º 1
0
        public void CheckSequenceIntoAGivenTextReturnRemainingText()
        {
            var many = new Many(new Sequence(
                                    new Character('u'),
                                    new Range('0', '9'),
                                    new Range('0', '9')));

            Assert.Equal("bc567", many.Match("u12bc567").RemainingText());
        }
Ejemplo n.º 2
0
        public void UseListMethodWithComplexStringReturnRemainingText()
        {
            var digits     = new OneOrMore(new Range('0', '9'));
            var whitespace = new Many(new Any(" \r\n\t"));
            var separator  = new Sequence(whitespace, new Character(';'), whitespace);
            var list       = new List(digits, separator);

            Assert.Equal("", list.Match("1; 22;\n 333 \t; 22").RemainingText());
        }
Ejemplo n.º 3
0
        public void CheckSameCharIntoAGivenTextReturnRemainingText()
        {
            var many = new Many(new Character('a'));

            Assert.Equal("bc", many.Match("aaabc").RemainingText());
        }
Ejemplo n.º 4
0
        public void CheckRangeIntoAGivenTextReturnRemainingText()
        {
            var many = new Many(new Range('0', '9'));

            Assert.Equal("bc567", many.Match("1234bc567").RemainingText());
        }