/// <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); } }
/// <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); }