Esempio n. 1
0
        private bool buildVariabel(ClassItemAccessLevel level, bool isStatic, Token token, EnegyData data)
        {
            //it is a variabel :)
            //okay it is a variabel ?
            if (token.getCache().type() != TokenType.Variabel) {
                data.setError(new ScriptError("1 Unknown token in class (" + builder.GetContainer().Name + ") body: " + token.getCache().ToString() + " | " + token.getCache().type().ToString(), token.getCache().posision()), db);
                return false;
            }

            Pointer pointer = new Pointer(token.getCache().ToString());

            if(token.next().type() == TokenType.Assigen)
            {
                token.next();
                pointer.SetDefault(new VariabelParser().parse(data, db, token));
            }else if(token.getCache().type() == TokenType.End)
            {
                token.next();
            }
            else
            {
                data.setError(new ScriptError("2 Unknown token in class ("+builder.GetContainer().Name+") body: " + token.getCache().ToString(), token.getCache().posision()), db);
                return false;
            }

            if (isStatic)
                pointer.SetStatic();

            pointer.SetLevel(level);

            builder.SetPointer(pointer, data, db, token.getCache().posision());
            return true;
        }