see phpcr/phpcr#35 for discussion
parenthesis are parsed by the sql2 parser. however, operator precedence is ignored: a or b and c gets parsed as if it was (a or b) and c. the parser should respect precedence of operators.
i suggest starting with a couple of phpcr-api-tests that test operator precendence and parenthesis (and do the assertions really based on what would be correct and not on what you get from the current implementation ;-) )
fixed
the qom to sql2 generator adds parenthesis everywhere to avoid potential problems.