public override void EvaluateNode(Interpreter.EvaluationContext context, AstMode mode, DateTime time)
 {
     if (ExecuteFrequency.CanExecute(context.StartDate, time))
     {
         Statements.EvaluateNode(context, AstMode.None, time);
     }
 }
 private void EvaluateCombined(EvaluationContext context, AstMode mode, DateTime time)
 {
   Target.Evaluate(context, AstMode.Read, time);
   Expression.Evaluate(context, AstMode.Read, time);
   context.CallDispatcher.ExecuteBinaryOperator(BaseOp); 
   Target.Evaluate(context, AstMode.Write, time); //writes the value into the slot
 }
Пример #3
0
 private void EvaluateCombined(EvaluationContext context, AstMode mode)
 {
     Target.Evaluate(context, AstMode.Read);
     Expression.Evaluate(context, AstMode.Read);
     context.CallDispatcher.ExecuteBinaryOperator(BaseOp);
     Target.Evaluate(context, AstMode.Write); //writes the value into the slot
 }
Пример #4
0
        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            _paramName.Evaluate (context, AstMode.Read);
            _array.Evaluate (context, AstMode.Read);

            _name = (_paramName as Irony.Ast.LiteralValueNode).Value as string;
        }
Пример #5
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            if (EntryPoint == null)
            {
                context.ThrowError("No entry point defined (entry point is a function named «Go»)");
            }

            // load standard run-time library functions
            var libraryFunctions = LibraryFunction.ExtractLibraryFunctions(context, new RefalLibrary(context));

            foreach (LibraryFunction libFun in libraryFunctions)
            {
                context.SetValue(libFun.Name, libFun);
            }

            // define all functions
            foreach (Function fun in FunctionList)
            {
                fun.Evaluate(context, mode);
            }

            // call entry point with empty expression as an argument
            context.Data.Push(Runtime.PassiveExpression.Build());
            EntryPoint.Call(context);

            // discard execution results
            context.Data.Pop();
            context.ClearLastResult();
        }
 public override void EvaluateNode(Interpreter.EvaluationContext context, AstMode mode, DateTime time)
 {
     foreach (var rule in TradingRules)
     {
         rule.EvaluateNode(context, AstMode.None, time);
     }
 }
Пример #7
0
 private void EvaluateNot(EvaluationContext context, AstMode mode)
 {
     Argument.Evaluate(context, AstMode.Read);
       var value = context.Data.Pop();
       var bValue = (bool) context.Runtime.BoolResultConverter(value);
       context.Data.Push(!bValue);
 }
Пример #8
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            // evaluate expression
            Expression.Evaluate(context, AstMode.Read);

            // extract last recognized pattern (it contains bound variables)
            var lastPattern = context.GetLastPattern();

            if (lastPattern == null)
            {
                context.ThrowError("Internal error: last recognized pattern is lost");
            }

            // with-clause
            if (Block != null)
            {
                Block.BlockPattern = lastPattern;
                Block.Evaluate(context, mode);

                // with-clause is always successful
                context.Data.Push(true);
            }

            // where-clause
            if (Pattern != null)
            {
                EvaluateWhereClause(lastPattern, context, mode);
            }
        }
Пример #9
0
        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            _x.Evaluate (context, AstMode.Read);
            _y.Evaluate (context, AstMode.Read);
            _z.Evaluate (context, AstMode.Read);
            _dx.Evaluate (context, AstMode.Read);
            _dy.Evaluate (context, AstMode.Read);
            _dz.Evaluate (context, AstMode.Read);
            _ux.Evaluate (context, AstMode.Read);
            _uy.Evaluate (context, AstMode.Read);
            _uz.Evaluate (context, AstMode.Read);

            double x = Convert.ToDouble (context.Data[8]);
            double y = Convert.ToDouble (context.Data[7]);
            double z = Convert.ToDouble (context.Data[6]);

            double ux = Convert.ToDouble (context.Data[2]);
            double uy = Convert.ToDouble (context.Data[1]);
            double uz = Convert.ToDouble (context.Data[0]);

            double dx = Convert.ToDouble (context.Data[5]);
            double dy = Convert.ToDouble (context.Data[4]);
            double dz = Convert.ToDouble (context.Data[3]);

            Api.LookAt (x, y, z, ux, uy, uz, dx, dy, dz);
        }
Пример #10
0
        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            _name.Evaluate (context, AstMode.Read);

            string name = (_name as Irony.Ast.LiteralValueNode).Value as string;

            Api.CoordSysTransform (name);
        }
Пример #11
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            var transactionID = _graphDS.BeginTransaction(null);

            context.Data.Push(String.Format("Cleared the GraphDB in {0} seconds.", _graphDS.Clear<double>(null, transactionID, new RequestClear(), (_, __) => _.ExecutionTime.TotalSeconds)));

            _graphDS.CommitTransaction(null, transactionID);
        }
Пример #12
0
 public override void EvaluateNode(EvaluationContext context, AstMode mode) {
   TargetRef.Evaluate(context, AstMode.Read);
   var target = context.Data.Pop() as ICallTarget;
   if (target == null)
     context.ThrowError(Resources.ErrVarIsNotCallable, _targetName);
   Arguments.Evaluate(context, AstMode.Read);
   target.Call(context);
 }
Пример #13
0
        private void EvaluateNot(EvaluationContext context, AstMode mode)
        {
            Argument.Evaluate(context, AstMode.Read);
            var value  = context.Data.Pop();
            var bValue = (bool)context.Runtime.BoolResultConverter(value);

            context.Data.Push(!bValue);
        }
Пример #14
0
        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            _numbers = new double[_parameters.Length];

            foreach (AstNode node in _parameters)
                node.Evaluate (context, AstMode.Read);
            for (int i = _parameters.Length - 1; i >= 0; --i)
                _numbers[i] = Convert.ToDouble (context.Data.Pop ());
        }
Пример #15
0
 public override void EvaluateNode(EvaluationContext context, AstMode mode)
 {
     context.Data.Push(new OpeningBrace());
     if (InnerExpression != null)
     {
         InnerExpression.Evaluate(context, mode);
     }
     context.Data.Push(new ClosingBrace());
 }
Пример #16
0
 public override void EvaluateNode(EvaluationContext context, AstMode mode)
 {
     foreach (var term in Terms)
     {
         // in pattern, variables are never read
         mode = term is Variable ? AstMode.None : AstMode.Read;
         term.Evaluate(context, mode);
     }
 }
Пример #17
0
 public override void EvaluateNode(EvaluationContext context, AstMode mode) {
   var result = new ValuesList();
   foreach (var expr in ChildNodes) {
     expr.Evaluate(context, AstMode.Read);
     result.Add(context.Data.Pop());
   }
   //Push list on the stack
   context.Data.Push(result); 
 }
Пример #18
0
 public override void EvaluateNode(EvaluationContext context, AstMode mode) {
   Test.Evaluate(context, AstMode.Write);
   var result = context.Data.Pop();
   if (context.Runtime.IsTrue(result)) {
     if (IfTrue != null)    IfTrue.Evaluate(context, AstMode.Read);
   } else {
     if (IfFalse != null)   IfFalse.Evaluate(context, AstMode.Read);
   }
 }
Пример #19
0
 //Important: normally you don't need to override this method - you should override EvaluateNode instead
 // You should have strong reasons to override it - for example, if you want to change
 // exception handling implementation in base method. Otherwise, put all derived functionality
 // in EvaluateNode, or create other method(s) and set reference to it in EvaluateRef
 public virtual void Evaluate(EvaluationContext context, AstMode mode)
 {
     try {
         EvaluateRef(context, mode);
     } catch (RuntimeException) {
         throw;
     } catch (Exception ex) {
         throw new RuntimeException(ex.Message, ex, this.GetErrorAnchor());
     }
 }
 public override void EvaluateNode(EvaluationContext context, AstMode mode) {
   switch (mode) {
     case AstMode.Read: 
       context.Data.Push(Value); 
       break;
     case AstMode.Write: 
       context.ThrowError(O2_Misc_Microsoft_MPL_Libs.Irony_Parser.Resources.ErrAssignLiteralValue);  
       break;  
   }
 }
Пример #21
0
        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            for (int i = 0; i < 16; ++i)
            {
                _numberNodes[i].Evaluate (context, AstMode.Read);
                _numbers[i] = Convert.ToDouble((_numberNodes[i] as LiteralValueNode).Value);
            }

            Api.ConcatTransform (_numbers);
        }
 public override void EvaluateNode(EvaluationContext context, AstMode mode, DateTime time) {
   switch (mode) {
     case AstMode.Read: 
       context.Data.Push(Value); 
       break;
     case AstMode.Write: 
       context.ThrowError(Resources.ErrAssignLiteralValue);  
       break;  
   }
 }
Пример #23
0
        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            _pluginName.Evaluate (context, AstMode.Read);
            _parameters.Evaluate (context, AstMode.Read);

            ParameterSet parameterSet = new Hyperion.Core.Tools.ParameterSet ();
            string plugin = (_pluginName as Irony.Ast.LiteralValueNode).Value as string;

            Api.VolumeIntegrator (plugin, parameterSet);
        }
Пример #24
0
        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            _parameterSet = new Hyperion.Core.Tools.ParameterSet ();

            for (int i = 0; i < _parameters.Length; ++i)
            {
                _parameters[i].Evaluate (context, AstMode.Read);
                _parameterSet.AddNode (_parameters[i]);
            }
        }
Пример #25
0
 public override void EvaluateNode(EvaluationContext context, AstMode mode) {
   if (ChildNodes.Count == 0) return;
   ChildNodes[ChildNodes.Count - 1].Flags |= AstNodeFlags.IsTail;
   int iniCount = context.Data.Count; 
   foreach(var stmt in ChildNodes) {
     stmt.Evaluate(context, AstMode.Read);
     //restore position, in case a statement left something (like standalone expression vs assignment) 
     context.Data.PopUntil(iniCount);
   }
   context.Data.Push(context.LastResult); //push it back again
 }
Пример #26
0
 public override void EvaluateNode(EvaluationContext context, AstMode mode) {
   Argument.Evaluate(context, AstMode.Read);
   var result = context.LastResult;
   context.Data.Push(1);
   context.CallDispatcher.ExecuteBinaryOperator(BinaryOp);
   //prefix op: result of operation is the value AFTER inc/dec; so overwrite the result value
   if (!IsPostfix)
     result = context.LastResult;
   Argument.Evaluate(context, AstMode.Write); //write value into variable
   context.Data.Push(result); 
 } 
Пример #27
0
        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            _pluginName.Evaluate (context, AstMode.Read);
            _parameters.Evaluate (context, AstMode.Read);

            ParamListContentNode node = _parameters as ParamListContentNode;
            ParameterSet parameterSet = node._parameterSet;
            string plugin = (_pluginName as Irony.Ast.LiteralValueNode).Value as string;

            Api.Accelerator (plugin, parameterSet);
        }
Пример #28
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            if (_import != null)
            {
                Stopwatch sw = Stopwatch.StartNew();
                _import.Execute(_ => context.Data.Push(_), _graphDS);
                sw.Stop();

                context.Data.Push(String.Format("Executed {0} import in {1} seconds.", _import.PluginName, sw.Elapsed.TotalSeconds));
            }
        }
Пример #29
0
        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            _x.Evaluate (context, AstMode.Read);
            _y.Evaluate (context, AstMode.Read);
            _z.Evaluate (context, AstMode.Read);

            double x = Convert.ToDouble (context.Data[2]);
            double y = Convert.ToDouble (context.Data[1]);
            double z = Convert.ToDouble (context.Data[0]);

            Api.Scale (x, y, z);
        }
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            TargetRef.Evaluate(context, AstMode.Read);
            var target = context.Data.Pop() as ICallTarget;

            if (target == null)
            {
                context.ThrowError(O2_Misc_Microsoft_MPL_Libs.Irony_Parser.Resources.ErrVarIsNotCallable, _targetName);
            }
            Arguments.Evaluate(context, AstMode.Read);
            target.Call(context);
        }
Пример #31
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            var result = new ValuesList();

            foreach (var expr in ChildNodes)
            {
                expr.Evaluate(context, AstMode.Read);
                result.Add(context.Data.Pop());
            }
            //Push list on the stack
            context.Data.Push(result);
        }
    public override void EvaluateNode(EvaluationContext context, AstMode mode) {
      var argsObj = context.Data.Pop();
      var args = argsObj as ValuesList;
      if (args == null)
        context.ThrowError(O2_Misc_Microsoft_MPL_Libs.Irony_Parser.Resources.ErrArgListNotFound, argsObj);
      if (args.Count != ChildNodes.Count)
        context.ThrowError(O2_Misc_Microsoft_MPL_Libs.Irony_Parser.Resources.ErrWrongArgCount, ChildNodes.Count, args.Count);

      for(int i = 0; i < ChildNodes.Count; i++) {
        context.Data.Push(args[i]);
        ChildNodes[i].Evaluate(context, AstMode.Write); 
      }
    }//method
Пример #33
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            switch (mode)
            {
            case AstMode.Read:
                context.Data.Push(Value);
                break;

            case AstMode.Write:
                context.ThrowError(Resources.ErrAssignLiteralValue);
                break;
            }
        }
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            switch (mode)
            {
            case AstMode.Read:
                context.Data.Push(Value);
                break;

            case AstMode.Write:
                context.ThrowError(O2_Misc_Microsoft_MPL_Libs.Irony_Parser.Resources.ErrAssignLiteralValue);
                break;
            }
        }
Пример #35
0
 public override void EvaluateNode(EvaluationContext context, AstMode mode) {
   switch (mode) {
     case AstMode.Read:
       object value;
       if (context.TryGetValue(Symbol, out value))
         context.Data.Push(value); 
       else 
         context.ThrowError(Resources.ErrVarNotDefined, Symbol);
       break; 
     case AstMode.Write:
       context.SetValue(Symbol, context.Data.Pop()); 
       break; 
   }
 }
Пример #36
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            Argument.Evaluate(context, AstMode.Read);
            var result = context.LastResult;

            context.Data.Push(1);
            context.CallDispatcher.ExecuteBinaryOperator(BinaryOp);
            //prefix op: result of operation is the value AFTER inc/dec; so overwrite the result value
            if (!IsPostfix)
            {
                result = context.LastResult;
            }
            Argument.Evaluate(context, AstMode.Write); //write value into variable
            context.Data.Push(result);
        }
Пример #37
0
        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            _pluginName.Evaluate (context, AstMode.Read);
            _parameters.Evaluate (context, AstMode.Read);
            _paramOne.Evaluate (context, AstMode.Read);
            _paramTwo.Evaluate (context, AstMode.Read);

            ParamListContentNode node = _parameters as ParamListContentNode;
            ParameterSet parameterSet = node._parameterSet;
            string plugin = (_pluginName as Irony.Ast.LiteralValueNode).Value as string;
            string n1 = (_paramOne as Irony.Ast.LiteralValueNode).Value as string;
            string n2 = (_paramTwo as Irony.Ast.LiteralValueNode).Value as string;

            Api.Texture (plugin, n1, n2, parameterSet);
        }
Пример #38
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            if (_iterations < 1)
            {
                context.Data.Push(String.Format("It's not possible to execute {0} iterations.", _iterations));
            }
            else
            {
                Stopwatch sw = Stopwatch.StartNew();
                _benchmark.Execute(_graphDS, _iterations, _ => context.Data.Push(_));
                sw.Stop();

                context.Data.Push(String.Format("Executed the {0} benchmark in {1} seconds.", _componentName, sw.Elapsed.TotalSeconds));
            }
        }
Пример #39
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            // evaluate pattern and copy bound variables of the current block
            var patt = Pattern.Instantiate(context, mode);

            if (BlockPattern != null)
            {
                patt.CopyBoundVariables(BlockPattern);
            }

            // pop expression from evaluation stack
            var expr = context.Data.Pop() as Runtime.PassiveExpression;

            // if pattern is recognized, calculate new expression and return true
            var result = patt.Match(expr);

            if (result)
            {
                // store last recognized pattern as a local variable
                context.SetLastPattern(patt);

                // match succeeded, return expression
                if (Expression != null)
                {
                    Expression.Evaluate(context, AstMode.Read);
                    context.Data.Push(true);
                    return;
                }

                // match succeeded? it depends on conditions
                if (Conditions != null)
                {
                    Conditions.Evaluate(context, mode);

                    // check if conditions succeeded
                    result = Convert.ToBoolean(context.Data.Pop());
                    if (result)
                    {
                        context.Data.Push(true);
                        return;
                    }
                }
            }

            // push expression back for the next sentence
            context.Data.Push(expr);
            context.Data.Push(false);             // match failed
        }
Пример #40
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            foreach (Sentence sentence in Sentences)
            {
                sentence.BlockPattern = BlockPattern;
                sentence.Evaluate(context, mode);

                // if some sentence is evaluated to true, then stop
                var result = context.Data.Pop();
                if (Convert.ToBoolean(result) == true)
                {
                    return;
                }
            }

            context.ThrowError("Recognition impossible");
        }
Пример #41
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            if (ChildNodes.Count == 0)
            {
                return;
            }
            ChildNodes[ChildNodes.Count - 1].Flags |= AstNodeFlags.IsTail;
            int iniCount = context.Data.Count;

            foreach (var stmt in ChildNodes)
            {
                stmt.Evaluate(context, AstMode.Read);
                //restore position, in case a statement left something (like standalone expression vs assignment)
                context.Data.PopUntil(iniCount);
            }
            context.Data.Push(context.LastResult); //push it back again
        }
Пример #42
0
        private object[] EvaluateTerms(EvaluationContext context, AstMode mode)
        {
            // save initial stack position
            var initialCount = context.Data.Count;

            Evaluate(context, mode);

            // get terms from evaluation stack
            var args = new List <object>();

            while (context.Data.Count > initialCount)
            {
                args.Add(context.Data.Pop());
            }

            // restore original order
            args.Reverse();
            return(args.ToArray());
        }
Пример #43
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            // read variable from last recognized pattern
            if (mode == AstMode.Read)
            {
                if (context.GetLastPattern() == null)
                {
                    context.ThrowError("No pattern recognized");
                }

                // push variable contents onto stack
                var pattern = context.GetLastPattern();
                context.Data.Push(pattern.GetVariable(Index));
                return;
            }

            // create variable for pattern matching
            context.Data.Push(CreateVariable());
        }
Пример #44
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            var argsObj = context.Data.Pop();
            var args    = argsObj as ValuesList;

            if (args == null)
            {
                context.ThrowError(Resources.ErrArgListNotFound, argsObj);
            }
            if (args.Count != ChildNodes.Count)
            {
                context.ThrowError(Resources.ErrWrongArgCount, ChildNodes.Count, args.Count);
            }

            for (int i = 0; i < ChildNodes.Count; i++)
            {
                context.Data.Push(args[i]);
                ChildNodes[i].Evaluate(context, AstMode.Write);
            }
        } //method
Пример #45
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            Test.Evaluate(context, AstMode.Write);
            var result = context.Data.Pop();

            if (context.Runtime.IsTrue(result))
            {
                if (IfTrue != null)
                {
                    IfTrue.Evaluate(context, AstMode.Read);
                }
            }
            else
            {
                if (IfFalse != null)
                {
                    IfFalse.Evaluate(context, AstMode.Read);
                }
            }
        }
Пример #46
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            Expression.Evaluate(context, mode);

            object value;

            if (context.TryGetValue(FunctionName, out value))
            {
                ICallTarget function = value as ICallTarget;
                if (function == null)
                {
                    context.ThrowError("This identifier cannot be called: {0}", FunctionName);
                }

                function.Call(context);
                return;
            }

            context.ThrowError("Unknown identifier: {0}", FunctionName.Text);
        }
Пример #47
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            switch (mode)
            {
            case AstMode.Read:
                object value;
                if (context.TryGetValue(Symbol, out value))
                {
                    context.Data.Push(value);
                }
                else
                {
                    context.ThrowError(Resources.ErrVarNotDefined, Symbol);
                }
                break;

            case AstMode.Write:
                context.SetValue(Symbol, context.Data.Pop());
                break;
            }
        }
Пример #48
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            if (ChildNodes.Count == 0)
            {
                return;
            }

            StringBuilder sb = new StringBuilder();

            foreach (var aChild in ChildNodes)
            {
                aChild.Evaluate(context, AstMode.Read);

                for (int i = 0; i < context.Data.Count; i++)
                {
                    sb.AppendLine(context.Data.Top.ToString());
                    context.Data.Pop();
                }
            }

            context.Data.Push(sb.ToString());
        }
Пример #49
0
        public override void EvaluateNode(EvaluationContext context, AstMode mode)
        {
            // evaluate terms
            var initialCount = context.Data.Count;

            foreach (var term in Terms)
            {
                term.Evaluate(context, mode);
            }

            // build passive expression from terms
            var args = new List <object>();

            while (context.Data.Count > initialCount)
            {
                args.Add(context.Data.Pop());
            }

            // build expression and push onto stack
            args.Reverse();
            context.Data.Push(PassiveExpression.Build(args.ToArray()));
        }
 public override void EvaluateNode(EvaluationContext context, AstMode mode, DateTime time)
 {
   Left.Evaluate(context, AstMode.Read, time);
   Right.Evaluate(context, AstMode.Read, time);
   context.CallDispatcher.ExecuteBinaryOperator(this.Op);
 }//method
Пример #51
0
 private void EvaluateSimple(EvaluationContext context, AstMode mode) {
   Expression.Evaluate(context, AstMode.Read);
   Target.Evaluate(context, AstMode.Write); //writes the value into the slot
 }
Пример #52
0
 public override void EvaluateNode(EvaluationContext context, AstMode mode)
 {
     //push the function into the stack
     context.Data.Push(this);
     NameNode.Evaluate(context, AstMode.Write);
 }
Пример #53
0
 private void EvaluateMinus(EvaluationContext context, AstMode mode) {
   context.Data.Push((byte)0);
   Argument.Evaluate(context, AstMode.Read);
   context.CallDispatcher.ExecuteBinaryOperator("-"); 
 }
Пример #54
0
 public override void Evaluate(EvaluationContext context, AstMode mode)
 {
     context.ThrowError(Resources.ErrNullNodeEval, this.Term);
 }
 public override void EvaluateNode(EvaluationContext context, AstMode mode)
 {
     context.ThrowError(Resources.ErrConstructNotSupported, Name);
 }
Пример #56
0
 public override void EvaluateNode(EvaluationContext context, AstMode mode)
 {
     Left.Evaluate(context, AstMode.Read);
     Right.Evaluate(context, AstMode.Read);
     context.CallDispatcher.ExecuteBinaryOperator(this.Op);
 } //method
Пример #57
0
 public override void EvaluateNode(EvaluationContext context, AstMode mode)
 {
 }
Пример #58
0
 private void EvaluatePlus(EvaluationContext context, AstMode mode)
 {
     Argument.Evaluate(context, AstMode.Read);
 }
Пример #59
0
        void EvaluateWhereClause(Runtime.Pattern lastPattern, EvaluationContext context, AstMode mode)
        {
            // instantiate where-clause pattern
            var patt = Pattern.Instantiate(context, mode);

            patt.CopyBoundVariables(lastPattern);

            // perform matching
            var expr   = context.Data.Pop() as Runtime.PassiveExpression;
            var result = patt.Match(expr);

            if (result)
            {
                // store last recognized pattern as a local variable
                context.SetLastPattern(patt);

                // match succeeded, return true
                if (ResultExpression != null)
                {
                    ResultExpression.Evaluate(context, AstMode.Read);
                    context.Data.Push(true);
                    return;
                }

                // match succeeded? depends on more conditions
                if (MoreConditions != null)
                {
                    // return true or false
                    MoreConditions.Evaluate(context, AstMode.Read);
                    return;
                }
            }

            // match failed, return false
            context.Data.Push(false);
        }
Пример #60
0
 private void EvaluateMinus(EvaluationContext context, AstMode mode)
 {
     context.Data.Push((byte)0);
     Argument.Evaluate(context, AstMode.Read);
     context.CallDispatcher.ExecuteBinaryOperator("-");
 }