varDecl_AST = (org.exist.xquery.parser.XQueryAST)currentAST.root; returnAST = varDecl_AST;
	public final void varDecl() throws RecognitionException, TokenStreamException {				traceIn("varDecl");		try { // debugging			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;		} finally { // debugging			traceOut("varDecl");		}	}