//- 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); }
public DeclarInitStatementNode loadDeclarationStmt(string path) { VarDeclNode decl = (VarDeclNode)loadSymbolRef(path + ".var"); ExprNode expr = loadExpression(path + ".expr"); DeclarInitStatementNode snode = new DeclarInitStatementNode(decl, expr); return(snode); }
public VarDeclNode loadVarDecl(string path) { VarDeclNode vnode = new VarDeclNode(); vnode.name = oilcan.getStringValue(path + ".name", ""); vnode.varType = loadTypeDecl(path + ".type"); return(vnode); }
public void saveVarDecl(string path, VarDeclNode v) { oilcan.setStringValue(path + ".name", v.name); saveTypeDecl(path + ".type", v.varType); }
public DeclarInitStatementNode(VarDeclNode _decl, ExprNode _initexpr) { type = OILType.DeclarationStmt; decl = _decl; initexpr = _initexpr; }