Exemple #1
0
 protected void parse(Rete engine, CLIPSParser parser, IList factlist)
 {
     Object itm = null;
     try
     {
         while ((itm = parser.basicExpr()) != null)
         {
             // System.Console.WriteLine("obj is " + itm.getClass().Name);
             if (itm is Defrule)
             {
                 Defrule rule = (Defrule) itm;
                 engine.RuleCompiler.addRule(rule);
             }
             else if (itm is Deftemplate)
             {
                 Deftemplate dt = (Deftemplate) itm;
                 Console.WriteLine("template=" + dt.Name);
                 engine.declareTemplate(dt);
             }
             else if (itm is FunctionAction)
             {
                 FunctionAction fa = (FunctionAction) itm;
             }
             else if (itm is IFunction)
             {
                 IReturnVector rv = ((IFunction) itm).executeFunction(engine, null);
                 IEnumerator itr = rv.Iterator;
                 while (itr.MoveNext())
                 {
                     IReturnValue rval = (IReturnValue) itr.Current;
                     Console.WriteLine(rval.StringValue);
                 }
             }
         }
     }
     catch
     {
         // Console.WriteLine(e.Message);
         parser.ReInit(Console.OpenStandardInput());
     }
 }