use of com.alibaba.cobar.parser.ast.expression.primary.MatchExpression.Modifier in project cobar by alibaba.
the class MySQLExprParser method matchExpression.
/**
* first <code>MATCH</code> has been consumed
*/
private Expression matchExpression() throws SQLSyntaxErrorException {
match(PUNC_LEFT_PAREN);
List<Expression> colList = expressionList(new LinkedList<Expression>());
matchIdentifier("AGAINST");
match(PUNC_LEFT_PAREN);
Expression pattern = expression();
Modifier modifier = Modifier._DEFAULT;
switch(lexer.token()) {
case KW_WITH:
lexer.nextToken();
match(IDENTIFIER);
match(IDENTIFIER);
modifier = Modifier.WITH_QUERY_EXPANSION;
break;
case KW_IN:
switch(lexer.nextToken()) {
case KW_NATURAL:
lexer.nextToken();
matchIdentifier("LANGUAGE");
matchIdentifier("MODE");
if (lexer.token() == KW_WITH) {
lexer.nextToken();
lexer.nextToken();
lexer.nextToken();
modifier = Modifier.IN_NATURAL_LANGUAGE_MODE_WITH_QUERY_EXPANSION;
} else {
modifier = Modifier.IN_NATURAL_LANGUAGE_MODE;
}
break;
default:
matchIdentifier("BOOLEAN");
matchIdentifier("MODE");
modifier = Modifier.IN_BOOLEAN_MODE;
break;
}
}
match(PUNC_RIGHT_PAREN);
return new MatchExpression(colList, pattern, modifier).setCacheEvalRst(cacheEvalRst);
}
Aggregations