in jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLParser.java [282:581]
final public void Predicate() throws ParseException {
/*@bgen(jjtree) Predicate */
ASTPredicate jjtn000 = new ASTPredicate(JJTPREDICATE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);int operationType;
Name identifier;
String value;
String escapeString;
try {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BY:
case IN:
case OR:
case IS:
case AND:
case LIKE:
case NULL:
case FROM:
case LOWER:
case ORDER:
case UPPER:
case WHERE:
case SELECT:
case BETWEEN:
case REGULAR_IDENTIFIER:
case DELIMITED_IDENTIFIER:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BY:
case IN:
case OR:
case IS:
case AND:
case LIKE:
case NULL:
case FROM:
case ORDER:
case WHERE:
case SELECT:
case BETWEEN:
case REGULAR_IDENTIFIER:
case DELIMITED_IDENTIFIER:
identifier = Identifier();
jjtn000.setIdentifier(identifier);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PERIOD:
jj_consume_token(PERIOD);
identifier = Identifier();
Node n = jjtree.popNode(); jjtree.popNode(); jjtree.pushNode(n); jjtn000.setIdentifier(identifier);
break;
default:
jj_la1[7] = jj_gen;
;
}
break;
case LOWER:
case UPPER:
identifier = PropertyFunction();
jjtn000.setIdentifier(identifier);
break;
default:
jj_la1[8] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LT_OPERATOR:
case EQ_OPERATOR:
case GT_OPERATOR:
case NE_OPERATOR:
case GE_OPERATOR:
case LE_OPERATOR:
operationType = ComparisonOperation();
jjtn000.setOperationType(operationType);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case EXACT_NUMERIC_LITERAL:
case APPROXIMATE_NUMERIC_LITERAL:
case DATETIME_LITERAL:
case CHAR_STRING_LITERAL:
Literal();
break;
case BY:
case IN:
case OR:
case IS:
case AND:
case LIKE:
case NULL:
case FROM:
case ORDER:
case WHERE:
case SELECT:
case BETWEEN:
case REGULAR_IDENTIFIER:
case DELIMITED_IDENTIFIER:
identifier = Identifier();
jjtn000.setIdentifier(identifier);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PERIOD:
jj_consume_token(PERIOD);
identifier = Identifier();
Node n = jjtree.popNode(); jjtree.popNode(); jjtree.pushNode(n); jjtn000.setIdentifier(identifier);
break;
default:
jj_la1[9] = jj_gen;
;
}
break;
default:
jj_la1[10] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
case NOT:
case LIKE:
case BETWEEN:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NOT:
jj_consume_token(NOT);
jjtn000.setNegate(true);
break;
default:
jj_la1[11] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BETWEEN:
jj_consume_token(BETWEEN);
jjtn000.setOperationType(QueryConstants.OPERATION_BETWEEN);
Literal();
jj_consume_token(AND);
Literal();
break;
case LIKE:
jj_consume_token(LIKE);
jjtn000.setOperationType(QueryConstants.OPERATION_LIKE);
value = CharStringLiteral();
ASTLiteral s = new ASTLiteral(JJTLITERAL);
s.setType(QueryConstants.TYPE_STRING);
s.setValue(value);
jjtree.pushNode(s);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ESCAPE:
jj_consume_token(ESCAPE);
escapeString = CharStringLiteral();
jjtn000.setEscapeString(escapeString);
break;
default:
jj_la1[12] = jj_gen;
;
}
break;
default:
jj_la1[13] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
case IS:
jj_consume_token(IS);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NOT:
jj_consume_token(NOT);
jjtn000.setNegate(true);
break;
default:
jj_la1[14] = jj_gen;
;
}
jj_consume_token(NULL);
jjtree.closeNodeScope(jjtn000, true);
jjtc000 = false;
jjtn000.setOperationType(jjtn000.isNegate() ? QueryConstants.OPERATION_NOT_NULL : QueryConstants.OPERATION_NULL);
break;
default:
jj_la1[15] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
break;
case EXACT_NUMERIC_LITERAL:
case APPROXIMATE_NUMERIC_LITERAL:
case DATETIME_LITERAL:
case CHAR_STRING_LITERAL:
Literal();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NOT:
jj_consume_token(NOT);
jjtn000.setNegate(true);
break;
default:
jj_la1[16] = jj_gen;
;
}
jj_consume_token(IN);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BY:
case IN:
case OR:
case IS:
case AND:
case LIKE:
case NULL:
case FROM:
case ORDER:
case WHERE:
case SELECT:
case BETWEEN:
case REGULAR_IDENTIFIER:
case DELIMITED_IDENTIFIER:
identifier = Identifier();
break;
case LOWER:
case UPPER:
identifier = PropertyFunction();
break;
default:
jj_la1[17] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
jjtree.closeNodeScope(jjtn000, true);
jjtc000 = false;
jjtn000.setIdentifier(identifier);
jjtn000.setOperationType(jjtn000.isNegate() ? QueryConstants.OPERATION_NE_GENERAL : QueryConstants.OPERATION_EQ_GENERAL);
break;
case SIMILAR:
jj_consume_token(SIMILAR);
jj_consume_token(LEFT_PAREN);
jjtn000.setOperationType(QueryConstants.OPERATION_SIMILAR);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PERIOD:
jj_consume_token(PERIOD);
break;
case BY:
case IN:
case OR:
case IS:
case AND:
case LIKE:
case NULL:
case FROM:
case ORDER:
case WHERE:
case SELECT:
case BETWEEN:
case REGULAR_IDENTIFIER:
case DELIMITED_IDENTIFIER:
identifier = Identifier();
jjtn000.setIdentifier(identifier);
break;
default:
jj_la1[18] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
jj_consume_token(COMMA);
value = CharStringLiteral();
ASTLiteral s = new ASTLiteral(JJTLITERAL);
s.setType(QueryConstants.TYPE_STRING);
s.setValue(value);
jjtree.pushNode(s);
jj_consume_token(RIGHT_PAREN);
break;
case SPELLCHECK:
jj_consume_token(SPELLCHECK);
jj_consume_token(LEFT_PAREN);
jjtn000.setOperationType(QueryConstants.OPERATION_SPELLCHECK);
value = CharStringLiteral();
ASTLiteral stmt = new ASTLiteral(JJTLITERAL);
stmt.setType(QueryConstants.TYPE_STRING);
stmt.setValue(value);
jjtree.pushNode(stmt);
jj_consume_token(RIGHT_PAREN);
break;
default:
jj_la1[19] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
} catch (Throwable jjte000) {
if (jjtc000) {
jjtree.clearNodeScope(jjtn000);
jjtc000 = false;
} else {
jjtree.popNode();
}
if (jjte000 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte000;}
}
if (jjte000 instanceof ParseException) {
{if (true) throw (ParseException)jjte000;}
}
{if (true) throw (Error)jjte000;}
} finally {
if (jjtc000) {
jjtree.closeNodeScope(jjtn000, true);
}
}
}