docs: public final QueryParser.primary_return primary() throws RecognitionException {
          QueryParser.primary_return retval = new QueryParser.primary_return();
          retval.start = input.LT(1);
  
          CommonTree root_0 = null;
  
          Token char_literal19=null;
          Token char_literal21=null;
          QueryParser.or_return or20 = null;
  
          QueryParser.simple_return simple22 = null;
  
  
          CommonTree char_literal19_tree=null;
          CommonTree char_literal21_tree=null;
          RewriteRuleTokenStream stream_25=new RewriteRuleTokenStream(adaptor,"token 25");
          RewriteRuleTokenStream stream_26=new RewriteRuleTokenStream(adaptor,"token 26");
          RewriteRuleSubtreeStream stream_or=new RewriteRuleSubtreeStream(adaptor,"rule or");
          RewriteRuleSubtreeStream stream_simple=new RewriteRuleSubtreeStream(adaptor,"rule simple");
          try {
              // src/riemann/Query.g:35:9: ( ( ( '(' or ')' ) -> ^( or ) | simple -> simple ) )
              // src/riemann/Query.g:35:12: ( ( '(' or ')' ) -> ^( or ) | simple -> simple )
              {
              // src/riemann/Query.g:35:12: ( ( '(' or ')' ) -> ^( or ) | simple -> simple )
              int alt11=2;
              int LA11_0 = input.LA(1);
  
              if ( (LA11_0==25) ) {
                  alt11=1;
              }
              else if ( (LA11_0==TAGGED||(LA11_0>=27 && LA11_0<=38)) ) {
                  alt11=2;
              }
              else {
                  NoViableAltException nvae =
                      new NoViableAltException("", 11, 0, input);
  
                  throw nvae;
              }
              switch (alt11) {
                  case 1 :
                      // src/riemann/Query.g:36:4: ( '(' or ')' )
                      {
                      // src/riemann/Query.g:36:4: ( '(' or ')' )
                      // src/riemann/Query.g:36:5: '(' or ')'
                      {
                      char_literal19=(Token)match(input,25,FOLLOW_25_in_primary244);  
                      stream_25.add(char_literal19);
  
                      pushFollow(FOLLOW_or_in_primary246);
                      or20=or();
  
                      state._fsp--;
  
                      stream_or.add(or20.getTree());
                      char_literal21=(Token)match(input,26,FOLLOW_26_in_primary248);  
                      stream_26.add(char_literal21);
  
  
                      }
  
  
  
                      // AST REWRITE
                      // elements: or
                      // token labels: 
                      // rule labels: retval
                      // token list labels: 
                      // rule list labels: 
                      // wildcard labels: 
                      retval.tree = root_0;
                      RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
  
                      root_0 = (CommonTree)adaptor.nil();
                      // 36:17: -> ^( or )
                      {
                          // src/riemann/Query.g:36:20: ^( or )
                          {
                          CommonTree root_1 = (CommonTree)adaptor.nil();
                          root_1 = (CommonTree)adaptor.becomeRoot(stream_or.nextNode(), root_1);
  
                          adaptor.addChild(root_0, root_1);
                          }
  
                      }
  
                      retval.tree = root_0;
                      }
                      break;
                  case 2 :
                      // src/riemann/Query.g:37:6: simple
                      {
                      pushFollow(FOLLOW_simple_in_primary262);
                      simple22=simple();
  
                      state._fsp--;
  
                      stream_simple.add(simple22.getTree());
  
  
                      // AST REWRITE
                      // elements: simple
                      // token labels: 
                      // rule labels: retval
                      // token list labels: 
                      // rule list labels: 
                      // wildcard labels: 
                      retval.tree = root_0;
                      RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
  
                      root_0 = (CommonTree)adaptor.nil();
                      // 37:13: -> simple
                      {
                          adaptor.addChild(root_0, stream_simple.nextTree());
  
                      }
  
                      retval.tree = root_0;
                      }
                      break;
  
              }
  
  
              }
  
              retval.stop = input.LT(-1);
  
              retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
              adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
  
          }
          catch (RecognitionException re) {
              reportError(re);
              recover(input,re);
      	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
  
          }
          finally {
          }
          return retval;
      }