[37] WhereClause ::= "where" ExprSingle
[38] OrderByClause ::= (<"order" "by"> | <"stable" "order" "by">) OrderSpecList
[39] OrderSpecList ::= OrderSpec ("," OrderSpec)*
************************************************************************/
final public XQExpression parseFLWRExpr() throws ParseException, XQueryException {
final FLWRExpr flower = new FLWRExpr();
List<Binding> bindings = null;
XQExpression whereExpr = null;
OrderSpec order = null;
XQExpression returnExpr = null;
currentModule.pushVarScope();
locate(flower);
label_7: while(true) {
switch(jj_nt.kind) {
case ForVariable:
bindings = parseForClause();
break;
case LetVariable:
bindings = parseLetClause();
break;
default:
jj_la1[59] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
flower.addClauses(bindings);
switch(jj_nt.kind) {
case ForVariable:
case LetVariable:
;
break;
default:
jj_la1[60] = jj_gen;
break label_7;
}
}
switch(jj_nt.kind) {
case Where:
currentToken = jj_consume_token(Where);
whereExpr = parseExprSingle();
flower.setWhereExpr(whereExpr);
break;
default:
jj_la1[61] = jj_gen;
;
}
switch(jj_nt.kind) {
case GroupBy:
Grouping grouping = null;
grouping = parseGroupByClause();
flower.setGroupByClause(grouping);
label_8: while(true) {
switch(jj_nt.kind) {
case LetVariable:
;
break;
default:
jj_la1[62] = jj_gen;
break label_8;
}
bindings = parseLetClause();
grouping.addLetClauses(bindings);
}
switch(jj_nt.kind) {
case Where:
currentToken = jj_consume_token(Where);
whereExpr = parseExprSingle();
grouping.setWhereExpression(whereExpr);
break;
default:
jj_la1[63] = jj_gen;
;
}
break;
default:
jj_la1[64] = jj_gen;
;
}
switch(jj_nt.kind) {
case OrderBy:
case OrderByStable:
switch(jj_nt.kind) {
case OrderBy:
currentToken = jj_consume_token(OrderBy);
break;
case OrderByStable:
currentToken = jj_consume_token(OrderByStable);
flower.setStableOrdering(true);
break;
default:
jj_la1[65] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
order = parseOrderSpec();
flower.addOrderSpec(order);
label_9: while(true) {
switch(jj_nt.kind) {
case Comma:
;
break;
default:
jj_la1[66] = jj_gen;
break label_9;
}
currentToken = jj_consume_token(Comma);
order = parseOrderSpec();
flower.addOrderSpec(order);
}
break;
default:
jj_la1[67] = jj_gen;
;
}
currentToken = jj_consume_token(Return);
returnExpr = parseExprSingle();
flower.setReturnExpr(returnExpr);
currentModule.popVarScope();
{
if(true)
return flower.normalize();
}
throw new Error("Missing return statement in function");
}