예제 #1
0
        /// <summary>
        /// Добавление оператора в хаш компилятора
        /// </summary>
        /// <param name="name">Название оператора</param>
        /// <param name="kind">Тип оператора</param>
        /// <param name="signature">Строка с сигнатурой оператора</param>
        /// <param name="priority">Приоритет оператора</param>
        private static void Add(string name, eOperatorKind kind, string signature, int priority)
        {
            Operator Operator = new Operator(name, kind, signature, priority);

            _operatorsDictionary.Add(name, Operator);
            foreach (string str in Operator.Signatures)
            {
                List <Operator> collection = null;
                if (_signaturesDictionary.TryGetValue(str, out collection) == false)
                {
                    collection = new List <Operator>();
                    _signaturesDictionary.Add(str, collection);
                }
                collection.Add(Operator);
            }
        }
예제 #2
0
 /// <summary>
 /// Параметризованный конструктор
 /// </summary>
 /// <param name="name">Название оператора</param>
 /// <param name="kind">Тип оператора</param>
 /// <param name="signature">Строка сигнатуры</param>
 /// <param name="priority">Приоритет оператора</param>
 public Operator(string name, eOperatorKind kind, string signature, int priority)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (signature == null)
     {
         throw new ArgumentNullException("signature");
     }
     if (signature.Length == 0)
     {
         throw new ArgumentException("Signature is empty.", "signature");
     }
     Name              = name;
     Kind              = kind;
     _text             = signature;
     Signatures        = new List <string>();
     _operatorItemList = GetKingList(signature);
 }