match(LCURLY); expr(); ex_AST = (org.exist.xquery.parser.XQueryAST)returnAST; astFactory.addASTChild(currentAST, returnAST); match(RCURLY);
{ switch ( LA(1)) { case LCURLY: { match(LCURLY); expr(); ex_AST = (org.exist.xquery.parser.XQueryAST)returnAST; astFactory.addASTChild(currentAST, returnAST); match(RCURLY); break; } case LITERAL_external: { org.exist.xquery.parser.XQueryAST tmp95_AST = null; tmp95_AST = (org.exist.xquery.parser.XQueryAST)astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp95_AST); match(LITERAL_external); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } }
	public final void varDecl() throws RecognitionException, TokenStreamException, XPathException {				returnAST = null;		ASTPair currentAST = new ASTPair();		org.exist.xquery.parser.XQueryAST varDecl_AST = null;		Token  decl = null;		org.exist.xquery.parser.XQueryAST decl_AST = null;		org.exist.xquery.parser.XQueryAST ex_AST = null;		String varName= null;				decl = LT(1);		decl_AST = (org.exist.xquery.parser.XQueryAST)astFactory.create(decl);		match(LITERAL_declare);		match(LITERAL_variable);		match(DOLLAR);		varName=qName();		{		switch ( LA(1)) {		case LITERAL_as:		{			typeDeclaration();			astFactory.addASTChild(currentAST, returnAST);			break;		}		case LCURLY:		{			break;		}		default:		{			throw new NoViableAltException(LT(1), getFilename());		}		}		}		match(LCURLY);		expr();		ex_AST = (org.exist.xquery.parser.XQueryAST)returnAST;		astFactory.addASTChild(currentAST, returnAST);		match(RCURLY);		if ( inputState.guessing==0 ) {			varDecl_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root;						varDecl_AST= (org.exist.xquery.parser.XQueryAST)astFactory.make( (new ASTArray(2)).add((org.exist.xquery.parser.XQueryAST)astFactory.create(GLOBAL_VAR,varName)).add(varDecl_AST));			varDecl_AST.copyLexInfo(decl_AST);						currentAST.root = varDecl_AST;			currentAST.child = varDecl_AST!=null &&varDecl_AST.getFirstChild()!=null ?				varDecl_AST.getFirstChild() : varDecl_AST;			currentAST.advanceChildToEnd();		}		varDecl_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root;		returnAST = varDecl_AST;	}