1 # Grammar rules for tag searching; EBNF.
3 # The grammar defines expressions in the following forms:
4 # TAG - search blog posts that contain the tag;
5 # !TAG - search blog posts that don't contain the tag;
6 # TAG & TAG - search blog posts that contain both tags;
7 # TAG | TAG - search blog posts that contain any of the tags;
8 # Parentheses are allowed to group expressions; for example:
11 # Allowed operators: conjunction - & && AND and
12 # disjunction - | || OR or
13 # negation - ! NOT not
14 # This is a simple version of the grammar and it allows
15 # rather stupid expressions, like !!TAG or ((TAG)); in the future
16 # it will be fixed by making the grammar more complex and stricter.
20 ?expression : or_expression
24 or_expression : or_sub_expression (or or_sub_expression)+
26 ?or_sub_expression : and_expression
29 and_expression : and_sub_expression (and and_sub_expression)+
31 ?and_sub_expression : not_expression
35 not_expression: not and_sub_expression
37 expression_parens : "(" expression ")"
39 name : /[A-Za-zА-Яа-я][A-Za-zА-Яа-я0-9_]+/