Пример #1
0
        private static List <Rule> GetRulesResolved(List <Rule> rulesRaw, List <string> rulesStrings, List <string> rulesFiles)
        {
            List <Rule> list = new List <Rule>();

            for (int i = 0; i < rulesStrings.Count; i++)
            {
                try
                {
                    Rule_String rule_String = new Rule_String(rulesStrings[i]);
                    rule_String.Init();
                    list.Add(rule_String);
                }
                catch (Exception ex)
                {
                    Log.Error("Exception parsing grammar rule from " + rulesStrings[i] + ": " + ex);
                }
            }
            for (int j = 0; j < rulesFiles.Count; j++)
            {
                try
                {
                    string[] array = rulesFiles[j].Split(new string[1]
                    {
                        "->"
                    }, StringSplitOptions.None);
                    Rule_File rule_File = new Rule_File();
                    rule_File.keyword = array[0].Trim();
                    rule_File.path    = array[1].Trim();
                    rule_File.Init();
                    list.Add(rule_File);
                }
                catch (Exception ex2)
                {
                    Log.Error("Error initializing Rule_File " + rulesFiles[j] + ": " + ex2);
                }
            }
            if (rulesRaw != null)
            {
                for (int k = 0; k < rulesRaw.Count; k++)
                {
                    try
                    {
                        rulesRaw[k].Init();
                        list.Add(rulesRaw[k]);
                    }
                    catch (Exception ex3)
                    {
                        Log.Error("Error initializing rule " + rulesRaw[k].ToStringSafe() + ": " + ex3);
                    }
                }
            }
            return(list);
        }
        public override Rule DeepCopy()
        {
            Rule_File rule_File = (Rule_File)base.DeepCopy();

            rule_File.path = this.path;
            if (this.pathList != null)
            {
                rule_File.pathList = this.pathList.ToList <string>();
            }
            if (this.cachedStrings != null)
            {
                rule_File.cachedStrings = this.cachedStrings.ToList <string>();
            }
            return(rule_File);
        }
Пример #3
0
        public override Rule DeepCopy()
        {
            Rule_File rule_File = (Rule_File)base.DeepCopy();

            rule_File.path = path;
            if (pathList != null)
            {
                rule_File.pathList = pathList.ToList();
            }
            if (cachedStrings != null)
            {
                rule_File.cachedStrings = cachedStrings.ToList();
            }
            return(rule_File);
        }