AST __t35 = _t; org.exist.xquery.parser.XQueryAST tmp56_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
AST __t36 = _t; org.exist.xquery.parser.XQueryAST tmp57_AST_in = (org.exist.xquery.parser.XQueryAST)_t;
	public final void functionDecl(AST _t,		PathExpr path	) throws RecognitionException, PermissionDeniedException,EXistException,XPathException {				org.exist.xquery.parser.XQueryAST functionDecl_AST_in = (_t == ASTNULL) ? null : (org.exist.xquery.parser.XQueryAST)_t;		org.exist.xquery.parser.XQueryAST name = null;		Expression step = null;				AST __t30 = _t;		name = _t==ASTNULL ? null :(org.exist.xquery.parser.XQueryAST)_t;		match(_t,FUNCTION_DECL);		_t = _t.getFirstChild();		PathExpr body= new PathExpr(context);							QName qn= null;					try {						qn = QName.parse(context, name.getText());					} catch(XPathException e) {						// throw exception with correct source location						e.setASTNode(name);						throw e;					}					FunctionSignature signature= new FunctionSignature(qn);					UserDefinedFunction func= new UserDefinedFunction(context, signature);					func.setASTNode(name);					List varList= new ArrayList(3);						{		if (_t==null) _t=ASTNULL;		switch ( _t.getType()) {		case VARIABLE_BINDING:		{			paramList(_t,varList);			_t = _retTree;			break;		}		case LCURLY:		case LITERAL_external:		case LITERAL_as:		{			break;		}		default:		{			throw new NoViableAltException(_t);		}		}		}							SequenceType[] types= new SequenceType[varList.size()];					int j= 0;					for (Iterator i= varList.iterator(); i.hasNext(); j++) {						FunctionParameter param= (FunctionParameter) i.next();						types[j]= param.type;						func.addVariable(param.varName);					}					signature.setArgumentTypes(types);						{		if (_t==null) _t=ASTNULL;		switch ( _t.getType()) {		case LITERAL_as:		{			AST __t33 = _t;			org.exist.xquery.parser.XQueryAST tmp55_AST_in = (org.exist.xquery.parser.XQueryAST)_t;			match(_t,LITERAL_as);			_t = _t.getFirstChild();			SequenceType type= new SequenceType();			sequenceType(_t,type);			_t = _retTree;			signature.setReturnType(type);			_t = __t33;			_t = _t.getNextSibling();			break;		}		case LCURLY:		case LITERAL_external:		{			break;		}		default:		{			throw new NoViableAltException(_t);		}		}		}		{		if (_t==null) _t=ASTNULL;		switch ( _t.getType()) {		case LCURLY:		{			AST __t35 = _t;			org.exist.xquery.parser.XQueryAST tmp56_AST_in = (org.exist.xquery.parser.XQueryAST)_t;			match(_t,LCURLY);			_t = _t.getFirstChild();			step=expr(_t,body);			_t = _retTree;											func.setFunctionBody(body);								context.declareFunction(func);								if(myModule != null)									myModule.declareFunction(func);										_t = __t35;			_t = _t.getNextSibling();			break;		}		case LITERAL_external:		{			org.exist.xquery.parser.XQueryAST tmp57_AST_in = (org.exist.xquery.parser.XQueryAST)_t;			match(_t,LITERAL_external);			_t = _t.getNextSibling();			break;		}		default:		{			throw new NoViableAltException(_t);		}		}		}		_t = __t30;		_t = _t.getNextSibling();		_retTree = _t;	}