Exemple #1
0
        private static void createIntClass(EnegyData data, VariabelDatabase db, Posision pos)
        {
            Class i = new Class("int");

            Method constructor = new Method(null);
            constructor.GetAgumentStack().push("int", "double", new NullVariabel());
            constructor.SetBody(Constructor_caller1);
            i.SetConstructor(constructor, data, db, pos);

            Method toInt = new Method("toInt");
            toInt.SetBody(ToInt_caller);
            i.SetMethod(toInt, data, db, pos);

            Method toString = new Method("toString");
            toString.SetBody(ToString_caller1);
            i.SetMethod(toString, data, db, pos);

            Method convert = new Method("convert");
            convert.SetStatic();
            convert.GetAgumentStack().push("string", "int");
            convert.SetBody(Convert_caller);
            i.SetMethod(convert, data, db, pos);

            db.pushClass(i, data);
        }
Exemple #2
0
        public void open(VariabelDatabase database, EnegyData data, Posision pos)
        {
            Class r = new Class("Random");

            Method constructor = new Method("");
            constructor.SetBody(Constructor_caller);
            r.SetConstructor(constructor, data, database, pos);

            Method seed = new Method("seed");
            seed.GetAgumentStack().push("int", "seed");
            seed.SetBody(Seed_caller);
            r.SetMethod(seed, data, database, pos);

            Method next = new Method("next");
            next.GetAgumentStack().push("int", "min");
            next.GetAgumentStack().push("int", "max");
            next.SetBody(Next_caller);
            r.SetMethod(next, data, database, pos);

            database.pushClass(r, data);
        }
Exemple #3
0
        private static void createStringClass(EnegyData data, VariabelDatabase db, Posision pos)
        {
            Class s = new Class("string");

            Method format = new Method("format");
            format.SetStatic();
            format.GetAgumentStack().push("string", "query");
            format.GetAgumentStack().push("array", "parameters");
            format.SetBody(Format_caller);
            s.SetMethod(format, data, db, pos);

            //constructor :)
            Method constructor = new Method(null);
            constructor.GetAgumentStack().push("string", "s", new NullVariabel());
            constructor.SetBody(Constructor_caller);
            s.SetConstructor(constructor, data, db, pos);

            Method length = new Method("length");
            length.SetBody(Length_caller);
            s.SetMethod(length, data, db, pos);

            Method substr = new Method("substr");
            substr.GetAgumentStack().push("int", "min");
            substr.GetAgumentStack().push("int", "max", new NullVariabel());
            substr.SetBody(Substr_caller);
            s.SetMethod(substr, data, db, pos);

            Method indexOf = new Method("indexOf");
            indexOf.GetAgumentStack().push("string", "serche");
            indexOf.SetBody(IndexOf_caller);
            s.SetMethod(indexOf, data, db, pos);

            Method toChars = new Method("toChars");
            toChars.SetBody(ToChars_caller);
            s.SetMethod(toChars, data, db, pos);

            Method split = new Method("split");
            split.GetAgumentStack().push("string", "string");
            split.SetBody(Split_caller);
            s.SetMethod(split, data, db, pos);

            Method toLower = new Method("toLower");
            toLower.SetBody(ToLower_caller);
            s.SetMethod(toLower, data, db, pos);

            Method toUpper = new Method("toUpper");
            toUpper.SetBody(ToUpper_caller);
            s.SetMethod(toUpper, data, db, pos);

            Method toString = new Method("toString");
            toString.SetBody(ToString_caller);
            s.SetMethod(toString, data, db, pos);

            Method set = new Method("set");
            set.GetAgumentStack().push("string", "context");
            set.setLevel(ClassItemAccessLevel.Protected);
            set.SetBody(Set_caller);
            s.SetMethod(set, data, db, pos);

            db.pushClass(s, data);
        }