public final SQLExpr inRest(SQLExpr expr) {
if (lexer.token() == Token.IN) {
lexer.nextToken();
SQLInListExpr inListExpr = new SQLInListExpr(expr);
if (lexer.token() == Token.LPAREN) {
lexer.nextToken();
exprList(inListExpr.getTargetList(), inListExpr);
accept(Token.RPAREN);
expr = inListExpr;
} else {
SQLExpr itemExpr = primary();
itemExpr.setParent(inListExpr);
inListExpr.getTargetList().add(itemExpr);
}
expr = inListExpr;
if (inListExpr.getTargetList().size() == 1) {
SQLExpr targetExpr = inListExpr.getTargetList().get(0);
if (targetExpr instanceof SQLQueryExpr) {
SQLInSubQueryExpr inSubQueryExpr = new SQLInSubQueryExpr();
inSubQueryExpr.setExpr(inListExpr.getExpr());
inSubQueryExpr.setSubQuery(((SQLQueryExpr) targetExpr).getSubQuery());
expr = inSubQueryExpr;
}
}
}