private void Scan(StateSet[] S, int stateIndex, Item item, Terminal terminal, Sentence s, Terminal currentTerminal)
{
var state = S[stateIndex];
if (stateIndex + 1 >= S.Length)
{
return;
}
StateSet nextState = S[stateIndex + 1];
if (currentTerminal == terminal)
{
var newItem = item.Increment();
if (item.CurrentPosition != 0)
{
newItem.AddPredecessor(stateIndex, item);
}
// Scan can never insert a duplicate because it adds items to the next
// StateSet, but never adds them more than once
nextState.Insert(newItem);
}
}