public void NestedBacktracking()
        {
            var program    = "x = '4' | '5'";
            var enumerator = new ProgramEnumerator(program);

            Assert.AreEqual(true, enumerator.Matches("x"));
            enumerator.Advance(1);
            Assert.AreEqual(true, enumerator.Matches(" = "));
            enumerator.Advance(3);
            enumerator.SetBacktrackPoint();
            Assert.AreEqual(true, enumerator.Matches("'4'"));
            enumerator.Advance(3);
            enumerator.SetBacktrackPoint();
            Assert.AreEqual(false, enumerator.Matches(" / "));
            enumerator.Advance(3);
            enumerator.Backtrack();
            Assert.AreEqual(true, enumerator.Matches(" | "));
            enumerator.Advance(3);
            Assert.AreEqual(false, enumerator.Matches(")"));
            enumerator.Advance(1);
            enumerator.Backtrack();
            Assert.AreEqual(true, enumerator.Matches("'4' | '5'"));
            enumerator.Advance(9);
            Assert.AreEqual(true, enumerator.IsFinished);
        }
        public void Backtracking()
        {
            var program    = "func FuncName = 3 * 4";
            var enumerator = new ProgramEnumerator(program);

            Assert.AreEqual(true, enumerator.Matches("func"));
            enumerator.Advance(4);
            Assert.AreEqual(true, enumerator.Matches(" "));
            enumerator.Advance(1);
            Assert.AreEqual(true, enumerator.Matches("FuncName"));
            enumerator.Advance(8);
            Assert.AreEqual(true, enumerator.Matches(" "));
            enumerator.Advance(1);
            enumerator.SetBacktrackPoint();
            Assert.AreEqual(false, enumerator.Matches("'"));
            enumerator.Advance(1);
            enumerator.Backtrack();
            Assert.AreEqual(true, enumerator.Matches("="));
            enumerator.Advance(1);
            Assert.AreEqual(true, enumerator.Matches(" "));
            enumerator.Advance(1);
            Assert.AreEqual(true, enumerator.Matches("3"));
            enumerator.Advance(1);
            Assert.AreEqual(true, enumerator.Matches(" "));
            enumerator.Advance(1);
            Assert.AreEqual(true, enumerator.Matches("*"));
            enumerator.Advance(1);
            Assert.AreEqual(true, enumerator.Matches(" "));
            enumerator.Advance(1);
            Assert.AreEqual(true, enumerator.Matches("4"));
            enumerator.Advance(1);
            Assert.AreEqual(true, enumerator.IsFinished);
        }