public final HiveParser.grantPrivileges_return grantPrivileges() throws RecognitionException {
		HiveParser.grantPrivileges_return retval = new HiveParser.grantPrivileges_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		Token KW_GRANT416=null;
		Token KW_TO418=null;
		Token KW_WITH420=null;
		ParserRuleReturnScope privList =null;
		ParserRuleReturnScope privilegeObject417 =null;
		ParserRuleReturnScope principalSpecification419 =null;
		ParserRuleReturnScope withOption421 =null;

		CommonTree KW_GRANT416_tree=null;
		CommonTree KW_TO418_tree=null;
		CommonTree KW_WITH420_tree=null;
		RewriteRuleTokenStream stream_KW_GRANT=new RewriteRuleTokenStream(adaptor,"token KW_GRANT");
		RewriteRuleTokenStream stream_KW_WITH=new RewriteRuleTokenStream(adaptor,"token KW_WITH");
		RewriteRuleTokenStream stream_KW_TO=new RewriteRuleTokenStream(adaptor,"token KW_TO");
		RewriteRuleSubtreeStream stream_privilegeList=new RewriteRuleSubtreeStream(adaptor,"rule privilegeList");
		RewriteRuleSubtreeStream stream_privilegeObject=new RewriteRuleSubtreeStream(adaptor,"rule privilegeObject");
		RewriteRuleSubtreeStream stream_principalSpecification=new RewriteRuleSubtreeStream(adaptor,"rule principalSpecification");
		RewriteRuleSubtreeStream stream_withOption=new RewriteRuleSubtreeStream(adaptor,"rule withOption");

		msgs.push("grant privileges");
		try {
			// HiveParser.g:1283:5: ( KW_GRANT privList= privilegeList ( privilegeObject )? KW_TO principalSpecification ( KW_WITH withOption )? -> ^( TOK_GRANT $privList principalSpecification ( privilegeObject )? ( withOption )? ) )
			// HiveParser.g:1283:7: KW_GRANT privList= privilegeList ( privilegeObject )? KW_TO principalSpecification ( KW_WITH withOption )?
			{
			KW_GRANT416=(Token)match(input,KW_GRANT,FOLLOW_KW_GRANT_in_grantPrivileges6886);  
			stream_KW_GRANT.add(KW_GRANT416);

			pushFollow(FOLLOW_privilegeList_in_grantPrivileges6890);
			privList=privilegeList();
			state._fsp--;

			stream_privilegeList.add(privList.getTree());
			// HiveParser.g:1284:7: ( privilegeObject )?
			int alt121=2;
			int LA121_0 = input.LA(1);
			if ( (LA121_0==KW_ON) ) {
				alt121=1;
			}
			switch (alt121) {
				case 1 :
					// HiveParser.g:1284:7: privilegeObject
					{
					pushFollow(FOLLOW_privilegeObject_in_grantPrivileges6898);
					privilegeObject417=privilegeObject();
					state._fsp--;

					stream_privilegeObject.add(privilegeObject417.getTree());
					}
					break;

			}

			KW_TO418=(Token)match(input,KW_TO,FOLLOW_KW_TO_in_grantPrivileges6907);  
			stream_KW_TO.add(KW_TO418);

			pushFollow(FOLLOW_principalSpecification_in_grantPrivileges6909);
			principalSpecification419=principalSpecification();
			state._fsp--;

			stream_principalSpecification.add(principalSpecification419.getTree());
			// HiveParser.g:1286:7: ( KW_WITH withOption )?
			int alt122=2;
			int LA122_0 = input.LA(1);
			if ( (LA122_0==KW_WITH) ) {
				alt122=1;
			}
			switch (alt122) {
				case 1 :
					// HiveParser.g:1286:8: KW_WITH withOption
					{
					KW_WITH420=(Token)match(input,KW_WITH,FOLLOW_KW_WITH_in_grantPrivileges6918);  
					stream_KW_WITH.add(KW_WITH420);

					pushFollow(FOLLOW_withOption_in_grantPrivileges6920);
					withOption421=withOption();
					state._fsp--;

					stream_withOption.add(withOption421.getTree());
					}
					break;

			}

			// AST REWRITE
			// elements: withOption, principalSpecification, privList, privilegeObject
			// token labels: 
			// rule labels: retval, privList
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			retval.tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
			RewriteRuleSubtreeStream stream_privList=new RewriteRuleSubtreeStream(adaptor,"rule privList",privList!=null?privList.getTree():null);

			root_0 = (CommonTree)adaptor.nil();
			// 1287:5: -> ^( TOK_GRANT $privList principalSpecification ( privilegeObject )? ( withOption )? )
			{
				// HiveParser.g:1287:8: ^( TOK_GRANT $privList principalSpecification ( privilegeObject )? ( withOption )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.nil();
				root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TOK_GRANT, "TOK_GRANT"), root_1);
				adaptor.addChild(root_1, stream_privList.nextTree());
				adaptor.addChild(root_1, stream_principalSpecification.nextTree());
				// HiveParser.g:1287:53: ( privilegeObject )?
				if ( stream_privilegeObject.hasNext() ) {
					adaptor.addChild(root_1, stream_privilegeObject.nextTree());
				}
				stream_privilegeObject.reset();

				// HiveParser.g:1287:70: ( withOption )?
				if ( stream_withOption.hasNext() ) {
					adaptor.addChild(root_1, stream_withOption.nextTree());
				}
				stream_withOption.reset();

				adaptor.addChild(root_0, root_1);
				}

			}


			retval.tree = root_0;

			}

			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

			msgs.pop();
		}

		catch (RecognitionException e) {
		 reportError(e);
		  throw e;
		}

		finally {
			// do for sure before leaving
		}
		return retval;
	}