public ValuesTable Values; //global values for top frame; parameters and local variables for method frame #endregion Fields #region Constructors public StackFrame(EvaluationContext context, ValuesTable globals) { Context = context; Values = globals; if (Values == null) Values = new ValuesTable(100); }
public StackFrame(EvaluationContext context, string methodName, StackFrame caller, StackFrame parent) { MethodName = methodName; Caller = caller; Parent = parent; Values = new ValuesTable(8); }
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 }
public ScriptInterpreter(LanguageData language) { Language = language; Runtime = Language.Grammar.CreateRuntime(Language); Parser = new Parser(Language); EvaluationContext = new EvaluationContext(Runtime); Status = _internalStatus = InterpreterStatus.Ready; }
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); }
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); }
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); }
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) { 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); } }
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; } }
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; } }
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 }
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)); } }
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); }
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
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; } }
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)); } }
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()); }
private void EvaluateMinus(EvaluationContext context, AstMode mode) { context.Data.Push((byte)0); Argument.Evaluate(context, AstMode.Read); context.CallDispatcher.ExecuteBinaryOperator("-"); }
private void EvaluatePlus(EvaluationContext context, AstMode mode) { Argument.Evaluate(context, AstMode.Read); }
public override void Evaluate(EvaluationContext context, AstMode mode) { context.ThrowError(O2_Misc_Microsoft_MPL_Libs.Irony_Parser.Resources.ErrNullNodeEval, this.Term); }
public override void Evaluate(EvaluationContext context, AstMode mode) { context.ThrowError(Resources.ErrNullNodeEval, this.Term); }
public override void EvaluateNode(EvaluationContext context, AstMode mode, DateTime time) { context.ThrowError(Resources.ErrConstructNotSupported, Name); }
public void Call(EvaluationContext context) { context.PushFrame(this.NameNode.ToString(), this, context.CurrentFrame); Parameters.Evaluate(context, AstMode.None); Body.Evaluate(context, AstMode.None); context.PopFrame(); }
public override void EvaluateNode(EvaluationContext context, AstMode mode) { //push the function into the stack context.Data.Push(this); NameNode.Evaluate(context, AstMode.Write); }
public IEnumerable<object> GetCollectionData(EvaluationContext context, DateTime dateTime) { return context.StrategyDataContainer.GetData(Symbol.Text, dateTime); }
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
private void EvaluateSimple(EvaluationContext context, AstMode mode) { Expression.Evaluate(context, AstMode.Read); Target.Evaluate(context, AstMode.Write); //writes the value into the slot }
private void EvaluatePlus(EvaluationContext context, AstMode mode, DateTime time) { Argument.Evaluate(context, AstMode.Read, time); }