#NEWLINE# def _p_search_key( self ) : #NEWLINE# #INDENT# 'search_key ::= "ALL" / "ANSWERED" / "BCC" SPACE astring /\n                          "BEFORE" SPACE date / "BODY" SPACE astring /\n                          "CC" SPACE astring / "DELETED" / "FLAGGED" /\n                          "FROM" SPACE astring /\n                          "KEYWORD" SPACE flag_keyword / "NEW" / "OLD" /\n                          "ON" SPACE date / "RECENT" / "SEEN" /\n                          "SINCE" SPACE date / "SUBJECT" SPACE astring /\n                          "TEXT" SPACE astring / "TO" SPACE astring /\n                          "UNANSWERED" / "UNDELETED" / "UNFLAGGED" /\n                          "UNKEYWORD" SPACE flag_keyword / "UNSEEN" /\n                          ;; Above this line were in [IMAP2]\n                          "DRAFT" /\n                          "HEADER" SPACE header_fld_name SPACE astring /\n                          "LARGER" SPACE number / "NOT" SPACE search_key /\n                          "OR" SPACE search_key SPACE search_key /\n                          "SENTBEFORE" SPACE date / "SENTON" SPACE date /\n                          "SENTSINCE" SPACE date / "SMALLER" SPACE number /\n                          "UID" SPACE set / "UNDRAFT" / set /\n                          "(" 1#search_key ")"\n        So, yeah, this will parse a single search_key.. which may contain a\n        list of search keys.\n\n        Based on the search_key text we will generate an IMAPSearch object\n        which we will return to our caller.\n\n        We will use the same mechanism to parse search_key as we do for basic\n        commands - we parse out an atom, we see if there is a method that is\n        named after the search command and if there is we invoke that command\n        to finish parsing this search.\n        ' #NEWLINE# if self . _p_simple_string ( '(' , silent = True , swallow = False ) : #NEWLINE# #INDENT# search_key = self . _p_paren_list_of ( self . _p_search_key ) #NEWLINE# if ( len ( search_key ) == 1 ) : #NEWLINE# #INDENT# return search_key [ 0 ] #NEWLINE# #UNINDENT# return IMAPSearch ( 'and' , search_key = search_key ) #NEWLINE# #UNINDENT# search_tok = self . _p_re ( _search_atom_re , silent = True ) #NEWLINE# if search_tok : #NEWLINE# #INDENT# search_tok = search_tok . lower ( ) #NEWLINE# if ( not hasattr ( self , ( '_p_srchkey_%s' % search_tok ) ) ) : #NEWLINE# #INDENT# raise UnknownSearchKey ( value = ( 'Unknown search key "%s"' % search_tok ) ) #NEWLINE# #UNINDENT# return getattr ( self , ( '_p_srchkey_%s' % search_tok ) ) ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg_set = self . _p_msg_set ( ) #NEWLINE# return IMAPSearch ( 'message_set' , msg_set = msg_set ) #NEWLINE# #UNINDENT# raise UnknownSearchKey