Exemplo n.º 1
0
        //- reading expressions -------------------------------------

        public ExprNode loadExpression(string path)
        {
            ExprNode enode    = null;
            string   exprtype = oilcan.getStringValue(path + ".type", "");

            switch (exprtype)
            {
            case "ident-expr":
                OILNode idsym = loadSymbolRef(path + ".ref");
                enode = new IdentExprNode(idsym);
                break;

            case "int-const":
                int intval = oilcan.getIntValue(path + ".val", 0);
                enode = new IntConstant(intval);
                break;

            case "float-const":
                double dblval = oilcan.getFloatValue(path + ".val", 0.0);
                enode = new FloatConstant(dblval);
                break;

            case "arith-expr":
                enode = loadArithmeticExpression(path);
                break;

            case "comp-expr":
                enode = loadComparisionExpression(path);
                break;

            case "assign-expr":
                enode = loadAssignmentExpression(path);
                break;

            default:
                break;
            }
            return(enode);
        }