case RPAREN: { break;
catch (RecognitionException e) { if (inputState.guessing==0) {  throw new XPathException(lp_AST, "Syntax error in declaration of function " + name + ": " + e.getMessage());  } else { throw e; }
	public final void functionDecl() throws RecognitionException, TokenStreamException, XPathException {				returnAST = null;		ASTPair currentAST = new ASTPair();		org.exist.xquery.parser.XQueryAST functionDecl_AST = null;		Token  lp = null;		org.exist.xquery.parser.XQueryAST lp_AST = null;		String name= null;				match(LITERAL_declare);		match(LITERAL_function);		name=qName();		lp = LT(1);		lp_AST = (org.exist.xquery.parser.XQueryAST)astFactory.create(lp);		match(LPAREN);		{		switch ( LA(1)) {		case DOLLAR:		{			paramList();			astFactory.addASTChild(currentAST, returnAST);			break;		}		case RPAREN:		{			break;		}		default:		{			throw new NoViableAltException(LT(1), getFilename());		}		}		}		match(RPAREN);		{		switch ( LA(1)) {		case LITERAL_as:		{			returnType();			astFactory.addASTChild(currentAST, returnAST);			break;		}		case LCURLY:		{			break;		}		default:		{			throw new NoViableAltException(LT(1), getFilename());		}		}		}		functionBody();		astFactory.addASTChild(currentAST, returnAST);		if ( inputState.guessing==0 ) {			functionDecl_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root;								functionDecl_AST= (org.exist.xquery.parser.XQueryAST)astFactory.make( (new ASTArray(2)).add((org.exist.xquery.parser.XQueryAST)astFactory.create(FUNCTION_DECL,name)).add(functionDecl_AST)); 					functionDecl_AST.copyLexInfo(lp_AST);							currentAST.root = functionDecl_AST;			currentAST.child = functionDecl_AST!=null &&functionDecl_AST.getFirstChild()!=null ?				functionDecl_AST.getFirstChild() : functionDecl_AST;			currentAST.advanceChildToEnd();		}		functionDecl_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root;		returnAST = functionDecl_AST;	}