示例#1
0
        public void NextItem()
        {
            var segment1 = new Segment("E", false);
            var segment2 = new Segment("+", true);
            var segment3 = new Segment("Number", true);

            var production = new Production(segment1, ImmutableArray.Create(segment1, segment2, segment3));

            var item0 = new ParseItem(production, 0);
            var item1 = new ParseItem(production, 1);
            var item2 = new ParseItem(production, 2);
            var item3 = new ParseItem(production, 3);

            Assert.That(item0.NextItem(), Is.EqualTo(item1));
            Assert.That(item1.NextItem(), Is.EqualTo(item2));
            Assert.That(item2.NextItem(), Is.EqualTo(item3));
            Assert.That(item3.NextItem(), Is.EqualTo(null));
        }