Esempio n. 1
0
        private static IEnumerable <ITerminal> SelectTerminals(char current)
        {
            TerminalList result;

            if (TerminalsLookup.TryGetValue(current, out result))
            {
                return(result);
            }

            throw new CompilerException("Can't select terminal for start char " + current);
        }
Esempio n. 2
0
 private void AddTerminalToLookupByFirstChar(TerminalLookupTable _lookup, Terminal term, char firstChar)
 {
     TerminalList currentList;
       if (!_lookup.TryGetValue(firstChar, out currentList)) {
     //if list does not exist yet, create it
     currentList = new TerminalList();
     _lookup[firstChar] = currentList;
       }
       //add terminal to the list
       if (!currentList.Contains(term))
     currentList.Add(term);
 }
Esempio n. 3
0
 private void AddTerminalToLookupByFirstChar(TerminalLookupTable lookup, Terminal term, char firstChar)
 {
     if (!lookup.TryGetValue(firstChar, out TerminalList currentList))
     {
         //if list does not exist yet, create it
         currentList       = new TerminalList();
         lookup[firstChar] = currentList;
     }
     //add terminal to the list
     if (!currentList.Contains(term))
     {
         currentList.Add(term);
     }
 }