case PARENT:
case SELF:
	public final Expression  pathExpr(AST _t,		PathExpr path	) throws RecognitionException, PermissionDeniedException,EXistException,XPathException {		Expression step;				org.exist.xquery.parser.XQueryAST pathExpr_AST_in = (_t == ASTNULL) ? null : (org.exist.xquery.parser.XQueryAST)_t;		org.exist.xquery.parser.XQueryAST qn = null;		org.exist.xquery.parser.XQueryAST nc1 = null;		org.exist.xquery.parser.XQueryAST nc = null;		org.exist.xquery.parser.XQueryAST n = null;		org.exist.xquery.parser.XQueryAST qn2 = null;		org.exist.xquery.parser.XQueryAST qn3 = null;		org.exist.xquery.parser.XQueryAST attr = null;		org.exist.xquery.parser.XQueryAST nc2 = null;		org.exist.xquery.parser.XQueryAST nc3 = null;					Expression rightStep= null;			step= null;			int axis= Constants.CHILD_AXIS;						if (_t==null) _t=ASTNULL;		switch ( _t.getType()) {		case QNAME:		case WILDCARD:		case PREFIX_WILDCARD:		case ATTRIBUTE_TEST:		case NCNAME:		case LITERAL_element:		case LITERAL_text:		case LITERAL_node:		case LITERAL_attribute:		case LITERAL_comment:		case 140:		case LITERAL_child:		case LITERAL_self:		case LITERAL_descendant:		case 152:		case 153:		case LITERAL_following:		case LITERAL_parent:		case LITERAL_ancestor:		case 157:		case 158:		case LITERAL_preceding:		{			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case LITERAL_attribute:			case LITERAL_child:			case LITERAL_self:			case LITERAL_descendant:			case 152:			case 153:			case LITERAL_following:			case LITERAL_parent:			case LITERAL_ancestor:			case 157:			case 158:			case LITERAL_preceding:			{				axis=forwardAxis(_t);				_t = _retTree;				break;			}			case QNAME:			case WILDCARD:			case PREFIX_WILDCARD:			case ATTRIBUTE_TEST:			case NCNAME:			case LITERAL_element:			case LITERAL_text:			case LITERAL_node:			case LITERAL_comment:			case 140:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			NodeTest test;			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case QNAME:			{				qn = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,QNAME);				_t = _t.getNextSibling();											QName qname= QName.parse(context, qn.getText());							test= new NameTest(Type.ELEMENT, qname);							if (axis == Constants.ATTRIBUTE_AXIS)								test.setType(Type.ATTRIBUTE);										break;			}			case PREFIX_WILDCARD:			{				AST __t116 = _t;				org.exist.xquery.parser.XQueryAST tmp62_AST_in = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,PREFIX_WILDCARD);				_t = _t.getFirstChild();				nc1 = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,NCNAME);				_t = _t.getNextSibling();				_t = __t116;				_t = _t.getNextSibling();											QName qname= new QName(nc1.getText(), null, null);							qname.setNamespaceURI(null);							test= new NameTest(Type.ELEMENT, qname);							if (axis == Constants.ATTRIBUTE_AXIS)								test.setType(Type.ATTRIBUTE);										break;			}			case NCNAME:			{				AST __t117 = _t;				nc = _t==ASTNULL ? null :(org.exist.xquery.parser.XQueryAST)_t;				match(_t,NCNAME);				_t = _t.getFirstChild();				org.exist.xquery.parser.XQueryAST tmp63_AST_in = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,WILDCARD);				_t = _t.getNextSibling();				_t = __t117;				_t = _t.getNextSibling();											String namespaceURI= context.getURIForPrefix(nc.getText());							QName qname= new QName(null, namespaceURI, nc.getText());							test= new NameTest(Type.ELEMENT, qname);							if (axis == Constants.ATTRIBUTE_AXIS)								test.setType(Type.ATTRIBUTE);										break;			}			case WILDCARD:			{				org.exist.xquery.parser.XQueryAST tmp64_AST_in = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,WILDCARD);				_t = _t.getNextSibling();											if (axis == Constants.ATTRIBUTE_AXIS)								test= new TypeTest(Type.ATTRIBUTE);							else								test= new TypeTest(Type.ELEMENT);										break;			}			case LITERAL_node:			{				n = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,LITERAL_node);				_t = _t.getNextSibling();											if (axis == Constants.ATTRIBUTE_AXIS)								throw new XPathException(n, "Cannot test for node() on the attribute axis");							test= new AnyNodeTest(); 										break;			}			case LITERAL_text:			{				org.exist.xquery.parser.XQueryAST tmp65_AST_in = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,LITERAL_text);				_t = _t.getNextSibling();											if (axis == Constants.ATTRIBUTE_AXIS)								throw new XPathException(n, "Cannot test for text() on the attribute axis"); 							test= new TypeTest(Type.TEXT); 										break;			}			case LITERAL_element:			{				AST __t118 = _t;				org.exist.xquery.parser.XQueryAST tmp66_AST_in = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,LITERAL_element);				_t = _t.getFirstChild();												if (axis == Constants.ATTRIBUTE_AXIS)									throw new XPathException(n, "Cannot test for element() on the attribute axis"); 								test= new TypeTest(Type.ELEMENT); 											{				if (_t==null) _t=ASTNULL;				switch ( _t.getType()) {				case QNAME:				{					qn2 = (org.exist.xquery.parser.XQueryAST)_t;					match(_t,QNAME);					_t = _t.getNextSibling();															QName qname= QName.parse(context, qn2.getText());										test= new NameTest(Type.ELEMENT, qname);														break;				}				case WILDCARD:				{					org.exist.xquery.parser.XQueryAST tmp67_AST_in = (org.exist.xquery.parser.XQueryAST)_t;					match(_t,WILDCARD);					_t = _t.getNextSibling();					break;				}				case 3:				{					break;				}				default:				{					throw new NoViableAltException(_t);				}				}				}				_t = __t118;				_t = _t.getNextSibling();				break;			}			case ATTRIBUTE_TEST:			{				AST __t120 = _t;				org.exist.xquery.parser.XQueryAST tmp68_AST_in = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,ATTRIBUTE_TEST);				_t = _t.getFirstChild();				test= new TypeTest(Type.ATTRIBUTE);				{				if (_t==null) _t=ASTNULL;				switch ( _t.getType()) {				case QNAME:				{					qn3 = (org.exist.xquery.parser.XQueryAST)_t;					match(_t,QNAME);					_t = _t.getNextSibling();															QName qname= QName.parse(context, qn3.getText());										test= new NameTest(Type.ATTRIBUTE, qname);										axis= Constants.ATTRIBUTE_AXIS;														break;				}				case WILDCARD:				{					org.exist.xquery.parser.XQueryAST tmp69_AST_in = (org.exist.xquery.parser.XQueryAST)_t;					match(_t,WILDCARD);					_t = _t.getNextSibling();					break;				}				case 3:				{					break;				}				default:				{					throw new NoViableAltException(_t);				}				}				}				_t = __t120;				_t = _t.getNextSibling();				break;			}			case LITERAL_comment:			{				org.exist.xquery.parser.XQueryAST tmp70_AST_in = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,LITERAL_comment);				_t = _t.getNextSibling();											if (axis == Constants.ATTRIBUTE_AXIS)								throw new XPathException(n, "Cannot test for comment() on the attribute axis");							test= new TypeTest(Type.COMMENT); 										break;			}			case 140:			{				org.exist.xquery.parser.XQueryAST tmp71_AST_in = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,140);				_t = _t.getNextSibling();				test= new TypeTest(Type.DOCUMENT);				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}								step= new LocationStep(context, axis, test);					path.add(step);							{			_loop123:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==PREDICATE)) {					predicate(_t,(LocationStep) step);					_t = _retTree;				}				else {					break _loop123;				}							} while (true);			}			break;		}		case AT:		{			org.exist.xquery.parser.XQueryAST tmp72_AST_in = (org.exist.xquery.parser.XQueryAST)_t;			match(_t,AT);			_t = _t.getNextSibling();			QName qname= null;			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			case QNAME:			{				attr = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,QNAME);				_t = _t.getNextSibling();				qname= QName.parse(context, attr.getText(), null);				break;			}			case WILDCARD:			{				org.exist.xquery.parser.XQueryAST tmp73_AST_in = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,WILDCARD);				_t = _t.getNextSibling();				break;			}			case PREFIX_WILDCARD:			{				AST __t125 = _t;				org.exist.xquery.parser.XQueryAST tmp74_AST_in = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,PREFIX_WILDCARD);				_t = _t.getFirstChild();				nc2 = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,NCNAME);				_t = _t.getNextSibling();				_t = __t125;				_t = _t.getNextSibling();				qname= new QName(nc2.getText(), null, null);				break;			}			case NCNAME:			{				AST __t126 = _t;				nc3 = _t==ASTNULL ? null :(org.exist.xquery.parser.XQueryAST)_t;				match(_t,NCNAME);				_t = _t.getFirstChild();				org.exist.xquery.parser.XQueryAST tmp75_AST_in = (org.exist.xquery.parser.XQueryAST)_t;				match(_t,WILDCARD);				_t = _t.getNextSibling();				_t = __t126;				_t = _t.getNextSibling();											String namespaceURI= context.getURIForPrefix(nc3.getText());							if (namespaceURI == null)								throw new EXistException("No namespace defined for prefix " + nc3.getText());							qname= new QName(null, namespaceURI, null);										break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}								NodeTest test= qname == null ? new TypeTest(Type.ATTRIBUTE) : new NameTest(Type.ATTRIBUTE, qname);					step= new LocationStep(context, Constants.ATTRIBUTE_AXIS, test);					path.add(step);							{			_loop128:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==PREDICATE)) {					predicate(_t,(LocationStep) step);					_t = _retTree;				}				else {					break _loop128;				}							} while (true);			}			break;		}		case SELF:		{			org.exist.xquery.parser.XQueryAST tmp76_AST_in = (org.exist.xquery.parser.XQueryAST)_t;			match(_t,SELF);			_t = _t.getNextSibling();								step= new LocationStep(context, Constants.SELF_AXIS, new TypeTest(Type.NODE));					path.add(step);							{			_loop130:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==PREDICATE)) {					predicate(_t,(LocationStep) step);					_t = _retTree;				}				else {					break _loop130;				}							} while (true);			}			break;		}		case PARENT:		{			org.exist.xquery.parser.XQueryAST tmp77_AST_in = (org.exist.xquery.parser.XQueryAST)_t;			match(_t,PARENT);			_t = _t.getNextSibling();								step= new LocationStep(context, Constants.PARENT_AXIS, new TypeTest(Type.NODE));					path.add(step);							{			_loop132:			do {				if (_t==null) _t=ASTNULL;				if ((_t.getType()==PREDICATE)) {					predicate(_t,(LocationStep) step);					_t = _retTree;				}				else {					break _loop132;				}							} while (true);			}			break;		}		case SLASH:		{			AST __t133 = _t;			org.exist.xquery.parser.XQueryAST tmp78_AST_in = (org.exist.xquery.parser.XQueryAST)_t;			match(_t,SLASH);			_t = _t.getFirstChild();			step=expr(_t,path);			_t = _retTree;			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			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 BEFORE:			case AFTER:			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_DOC_CONSTRUCTOR:			case NCNAME:			case EQ:			case STRING_LITERAL:			case LITERAL_element:			case LCURLY:			case COMMA:			case STAR:			case PLUS:			case LITERAL_some:			case LITERAL_every:			case LITERAL_if:			case LITERAL_return:			case LITERAL_or:			case LITERAL_and:			case LITERAL_instance:			case LITERAL_castable:			case LITERAL_cast:			case LT:			case GT:			case LITERAL_eq:			case LITERAL_ne:			case LITERAL_lt:			case LITERAL_le:			case LITERAL_gt:			case LITERAL_ge:			case NEQ:			case GTEQ:			case LTEQ:			case LITERAL_is:			case LITERAL_isnot:			case ANDEQ:			case OREQ:			case LITERAL_to:			case MINUS:			case LITERAL_div:			case LITERAL_idiv:			case LITERAL_mod:			case UNION:			case LITERAL_intersect:			case LITERAL_except:			case SLASH:			case DSLASH:			case LITERAL_text:			case LITERAL_node:			case LITERAL_attribute:			case LITERAL_comment:			case 140:			case SELF:			case XML_COMMENT:			case XML_PI:			case AT:			case PARENT:			case LITERAL_child:			case LITERAL_self:			case LITERAL_descendant:			case 152:			case 153:			case LITERAL_following:			case LITERAL_parent:			case LITERAL_ancestor:			case 157:			case 158:			case DOUBLE_LITERAL:			case DECIMAL_LITERAL:			case INTEGER_LITERAL:			case XML_CDATA:			case LITERAL_preceding:			{				rightStep=expr(_t,path);				_t = _retTree;												if (rightStep instanceof LocationStep) {									if(((LocationStep) rightStep).getAxis() == -1)										((LocationStep) rightStep).setAxis(Constants.CHILD_AXIS);								} else {									rightStep.setPrimaryAxis(Constants.CHILD_AXIS);									if(rightStep instanceof VariableReference) {										rightStep = new SimpleStep(context, Constants.CHILD_AXIS, rightStep);										path.replaceLastExpression(rightStep);									}								}											break;			}			case 3:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			_t = __t133;			_t = _t.getNextSibling();								if (step instanceof LocationStep && ((LocationStep) step).getAxis() == -1)						 ((LocationStep) step).setAxis(Constants.CHILD_AXIS);							break;		}		case DSLASH:		{			AST __t135 = _t;			org.exist.xquery.parser.XQueryAST tmp79_AST_in = (org.exist.xquery.parser.XQueryAST)_t;			match(_t,DSLASH);			_t = _t.getFirstChild();			step=expr(_t,path);			_t = _retTree;			{			if (_t==null) _t=ASTNULL;			switch ( _t.getType()) {			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 BEFORE:			case AFTER:			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_DOC_CONSTRUCTOR:			case NCNAME:			case EQ:			case STRING_LITERAL:			case LITERAL_element:			case LCURLY:			case COMMA:			case STAR:			case PLUS:			case LITERAL_some:			case LITERAL_every:			case LITERAL_if:			case LITERAL_return:			case LITERAL_or:			case LITERAL_and:			case LITERAL_instance:			case LITERAL_castable:			case LITERAL_cast:			case LT:			case GT:			case LITERAL_eq:			case LITERAL_ne:			case LITERAL_lt:			case LITERAL_le:			case LITERAL_gt:			case LITERAL_ge:			case NEQ:			case GTEQ:			case LTEQ:			case LITERAL_is:			case LITERAL_isnot:			case ANDEQ:			case OREQ:			case LITERAL_to:			case MINUS:			case LITERAL_div:			case LITERAL_idiv:			case LITERAL_mod:			case UNION:			case LITERAL_intersect:			case LITERAL_except:			case SLASH:			case DSLASH:			case LITERAL_text:			case LITERAL_node:			case LITERAL_attribute:			case LITERAL_comment:			case 140:			case SELF:			case XML_COMMENT:			case XML_PI:			case AT:			case PARENT:			case LITERAL_child:			case LITERAL_self:			case LITERAL_descendant:			case 152:			case 153:			case LITERAL_following:			case LITERAL_parent:			case LITERAL_ancestor:			case 157:			case 158:			case DOUBLE_LITERAL:			case DECIMAL_LITERAL:			case INTEGER_LITERAL:			case XML_CDATA:			case LITERAL_preceding:			{				rightStep=expr(_t,path);				_t = _retTree;												if (rightStep instanceof LocationStep) {									LocationStep rs= (LocationStep) rightStep;									if (rs.getAxis() == Constants.ATTRIBUTE_AXIS)										rs.setAxis(Constants.DESCENDANT_ATTRIBUTE_AXIS);									else										rs.setAxis(Constants.DESCENDANT_SELF_AXIS);								} else {									rightStep.setPrimaryAxis(Constants.DESCENDANT_SELF_AXIS);									if(rightStep instanceof VariableReference) {										rightStep = new SimpleStep(context, Constants.DESCENDANT_SELF_AXIS, rightStep);										path.replaceLastExpression(rightStep);									}								}											break;			}			case 3:			{				break;			}			default:			{				throw new NoViableAltException(_t);			}			}			}			_t = __t135;			_t = _t.getNextSibling();								if (step instanceof LocationStep && ((LocationStep) step).getAxis() == -1)						 ((LocationStep) step).setAxis(Constants.DESCENDANT_SELF_AXIS);							break;		}		default:		{			throw new NoViableAltException(_t);		}		}		_retTree = _t;		return step;	}