pub fn query<'a>() -> impl Parser<'a, &'a str, SearchEmailsFilterQuery, ParserError<'a>> + CloneExpand description
The emails search filter query string parser.
A filter query string should be composed of operators and
conditions separated by spaces. Operators and conditions can be
wrapped into parentheses (…), which change the precedence.
§Operators
There is actually 3 operators, as defined in
SearchEmailsFilterQuery (ordered by precedence):
not <condition><condition> and <condition><condition> or <condition>
not has the highest priority, then and and finally or. a and b or c is the same as (a and b) or c, but is different from
a and (b or c).
§Conditions
There is actually 8 conditions, as defined in
SearchEmailsFilterQuery:
date <yyyy-mm-dd>before <yyyy-mm-dd>after <yyyy-mm-dd>from <pattern>to <pattern>subject <pattern>body <pattern>flag <flag>
<pattern> can be quoted using " (subject "foo bar") or
unquoted (spaces need to be escaped using back slash: subject foo\ bar).
§ABNF
filter-query = filter *(SP filter)
filter = "(" filter ")"
; nested filter
filter =/ and / or / not
; filter operators
filter =/ date / before-date / after-date / from / to / subject / body / flag
; filter conditions
and = filter SP "and" SP filter
or = filter SP "or" SP filter
not = "not" SP filter
date = "date" SP date-pattern
before-date = "before" SP date-pattern
after-date = "before" SP date-pattern
from = "from" SP text-pattern
to = "to" SP text-pattern
subject = "subject" SP text-pattern
body = "body" SP text-pattern
flag = "flag" SP text-pattern
date-pattern = 4DIGIT "-" 2DIGIT "-" 2DIGIT
; date matching "YYYY-MM-dd" format
date-pattern =/ 4DIGIT "/" 2DIGIT "/" 2DIGIT
; date matching "YYYY/MM/dd" format
date-pattern =/ 2DIGIT "-" 2DIGIT "-" 4DIGIT
; date matching "dd-MM-YYYY" format
date-pattern =/ 2DIGIT "/" 2DIGIT "/" 4DIGIT
; date matching "dd/MM/YYYY" format
text-pattern = DQUOTE *VCHAR DQUOTE