예제 #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);
            }
        }
예제 #2
0
 internal TerminalEdge(TerminalLabel terminal, SourceContext startContext, TerminalMatch match)
     : base(terminal, startContext, match.MatchEnd)
 {
     Match = match;
 }
예제 #3
0
 protected CompleteEdge(TerminalLabel terminalLabel, SourceContext startContext, SourceContext endContext)
     : base(startContext, endContext)
 {
     Parent        = terminalLabel.Terminal;
     CompleteLabel = terminalLabel;
 }