Exemple #1
0
        void ParseRule(ParseTreeNode node)
        {
            var         t = node.ChildNodes[0];
            KastepsRule r = new KastepsRule();

            switch (t.Term.Name)
            {
            case "Number":
                r.ConditionType = KastepsRuleConditionType.LineNumber;
                r.LineNumber    = (int)t.Token.Value;
                break;

            case "String":
                r.ConditionType = KastepsRuleConditionType.RegularExpression;
                r.Regex         = new Regex(t.Token.Value as string);
                break;

            case "begin":
                r.ConditionType = KastepsRuleConditionType.Begin;
                break;

            case "every":
                r.ConditionType = KastepsRuleConditionType.Every;
                break;

            case "end":
                r.ConditionType = KastepsRuleConditionType.End;
                break;

            default:
                break;
            }
        }
Exemple #2
0
 void ParseRule(ParseTreeNode node)
 {
     var t = node.ChildNodes[0];
     KastepsRule r=new KastepsRule();
     switch (t.Term.Name)
     {
         case "Number":
             r.ConditionType = KastepsRuleConditionType.LineNumber;
             r.LineNumber = (int)t.Token.Value;
             break;
         case "String":
             r.ConditionType = KastepsRuleConditionType.RegularExpression;
             r.Regex = new Regex(t.Token.Value as string);
             break;
         case "begin":
             r.ConditionType = KastepsRuleConditionType.Begin;
             break;
         case "every":
             r.ConditionType = KastepsRuleConditionType.Every;
             break;
         case "end":
             r.ConditionType = KastepsRuleConditionType.End;
             break;
         default:
             break;
     }
 }