Beispiel #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);
        }
Beispiel #2
0
        public DeclarInitStatementNode loadDeclarationStmt(string path)
        {
            VarDeclNode             decl  = (VarDeclNode)loadSymbolRef(path + ".var");
            ExprNode                expr  = loadExpression(path + ".expr");
            DeclarInitStatementNode snode = new DeclarInitStatementNode(decl, expr);

            return(snode);
        }
Beispiel #3
0
        public VarDeclNode loadVarDecl(string path)
        {
            VarDeclNode vnode = new VarDeclNode();

            vnode.name    = oilcan.getStringValue(path + ".name", "");
            vnode.varType = loadTypeDecl(path + ".type");
            return(vnode);
        }
Beispiel #4
0
 public void saveVarDecl(string path, VarDeclNode v)
 {
     oilcan.setStringValue(path + ".name", v.name);
     saveTypeDecl(path + ".type", v.varType);
 }
Beispiel #5
0
 public DeclarInitStatementNode(VarDeclNode _decl, ExprNode _initexpr)
 {
     type     = OILType.DeclarationStmt;
     decl     = _decl;
     initexpr = _initexpr;
 }