if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case CATCH_ERROR_CODE:
{
QName qncode = null;
QName qndesc = null;
QName qnval = null;
code = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,CATCH_ERROR_CODE);
_t = _t.getNextSibling();
qncode = QName.parse(staticContext, code.getText());
catchVars.add(qncode);
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case CATCH_ERROR_DESC:
{
desc = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,CATCH_ERROR_DESC);
_t = _t.getNextSibling();
qndesc = QName.parse(staticContext, desc.getText());
catchVars.add(qndesc);
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case CATCH_ERROR_VAL:
{
val = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,CATCH_ERROR_VAL);
_t = _t.getNextSibling();
qnval = QName.parse(staticContext, val.getText());
catchVars.add(qnval);
break;
}
case EOF:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
break;
}
case EOF:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
break;
}
case EOF:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
step=expr(_t,catchExpr);
_t = _retTree;
catchExpr.setASTNode(astCatch);
cond.addCatchClause(catchErrorList, catchVars, catchExpr);
_t = __t137;
_t = _t.getNextSibling();
}
else {
if ( _cnt142>=1 ) { break _loop142; } else {throw new NoViableAltException(_t);}
}
_cnt142++;
} while (true);
}
step = cond;
_t = __t135;
_t = _t.getNextSibling();
break;
}
case LITERAL_return:
{
AST __t143 = _t;
r = _t==ASTNULL ? null :(org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_return);
_t = _t.getFirstChild();
List<ForLetClause> clauses= new ArrayList<ForLetClause>();
Expression action= new PathExpr(context);
action.setASTNode(r);
PathExpr whereExpr= null;
List orderBy= null;
{
int _cnt158=0;
_loop158:
do {
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case LITERAL_for:
{
AST __t145 = _t;
f = _t==ASTNULL ? null :(org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_for);
_t = _t.getFirstChild();
{
int _cnt151=0;
_loop151:
do {
if (_t==null) _t=ASTNULL;
if ((_t.getType()==VARIABLE_BINDING)) {
AST __t147 = _t;
varName = _t==ASTNULL ? null :(org.exist.xquery.parser.XQueryAST)_t;
match(_t,VARIABLE_BINDING);
_t = _t.getFirstChild();
ForLetClause clause= new ForLetClause();
clause.ast = varName;
PathExpr inputSequence= new PathExpr(context);
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case LITERAL_as:
{
AST __t149 = _t;
org.exist.xquery.parser.XQueryAST tmp8_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_as);
_t = _t.getFirstChild();
clause.sequenceType= new SequenceType();
sequenceType(_t,clause.sequenceType);
_t = _retTree;
_t = __t149;
_t = _t.getNextSibling();
break;
}
case EOF:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case POSITIONAL_VAR:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case POSITIONAL_VAR:
{
posVar = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,POSITIONAL_VAR);
_t = _t.getNextSibling();
clause.posVar= posVar.getText();
break;
}
case EOF:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
step=expr(_t,inputSequence);
_t = _retTree;
clause.varName= varName.getText();
clause.inputSequence= inputSequence;
clauses.add(clause);
_t = __t147;
_t = _t.getNextSibling();
}
else {
if ( _cnt151>=1 ) { break _loop151; } else {throw new NoViableAltException(_t);}
}
_cnt151++;
} while (true);
}
_t = __t145;
_t = _t.getNextSibling();
break;
}
case LITERAL_let:
{
AST __t152 = _t;
l = _t==ASTNULL ? null :(org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_let);
_t = _t.getFirstChild();
{
int _cnt157=0;
_loop157:
do {
if (_t==null) _t=ASTNULL;
if ((_t.getType()==VARIABLE_BINDING)) {
AST __t154 = _t;
letVarName = _t==ASTNULL ? null :(org.exist.xquery.parser.XQueryAST)_t;
match(_t,VARIABLE_BINDING);
_t = _t.getFirstChild();
ForLetClause clause= new ForLetClause();
clause.ast = letVarName;
clause.isForClause= false;
PathExpr inputSequence= new PathExpr(context);
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case LITERAL_as:
{
AST __t156 = _t;
org.exist.xquery.parser.XQueryAST tmp9_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_as);
_t = _t.getFirstChild();
clause.sequenceType= new SequenceType();
sequenceType(_t,clause.sequenceType);
_t = _retTree;
_t = __t156;
_t = _t.getNextSibling();
break;
}
case EOF:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
step=expr(_t,inputSequence);
_t = _retTree;
clause.varName= letVarName.getText();
clause.inputSequence= inputSequence;
clauses.add(clause);
_t = __t154;
_t = _t.getNextSibling();
}
else {
if ( _cnt157>=1 ) { break _loop157; } else {throw new NoViableAltException(_t);}
}
_cnt157++;
} while (true);
}
_t = __t152;
_t = _t.getNextSibling();
break;
}
default:
{
if ( _cnt158>=1 ) { break _loop158; } else {throw new NoViableAltException(_t);}
}
}
_cnt158++;
} while (true);
}
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case LITERAL_where:
{
w = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_where);
_t = _t.getNextSibling();
whereExpr= new PathExpr(context);
whereExpr.setASTNode(w);
step=expr(_t,whereExpr);
_t = _retTree;
break;
}
case EOF:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ORDER_BY:
case GROUP_BY:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case GROUP_BY:
{
AST __t161 = _t;
org.exist.xquery.parser.XQueryAST tmp10_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,GROUP_BY);
_t = _t.getFirstChild();
// attach group by to last for expression, skipping lets
ForLetClause clause = null;
for (int i = clauses.size() - 1; i > -1; i--) {
ForLetClause currentClause = clauses.get(i);
if (currentClause.isForClause) {
clause = currentClause;
break;
}
}
if (clause == null)
clause = clauses.get(clauses.size() - 1);
clause.groupSpecs = new ArrayList<GroupSpec>(4);
{
int _cnt166=0;
_loop166:
do {
if (_t==null) _t=ASTNULL;
if ((_t.getType()==VARIABLE_BINDING)) {
AST __t163 = _t;
groupVarName = _t==ASTNULL ? null :(org.exist.xquery.parser.XQueryAST)_t;
match(_t,VARIABLE_BINDING);
_t = _t.getFirstChild();
PathExpr groupSpecExpr= null;
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case EOF:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
groupSpecExpr = new PathExpr(context);
step=expr(_t,groupSpecExpr);
_t = _retTree;
break;
}
case 3:
case LITERAL_collation:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
String groupKeyVar = groupVarName.getText();
// if there is no groupSpec expression, try to find definition of
// grouping variable and inline it
if (groupSpecExpr == null) {
ForLetClause groupVarDef = null;
for (int i = clauses.size() - 1; i > -1; i--) {
ForLetClause currentClause = clauses.get(i);
if (!currentClause.isForClause && currentClause.varName.equals(groupKeyVar)) {
groupVarDef = currentClause;
break;
}
}
if (groupVarDef == null) {
throw new XPathException("Definition for grouping var " + groupKeyVar + " not found");
}
// inline the grouping expression
clauses.remove(groupVarDef);
groupSpecExpr = (PathExpr) groupVarDef.inputSequence;
}
GroupSpec groupSpec= new GroupSpec(context, groupSpecExpr, groupKeyVar);
clause.groupSpecs.add(groupSpec);
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case LITERAL_collation:
{
org.exist.xquery.parser.XQueryAST tmp11_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_collation);
_t = _t.getNextSibling();
groupCollURI = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,STRING_LITERAL);
_t = _t.getNextSibling();
groupSpec.setCollation(groupCollURI.getText());
break;
}
case 3:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
_t = __t163;
_t = _t.getNextSibling();
}
else {
if ( _cnt166>=1 ) { break _loop166; } else {throw new NoViableAltException(_t);}
}
_cnt166++;
} while (true);
}
_t = __t161;
_t = _t.getNextSibling();
break;
}
case EOF:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ORDER_BY:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case ORDER_BY:
{
AST __t168 = _t;
org.exist.xquery.parser.XQueryAST tmp12_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,ORDER_BY);
_t = _t.getFirstChild();
orderBy= new ArrayList(3);
{
int _cnt175=0;
_loop175:
do {
if (_t==null) _t=ASTNULL;
if ((_tokenSet_0.member(_t.getType()))) {
PathExpr orderSpecExpr= new PathExpr(context);
step=expr(_t,orderSpecExpr);
_t = _retTree;
OrderSpec orderSpec= new OrderSpec(context, orderSpecExpr);
int modifiers= 0;
boolean orderDescending = false;
orderBy.add(orderSpec);
if (!context.orderEmptyGreatest()) {
modifiers |= OrderSpec.EMPTY_LEAST;
orderSpec.setModifiers(modifiers);
}
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case LITERAL_ascending:
case LITERAL_descending:
{
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case LITERAL_ascending:
{
org.exist.xquery.parser.XQueryAST tmp13_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_ascending);
_t = _t.getNextSibling();
break;
}
case LITERAL_descending:
{
org.exist.xquery.parser.XQueryAST tmp14_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_descending);
_t = _t.getNextSibling();
modifiers |= OrderSpec.DESCENDING_ORDER;
orderSpec.setModifiers(modifiers);
orderDescending = true;
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
break;
}
case EOF:
case 3:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_collation:
case LITERAL_element:
case LITERAL_empty:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case LITERAL_empty:
{
org.exist.xquery.parser.XQueryAST tmp15_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_empty);
_t = _t.getNextSibling();
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case LITERAL_greatest:
{
org.exist.xquery.parser.XQueryAST tmp16_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_greatest);
_t = _t.getNextSibling();
if (!context.orderEmptyGreatest())
modifiers &= OrderSpec.EMPTY_GREATEST;
if (orderDescending)
modifiers |= OrderSpec.DESCENDING_ORDER;
orderSpec.setModifiers(modifiers);
break;
}
case LITERAL_least:
{
org.exist.xquery.parser.XQueryAST tmp17_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_least);
_t = _t.getNextSibling();
modifiers |= OrderSpec.EMPTY_LEAST;
orderSpec.setModifiers(modifiers);
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
break;
}
case EOF:
case 3:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_collation:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case LITERAL_collation:
{
org.exist.xquery.parser.XQueryAST tmp18_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_collation);
_t = _t.getNextSibling();
collURI = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,STRING_LITERAL);
_t = _t.getNextSibling();
orderSpec.setCollation(collURI.getText());
break;
}
case EOF:
case 3:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
}
else {
if ( _cnt175>=1 ) { break _loop175; } else {throw new NoViableAltException(_t);}
}
_cnt175++;
} while (true);
}
_t = __t168;
_t = _t.getNextSibling();
break;
}
case EOF:
case QNAME:
case PARENTHESIZED:
case ABSOLUTE_SLASH:
case ABSOLUTE_DSLASH:
case WILDCARD:
case PREFIX_WILDCARD:
case FUNCTION:
case UNARY_MINUS:
case UNARY_PLUS:
case VARIABLE_REF:
case ELEMENT:
case TEXT:
case FUNCTION_DECL:
case MAP_LOOKUP:
case ATTRIBUTE_TEST:
case COMP_ELEM_CONSTRUCTOR:
case COMP_ATTR_CONSTRUCTOR:
case COMP_TEXT_CONSTRUCTOR:
case COMP_COMMENT_CONSTRUCTOR:
case COMP_PI_CONSTRUCTOR:
case COMP_NS_CONSTRUCTOR:
case COMP_DOC_CONSTRUCTOR:
case PRAGMA:
case GTEQ:
case SEQUENCE:
case NCNAME:
case EQ:
case STRING_LITERAL:
case LITERAL_element:
case COMMA:
case LCURLY:
case STAR:
case PLUS:
case LITERAL_map:
case LITERAL_try:
case LITERAL_some:
case LITERAL_every:
case LITERAL_if:
case LITERAL_switch:
case LITERAL_typeswitch:
case LITERAL_update:
case LITERAL_preceding:
case LITERAL_following:
case UNION:
case LITERAL_return:
case LITERAL_or:
case LITERAL_and:
case LITERAL_instance:
case LITERAL_treat:
case LITERAL_castable:
case LITERAL_cast:
case BEFORE:
case AFTER:
case LITERAL_eq:
case LITERAL_ne:
case LITERAL_lt:
case LITERAL_le:
case LITERAL_gt:
case LITERAL_ge:
case GT:
case NEQ:
case LT:
case LTEQ:
case LITERAL_is:
case LITERAL_isnot:
case ANDEQ:
case OREQ:
case CONCAT:
case LITERAL_to:
case MINUS:
case LITERAL_div:
case LITERAL_idiv:
case LITERAL_mod:
case LITERAL_intersect:
case LITERAL_except:
case SLASH:
case DSLASH:
case BANG:
case LITERAL_text:
case LITERAL_node:
case LITERAL_attribute:
case LITERAL_comment:
case 186:
case 187:
case HASH:
case SELF:
case XML_COMMENT:
case XML_PI:
case AT:
case PARENT:
case LITERAL_child:
case LITERAL_self:
case LITERAL_descendant:
case 200:
case 201:
case LITERAL_parent:
case LITERAL_ancestor:
case 204:
case 205:
case DOUBLE_LITERAL:
case DECIMAL_LITERAL:
case INTEGER_LITERAL:
case XML_CDATA:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
step=expr(_t,(PathExpr) action);
_t = _retTree;
//bv : save the "real" return expression (used in groupBy)
PathExpr groupReturnExpr = (PathExpr) action;
for (int i= clauses.size() - 1; i >= 0; i--) {
ForLetClause clause= (ForLetClause) clauses.get(i);
BindingExpression expr;
if (clause.isForClause)
expr= new ForExpr(context);
else
expr= new LetExpr(context);
expr.setASTNode(clause.ast);
expr.setVariable(clause.varName);
expr.setSequenceType(clause.sequenceType);
expr.setInputSequence(clause.inputSequence);
if (!(action instanceof BindingExpression))
expr.setReturnExpression(new DebuggableExpression(action));
else
expr.setReturnExpression(action);
if (clause.groupSpecs != null) {
GroupSpec specs[]= new GroupSpec[clause.groupSpecs.size()];
int k= 0;
for (GroupSpec groupSpec : clause.groupSpecs) {
specs[k++]= groupSpec;
}
expr.setGroupSpecs(specs);
expr.setGroupReturnExpr(action);
}
if (clause.isForClause)
((ForExpr) expr).setPositionalVariable(clause.posVar);
if (whereExpr != null) {
expr.setWhereExpression(new DebuggableExpression(whereExpr));
whereExpr= null;
}
action= expr;
}
if (orderBy != null) {
OrderSpec orderSpecs[]= new OrderSpec[orderBy.size()];
int k= 0;
for (Iterator j= orderBy.iterator(); j.hasNext(); k++) {
OrderSpec orderSpec= (OrderSpec) j.next();
orderSpecs[k]= orderSpec;
}
((BindingExpression)action).setOrderSpecs(orderSpecs);
}
path.add(action);
step = action;
_t = __t143;
_t = _t.getNextSibling();
break;
}
case LITERAL_instance:
{
AST __t176 = _t;
org.exist.xquery.parser.XQueryAST tmp19_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_instance);
_t = _t.getFirstChild();
PathExpr expr = new PathExpr(context);
SequenceType type= new SequenceType();
step=expr(_t,expr);
_t = _retTree;
sequenceType(_t,type);
_t = _retTree;
step = new InstanceOfExpression(context, expr, type);
path.add(step);
_t = __t176;
_t = _t.getNextSibling();
break;
}
case LITERAL_treat:
{
AST __t177 = _t;
org.exist.xquery.parser.XQueryAST tmp20_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_treat);
_t = _t.getFirstChild();
PathExpr expr = new PathExpr(context);
SequenceType type= new SequenceType();
step=expr(_t,expr);
_t = _retTree;
sequenceType(_t,type);
_t = _retTree;
step = new TreatAsExpression(context, expr, type);
path.add(step);
_t = __t177;
_t = _t.getNextSibling();
break;
}
case LITERAL_switch:
{
AST __t178 = _t;
switchAST = _t==ASTNULL ? null :(org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_switch);
_t = _t.getFirstChild();
PathExpr operand = new PathExpr(context);
step=expr(_t,operand);
_t = _retTree;
SwitchExpression switchExpr = new SwitchExpression(context, operand);
switchExpr.setASTNode(switchAST);
path.add(switchExpr);
{
int _cnt184=0;
_loop184:
do {
if (_t==null) _t=ASTNULL;
if ((_t.getType()==LITERAL_case)) {
List caseOperands = new ArrayList<Expression>(2);
PathExpr returnExpr = new PathExpr(context);
{
{
int _cnt182=0;
_loop182:
do {
if (_t==null) _t=ASTNULL;
if ((_t.getType()==LITERAL_case)) {
PathExpr caseOperand = new PathExpr(context);
org.exist.xquery.parser.XQueryAST tmp21_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_case);
_t = _t.getNextSibling();
expr(_t,caseOperand);
_t = _retTree;
caseOperands.add(caseOperand);
}
else {
if ( _cnt182>=1 ) { break _loop182; } else {throw new NoViableAltException(_t);}
}
_cnt182++;
} while (true);
}
AST __t183 = _t;
org.exist.xquery.parser.XQueryAST tmp22_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_return);
_t = _t.getFirstChild();
step=expr(_t,returnExpr);
_t = _retTree;
switchExpr.addCase(caseOperands, returnExpr);
_t = __t183;
_t = _t.getNextSibling();
}
}
else {
if ( _cnt184>=1 ) { break _loop184; } else {throw new NoViableAltException(_t);}
}
_cnt184++;
} while (true);
}
{
org.exist.xquery.parser.XQueryAST tmp23_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_default);
_t = _t.getNextSibling();
PathExpr returnExpr = new PathExpr(context);
step=expr(_t,returnExpr);
_t = _retTree;
switchExpr.setDefault(returnExpr);
}
step = switchExpr;
_t = __t178;
_t = _t.getNextSibling();
break;
}
case LITERAL_typeswitch:
{
AST __t186 = _t;
org.exist.xquery.parser.XQueryAST tmp24_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_typeswitch);
_t = _t.getFirstChild();
PathExpr operand = new PathExpr(context);
step=expr(_t,operand);
_t = _retTree;
TypeswitchExpression tswitch = new TypeswitchExpression(context, operand);
path.add(tswitch);
{
int _cnt191=0;
_loop191:
do {
if (_t==null) _t=ASTNULL;
if ((_t.getType()==LITERAL_case)) {
SequenceType type = new SequenceType();
PathExpr returnExpr = new PathExpr(context);
QName qn = null;
AST __t188 = _t;
org.exist.xquery.parser.XQueryAST tmp25_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_case);
_t = _t.getFirstChild();
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case VARIABLE_BINDING:
{
var = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,VARIABLE_BINDING);
_t = _t.getNextSibling();
qn = QName.parse(staticContext, var.getText());
break;
}
case FUNCTION_TEST:
case MAP_TEST:
case ATOMIC_TYPE:
case ATTRIBUTE_TEST:
case LITERAL_element:
case LITERAL_empty:
case 107:
case LITERAL_item:
case LITERAL_text:
case LITERAL_node:
case LITERAL_comment:
case 186:
case 187:
{
break;
}
default:
{
throw new NoViableAltException(_t);
}
}
}
sequenceType(_t,type);
_t = _retTree;
AST __t190 = _t;
org.exist.xquery.parser.XQueryAST tmp26_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_return);
_t = _t.getFirstChild();
step=expr(_t,returnExpr);
_t = _retTree;
tswitch.addCase(type, qn, returnExpr);
_t = __t190;
_t = _t.getNextSibling();
_t = __t188;
_t = _t.getNextSibling();
}
else {
if ( _cnt191>=1 ) { break _loop191; } else {throw new NoViableAltException(_t);}
}
_cnt191++;
} while (true);
}
{
org.exist.xquery.parser.XQueryAST tmp27_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
match(_t,LITERAL_default);
_t = _t.getNextSibling();
PathExpr returnExpr = new PathExpr(context);
QName qn = null;
{
if (_t==null) _t=ASTNULL;
switch ( _t.getType()) {
case VARIABLE_BINDING: