public void AddFirst(DotItem item, MutableIntSet output) { bool isNullable = tables.AddFirst(item.GetPattern(), item.Position, output); if (isNullable) { output.AddAll(item.LA); } }
/// <summary> /// Firsts set of the token chain /// </summary> /// <param name="tokenChain"></param> /// <param name="output"></param> /// <returns><c>true</c> if chain is nullable, <c>false</c> otherwise</returns> public bool AddFirst(int[] tokenChain, int startIndex, MutableIntSet output) { bool result = true; while (startIndex != tokenChain.Length) { int token = tokenChain[startIndex]; output.AddAll(firsts[token]); if (!isNullable[token]) { result = false; break; } ++startIndex; } return result; }