public TreeWalker(RenpyScriptBuilder scriptBuilder) { this.functionLookup = new FunctionHandlerLookup(); this.numAliasDictionary = new IgnoreCaseDictionary<int>(); this.stringAliasDictionary = new IgnoreCaseDictionary<int>(); this.scriptBuilder = scriptBuilder; // Variables used for jumpf command this.sawJumpfCommand = false; this.jumpfTargetCount = 0; this.gotIfStatement = false; this.forNextStatementIncrementString = new Stack<string>(); //Register function handlers this.functionLookup.RegisterSystemFunction(new NumAliasHandler()); this.functionLookup.RegisterSystemFunction(new StringAliasHandler()); this.functionLookup.RegisterSystemFunction(new MovHandler()); this.functionLookup.RegisterSystemFunction(new AddHandler()); this.functionLookup.RegisterSystemFunction(new IncHandler()); this.functionLookup.RegisterSystemFunction(new DecHandler()); this.functionLookup.RegisterSystemFunction(new DefSubHandler()); this.functionLookup.RegisterSystemFunction(new GetParamHandler()); this.functionLookup.RegisterSystemFunction(new JumpfHandler()); this.functionLookup.RegisterSystemFunction(new GotoHandler()); this.functionLookup.RegisterSystemFunction(new GoSubHandler()); this.functionLookup.RegisterSystemFunction(new DimHandler()); this.functionLookup.RegisterSystemFunction(new NextHandler()); this.functionLookup.RegisterSystemFunction(new LspHandler()); this.functionLookup.RegisterSystemFunction(new SpbtnExbtnHandler()); this.functionLookup.RegisterSystemFunction(new Btnwait2Handler()); this.functionLookup.RegisterSystemFunction(new BtndefHandler()); }
private void RegisterFunctionWithCheck(IgnoreCaseDictionary<FunctionHandler> dict, FunctionHandler userFunctionHandler) { foreach (string function_name in userFunctionHandler.FunctionNames()) { if (dict.Contains(function_name)) { throw new Exception($"User function {function_name} was defined twice"); } else { dict.Set(function_name, userFunctionHandler); } } }
public FunctionHandlerLookup() { this.systemFunctions = new IgnoreCaseDictionary<FunctionHandler>(); this.userFunctions = new IgnoreCaseDictionary<int>(); }