use of com.alibaba.cobar.parser.ast.expression.primary.function.comparison.Interval in project cobar by alibaba.
the class MySQLExprParser method intervalExpression.
/**
* first <code>INTERVAL</code> has been consumed
*/
private Expression intervalExpression() throws SQLSyntaxErrorException {
Expression fstExpr;
List<Expression> argList = null;
if (lexer.token() == PUNC_LEFT_PAREN) {
if (lexer.nextToken() == KW_SELECT) {
fstExpr = subQuery();
match(PUNC_RIGHT_PAREN);
} else {
fstExpr = expression();
if (lexer.token() == PUNC_COMMA) {
lexer.nextToken();
argList = new LinkedList<Expression>();
argList.add(fstExpr);
argList = expressionList(argList);
} else {
match(PUNC_RIGHT_PAREN);
}
}
} else {
fstExpr = expression();
}
if (argList != null) {
return new Interval(argList).setCacheEvalRst(cacheEvalRst);
}
return new IntervalPrimary(fstExpr, intervalPrimaryUnit()).setCacheEvalRst(cacheEvalRst);
}
Aggregations