示例#1
0
        public override Rule DeepCopy()
        {
            Rule_String rule_String = (Rule_String)base.DeepCopy();

            rule_String.output = this.output;
            rule_String.weight = this.weight;
            return(rule_String);
        }
示例#2
0
        public override Rule DeepCopy()
        {
            Rule_String obj = (Rule_String)base.DeepCopy();

            obj.output   = output;
            obj.weight   = weight;
            obj.priority = priority;
            return(obj);
        }
示例#3
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);
        }