Example #1
0
        /// <summary>
        /// システムに登録する
        /// </summary>
        /// <param name="dic"></param>
        /// <param name="globalVar"></param>
        public void RegisterToSystem(NakoTokenDic dic, NakoVariableManager globalVar)
        {
            // --- 関数
            // Tokenizer に登録
            for (int i = 0; i < FuncList.Count; i++)
            {
                NakoAPIFunc call = FuncList[i];
                if (!dic.ContainsKey(call.name))
                {
                    dic.Add(call.name, NakoTokenType.FUNCTION_NAME);
                }
                else
                {
                    dic[call.name] = NakoTokenType.FUNCTION_NAME;
                }
            }

            // NakoVariables に登録
            for (int i = 0; i < FuncList.Count; i++)
            {
                NakoVariable var = new NakoVariable();
                var.SetBody(i, NakoVarType.SystemFunc);
                NakoAPIFunc call = FuncList[i];
                globalVar.SetVar(call.name, var);
            }

            // --- 変数
            foreach (string name in VarList.Keys)
            {
                NakoVariable var = new NakoVariable();
                var.SetBodyAutoType(VarList[name]);
                globalVar.SetVar(name, var);
            }
        }
Example #2
0
        private void ld_local_ref(int no)
        {
            NakoVariable v = localVar.GetVar(no);

            if (v == null)
            {
                v = new NakoVariable();
                localVar.SetVar(no, v);
            }
            StackPush(v);
        }