private QueryPart parseRestrictions(String rql, AtomicInteger pos) {
        ComplexPart part = new ComplexPart(); 

        rql = rql.trim();

        boolean isString = false; //if true, we are dealing with a string
        boolean isMethodWithParenthesis = false; //if true, it is not a sub expression
        char chr = '-'; //just any character
        StringBuilder builder = new StringBuilder(); // this hold the level's expressions
        String lowerRQL = null;
        
        int i = pos.get();
        while(i < rql.length()) {
            chr = rql.charAt(i);
            i = pos.incrementAndGet();
            
            switch(chr) {
                case '(':
                    if(isString) {
                        builder.append(chr);
                        continue;
                    }
                    
                    lowerRQL = builder.toString().toLowerCase();
                    isMethodWithParenthesis = isMethodWithParameter(lowerRQL);
                    
                    if(isMethodWithParenthesis) {
                        builder.append(chr);
                        i = pos.get();
                        continue;
                    }
                    
                    lowerRQL = lowerRQL.trim();
                    
                    if(lowerRQL.length() == 0) {
                        part.addPart(parseRestrictions(rql, pos));
                        i = pos.get();
                        continue;
                    }
                    
                    parsePartial(part, rql, pos, builder.toString().trim());
                    part.addPart(parseRestrictions(rql, pos));
                    i = pos.get();
                break;
                case ')':
                    if(isString) {
                        builder.append(chr);
                        i = pos.get();
                        continue;
                    }
                    
                    if(isMethodWithParenthesis) {
                        builder.append(chr);
                        isMethodWithParenthesis = false;
                        i = pos.get();
                        continue;
                    }
                    parsePartial(part, rql, pos, builder.toString());
                    return part;
                case '\'':
                    isString = !isString;
                    builder.append(chr);
                break;
                default:
                    builder.append(chr);
            }
        }
        
        parsePartial(part, rql, pos, builder.toString().trim());
        
        return part;
    }