public Completion Execute(ExecutionEnvironment enviroment) { if (Right == null) { return(Completion.Void); } var right = Right.Execute(enviroment); if (right.Type != CompletionType.Value) { return(right); } if (Left == null) { return(right); } if (Left is Identifier) { enviroment.SetValue(((Identifier)Left).Variable, right.ReturnValue); return(right); } else { return(new Completion("invliad format before =", CompletionType.Exception)); } //var left = Left.Execute(enviroment); }
public Completion Assign(ExecutionEnvironment environment, object value) { if (environment.HasValue(Raw)) { environment.SetValue(Raw, value); } return(Completion.Exception(string.Format(Properties.Language.VariableNotDefined, Raw), this)); }
Nullable <DateTime> Callback(object value, object exception, ExecutionEnvironment _env) { variable = (Left as Identifier).Variable; result = value; _env.SetValue(variable, value); current++; return(null); }
public Completion Assign(ExecutionEnvironment environemtn, object value) { try { environemtn.SetValue(Variable, value); return(new Completion(value)); }catch (Exception e) { return(Completion.Exception(string.Format(Properties.Language.VariableNotDefined, Variable), this)); } }
protected override Completion ExecuteImpl(ExecutionEnvironment enviroment) { if (enviroment.HasValue("$$ReflectionOnTouchSide&&")) { enviroment.SetValue("$$ReflectionOnTouchSide&&", true); } else { enviroment.RegisterValue("$$ReflectionOnTouchSide&&", true); } return(Completion.Void); }
public void SetValue(string variable, object value) { if (currentVariables.ContainsKey(variable)) { currentVariables[variable] = value; return; } if (_parent != null) { _parent.SetValue(variable, value); return; } currentVariables[variable] = value; }
public void SetValue(string variable, object value) { if (currentScope.ContainsKey(variable)) { currentScope[variable] = value; return; } if (_parent != null && _parent.Has(variable)) { _parent.SetValue(variable, value); return; } currentScope.Add(variable, value); }
public void SetValue(string variable, object value) { if (IsAborting) { throw new ExecutionAbortException(Properties.Language.ExecutionAborted); } if (currentVariables.ContainsKey(variable)) { currentVariables[variable] = value; return; } else if (_parent != null) { _parent.SetValue(variable, value); return; } else { throw new KeyNotFoundException(); } }
protected override Completion ExecuteImpl(ExecutionEnvironment enviroment) { if (Expression == null) { return(Completion.Exception(Properties.Language.NullException, this)); } var c = Expression.Execute(enviroment); if (c.Type != CompletionType.Value) { return(c); } if (!TypeConverters.IsNumber(c.ReturnValue)) { return(Completion.Exception(Properties.Language.NotNumber, Expression)); } Type t = c.ReturnValue.GetType(); if (t.Equals(typeof(int))) { int v = TypeConverters.GetValue <int>(c.ReturnValue); int old = v; if (Operator == UpdateOperator.Add) { v += 1; } else { v = v - 1; } if (Expression is Identifier) { enviroment.SetValue(((Identifier)Expression).Variable, v); } return(new Completion(IsPrefix ? v : old)); } else if (t.Equals(typeof(float))) { float v = TypeConverters.GetValue <float>(c.ReturnValue); float old = v; if (Operator == UpdateOperator.Add) { v += 1; } else { v = v - 1; } if (Expression is Identifier) { enviroment.SetValue(((Identifier)Expression).Variable, v); } return(new Completion(IsPrefix ? v : old)); } else { double v = TypeConverters.GetValue <double>(c.ReturnValue); double old = v; if (Operator == UpdateOperator.Add) { v += 1; } else { v = v - 1; } if (Expression is Identifier) { enviroment.SetValue(((Identifier)Expression).Variable, v); } return(new Completion(IsPrefix ? v : old)); } }
public Completion Execute(ExecutionEnvironment enviroment) { enviroment.SetValue("$$ReflectionOnTouchSide&&", true); return(Completion.Void); }