protected Terminal ExpectOneTerminal(Reduction reduction) { Terminal found = null; Predicate<Terminal> expectTerminal = terminal => { if (found != null) return false; found = terminal; return true; }; TokenParser parser = new TokenParser(m_isNoise, m_isSynthetic); parser.OnCreate(expectTerminal, reduction); Assert(found != null); return found; }
protected List<Terminal> ExpectTerminalList(Reduction reduction) { List<Terminal> found = new List<Terminal>(); Predicate<Terminal> expectTerminal = terminal => { found.Add(terminal); return true; }; TokenParser parser = new TokenParser(m_isNoise, m_isSynthetic); parser.OnCreate(expectTerminal, reduction); Assert(found.Count > 0); return found; }