}
protected OrderBySpec parseOrderBySpec( TokenStream tokens ) {
if (tokens.canConsume('@')) {
NameTest attributeName = parseQName(tokens);
Order order = Order.ASCENDING;
if (tokens.canConsume("ascending")) order = Order.ASCENDING;
else if (tokens.canConsume("descending")) order = Order.DESCENDING;
return new OrderBySpec(order, attributeName);
}
if (tokens.matches("jcr", ":", "score", "(")) {
FunctionCall scoreFunction = parseFunctionCall(tokens);
Order order = Order.ASCENDING;
if (tokens.canConsume("ascending")) order = Order.ASCENDING;
else if (tokens.canConsume("descending")) order = Order.DESCENDING;
return new OrderBySpec(order, scoreFunction);
}
throw new ParsingException(tokens.nextPosition(),