/// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static SystemTrieSingleton getInstance()
 {
     if (instance == null)
     {
         instance = new SystemTrieSingleton();
     }
     return(instance);
 }
Example #2
0
        /// <summary>
        /// Создание системной конструкции
        /// </summary>
        /// <param name="text">Текстовое описание конструкции</param>
        /// <param name="charcnt">Количество символов, использованных для создания</param>
        /// <returns>Системная конструкция</returns>
        public override Rule CreateRule(string text, out int charcnt)
        {
            SystemTrieSingleton systemTrieSingleton = SystemTrieSingleton.getInstance();

            var result = systemTrieSingleton.Search(text, out charcnt, out string Suggestion);

            if (result != null)
            {
                return(result);
            }
            else
            {
                if (Suggestion.Length > 0)
                {
                    throw new SyntaxError(Suggestion, text);
                }
                throw new SyntaxError("system rule", text);
            }
        }