Example #1
0
        internal ActiveLabel(GrammarSequence sequence, int index = 0)
        {
            _sequence = sequence;
            _index    = index;

            var sequenceTerms = sequence.Terms;

            CurrentTerm  = sequenceTerms.Skip(index).First();
            WillComplete = sequenceTerms.Count() == index + 1;

            var currentTerminal = CurrentTerm as Terminal;

            if (currentTerminal != null)
            {
                TerminalLabel = new TerminalLabel(currentTerminal, sequence);
            }

            if (WillComplete)
            {
                CompleteLabel = new CompleteLabel(_sequence);
            }
            else
            {
                NextInChain = new ActiveLabel(sequence, index + 1);
            }
        }
Example #2
0
 internal CompleteLabel(GrammarSequence sequence)
 {
     Sequence = sequence;
     Parent   = sequence.Parent;
 }
Example #3
0
 public TerminalLabel(Terminal currentTerminal, GrammarSequence sequence)
     : base(sequence)
 {
     Terminal = currentTerminal;
 }