public void SetInvokeProperties(string[] args, List <Token> vars, List <Token> oldargs) { invokeProperties = args; //if (LocalVariables == null) //trying emptying local vars each invoke, it might break things tho LocalVariables = new TokenStack(); vars.RemoveAll(r => r.Name == ""); oldargs.RemoveAll(r => r.Name == ""); LocalVariables.AddRange(vars); LocalVariables.AddRange(oldargs);//add the parameters from the calling function to this functions local var stack }
public TokenParser(List <IBaseFunction> functionList) { CancellationTokenSource = new CancellationTokenSource(); FunctionStack.AddRange(functionList); AnonymousTokens = new TokenStack(); GlobalVariables = new TokenStack(); GlobalVariables.AddRange(new List <Token>() { new Token("DateTime", () => { return(DateTime.Now.ToString()); }, "{0}", locked: true), new Token("Date", () => { return(DateTime.Now.ToShortDateString()); }, "{0}", locked: true), new Token("Time", () => { return(DateTime.Now.ToShortTimeString()); }, "{0}", locked: true), new TArray("GetVersion", StrVersion(), "{0}", locked: true), new Token("null", "null", "{0}", locked: true), new Token("True", "True", "{0}", locked: true), new Token("true", "true", "{0}", locked: true), new Token("False", "False", "{0}", locked: true), new Token("false", "false", "{0}", locked: true) }); StartParse(); }