Example #1
0
        //- reading declarations ------------------------------------

        public FuncDefNode loadFuncDef(String path)
        {
            localSymbols.Clear();
            FuncDefNode func = new FuncDefNode();

            func.name       = oilcan.getStringValue(path + ".name", "");
            func.returnType = loadTypeDecl(path + ".return-type");

            List <String> paramnames = oilcan.getPathKeys(path + ".params");

            foreach (String pname in paramnames)
            {
                ParamDeclNode p = loadParamDecl(path + ".params." + pname);
                func.paramList.Add(p);
                localSymbols[pname] = p;
            }

            List <String> localnames = oilcan.getPathKeys(path + ".locals");

            foreach (String lname in localnames)
            {
                VarDeclNode l = loadVarDecl(path + ".locals." + lname);
                func.locals.Add(l);
                localSymbols[lname] = l;
            }

            func.body = loadStatementList(path + ".body");

            return(func);
        }
Example #2
0
        public ParamDeclNode loadParamDecl(string path)
        {
            ParamDeclNode pnode = new ParamDeclNode();

            pnode.name  = oilcan.getStringValue(path + ".name", "");
            pnode.pType = loadTypeDecl(path + ".type");
            return(pnode);
        }
Example #3
0
 public void saveParamDecl(string path, ParamDeclNode param)
 {
     oilcan.setStringValue(path + ".name", param.name);
     saveTypeDecl(path + ".type", param.pType);
 }