Source source ) {
Constraint constraint = null;
if (tokens.canConsume("JCR", ":", "PATH")) {
// It is a property constraint on "jcr:path" ...
SelectorName selector = getSelectorNameFor(source);
PropertyValue value = new PropertyValue(selector, "jcr:path");
Operator operator = parseComparisonOperator(tokens);
StaticOperand right = parseStaticOperand(tokens, typeSystem);
constraint = rewriteConstraint(new Comparison(value, operator, right));
} else if (tokens.matches(ANY_VALUE, "IN")) {
// This is a "... 'value' IN prop ..." pattern used in the JCR TCK tests but not in the JCR 1.0.1 specification
// ...
Literal value = parseLiteral(tokens, typeSystem);
tokens.consume("IN");
PropertyValue propertyValue = parsePropertyValue(tokens, typeSystem, source);
constraint = new SetCriteria(propertyValue, value);
} else if (source instanceof JoinableSources
&& !(tokens.matches("(") || tokens.matches("NOT") || tokens.matches("CONTAINS", "(")
|| tokens.matches("ISSAMENODE", "(") || tokens.matches("ISCHILDNODE", "(") || tokens.matches("ISDESCENDANTNODE",
"("))) {