]> git.phdru.name Git - phdru.name/cgi-bin/blog-ru/search-tags.git/blob - grammar
Report error if required parameter 'q' is missing
[phdru.name/cgi-bin/blog-ru/search-tags.git] / grammar
1 # Grammar rules for tag searching; BNF.
2
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 one of the tags or both;
8 # Parentheses are allowed to group expressions:
9 #  TAG & (TAG | TAG)
10 #  !(TAG | TAG)
11 # and so on. This  is the first version of the grammar and it allows
12 # rather stupid expressions, like !!TAG or ((TAG)); in the future
13 # it will be fixed by making the grammar stricter and more complex.
14
15 NAME : '[a-z][a-z0-9_]+'
16
17 AND_OP : '&'
18
19 OR_OP : '|'
20
21 NOT_OP : '!'
22
23 expression : NAME
24            | expression AND_OP expression
25            | NOT_OP expression
26            | expression OR_OP expression
27            | '(' expression ')'